X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=remote%2Fsource%2Fstreamcontrolitem.cpp;h=b7624df813d6c5f45cbe24cf99171fdeb84320f5;hb=4dd3070fa50882b7ec7a26f7d0994c064c6b29d6;hp=a225d52494f2366c63494c7015de75706a48846b;hpb=6fd809bbdbfe628ef1e63b68665f374751838baf;p=xinema.git diff --git a/remote/source/streamcontrolitem.cpp b/remote/source/streamcontrolitem.cpp index a225d52..b7624df 100644 --- a/remote/source/streamcontrolitem.cpp +++ b/remote/source/streamcontrolitem.cpp @@ -15,6 +15,7 @@ void StreamControlItem::set_control(XinemaControlItem *c) if(control) { XinemaControl &xc = control->get_control(); + connect(&xc, &XinemaControl::playback_state_changed, this, &StreamControlItem::playback_state_changed); connect(&xc, &XinemaControl::title_changed, this, &StreamControlItem::title_changed); connect(&xc, &XinemaControl::duration_changed, this, &StreamControlItem::duration_changed); connect(&xc, &XinemaControl::position_changed, this, &StreamControlItem::position_changed); @@ -24,12 +25,35 @@ void StreamControlItem::set_control(XinemaControlItem *c) if(control) { + emit playback_state_changed(); emit title_changed(); emit duration_changed(); emit position_changed(); } } +StreamControlItem::PlaybackState StreamControlItem::get_playback_state() const +{ + if(!control) + return Stopped; + + return static_cast(control->get_control().get_playback_state()); +} + +void StreamControlItem::set_playback_state(PlaybackState state) +{ + if(!control) + return; + + XinemaControl &xc = control->get_control(); + if(state==Stopped) + xc.stop(); + else if(state==Paused) + xc.pause(); + else if(state==Playing) + xc.play(); +} + QString StreamControlItem::get_title() const { if(!control) @@ -46,6 +70,12 @@ float StreamControlItem::get_duration() const return control->get_control().get_duration(); } +void StreamControlItem::set_position(float pos) +{ + if(control) + control->get_control().seek(pos); +} + float StreamControlItem::get_position() const { if(!control)