[vlc-devel] commit: Correctly save the column size from the playlist. ( Jean-Baptiste Kempf )

git version control git at videolan.org
Mon Aug 25 07:26:07 CEST 2008


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Sun Aug 24 20:26:51 2008 -0700| [27eb534266dc5c7eb177f17c263dae59171d964d] | committer: Jean-Baptiste Kempf 

Correctly save the column size from the playlist.

Fix bug reported on IRC and on Forum.

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

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

 modules/gui/qt4/components/playlist/playlist.cpp   |    5 +--
 modules/gui/qt4/components/playlist/playlist.hpp   |    1 -
 .../gui/qt4/components/playlist/standardpanel.cpp  |   32 +++++++++++++++----
 modules/gui/qt4/dialogs/playlist.cpp               |    3 --
 4 files changed, 27 insertions(+), 14 deletions(-)

diff --git a/modules/gui/qt4/components/playlist/playlist.cpp b/modules/gui/qt4/components/playlist/playlist.cpp
index 621c251..c55b0dc 100644
--- a/modules/gui/qt4/components/playlist/playlist.cpp
+++ b/modules/gui/qt4/components/playlist/playlist.cpp
@@ -140,10 +140,9 @@ QSize PlaylistWidget::sizeHint() const
 }
 
 PlaylistWidget::~PlaylistWidget()
-{}
-
-void PlaylistWidget::savingSettings()
 {
+    getSettings()->beginGroup("playlistdialog");
     getSettings()->setValue( "splitterSizes", saveState() );
+    getSettings()->endGroup();
 }
 
diff --git a/modules/gui/qt4/components/playlist/playlist.hpp b/modules/gui/qt4/components/playlist/playlist.hpp
index c83456a..8401688 100644
--- a/modules/gui/qt4/components/playlist/playlist.hpp
+++ b/modules/gui/qt4/components/playlist/playlist.hpp
@@ -48,7 +48,6 @@ public:
     PlaylistWidget( intf_thread_t *_p_i, QWidget *parent ) ;
     virtual ~PlaylistWidget();
     QSize sizeHint() const;
-    void savingSettings();
 private:
     PLSelector *selector;
     PLPanel *rightPanel;
diff --git a/modules/gui/qt4/components/playlist/standardpanel.cpp b/modules/gui/qt4/components/playlist/standardpanel.cpp
index e29f064..65e4e51 100644
--- a/modules/gui/qt4/components/playlist/standardpanel.cpp
+++ b/modules/gui/qt4/components/playlist/standardpanel.cpp
@@ -74,12 +74,22 @@ StandardPLPanel::StandardPLPanel( PlaylistWidget *_parent,
     view->setDropIndicatorShown( true );
     view->setAutoScroll( true );
 
-    /* Configure the size of the header */
-    view->header()->resizeSection( 0, 200 );
-    view->header()->resizeSection( 1, 80 );
-    view->header()->setSortIndicatorShown( true );
-    view->header()->setClickable( true );
-    view->header()->setContextMenuPolicy( Qt::CustomContextMenu );
+#if HAS_QT43
+    if( getSettings()->contains( "headerState" ) )
+    {
+        view->header()->restoreState( getSettings()->value( "headerState" ).toByteArray() );
+        msg_Dbg( p_intf, "exists" );
+    }
+    else
+#endif
+    {
+        /* Configure the size of the header */
+        view->header()->resizeSection( 0, 200 );
+        view->header()->resizeSection( 1, 80 );
+        view->header()->setSortIndicatorShown( true );
+        view->header()->setClickable( true );
+        view->header()->setContextMenuPolicy( Qt::CustomContextMenu );
+    }
 
     /* Connections for the TreeView */
     CONNECT( view, activated( const QModelIndex& ) ,
@@ -350,4 +360,12 @@ void StandardPLPanel::deleteSelection()
 }
 
 StandardPLPanel::~StandardPLPanel()
-{}
+{
+#if HAS_QT43
+    getSettings()->beginGroup("playlistdialog");
+    getSettings()->setValue( "headerState", view->header()->saveState() );
+    getSettings()->endGroup();
+#endif
+}
+
+
diff --git a/modules/gui/qt4/dialogs/playlist.cpp b/modules/gui/qt4/dialogs/playlist.cpp
index cff3c0b..289db4f 100644
--- a/modules/gui/qt4/dialogs/playlist.cpp
+++ b/modules/gui/qt4/dialogs/playlist.cpp
@@ -63,10 +63,7 @@ PlaylistDialog::PlaylistDialog( intf_thread_t *_p_intf )
 PlaylistDialog::~PlaylistDialog()
 {
     getSettings()->beginGroup("playlistdialog");
-
     writeSettings( getSettings() );
-    playlistWidget->savingSettings();
-
     getSettings()->endGroup();
 }
 




More information about the vlc-devel mailing list