Qt: better wording for the resume playback code
authorLudovic Fauvet <etix@videolan.org>
Mon, 24 Nov 2014 18:11:15 +0000 (19:11 +0100)
committerLudovic Fauvet <etix@videolan.org>
Mon, 24 Nov 2014 18:36:51 +0000 (19:36 +0100)
modules/gui/qt4/input_manager.cpp
modules/gui/qt4/input_manager.hpp
modules/gui/qt4/main_interface.cpp
modules/gui/qt4/main_interface.hpp

index 27cc997..1382512 100644 (file)
@@ -136,7 +136,7 @@ void InputManager::setInput( input_thread_t *_p_input )
                     !var_GetFloat( p_input, "start-time" ) &&
                     !var_GetFloat( p_input, "stop-time" ) )
             {
-                emit continuePlayback( (int64_t)i_time * 1000 );
+                emit resumePlayback( (int64_t)i_time * 1000 );
             }
         }
     }
index 60719b8..e6cc0ed 100644 (file)
@@ -223,8 +223,8 @@ signals:
     void titleChanged( bool );
     void chapterChanged( bool );
     void inputCanSeek( bool );
-    /// You can continuePlayback
-    void continuePlayback( int64_t );
+    /// You can resume playback
+    void resumePlayback( int64_t );
     /// Statistics are updated
     void statisticsUpdated( input_item_t* );
     void infoChanged( input_item_t* );
index 6ddd627..3ae7632 100644 (file)
@@ -366,13 +366,13 @@ void MainInterface::reloadPrefs()
     }
 }
 
-void MainInterface::createContinueDialog( QWidget *w )
+void MainInterface::createResumePanel( QWidget *w )
 {
-    /* Create non-modal continueDialog */
-    continueDialog = new QWidget( w );
-    continueDialog->hide();
-    QHBoxLayout *continueDialogLayout = new QHBoxLayout( continueDialog );
-    continueDialogLayout->setSpacing( 0 ); continueDialogLayout->setMargin( 0 );
+    /* Create non-modal resumePanel */
+    resumePanel = new QWidget( w );
+    resumePanel->hide();
+    QHBoxLayout *resumePanelLayout = new QHBoxLayout( resumePanel );
+    resumePanelLayout->setSpacing( 0 ); resumePanelLayout->setMargin( 0 );
 
     QLabel *continuePixmapLabel = new QLabel();
     continuePixmapLabel->setPixmap( QPixmap( ":/menu/help" ) );
@@ -380,63 +380,63 @@ void MainInterface::createContinueDialog( QWidget *w )
 
     QLabel *continueLabel = new QLabel( qtr( "Do you want to restart the playback where left off?") );
 
-    QToolButton *cancel = new QToolButton( continueDialog );
+    QToolButton *cancel = new QToolButton( resumePanel );
     cancel->setAutoRaise( true );
     cancel->setText( "X" );
     QPushButton *ok = new QPushButton( qtr("&Continue")  );
 
-    continueDialogLayout->addWidget( continuePixmapLabel );
-    continueDialogLayout->addWidget(continueLabel);
-    continueDialogLayout->addStretch( 1 );
-    continueDialogLayout->addWidget( ok );
-    continueDialogLayout->addWidget( cancel );
+    resumePanelLayout->addWidget( continuePixmapLabel );
+    resumePanelLayout->addWidget(continueLabel);
+    resumePanelLayout->addStretch( 1 );
+    resumePanelLayout->addWidget( ok );
+    resumePanelLayout->addWidget( cancel );
 
-    continueTimer = new QTimer( continueDialog );
-    continueTimer->setSingleShot( true );
-    continueTimer->setInterval( 6000 );
+    resumeTimer = new QTimer( resumePanel );
+    resumeTimer->setSingleShot( true );
+    resumeTimer->setInterval( 6000 );
 
-    CONNECT( continueTimer, timeout(), this, hideContinueDialog() );
+    CONNECT( resumeTimer, timeout(), this, hideResumePanel() );
 
-    CONNECT( cancel, clicked(), this, hideContinueDialog() );
-    BUTTONACT(ok, continuePlayback() );
+    CONNECT( cancel, clicked(), this, hideResumePanel() );
+    BUTTONACT(ok, resumePlayback() );
 
-    CONNECT( THEMIM->getIM(), continuePlayback(int64_t), this, showContinueDialog(int64_t) );
+    CONNECT( THEMIM->getIM(), resumePlayback(int64_t), this, showResumePanel(int64_t) );
 
-    w->layout()->addWidget( continueDialog );
+    w->layout()->addWidget( resumePanel );
 }
 
