[vlc-commits] Qt: fix syncing elapsed / remaining time in TimeLabel

Benoit du Payrat git at videolan.org
Fri Apr 8 15:51:11 CEST 2016


vlc | branch: master | Benoit du Payrat <benoit at videolabs.io> | Thu Apr  7 11:33:11 2016 +0200| [8784800a751548149d74707aa0be78b316b43c2b] | committer: Hugo Beauzée-Luyssen

Qt: fix syncing elapsed / remaining time in TimeLabel

Fix #8292

Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8784800a751548149d74707aa0be78b316b43c2b
---

 modules/gui/qt/components/interface_widgets.cpp |   12 ++++++++++++
 modules/gui/qt/components/interface_widgets.hpp |    3 +++
 modules/gui/qt/input_manager.hpp                |    1 +
 3 files changed, 16 insertions(+)

diff --git a/modules/gui/qt/components/interface_widgets.cpp b/modules/gui/qt/components/interface_widgets.cpp
index 920bf68..e4f1fc6 100644
--- a/modules/gui/qt/components/interface_widgets.cpp
+++ b/modules/gui/qt/components/interface_widgets.cpp
@@ -797,9 +797,20 @@ TimeLabel::TimeLabel( intf_thread_t *_p_intf, TimeLabel::Display _displayType  )
     CONNECT( THEMIM->getIM(), positionUpdated( float, int64_t, int ),
               this, setDisplayPosition( float, int64_t, int ) );
 
+    connect( this, SIGNAL( broadcastRemainingTime( bool ) ),
+	     THEMIM->getIM(), SIGNAL( remainingTimeChanged( bool ) ) );
+
+    CONNECT( THEMIM->getIM(), remainingTimeChanged( bool ),
+              this, setRemainingTime( bool ) );
+
     setStyleSheet( "QLabel { padding-left: 4px; padding-right: 4px; }" );
 }
 
+void TimeLabel::setRemainingTime( bool remainingTime )
+{
+    b_remainingTime = remainingTime;
+}
+
 void TimeLabel::setDisplayPosition( float pos, int64_t t, int length )
 {
     if( pos == -1.f )
@@ -890,5 +901,6 @@ void TimeLabel::toggleTimeDisplay()
 {
     b_remainingTime = !b_remainingTime;
     getSettings()->setValue( "MainWindow/ShowRemainingTime", b_remainingTime );
+    emit broadcastRemainingTime( b_remainingTime );
 }
 
diff --git a/modules/gui/qt/components/interface_widgets.hpp b/modules/gui/qt/components/interface_widgets.hpp
index 38b761c..a07119e 100644
--- a/modules/gui/qt/components/interface_widgets.hpp
+++ b/modules/gui/qt/components/interface_widgets.hpp
@@ -209,8 +209,11 @@ private:
     char psz_time[MSTRTIME_MAX_SIZE];
     void toggleTimeDisplay();
 private slots:
+    void setRemainingTime( bool );
     void setDisplayPosition( float pos, int64_t time, int length );
     void setDisplayPosition( float pos );
+signals:
+    void broadcastRemainingTime( bool );
 };
 
 class SpeedLabel : public QLabel
diff --git a/modules/gui/qt/input_manager.hpp b/modules/gui/qt/input_manager.hpp
index 8972729..c660cac 100644
--- a/modules/gui/qt/input_manager.hpp
+++ b/modules/gui/qt/input_manager.hpp
@@ -212,6 +212,7 @@ private slots:
 signals:
     /// Send new position, new time and new length
     void positionUpdated( float , int64_t, int );
+    void remainingTimeChanged( bool );
     void seekRequested( float pos );
     void rateChanged( float );
     void nameChanged( const QString& );



More information about the vlc-commits mailing list