[vlc-commits] qt: get/set the recent MRL time as vlc_tick_t

Steve Lhomme git at videolan.org
Tue Sep 18 13:53:24 CEST 2018


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Tue Sep 18 13:42:19 2018 +0200| [8dcb3938b29074799e5f6ee3d50b8f1674e19ce2] | committer: Steve Lhomme

qt: get/set the recent MRL time as vlc_tick_t

Instead of milliseconds.

Still store them as milliseconds for now.

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

 modules/gui/qt/input_manager.cpp  | 4 ++--
 modules/gui/qt/input_manager.hpp  | 2 +-
 modules/gui/qt/main_interface.cpp | 4 ++--
 modules/gui/qt/main_interface.hpp | 4 ++--
 modules/gui/qt/recents.cpp        | 8 ++++----
 modules/gui/qt/recents.hpp        | 4 ++--
 6 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/modules/gui/qt/input_manager.cpp b/modules/gui/qt/input_manager.cpp
index 0f8c07e981..03d38430a3 100644
--- a/modules/gui/qt/input_manager.cpp
+++ b/modules/gui/qt/input_manager.cpp
@@ -119,13 +119,13 @@ void InputManager::setInput( input_thread_t *_p_input )
         {
             char *uri = input_item_GetURI( p_item );
 
-            int i_time = RecentsMRL::getInstance( p_intf )->time( qfu(uri) );
+            vlc_tick_t i_time = RecentsMRL::getInstance( p_intf )->time( qfu(uri) );
             if( i_time > 0 && qfu( uri ) != lastURI &&
                     !var_GetFloat( p_input, "run-time" ) &&
                     !var_GetFloat( p_input, "start-time" ) &&
                     !var_GetFloat( p_input, "stop-time" ) )
             {
-                emit resumePlayback( (int64_t)i_time * 1000 );
+                emit resumePlayback( i_time );
             }
             playlist_Lock( THEPL );
             // Add root items only
diff --git a/modules/gui/qt/input_manager.hpp b/modules/gui/qt/input_manager.hpp
index 41b5a86340..3960499224 100644
--- a/modules/gui/qt/input_manager.hpp
+++ b/modules/gui/qt/input_manager.hpp
@@ -225,7 +225,7 @@ signals:
     void chapterChanged( bool );
     void inputCanSeek( bool );
     /// You can resume playback
-    void resumePlayback( int64_t );
+    void resumePlayback( vlc_tick_t );
     /// Statistics are updated
     void statisticsUpdated( input_item_t* );
     void infoChanged( input_item_t* );
diff --git a/modules/gui/qt/main_interface.cpp b/modules/gui/qt/main_interface.cpp
index f9f38530be..08a91e1831 100644
--- a/modules/gui/qt/main_interface.cpp
+++ b/modules/gui/qt/main_interface.cpp
@@ -391,13 +391,13 @@ void MainInterface::createResumePanel( QWidget *w )
 
     CONNECT( resumeTimer, timeout(), this, hideResumePanel() );
     CONNECT( cancel, clicked(), this, hideResumePanel() );
-    CONNECT( THEMIM->getIM(), resumePlayback(int64_t), this, showResumePanel(int64_t) );
+    CONNECT( THEMIM->getIM(), resumePlayback(vlc_tick_t), this, showResumePanel(vlc_tick_t) );
     BUTTONACT( ok, resumePlayback() );
 
     w->layout()->addWidget( resumePanel );
 }
 
-void MainInterface::showResumePanel( int64_t _time ) {
+void MainInterface::showResumePanel( vlc_tick_t _time ) {
     int setting = var_InheritInteger( p_intf, "qt-continue" );
 
     if( setting == 0 )
diff --git a/modules/gui/qt/main_interface.hpp b/modules/gui/qt/main_interface.hpp
index b61585d599..b4fe5eb880 100644
--- a/modules/gui/qt/main_interface.hpp
+++ b/modules/gui/qt/main_interface.hpp
@@ -157,7 +157,7 @@ protected:
     /* resume panel */
     QWidget             *resumePanel;
     QTimer              *resumeTimer;
-    int64_t             i_resumeTime;
+    vlc_tick_t          i_resumeTime;
 
     /* Status Bar */
     QLabel              *nameLabel;
@@ -266,7 +266,7 @@ protected slots:
     void setRaise();
     void voutReleaseMouseEvents();
 
-    void showResumePanel( int64_t);
+    void showResumePanel( vlc_tick_t);
     void hideResumePanel();
     void resumePlayback();
     void onInputChanged( bool );
diff --git a/modules/gui/qt/recents.cpp b/modules/gui/qt/recents.cpp
index 914f378c41..d8b58ea688 100644
--- a/modules/gui/qt/recents.cpp
+++ b/modules/gui/qt/recents.cpp
@@ -161,23 +161,23 @@ void RecentsMRL::playMRL( const QString &mrl )
     Open::openMRL( p_intf, mrl );
 }
 
-int RecentsMRL::time( const QString &mrl )
+vlc_tick_t RecentsMRL::time( const QString &mrl )
 {
     if( !isActive )
         return -1;
 
     int i_index = recents.indexOf( mrl );
     if( i_index != -1 )
-        return times.value(i_index, "-1").toInt();
+        return VLC_TICK_FROM_MS(times.value(i_index, "-1").toInt());
     else
         return -1;
 }
 
-void RecentsMRL::setTime( const QString &mrl, const int64_t time )
+void RecentsMRL::setTime( const QString &mrl, const vlc_tick_t time )
 {
     int i_index = recents.indexOf( mrl );
     if( i_index != -1 )
-        times[i_index] = QString::number( time / 1000 );
+        times[i_index] = QString::number( MS_FROM_VLC_TICK( time ) );
 }
 
 int Open::openMRL( intf_thread_t *p_intf,
diff --git a/modules/gui/qt/recents.hpp b/modules/gui/qt/recents.hpp
index a86d78f76e..23da2620c3 100644
--- a/modules/gui/qt/recents.hpp
+++ b/modules/gui/qt/recents.hpp
@@ -59,8 +59,8 @@ public:
     QStringList recentList();
     QSignalMapper *signalMapper;
 
-    int time( const QString &mrl );
-    void setTime( const QString &mrl, const int64_t time );
+    vlc_tick_t time( const QString &mrl );
+    void setTime( const QString &mrl, const vlc_tick_t time );
 
 private:
     RecentsMRL( intf_thread_t* _p_intf );



More information about the vlc-commits mailing list