[vlc-devel] commit: Qt: toggle minimal view should not change the interface size ( Jean-Philippe Andre )

git version control git at videolan.org
Sat Apr 11 06:44:22 CEST 2009


vlc | branch: master | Jean-Philippe Andre <jpeg at via.ecp.fr> | Sat Apr 11 12:41:01 2009 +0800| [d4799c27229f81c93aa0758a84466fb7d7d54db9] | committer: Jean-Philippe Andre 

Qt: toggle minimal view should not change the interface size

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d4799c27229f81c93aa0758a84466fb7d7d54db9
---

 modules/gui/qt4/main_interface.cpp |   20 ++++++++++++++++----
 modules/gui/qt4/main_interface.hpp |    1 +
 2 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp
index edfa08b..f02edac 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -83,6 +83,9 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
     fullscreenControls   = NULL;
     cryptedLabel         = NULL;
 
+    bgWasVisible         = false;
+    i_bg_height          = 0;
+
     /* Ask for privacy */
     askForPrivacy();
 
@@ -606,13 +609,16 @@ QSize MainInterface::sizeHint() const
 
     if( VISIBLE( bgWidget ) )
     {
-        nheight += bgWidget->size().height();
-        nwidth  = bgWidget->size().width();
+        if( i_bg_height )
+            nheight += i_bg_height;
+        else
+            nheight += bgWidget->size().height();
+        nwidth  = __MAX( nwidth, bgWidget->size().width() );
     }
     else if( videoIsActive && videoWidget->isVisible() )
     {
         nheight += videoWidget->sizeHint().height();
-        nwidth  = videoWidget->sizeHint().width();
+        nwidth  = __MAX( nwidth, videoWidget->sizeHint().width() );
     }
 #if 0
     if( !dockPL->isFloating() && dockPL->isVisible() && dockPL->widget()  )
@@ -820,7 +826,10 @@ void MainInterface::toggleMinimalView( bool b_switch )
     if( i_visualmode != QT_ALWAYS_VIDEO_MODE &&
         i_visualmode != QT_MINIMAL_MODE )
     { /* NORMAL MODE then */
-        if( !videoWidget || videoWidget->isHidden() ) emit askBgWidgetToToggle();
+        if( !videoWidget || videoWidget->isHidden() )
+        {
+            emit askBgWidgetToToggle();
+        }
         else
         {
             /* If video is visible, then toggle the status of bgWidget */
@@ -828,10 +837,13 @@ void MainInterface::toggleMinimalView( bool b_switch )
         }
     }
 
+    i_bg_height = bgWidget->height();
+
     menuBar()->setVisible( !b_switch );
     controls->setVisible( !b_switch );
     statusBar()->setVisible( !b_switch );
     inputC->setVisible( !b_switch );
+
     doComponentsUpdate();
 
     emit minimalViewToggled( b_switch );
diff --git a/modules/gui/qt4/main_interface.hpp b/modules/gui/qt4/main_interface.hpp
index 3fd00ae..af0dcbc 100644
--- a/modules/gui/qt4/main_interface.hpp
+++ b/modules/gui/qt4/main_interface.hpp
@@ -139,6 +139,7 @@ private:
     int                  i_visualmode;        ///< Visual Mode
     pl_dock_e            i_pl_dock;
     bool                 isDocked() { return ( i_pl_dock != PL_UNDOCKED ); }
+    int                  i_bg_height;         ///< Save height of bgWidget
 
     /* Status Bar */
     QLabel              *nameLabel;




More information about the vlc-devel mailing list