[vlc-devel] commit: Qt4: Playlist saving size and blablah... Close #2112 ( Jean-Baptiste Kempf )

git version control git at videolan.org
Tue Sep 23 21:30:46 CEST 2008


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Tue Sep 23 12:26:37 2008 -0700| [7a4d2bf7ebbf677890667c0113a3677ac0c806bf] | committer: Jean-Baptiste Kempf 

Qt4: Playlist saving size and blablah... Close #2112
(cherry picked from commit 17d2bc2f7804d1a23eb5e55eaff996de76777fd4)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/gui/qt4/components/playlist/playlist.cpp   |    5 ++++-
 .../gui/qt4/components/playlist/standardpanel.cpp  |    9 ++++++---
 modules/gui/qt4/main_interface.cpp                 |    7 ++++++-
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/playlist.cpp b/modules/gui/qt4/components/playlist/playlist.cpp
index 8089e81..8d07f34 100644
--- a/modules/gui/qt4/components/playlist/playlist.cpp
+++ b/modules/gui/qt4/components/playlist/playlist.cpp
@@ -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();
 }
 
diff --git a/modules/gui/qt4/components/playlist/standardpanel.cpp b/modules/gui/qt4/components/playlist/standardpanel.cpp
index 2d1a8b6..e3ed5a6 100644
--- a/modules/gui/qt4/components/playlist/standardpanel.cpp
+++ b/modules/gui/qt4/components/playlist/standardpanel.cpp
@@ -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
diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp
index c7c9544..150a6d2 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -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
         {




More information about the vlc-devel mailing list