]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/main_interface.cpp
Remove hacking fullscreen control invocation - fixes #1653
[vlc] / modules / gui / qt4 / main_interface.cpp
index 676637ca901336ad05324c391c16f6928bbc282f..4fdde6da4e4d270fd1d53ee324b2b3f2fce01b6b 100644 (file)
@@ -76,20 +76,6 @@ static int IntfShowCB( vlc_object_t *p_this, const char *psz_variable,
                        vlc_value_t old_val, vlc_value_t new_val, void *param );
 static int InteractCallback( vlc_object_t *, const char *, vlc_value_t,
                              vlc_value_t, void *);
-/* Video handling */
-static void *DoRequest( intf_thread_t *p_intf, vout_thread_t *p_vout,
-                        int *pi1, int *pi2, unsigned int*pi3,unsigned int*pi4)
-{
-    return p_intf->p_sys->p_mi->requestVideo( p_vout, pi1, pi2, pi3, pi4 );
-}
-static void DoRelease( intf_thread_t *p_intf, void *p_win )
-{
-    return p_intf->p_sys->p_mi->releaseVideo( p_win );
-}
-static int DoControl( intf_thread_t *p_intf, void *p_win, int i_q, va_list a )
-{
-    return p_intf->p_sys->p_mi->controlVideo( p_win, i_q, a );
-}
 
 MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
 {
@@ -225,21 +211,27 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
     var_AddCallback( p_intf->p_libvlc, "intf-show", IntfShowCB, p_intf );
 
     /* Register callback for the intf-popupmenu variable */
-    playlist_t *p_playlist = pl_Yield( p_intf );
-    var_AddCallback( p_playlist, "intf-popupmenu", PopupMenuCB, p_intf );
-    pl_Release( p_intf );
+    var_AddCallback( p_intf->p_libvlc, "intf-popupmenu", PopupMenuCB, p_intf );
 
     /* VideoWidget connect mess to avoid different threads speaking to each other */
     CONNECT( this, askReleaseVideo( void * ),
              this, releaseVideoSlot( void * ) );
-    CONNECT( this, askVideoToResize( unsigned int, unsigned int ),
-             videoWidget, SetSizing( unsigned int, unsigned int ) );
+    if( videoWidget )
+        CONNECT( this, askVideoToResize( unsigned int, unsigned int ),
+                 videoWidget, SetSizing( unsigned int, unsigned int ) );
 
     CONNECT( this, askUpdate(), this, doComponentsUpdate() );
 
     CONNECT( controls, advancedControlsToggled( bool ),
              this, doComponentsUpdate() );
 
+    CONNECT( fullscreenControls, advancedControlsToggled( bool ),
+             this, doComponentsUpdate() );
+
+    CONNECT( THEMIM->getIM(), inputUnset(),
+            fullscreenControls, unregFullscreenCallback() );
+
+
     /* Size and placement of interface */
     QVLCTools::restoreWidgetPosition(settings,this,QSize(350,60));
 
@@ -288,16 +280,11 @@ MainInterface::~MainInterface()
     var_DelCallback( p_intf->p_libvlc, "intf-show", IntfShowCB, p_intf );
 
     /* Unregister callback for the intf-popupmenu variable */
-    playlist_t *p_playlist = pl_Yield( p_intf );
-    var_DelCallback( p_playlist, "intf-popupmenu", PopupMenuCB, p_intf );
-    pl_Release( p_intf );
+    var_DelCallback( p_intf->p_libvlc, "intf-popupmenu", PopupMenuCB, p_intf );
 
     p_intf->b_interaction = false;
     var_DelCallback( p_intf, "interaction", InteractCallback, this );
 
-    p_intf->pf_request_window = NULL;
-    p_intf->pf_release_window = NULL;
-    p_intf->pf_control_window = NULL;
     p_intf->p_sys->p_mi = NULL;
 }
 
