]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/main_interface.cpp
Try to close ticket '#1775' (Qt intf startup size is too big)
[vlc] / modules / gui / qt4 / main_interface.cpp
index d413dae74ed0f16602bf540a4011ce854b288e57..2cb37548e810cd61c9770b55288b96bf4dc2c575 100644 (file)
@@ -57,7 +57,6 @@
 #include <QToolBar>
 #include <QGroupBox>
 #include <QDate>
-#include <QProgressBar>
 
 #include <assert.h>
 #include <vlc_keys.h>
@@ -238,6 +237,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
 
     /* Update the geometry TODO: is it useful ?*/
     updateGeometry();
+    resize( sizeHint() );
 
     /*****************************************************
      * End everything by creating the Systray Management *
@@ -306,13 +306,10 @@ inline void MainInterface::createStatusBar()
     speedLabel->setFrameStyle( QFrame::Sunken | QFrame::Panel );
     nameLabel->setFrameStyle( QFrame::Sunken | QFrame::StyledPanel);
 
-    pgBar = new QProgressBar;
-    pgBar->hide();
 
     /* and adding those */
     statusBar()->addWidget( nameLabel, 8 );
     statusBar()->addPermanentWidget( speedLabel, 0 );
-    statusBar()->addPermanentWidget( pgBar, 0 );
     statusBar()->addPermanentWidget( timeLabel, 0 );
 
     /* timeLabel behaviour:
@@ -544,7 +541,7 @@ int MainInterface::privacyDialog( QList<ConfigControl *> *controls )
    ask _parent->isFloating()...
    If you think this would be better, please FIXME it...
 */
-#if 0
+
 QSize MainInterface::sizeHint() const
 {
     int nwidth  = controls->sizeHint().width();
@@ -563,20 +560,22 @@ QSize MainInterface::sizeHint() const
     }
     else if( videoIsActive )
     {
-        nheight += videoWidget->size().height();
-        nwidth  = videoWidget->size().width();
+        nheight += videoWidget->sizeHint().height();
+        nwidth  = videoWidget->sizeHint().width();
         msg_Dbg( p_intf, "2 %i %i", nheight, nwidth );
     }
-/*    if( !dockPL->isFloating() && dockPL->isVisible() && dockPL->widget()  )
+#if 0
+    if( !dockPL->isFloating() && dockPL->isVisible() && dockPL->widget()  )
     {
         nheight += dockPL->size().height();
         nwidth = __MAX( nwidth, dockPL->size().width() );
         msg_Dbg( p_intf, "3 %i %i", nheight, nwidth );
-    }*/
+    }
+#endif
     msg_Dbg( p_intf, "4 %i %i", nheight, nwidth );
     return QSize( nwidth, nheight );
 }
-#endif
+
 #if 0
 /* FIXME This is dead code and need to be removed AT THE END */
 void MainInterface::resizeEvent( QResizeEvent *e )
@@ -598,10 +597,19 @@ void MainInterface::resizeEvent( QResizeEvent *e )
 }
 #endif
 
+void MainInterface::toggleFSC()
+{
+   if( !fullscreenControls ) return;
+
+   IMEvent *eShow = new IMEvent( FullscreenControlToggle_Type, 0 );
+   QApplication::postEvent( fullscreenControls, static_cast<QEvent *>(eShow) );
+}
+#if 0
 void MainInterface::requestLayoutUpdate()
 {
     emit askUpdate();
 }
+#endif
 
 //FIXME remove me at the end...
 void MainInterface::debug()
@@ -708,8 +716,8 @@ void MainInterface::releaseVideoSlot( void *p_win )
         bgWidget->show();
     }
 
-    adjustSize();
     videoIsActive = false;
+    if( !isFullScreen() ) adjustSize();
 }
 
 int MainInterface::controlVideo( void *p_window, int i_query, va_list args )
@@ -808,10 +816,16 @@ void MainInterface::toggleMinimalView()
 {
     /* HACK for minimalView, see menus.cpp */
     if( !menuBar()->isVisible() ) QVLCMenu::minimalViewAction->toggle();
+
     if( i_visualmode != QT_ALWAYS_VIDEO_MODE &&
         i_visualmode != QT_MINIMAL_MODE )
-    {
-        emit askBgWidgetToToggle();
+    { /* NORMAL MODE then */
+        if( videoWidget->isHidden() ) emit askBgWidgetToToggle();
+        else
+        {
+            /* If video is visible, then toggle the status of bgWidget */
+            bgWasVisible = !bgWasVisible;      
+        }
     }
 
     TOGGLEV( menuBar() );
@@ -833,7 +847,7 @@ void MainInterface::doComponentsUpdate()
 void MainInterface::toggleAdvanced()
 {
     controls->toggleAdvanced();
-    fullscreenControls->toggleAdvanced();
+    if( fullscreenControls ) fullscreenControls->toggleAdvanced();
 }
 
 /* Get the visibility status of the controls (hidden or not, advanced or not) */
@@ -1231,7 +1245,8 @@ static int IntfShowCB( vlc_object_t *p_this, const char *psz_variable,
                        vlc_value_t old_val, vlc_value_t new_val, void *param )
 {
     intf_thread_t *p_intf = (intf_thread_t *)param;
-    p_intf->p_sys->p_mi->requestLayoutUpdate();
+    p_intf->p_sys->p_mi->toggleFSC();
 
-    return VLC_SUCCESS;
+    /* Show event */
+     return VLC_SUCCESS;
 }