Commit 92e69fb4 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 - saving size, position for the playlist and the extended panels.

Be careful, if you have a config file, you may need to clean it.
parent 1afc6211
...@@ -721,11 +721,6 @@ void ControlsWidget::toggleAdvanced() ...@@ -721,11 +721,6 @@ void ControlsWidget::toggleAdvanced()
PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QSettings *settings ) : PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QSettings *settings ) :
p_intf ( _p_i ) p_intf ( _p_i )
{ {
/* In case we want to keep the splitter informations */
settings->beginGroup( "Playlist" );
restoreState(settings->value("splitterSizes").toByteArray());
settings->endGroup();
/* Left Part and design */ /* Left Part and design */
QWidget *leftW = new QWidget( this ); QWidget *leftW = new QWidget( this );
QVBoxLayout *left = new QVBoxLayout( leftW ); QVBoxLayout *left = new QVBoxLayout( leftW );
...@@ -776,8 +771,13 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QSettings *settings ) : ...@@ -776,8 +771,13 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QSettings *settings ) :
sizeList << 180 << 420 ; sizeList << 180 << 420 ;
setSizes( sizeList ); setSizes( sizeList );
setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Expanding ); setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Expanding );
resize( 600, 300 );
//updateGeometry(); /* In case we want to keep the splitter informations */
settings->beginGroup( "playlist" );
restoreState( settings->value("splitterSizes").toByteArray());
resize( settings->value("size", QSize(600, 300)).toSize());
move( settings->value("pos", QPoint( 0, 400)).toPoint());
settings->endGroup();
} }
void PlaylistWidget::setArt( QString url ) void PlaylistWidget::setArt( QString url )
...@@ -801,12 +801,13 @@ QSize PlaylistWidget::sizeHint() const ...@@ -801,12 +801,13 @@ QSize PlaylistWidget::sizeHint() const
} }
PlaylistWidget::~PlaylistWidget() PlaylistWidget::~PlaylistWidget()
{ {}
}
void PlaylistWidget::saveSettings( QSettings *settings ) void PlaylistWidget::savingSettings( QSettings *settings )
{ {
settings->beginGroup( "Playlist" ); settings->beginGroup( "playlist" );
settings->setValue( "pos", pos() );
settings->setValue( "size", size() );
settings->setValue("splitterSizes", saveState() ); settings->setValue("splitterSizes", saveState() );
settings->endGroup(); settings->endGroup();
} }
......
...@@ -245,7 +245,7 @@ public: ...@@ -245,7 +245,7 @@ public:
PlaylistWidget( intf_thread_t *_p_i, QSettings *settings ) ; PlaylistWidget( intf_thread_t *_p_i, QSettings *settings ) ;
virtual ~PlaylistWidget(); virtual ~PlaylistWidget();
QSize sizeHint() const; QSize sizeHint() const;
void saveSettings( QSettings *settings ); void savingSettings( QSettings *settings );
private: private:
PLSelector *selector; PLSelector *selector;
PLPanel *rightPanel; PLPanel *rightPanel;
......
...@@ -63,9 +63,15 @@ ExtendedDialog::ExtendedDialog( intf_thread_t *_p_intf ): QVLCFrame( _p_intf ) ...@@ -63,9 +63,15 @@ ExtendedDialog::ExtendedDialog( intf_thread_t *_p_intf ): QVLCFrame( _p_intf )
QPushButton *closeButton = new QPushButton( qtr( "Close" ) ); QPushButton *closeButton = new QPushButton( qtr( "Close" ) );
layout->addWidget( closeButton, 1, 4, 1, 1); layout->addWidget( closeButton, 1, 4, 1, 1);
CONNECT( closeButton, clicked(), this, close() ); CONNECT( closeButton, clicked(), this, close() );
readSettings( "EPanel", QSize( 400, 300 ), QPoint( 450, 0 ) );
} }
ExtendedDialog::~ExtendedDialog() void ExtendedDialog::savingSettings()
{ {
writeSettings( "EPanel" );
} }
ExtendedDialog::~ExtendedDialog()
{}
...@@ -37,10 +37,11 @@ public: ...@@ -37,10 +37,11 @@ public:
return instance; return instance;
} }
virtual ~ExtendedDialog(); virtual ~ExtendedDialog();
static bool exists(){ return ( instance != NULL ) ; }
void savingSettings();
private: private:
ExtendedDialog( intf_thread_t * ); ExtendedDialog( intf_thread_t * );
static ExtendedDialog *instance; static ExtendedDialog *instance;
public slots:
}; };
#endif #endif
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "util/customwidgets.hpp" #include "util/customwidgets.hpp"
#include "dialogs_provider.hpp" #include "dialogs_provider.hpp"
#include "components/interface_widgets.hpp" #include "components/interface_widgets.hpp"
#include "dialogs/extended.hpp"
#include "dialogs/playlist.hpp" #include "dialogs/playlist.hpp"
#include "menus.hpp" #include "menus.hpp"
...@@ -287,7 +288,9 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf ) ...@@ -287,7 +288,9 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
MainInterface::~MainInterface() MainInterface::~MainInterface()
{ {
if( playlistWidget ) playlistWidget->saveSettings( settings ); if( playlistWidget ) playlistWidget->savingSettings( settings );
if( ExtendedDialog::exists() )
ExtendedDialog::getInstance( p_intf )->savingSettings();
settings->beginGroup( "MainWindow" ); settings->beginGroup( "MainWindow" );
settings->setValue( "playlist-floats", dockPL->isFloating() ); settings->setValue( "playlist-floats", dockPL->isFloating() );
......
...@@ -54,12 +54,12 @@ public: ...@@ -54,12 +54,12 @@ public:
protected: protected:
intf_thread_t *p_intf; intf_thread_t *p_intf;
void readSettings( QString name, QSize defSize ) void readSettings( QString name, QSize defSize, QPoint defPos )
{ {
QSettings settings( "vlc", "vlc-qt-interface" ); QSettings settings( "vlc", "vlc-qt-interface" );
settings.beginGroup( name ); settings.beginGroup( name );
resize( settings.value( "size", defSize ).toSize() ); resize( settings.value( "size", defSize ).toSize() );
move( settings.value( "pos", QPoint( 0,0 ) ).toPoint() ); move( settings.value( "pos", defPos ).toPoint() );
settings.endGroup(); settings.endGroup();
} }
void writeSettings( QString name ) void writeSettings( QString name )
...@@ -90,7 +90,6 @@ protected: ...@@ -90,7 +90,6 @@ protected:
msg_Dbg( p_intf, "Enter Key pressed" ); msg_Dbg( p_intf, "Enter Key pressed" );
close(); close();
} }
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment