[vlc-commits] Qt: restore time where you left off

Jean-Baptiste Kempf git at videolan.org
Mon May 19 15:28:28 CEST 2014


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon May 19 15:27:33 2014 +0200| [13bb59c746adc9d476691efb40773f0785d5e9c2] | committer: Jean-Baptiste Kempf

Qt: restore time where you left off

This copies the MacOS way

Close #5315

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

 modules/gui/qt4/input_manager.cpp |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/modules/gui/qt4/input_manager.cpp b/modules/gui/qt4/input_manager.cpp
index affb694..d6f0600 100644
--- a/modules/gui/qt4/input_manager.cpp
+++ b/modules/gui/qt4/input_manager.cpp
@@ -42,6 +42,7 @@
 #include <QFile>
 #include <QDir>
 #include <QSignalMapper>
+#include <QMessageBox>
 
 #include <assert.h>
 
@@ -110,6 +111,7 @@ void InputManager::setInput( input_thread_t *_p_input )
         msg_Dbg( p_intf, "IM: Setting an input" );
         vlc_object_hold( p_input );
         addCallbacks();
+
         UpdateStatus();
         UpdateName();
         UpdateArt();
@@ -119,6 +121,22 @@ void InputManager::setInput( input_thread_t *_p_input )
 
         p_item = input_GetItem( p_input );
         emit rateChanged( var_GetFloat( p_input, "rate" ) );
+
+        /* Get Saved Time */
+        int i_time = RecentsMRL::getInstance( p_intf )->time( p_item->psz_uri );
+        if( i_time > 0 )
+        {
+            THEMIM->togglePlayPause();
+
+            if( QMessageBox::question( NULL,
+                        _("Continue playback?"),
+                        _("Do you want to restart the playback where left off?"),
+                        QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes )
+                    == QMessageBox::Yes )
+                var_SetTime( p_input, "time", (int64_t)i_time * 1000 );
+
+            THEMIM->togglePlayPause();
+        }
     }
     else
     {



More information about the vlc-commits mailing list