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()
PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QSettings *settings ) :
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 */
QWidget *leftW = new QWidget( this );
QVBoxLayout *left = new QVBoxLayout( leftW );
......@@ -776,8 +771,13 @@ PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QSettings *settings ) :
sizeList << 180 << 420 ;
setSizes( sizeList );
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 )
......@@ -801,12 +801,13 @@ QSize PlaylistWidget::sizeHint() const
}
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->endGroup();
}
......
......@@ -245,7 +245,7 @@ public:
PlaylistWidget( intf_thread_t *_p_i, QSettings *settings ) ;
virtual ~PlaylistWidget();
QSize sizeHint() const;
void saveSettings( QSettings *settings );
void savingSettings( QSettings *settings );
private:
PLSelector *selector;
PLPanel *rightPanel;
......
......@@ -63,9 +63,15 @@ ExtendedDialog::ExtendedDialog( intf_thread_t *_p_intf ): QVLCFrame( _p_intf )
QPushButton *closeButton = new QPushButton( qtr( "Close" ) );
layout->addWidget( closeButton, 1, 4, 1, 1);
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:
return instance;
}
virtual ~ExtendedDialog();
static bool exists(){ return ( instance != NULL ) ; }
void savingSettings();
private:
ExtendedDialog( intf_thread_t * );
static ExtendedDialog *instance;
public slots:
};
#endif
......@@ -54,7 +54,7 @@ PlaylistDialog::PlaylistDialog( intf_thread_t *_p_intf )
PlaylistDialog::~PlaylistDialog()
{
writeSettings( "playlist" );
writeSettings( "playlist" );
}
void PlaylistDialog::dropEvent(QDropEvent *event)
......
......@@ -29,6 +29,7 @@
#include "util/customwidgets.hpp"
#include "dialogs_provider.hpp"
#include "components/interface_widgets.hpp"
#include "dialogs/extended.hpp"
#include "dialogs/playlist.hpp"
#include "menus.hpp"
......@@ -287,8 +288,10 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
MainInterface::~MainInterface()
{
if( playlistWidget ) playlistWidget->saveSettings( settings );
if( playlistWidget ) playlistWidget->savingSettings( settings );
if( ExtendedDialog::exists() )
ExtendedDialog::getInstance( p_intf )->savingSettings();
settings->beginGroup( "MainWindow" );
settings->setValue( "playlist-floats", dockPL->isFloating() );
settings->setValue( "adv-controls", getControlsVisibilityStatus() & CONTROLS_ADVANCED );
......
......@@ -54,12 +54,12 @@ public:
protected:
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" );
settings.beginGroup( name );
resize( settings.value( "size", defSize ).toSize() );
move( settings.value( "pos", QPoint( 0,0 ) ).toPoint() );
move( settings.value( "pos", defPos ).toPoint() );
settings.endGroup();
}
void writeSettings( QString name )
......@@ -90,7 +90,6 @@ protected:
msg_Dbg( p_intf, "Enter Key pressed" );
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