X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=remote%2Fsource%2Fstreamcontrolitem.cpp;fp=remote%2Fsource%2Fstreamcontrolitem.cpp;h=a225d52494f2366c63494c7015de75706a48846b;hb=6fd809bbdbfe628ef1e63b68665f374751838baf;hp=0000000000000000000000000000000000000000;hpb=ed777426d367df15a67082f5dae0911c21472b5f;p=xinema.git diff --git a/remote/source/streamcontrolitem.cpp b/remote/source/streamcontrolitem.cpp new file mode 100644 index 0000000..a225d52 --- /dev/null +++ b/remote/source/streamcontrolitem.cpp @@ -0,0 +1,55 @@ +#include "streamcontrolitem.h" +#include "xinemacontrolitem.h" + +StreamControlItem::StreamControlItem(): + control(0) +{ +} + +void StreamControlItem::set_control(XinemaControlItem *c) +{ + if(control) + disconnect(control, 0, this, 0); + + control = c; + if(control) + { + XinemaControl &xc = control->get_control(); + 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); + } + + emit control_changed(); + + if(control) + { + emit title_changed(); + emit duration_changed(); + emit position_changed(); + } +} + +QString StreamControlItem::get_title() const +{ + if(!control) + return QString(); + + return control->get_control().get_title(); +} + +float StreamControlItem::get_duration() const +{ + if(!control) + return 0; + + return control->get_control().get_duration(); +} + +float StreamControlItem::get_position() const +{ + if(!control) + return 0; + + return control->get_control().get_position(); +}