[vlc-devel] [PATCH] Qt4: Fix docked playlist videoWidget docking bug

Edward Wang edward.c.wang at compdigitec.com
Mon Jan 2 00:48:58 CET 2012


Fixes issue where docked playlist doesn't "release" its embedded videoWidget, causing a bug.
Close #5588

Thanks,
	Edward Wang

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

diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp
index 19c65a8..f0323d5 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -548,6 +548,15 @@ inline void MainInterface::showTab( QWidget *widget )
             videoWidget->show(); videoWidget->raise();
             stackCentralW->addWidget( videoWidget );
         }
+
+        /* Embedded playlist -> Non-embedded playlist */
+        if( bgWidget == stackCentralOldWidget && widget == videoWidget )
+        {
+            playlistWidget->artContainer->removeWidget( videoWidget );
+            videoWidget->show(); videoWidget->raise();
+            stackCentralW->addWidget( videoWidget );
+            stackCentralW->setCurrentWidget( videoWidget );
+        }
     }
 
     stackCentralW->setCurrentWidget( widget );
@@ -803,6 +812,8 @@ void MainInterface::togglePlaylist()
         /* Playlist is not visible, show it */
         if( stackCentralW->currentWidget() != playlistWidget )
         {
+            if( stackCentralW->indexOf( playlistWidget ) == -1 )
+                stackCentralW->addWidget( playlistWidget );
             showTab( playlistWidget );
         }
         else /* Hide it! */
@@ -829,8 +840,10 @@ void MainInterface::dockPlaylist( bool p_docked )
     b_plDocked = p_docked;
 
     if( !playlistWidget ) return; /* Playlist wasn't created yet */
-    if( !p_docked )
+    if( !p_docked ) /* Previously docked */
     {
+        /* If playlist is invisible don't show it */
+        if( stackCentralW->currentWidget() != playlistWidget ) return;
         stackCentralW->removeWidget( playlistWidget );
 #ifdef WIN32
         playlistWidget->setParent( NULL );
@@ -841,8 +854,11 @@ void MainInterface::dockPlaylist( bool p_docked )
         playlistWidget->show();
         restoreStackOldWidget();
     }
-    else
+    else /* Previously undocked */
     {
+        /* If playlist is invisible don't show it */
+        if( !playlistWidget->isVisible() ) return;
+
         QVLCTools::saveWidgetPosition( p_intf, "Playlist", playlistWidget );
         playlistWidget->setWindowFlags( Qt::Widget ); // Probably a Qt bug here
         // It would be logical that QStackWidget::addWidget reset the flags...
-- 
1.7.5.4




More information about the vlc-devel mailing list