From 27eb534266dc5c7eb177f17c263dae59171d964d Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Kempf Date: Sun, 24 Aug 2008 20:26:51 -0700 Subject: [PATCH] Correctly save the column size from the playlist. Fix bug reported on IRC and on Forum. Signed-off-by: Jean-Baptiste Kempf --- 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 621c251b2f..c55b0dc7e8 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 c83456a1cd..8401688a94 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 e29f0643d9..65e4e51637 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 cff3c0b4d7..289db4fcc4 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(); } -- 2.11.4.GIT