]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/controller.cpp
Merge branch 'master' of git@git.videolan.org:vlc
[vlc] / modules / gui / qt4 / components / controller.cpp
index 67d7d24d6ef01a79db950e44b1ad3851bc74a997..e1aaad1228d83893e6264ee168b4255731aabe7f 100644 (file)
@@ -79,6 +79,9 @@ void AbstractController::setStatus( int status )
 
     emit inputIsRecordable( b_hasInput &&
                             var_GetBool( THEMIM->getInput(), "can-record" ) );
+
+    emit inputIsTrickPlayable( b_hasInput &&
+                            var_GetBool( THEMIM->getInput(), "can-rewind" ) );
 }
 
 /* Generic button setup */
@@ -184,6 +187,7 @@ QWidget *AbstractController::createWidget( buttonType_e button, int options )
     bool b_flat = options & WIDGET_FLAT;
     bool b_big = options & WIDGET_BIG;
     bool b_shiny = options & WIDGET_SHINY;
+    bool b_special = false;
 
     QWidget *widget = NULL;
     switch( button )
@@ -344,9 +348,11 @@ QWidget *AbstractController::createWidget( buttonType_e button, int options )
         widget = telexFrame();
         widget->hide();
         break;
+    case VOLUME_SPECIAL:
+        b_special = true;
     case VOLUME:
         {
-            SoundWidget *snd = new SoundWidget( this, p_intf, b_shiny );
+            SoundWidget *snd = new SoundWidget( this, p_intf, b_shiny, b_special );
             widget = snd;
         }
         break;
@@ -377,7 +383,11 @@ QWidget *AbstractController::createWidget( buttonType_e button, int options )
         setupButton( reverseButton );
         CONNECT_MAP_SET( reverseButton, REVERSE_ACTION );
         BUTTON_SET_BAR(  reverseButton );
-        ENABLE_ON_INPUT( reverseButton );
+        reverseButton->setCheckable( true );
+        /* You should, of COURSE change this to the correct event,
+           when/if we have one, that tells us if trickplay is possible . */
+        CONNECT( this, inputIsTrickPlayable( bool ), reverseButton, setVisible( bool ) );
+        reverseButton->setVisible( false );
         widget = reverseButton;
         }
         break;
@@ -477,7 +487,7 @@ QFrame *AbstractController::telexFrame()
     /**
      * Telextext QFrame
      **/
-    TeletextController *telexFrame = new TeletextController;
+    QFrame *telexFrame = new QFrame;
     QHBoxLayout *telexLayout = new QHBoxLayout( telexFrame );
     telexLayout->setSpacing( 0 ); telexLayout->setMargin( 0 );
     CONNECT( THEMIM->getIM(), teletextPossible( bool ),
@@ -485,21 +495,21 @@ QFrame *AbstractController::telexFrame()
 
     /* On/Off button */
     QToolButton *telexOn = new QToolButton;
-    telexFrame->telexOn = telexOn;
     setupButton( telexOn );
     BUTTON_SET_BAR2( telexOn, tv, qtr( "Teletext Activation" ) );
+    telexOn->setEnabled( false );
+    telexOn->setCheckable( true );
+
     telexLayout->addWidget( telexOn );
 
     /* Teletext Activation and set */
     CONNECT( telexOn, clicked( bool ),
              THEMIM->getIM(), activateTeletext( bool ) );
-    CONNECT( THEMIM->getIM(), teletextActivated( bool ),
-             telexFrame, enableTeletextButtons( bool ) );
-
+    CONNECT( THEMIM->getIM(), teletextPossible( bool ),
+             telexOn, setEnabled( bool ) );
 
     /* Transparency button */
     QToolButton *telexTransparent = new QToolButton;
-    telexFrame->telexTransparent = telexTransparent;
     setupButton( telexTransparent );
     BUTTON_SET_BAR2( telexTransparent, tvtelx,
                      qtr( "Toggle Transparency " ) );
@@ -515,8 +525,7 @@ QFrame *AbstractController::telexFrame()
 
 
     /* Page setting */
-    QSpinBox *telexPage = new QSpinBox;
-    telexFrame->telexPage = telexPage;
+    QSpinBox *telexPage = new QSpinBox( telexFrame );
     telexPage->setRange( 0, 999 );
     telexPage->setValue( 100 );
     telexPage->setAccelerated( true );
@@ -532,6 +541,9 @@ QFrame *AbstractController::telexFrame()
     CONNECT( THEMIM->getIM(), newTelexPageSet( int ),
             telexPage, setValue( int ) );
 
+    CONNECT( THEMIM->getIM(), teletextActivated( bool ), telexPage, setEnabled( bool ) );
+    CONNECT( THEMIM->getIM(), teletextActivated( bool ), telexTransparent, setEnabled( bool ) );
+    CONNECT( THEMIM->getIM(), teletextActivated( bool ), telexOn, setChecked( bool ) );
     return telexFrame;
 }
 #undef CONNECT_MAP
@@ -699,11 +711,12 @@ void FullscreenControllerWidget::showFSC()
     adjustSize();
     /* center down */
     int number = QApplication::desktop()->screenNumber( p_intf->p_sys->p_mi );
-    if( number != i_screennumber )
+    if( number != i_screennumber ||
+        screenRes != QApplication::desktop()->screenGeometry(number) )
     {
+        screenRes = QApplication::desktop()->screenGeometry(number);
         msg_Dbg( p_intf, "Calculation fullscreen controllers center");
         /* screen has changed, calculate new position */
-        QRect screenRes = QApplication::desktop()->screenGeometry(number);
         QPoint pos = QPoint( screenRes.x() + (screenRes.width() / 2) - (width() / 2),
                              screenRes.y() + screenRes.height() - height());
         move( pos );
@@ -1034,7 +1047,7 @@ void FullscreenControllerWidget::fullscreenChanged( vout_thread_t *p_vout,
 
         /* Force fs hidding */
         IMEvent *eHide = new IMEvent( FullscreenControlHide_Type, 0 );
-        QApplication::postEvent( this, static_cast<QEvent *>(eHide) );
+        QApplication::postEvent( this, eHide );
     }
     vlc_mutex_unlock( &lock );
 }
@@ -1061,11 +1074,11 @@ void FullscreenControllerWidget::mouseChanged( vout_thread_t *p_vout, int i_mous
     {
         /* Show event */
         IMEvent *eShow = new IMEvent( FullscreenControlShow_Type, 0 );
-        QApplication::postEvent( this, static_cast<QEvent *>(eShow) );
+        QApplication::postEvent( this, eShow );
 
         /* Plan hide event */
         IMEvent *eHide = new IMEvent( FullscreenControlPlanHide_Type, 0 );
-        QApplication::postEvent( this, static_cast<QEvent *>(eHide) );
+        QApplication::postEvent( this, eHide );
     }
 }