[vlc-commits] Qt: Go To Time dialog: set default time to current (fix #5511)

Francois Cartegnie git at videolan.org
Sat Nov 19 18:47:45 CET 2011


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat Nov 19 18:42:51 2011 +0100| [8be768a9cfb2c468b0e8917f045df81b592735a9] | committer: Francois Cartegnie

Qt: Go To Time dialog: set default time to current (fix #5511)

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

 modules/gui/qt4/dialogs/gototime.cpp |   24 ++++++++++++++++++++++--
 modules/gui/qt4/dialogs/gototime.hpp |    3 +++
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/modules/gui/qt4/dialogs/gototime.cpp b/modules/gui/qt4/dialogs/gototime.cpp
index 19a4d26..42d7329 100644
--- a/modules/gui/qt4/dialogs/gototime.cpp
+++ b/modules/gui/qt4/dialogs/gototime.cpp
@@ -62,22 +62,38 @@ GotoTimeDialog::GotoTimeDialog( intf_thread_t *_p_intf)
     timeEdit->setAlignment( Qt::AlignRight );
     timeEdit->setSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum );
 
+    QPushButton *resetButton = new QPushButton( QIcon(":/update"), "" );
+    resetButton->setToolTip( qtr("Reset") );
+
     mainLayout->addWidget( timeIntro, 0, 0, 1, 1 );
     mainLayout->addWidget( timeEdit, 0, 1, 1, 1 );
+    mainLayout->addWidget( resetButton, 0, 2, 1, 1 );
 
-    mainLayout->addWidget( buttonBox, 1, 0, 1, 2 );
+    mainLayout->addWidget( buttonBox, 1, 0, 1, 3 );
 
     BUTTONACT( gotoButton, close() );
     BUTTONACT( cancelButton, cancel() );
+    BUTTONACT( resetButton, reset() );
 }
 
 GotoTimeDialog::~GotoTimeDialog()
 {
 }
 
+void GotoTimeDialog::toggleVisible()
+{
+    reset();
+    if ( !isVisible() && THEMIM->getIM()->hasInput() )
+    {
+        int64_t i_time = var_GetTime( THEMIM->getInput(), "time" );
+        timeEdit->setTime( timeEdit->time().addSecs( i_time / 1000000 ) );
+    }
+    QVLCDialog::toggleVisible();
+}
+
 void GotoTimeDialog::cancel()
 {
-    timeEdit->setTime( QTime( 0, 0, 0) );
+    reset();
     toggleVisible();
 }
 
@@ -90,5 +106,9 @@ void GotoTimeDialog::close()
         var_SetTime( THEMIM->getInput(), "time", i_time );
     }
     toggleVisible();
+}
+
+void GotoTimeDialog::reset()
+{
     timeEdit->setTime( QTime( 0, 0, 0) );
 }
diff --git a/modules/gui/qt4/dialogs/gototime.hpp b/modules/gui/qt4/dialogs/gototime.hpp
index a173d10..38b0676 100644
--- a/modules/gui/qt4/dialogs/gototime.hpp
+++ b/modules/gui/qt4/dialogs/gototime.hpp
@@ -39,8 +39,11 @@ private:
 private slots:
     void close();
     void cancel();
+    void reset();
 
     friend class    Singleton<GotoTimeDialog>;
+public:
+    void toggleVisible();
 };
 
 #endif



More information about the vlc-commits mailing list