@@ -396,6 +383,7 @@ void MainInterface::handleMainUi( QSettings *settings )
     /* Margins, spacing */
     main->setContentsMargins( 0, 0, 0, 0 );
     main->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Maximum );
+    mainLayout->setSpacing( 0 );
     mainLayout->setMargin( 0 );
 
     /* Create the CONTROLS Widget */
@@ -404,6 +392,12 @@ void MainInterface::handleMainUi( QSettings *settings )
                    settings->value( "adv-controls", false ).toBool(),
                    config_GetInt( p_intf, "qt-blingbling" ) );
 
+    /* Create the FULLSCREEN CONTROLS Widget */
+    /* bool b_shiny = config_GetInt( p_intf, "qt-blingbling" ); */
+    fullscreenControls = new FullscreenControllerWidget( p_intf, this,
+                   settings->value( "adv-controls", false ).toBool(),
+                   config_GetInt( p_intf, "qt-blingbling" ) );
+
     /* Add the controls Widget to the main Widget */
     mainLayout->insertWidget( 0, controls, 0, Qt::AlignBottom );
 
@@ -438,11 +432,7 @@ void MainInterface::handleMainUi( QSettings *settings )
     if( videoEmbeddedFlag )
     {
         videoWidget = new VideoWidget( p_intf );
-        mainLayout->insertWidget( 0, videoWidget );
-
-        p_intf->pf_request_window  = ::DoRequest;
-        p_intf->pf_release_window  = ::DoRelease;
-        p_intf->pf_control_window  = ::DoControl;
+        mainLayout->insertWidget( 0, videoWidget, 10 );
     }
 
     /* Finish the sizing */
@@ -660,8 +650,6 @@ private:
  * Thou shall not call/resize/hide widgets from on another thread.
  * This is wrong, and this is TEH reason to emit signals on those Video Functions
  **/
-/* function called from ::DoRequest in order to show a nice VideoWidget
-    at the good size */
 void *MainInterface::requestVideo( vout_thread_t *p_nvout, int *pi_x,
                                    int *pi_y, unsigned int *pi_width,
                                    unsigned int *pi_height )
@@ -678,22 +666,22 @@ void *MainInterface::requestVideo( vout_thread_t *p_nvout, int *pi_x,
             bgWasVisible = true;
             emit askBgWidgetToToggle();
         }
-
-        /*if( THEMIM->getIM()->hasVideo() || !bgWasVisible )
+#if 0
+        if( THEMIM->getIM()->hasVideo() || !bgWasVisible )
         {
             videoWidget->widgetSize = QSize( *pi_width, *pi_height );
         }
         else /* Background widget available, use its size */
-        /*{
+        {
             /* Ok, our visualizations are bad, so don't do this for the moment
              * use the requested size anyway */
             // videoWidget->widgetSize = bgWidget->widgeTSize;
-          /*  videoWidget->widgetSize = QSize( *pi_width, *pi_height );
-        }*/
-
+            videoWidget->widgetSize = QSize( *pi_width, *pi_height );
+        }
+#endif
         videoIsActive = true;
 
-        emit askVideoToResize( *pi_width, *pi_height );
+//        emit askVideoToResize( *pi_width, *pi_height );
         emit askUpdate();
     }
     return ret;
@@ -709,7 +697,7 @@ void MainInterface::releaseVideoSlot( void *p_win )
     videoWidget->release( p_win );
     videoWidget->hide();
 
-    if( bgWidget )// WORONG
+    if( bgWidget )// WRONG
         bgWidget->show();
 
     adjustSize();
@@ -898,8 +886,10 @@ void MainInterface::setStatus( int status )
     msg_Dbg( p_intf, "I was here, updating your status" );
     /* Forward the status to the controls to toggle Play/Pause */
     controls->setStatus( status );
+    fullscreenControls->setStatus( status );
 
     controls->updateInput();
+    fullscreenControls->updateInput();
     speedControl->setEnable( THEMIM->getIM()->hasInput() );
 
     /* And in the systray for the menu */