[vlc-commits] commit: Qt: Better restore of the playlist State (Jean-Baptiste Kempf )

git at videolan.org git at videolan.org
Tue Mar 30 18:36:30 CEST 2010


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Tue Mar 30 17:19:04 2010 +0200| [de1d714f0222a0f73eee58ec6d323deb8bca42dc] | committer: Jean-Baptiste Kempf 

Qt: Better restore of the playlist State

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

 .../gui/qt4/components/playlist/standardpanel.cpp  |    1 -
 modules/gui/qt4/main_interface.cpp                 |   31 +++++++++++--------
 2 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/standardpanel.cpp b/modules/gui/qt4/components/playlist/standardpanel.cpp
index 8299ced..3a4568b 100644
--- a/modules/gui/qt4/components/playlist/standardpanel.cpp
+++ b/modules/gui/qt4/components/playlist/standardpanel.cpp
@@ -325,7 +325,6 @@ void StandardPLPanel::createTreeView()
             else if( m == COLUMN_DURATION ) treeView->header()->resizeSection( c, 80 );
         }
     }
-    getSettings()->endGroup();
 
     /* Connections for the TreeView */
     CONNECT( treeView, activated( const QModelIndex& ),
diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp
index 7ff26ef..953fd4b 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -254,8 +254,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
     }
 
     /* Playlist */
-    int i_plVis = settings->value( "playlist-visible", 0 ).toInt();
-
+    int i_plVis = settings->value( "playlist-visible", false ).toBool();
     settings->endGroup();
 
     if( i_plVis ) togglePlaylist();
@@ -274,18 +273,9 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
 MainInterface::~MainInterface()
 {
     /* Unsure we hide the videoWidget before destroying it */
-    if( stackCentralOldWidget == playlistWidget )
+    if( stackCentralOldWidget == videoWidget )
         showBg();
 
-    /* Save playlist state */
-    if( playlistWidget )
-    {
-        if( !isPlDocked() )
-            QVLCTools::saveWidgetPosition( p_intf, "Playlist", playlistWidget );
-
-        delete playlistWidget;
-    }
-
 #ifdef WIN32
     if( himl )
         ImageList_Destroy( himl );
@@ -306,7 +296,22 @@ MainInterface::~MainInterface()
     /* Save states */
     settings->beginGroup( "MainWindow" );
     settings->setValue( "pl-dock-status", b_plDocked );
-    settings->setValue( "playlist-visible", (int)playlistVisible );
+    /* Save playlist state */
+    if( playlistWidget )
+    {
+        if( isPlDocked() )
+        {
+            QVLCTools::saveWidgetPosition( p_intf, "Playlist", playlistWidget );
+            settings->setValue( "playlist-visible", playlistVisible );
+        }
+        else
+        {
+            settings->setValue( "playlist-visible", playlistWidget->isVisible() ); // FIXME
+        }
+
+        delete playlistWidget;
+    }
+
     settings->setValue( "adv-controls",
                         getControlsVisibilityStatus() & CONTROLS_ADVANCED );
 



More information about the vlc-commits mailing list