]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/main_interface.cpp
HACK for minimalView to go around a Qt bug/feature
[vlc] / modules / gui / qt4 / main_interface.cpp
index 33f883d45bc26aae48e6420444e633d94536168b..16f79f524740f783c9d0ec119d5897cdf8d3eabe 100644 (file)
@@ -211,15 +211,14 @@ 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() );
 
@@ -229,10 +228,6 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
     CONNECT( fullscreenControls, advancedControlsToggled( bool ),
              this, doComponentsUpdate() );
 
-    CONNECT( THEMIM->getIM(), inputUnset(),
-            fullscreenControls, unregFullscreenCallback() );
-
-
     /* Size and placement of interface */
     QVLCTools::restoreWidgetPosition(settings,this,QSize(350,60));
 
@@ -281,9 +276,7 @@ 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 );
@@ -435,13 +428,7 @@ void MainInterface::handleMainUi( QSettings *settings )
     if( videoEmbeddedFlag )
     {
         videoWidget = new VideoWidget( p_intf );
-        mainLayout->insertWidget( 0, videoWidget );
-
-        var_Create( p_intf, "window_widget", VLC_VAR_ADDRESS );
-        vlc_value_t val;
-        val.p_address = this;
-        var_Set( p_intf, "window_widget", val );
-        msg_Err( p_intf, "window_widget = %p", this);
+        mainLayout->insertWidget( 0, videoWidget, 10 );
     }
 
     /* Finish the sizing */
@@ -476,7 +463,7 @@ int MainInterface::privacyDialog( QList<ConfigControl *> controls )
 {
     QDialog *privacy = new QDialog();
 
-    privacy->setWindowTitle( qtr( "Privacy and Network policies" ) );
+    privacy->setWindowTitle( qtr( "Privacy and Network Policies" ) );
 
     QGridLayout *gLayout = new QGridLayout( privacy );
 
@@ -486,7 +473,7 @@ int MainInterface::privacyDialog( QList<ConfigControl *> controls )
         "<p>The <i>VideoLAN Team</i> doesn't like when an application goes "
         "online without authorization.</p>\n "
         "<p><i>VLC media player</i> can request limited information on "
-        "the Internet, especially to get CD covers and songs metadata or to know "
+        "the Internet, especially to get CD covers or to know "
         "if updates are available.</p>\n"
         "<p><i>VLC media player</i> <b>DOES NOT</b> send or collect <b>ANY</b> "
         "information, even anonymously, about your usage.</p>\n"
@@ -525,13 +512,12 @@ int MainInterface::privacyDialog( QList<ConfigControl *> controls )
     }
 
     CONFIG_GENERIC( "album-art", IntegerList ); line++;
-    CONFIG_GENERIC_NOBOOL( "fetch-meta", Bool ); line++;
 #ifdef UPDATE_CHECK
     CONFIG_GENERIC_NOBOOL( "qt-updates-notif", Bool ); line++;
     CONFIG_GENERIC_NOBOOL( "qt-updates-days", Integer ); line++;
 #endif
 
-    QPushButton *ok = new QPushButton( qtr( "Ok" ) );
+    QPushButton *ok = new QPushButton( qtr( "OK" ) );
 
     gLayout->addWidget( ok, 2, 2 );
 
@@ -659,8 +645,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 )
@@ -677,38 +661,32 @@ 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();
 
-        fullscreenControls->regFullscreenCallback( p_nvout );
+        fullscreenControls->attachVout( p_nvout );
     }
     return ret;
 }
 
-/* function called from ::DoRequest in order to show a nice VideoWidget
-    at the good size */
-void MainInterface::requestNotEmbeddedVideo( vout_thread_t *p_nvout )
-{
-    fullscreenControls->regFullscreenCallback( p_nvout );
-}
-
-void MainInterface::releaseVideo( void *p_win )
+void MainInterface::releaseVideo( vout_thread_t *p_vout, void *p_win )
 {
+    fullscreenControls->detachVout( p_vout );
     emit askReleaseVideo( p_win );
 }
 
@@ -818,6 +796,8 @@ void MainInterface::undockPlaylist()
 
 void MainInterface::toggleMinimalView()
 {
+    /* HACK for minimalView, see menus.cpp */
+    if( !menuBar()->isVisible() ) QVLCMenu::minimalViewAction->toggle();
     TOGGLEV( menuBar() );
     TOGGLEV( controls );
     TOGGLEV( statusBar() );