Qt4: Playlist saving size and blablah... Close #2112
authorJean-Baptiste Kempf <jb@videolan.org>
Tue, 23 Sep 2008 19:26:37 +0000 (12:26 -0700)
committerJean-Baptiste Kempf <jb@videolan.org>
Tue, 23 Sep 2008 19:32:51 +0000 (12:32 -0700)
(cherry picked from commit 17d2bc2f7804d1a23eb5e55eaff996de76777fd4)

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/gui/qt4/components/playlist/playlist.cpp
modules/gui/qt4/components/playlist/standardpanel.cpp
modules/gui/qt4/main_interface.cpp

index 8089e81..8d07f34 100644 (file)
@@ -117,7 +117,9 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i,
     // components shall never write there setting to a fixed location, may infer
     // with other uses of the same component...
     // getSettings()->beginGroup( "playlist" );
+    getSettings()->beginGroup("Playlist");
     restoreState( getSettings()->value("splitterSizes").toByteArray());
+    getSettings()->endGroup();
 
     setAcceptDrops( true );
     setWindowTitle( qtr( "Playlist" ) );
@@ -126,8 +128,9 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i,
 
 PlaylistWidget::~PlaylistWidget()
 {
-    getSettings()->beginGroup("playlistdialog");
+    getSettings()->beginGroup("Playlist");
     getSettings()->setValue( "splitterSizes", saveState() );
+    getSettings()->setValue( "GlobalPos", mapToGlobal( pos() ) );
     getSettings()->endGroup();
 }
 
index 2d1a8b6..e3ed5a6 100644 (file)
@@ -75,11 +75,13 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
     view->setDropIndicatorShown( true );
     view->setAutoScroll( true );
 
+
+    getSettings()->beginGroup("Playlist");
 #if HAS_QT43
     if( getSettings()->contains( "headerState" ) )
     {
-        view->header()->restoreState( getSettings()->value( "headerState" ).toByteArray() );
-        msg_Dbg( p_intf, "exists" );
+        view->header()->restoreState(
+                getSettings()->value( "headerState" ).toByteArray() );
     }
     else
 #endif
@@ -91,6 +93,7 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
         view->header()->setClickable( true );
         view->header()->setContextMenuPolicy( Qt::CustomContextMenu );
     }
+    getSettings()->endGroup();
 
     /* Connections for the TreeView */
     CONNECT( view, activated( const QModelIndex& ) ,
@@ -353,7 +356,7 @@ void StandardPLPanel::deleteSelection()
 StandardPLPanel::~StandardPLPanel()
 {
 #if HAS_QT43
-    getSettings()->beginGroup("playlistdialog");
+    getSettings()->beginGroup("Playlist");
     getSettings()->setValue( "headerState", view->header()->saveState() );
     getSettings()->endGroup();
 #endif
index c7c9544..150a6d2 100644 (file)
@@ -733,10 +733,15 @@ void MainInterface::togglePlaylist()
 
         if( i_pl_dock == PL_UNDOCKED )
         {
-            playlistWidget->setWindowFlags( Qt::Window );
+            playlistWidget->setParent( this, Qt::Window );
 
+            /* This will restore the geometry but will not work for position,
+               because of parenting */
             QVLCTools::restoreWidgetPosition( p_intf, "Playlist",
                     playlistWidget, QSize( 600, 300 ) );
+            /* Move it correctly then */
+            playlistWidget->move(
+                    getSettings()->value( "Playlist/GlobalPos" ).toPoint() );
         }
         else
         {