]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/main_interface.cpp
Merge branch 'master' into lpcm_encoder
[vlc] / modules / gui / qt4 / main_interface.cpp
index 588f7b558cabdd2beb797e7692f5740176633b6d..300bea7ad843d086a0aee1a9a8dc50d313d12abe 100644 (file)
@@ -252,8 +252,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
     /* Final sizing and showing */
     setVisible( !b_hideAfterCreation );
 
-    setMinimumWidth( __MAX( controls->sizeHint().width(),
-                            menuBar()->sizeHint().width() ) + 30 );
+    computeMinimumSize();
 
     /* Switch to minimal view if needed, must be called after the show() */
     if( b_minimalView )
@@ -318,6 +317,15 @@ MainInterface::~MainInterface()
     p_intf->p_sys->p_mi = NULL;
 }
 
+void MainInterface::computeMinimumSize()
+{
+    int minWidth = 30;
+    if( menuBar()->isVisible() )
+        minWidth += __MAX( controls->sizeHint().width(), menuBar()->sizeHint().width() );
+
+    setMinimumWidth( minWidth );
+}
+
 /*****************************
  *   Main UI handling        *
  *****************************/
@@ -468,6 +476,14 @@ inline void MainInterface::createStatusBar()
 
     CONNECT( THEMIM->getIM(), seekRequested( float ),
              timeLabel, setDisplayPosition( float ) );
+
+    /* This shouldn't be necessary, but for somehow reason, the statusBarr
+       starts at height of 20px and when a text is shown it needs more space.
+       But, as the QMainWindow policy doesn't allow statusBar to change QMW's
+       geometry, we need to force a height. If you have a better idea, please
+       tell me -- jb
+     */
+    statusBarr->setFixedHeight( statusBarr->sizeHint().height() + 2 );
 }
 
 /**********************************************************************
@@ -774,6 +790,10 @@ void MainInterface::dockPlaylist( bool p_docked )
     playlistVisible = true;
 }
 
+/*
+ * setMinimalView is the private function used by
+ * the SLOT toggleMinimalView and setVideoFullScreen
+ */
 void MainInterface::setMinimalView( bool b_minimal )
 {
     menuBar()->setVisible( !b_minimal );
@@ -783,7 +803,9 @@ void MainInterface::setMinimalView( bool b_minimal )
 }
 
 /*
-  If b_minimal is false, then we are normalView
+ * This public SLOT is used for moving to minimal View Mode
+ *
+ * If b_minimal is false, then we are normalView
  */
 void MainInterface::toggleMinimalView( bool b_minimal )
 {
@@ -799,7 +821,10 @@ void MainInterface::toggleMinimalView( bool b_minimal )
     }
     b_minimalView = b_minimal;
     if( !b_videoFullScreen )
+    {
         setMinimalView( b_minimalView );
+        computeMinimumSize();
+    }
 
     emit minimalViewToggled( b_minimalView );
 }
@@ -971,7 +996,7 @@ void MainInterface::handleSystrayClick(
     {
         case QSystemTrayIcon::Trigger:
         case QSystemTrayIcon::DoubleClick:
-#ifdef Q_WS_MAC:
+#ifdef Q_WS_MAC
             QVLCMenu::updateSystrayMenu( this, p_intf );
 #else
             toggleUpdateSystrayMenu();
@@ -1066,7 +1091,7 @@ void MainInterface::dropEventPlay( QDropEvent *event, bool b_play )
     {
         if( url.isValid() )
         {
-            char* psz_uri = make_URI( qtu( url.toString() ), NULL );
+            char* psz_uri = make_URI( url.toEncoded().constData(), NULL );
             playlist_Add( THEPL, psz_uri, NULL,
                           PLAYLIST_APPEND | (first ? PLAYLIST_GO: PLAYLIST_PREPARSE),
                           PLAYLIST_END, true, pl_Unlocked );