]> git.tdb.fi Git - xinema.git/blobdiff - remote/source/streamcontrolitem.cpp
Display a playback page on the remote after selecting a file
[xinema.git] / remote / source / streamcontrolitem.cpp
diff --git a/remote/source/streamcontrolitem.cpp b/remote/source/streamcontrolitem.cpp
new file mode 100644 (file)
index 0000000..a225d52
--- /dev/null
@@ -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();
+}