-void MainInterface::showContinueDialog( int64_t _time ) {
+void MainInterface::showResumePanel( int64_t _time ) {
     int setting = var_InheritInteger( p_intf, "qt-continue" );
 
     if( setting == 0 )
         return;
 
-    i_continueTime = _time;
+    i_resumeTime = _time;
 
     if( setting == 2)
-        continuePlayback();
+        resumePlayback();
     else
     {
-        continueDialog->setVisible(true);
-        continueTimer->start();
+        resumePanel->setVisible(true);
+        resumeTimer->start();
     }
 }
 
-void MainInterface::hideContinueDialog()
+void MainInterface::hideResumePanel()
 {
-    if( continueDialog->isVisible() )
+    if( resumePanel->isVisible() )
     {
         if( !isFullScreen() && !isMaximized() )
-            resize( width(), height() - continueDialog->height() );
-        continueDialog->hide();
-        continueTimer->stop();
+            resize( width(), height() - resumePanel->height() );
+        resumePanel->hide();
+        resumeTimer->stop();
     }
 }
 
-void MainInterface::continuePlayback()
+void MainInterface::resumePlayback()
 {
-    var_SetTime( THEMIM->getInput(), "time", i_continueTime );
-    hideContinueDialog();
+    var_SetTime( THEMIM->getInput(), "time", i_resumeTime );
+    hideResumePanel();
 }
 
 void MainInterface::createMainWidget( QSettings *creationSettings )
@@ -448,7 +448,7 @@ void MainInterface::createMainWidget( QSettings *creationSettings )
     main->setContentsMargins( 0, 0, 0, 0 );
     mainLayout->setSpacing( 0 ); mainLayout->setMargin( 0 );
 
-    createContinueDialog( main );
+    createResumePanel( main );
     /* */
     stackCentralW = new QVLCStackedWidget( main );
 
@@ -754,7 +754,7 @@ void MainInterface::releaseVideoSlot( void )
     videoWidget->release();
     setVideoOnTop( false );
     setVideoFullScreen( false );
-    hideContinueDialog();
+    hideResumePanel();
 
     if( stackCentralW->currentWidget() == videoWidget )
         restoreStackOldWidget();
index be7101e..c3f146c 100644 (file)
@@ -113,7 +113,7 @@ private:
     void createMainWidget( QSettings* );
     void createStatusBar();
     void createPlaylist();
-    void createContinueDialog( QWidget *w );
+    void createResumePanel( QWidget *w );
 
     /* Systray */
     void createSystray();
@@ -149,10 +149,10 @@ private:
     PlaylistWidget      *playlistWidget;
     //VisualSelector      *visualSelector;
 
-    /* continue */
-    QWidget             *continueDialog;
-    QTimer              *continueTimer;
-    int64_t             i_continueTime;
+    /* resume panel */
+    QWidget             *resumePanel;
+    QTimer              *resumeTimer;
+    int64_t             i_resumeTime;
 
     /* Status Bar */
     QLabel              *nameLabel;
@@ -260,9 +260,9 @@ private slots:
     void setBoss();
     void setRaise();
 
-    void showContinueDialog( int64_t);
-    void hideContinueDialog();
-    void continuePlayback();
+    void showResumePanel( int64_t);
+    void hideResumePanel();
+    void resumePlayback();
 
 signals:
     void askGetVideo( WId *, struct vout_window_t *, unsigned *, unsigned * );