Commit 8fc1be22 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

Qt4 - Remember playlist's size.

parent 46c88072
...@@ -38,8 +38,8 @@ ...@@ -38,8 +38,8 @@
* Playlist Widget. The embedded playlist * Playlist Widget. The embedded playlist
**********************************************************************/ **********************************************************************/
PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QSettings *settings ) : PlaylistWidget::PlaylistWidget( intf_thread_t *_p_i, QSettings *settings, QWidget *_parent ) :
p_intf ( _p_i ) p_intf ( _p_i ), parent( _parent )
{ {
/* Left Part and design */ /* Left Part and design */
QSplitter *leftW = new QSplitter( Qt::Vertical, this ); QSplitter *leftW = new QSplitter( Qt::Vertical, this );
...@@ -126,9 +126,9 @@ PlaylistWidget::~PlaylistWidget() ...@@ -126,9 +126,9 @@ PlaylistWidget::~PlaylistWidget()
void PlaylistWidget::savingSettings( QSettings *settings ) void PlaylistWidget::savingSettings( QSettings *settings )
{ {
settings->beginGroup( "playlist" ); settings->beginGroup( "playlist" );
settings->setValue( "pos", pos() ); settings->setValue( "pos", parent->pos() );
settings->setValue( "size", size() ); settings->setValue( "size", parent->size() );
settings->setValue("splitterSizes", saveState() ); settings->setValue( "splitterSizes", saveState() );
settings->endGroup(); settings->endGroup();
} }
...@@ -41,7 +41,7 @@ class PlaylistWidget : public QSplitter ...@@ -41,7 +41,7 @@ class PlaylistWidget : public QSplitter
{ {
Q_OBJECT; Q_OBJECT;
public: public:
PlaylistWidget( intf_thread_t *_p_i, QSettings *settings ) ; PlaylistWidget( intf_thread_t *_p_i, QSettings *settings, QWidget *parent ) ;
virtual ~PlaylistWidget(); virtual ~PlaylistWidget();
QSize sizeHint() const; QSize sizeHint() const;
void savingSettings( QSettings *settings ); void savingSettings( QSettings *settings );
...@@ -51,6 +51,7 @@ private: ...@@ -51,6 +51,7 @@ private:
QPushButton *addButton; QPushButton *addButton;
QLabel *art; QLabel *art;
QString prevArt; QString prevArt;
QWidget *parent;
protected: protected:
intf_thread_t *p_intf; intf_thread_t *p_intf;
private slots: private slots:
......
...@@ -47,16 +47,14 @@ PlaylistDialog::PlaylistDialog( intf_thread_t *_p_intf ) ...@@ -47,16 +47,14 @@ PlaylistDialog::PlaylistDialog( intf_thread_t *_p_intf )
QHBoxLayout *l = new QHBoxLayout( centralWidget() ); QHBoxLayout *l = new QHBoxLayout( centralWidget() );
QSettings *settings = new QSettings( "vlc", "vlc-qt-interface" ); QSettings *settings = new QSettings( "vlc", "vlc-qt-interface" );
PlaylistWidget *plw = new PlaylistWidget( p_intf, settings ); PlaylistWidget *plw = new PlaylistWidget( p_intf, settings, this );
l->addWidget( plw ); l->addWidget( plw );
readSettings( "playlist", QSize( 600,700 ) ); readSettings( "playlist", QSize( 600,700 ) );
} }
PlaylistDialog::~PlaylistDialog() PlaylistDialog::~PlaylistDialog()
{ {}
writeSettings( "playlist" );
}
void PlaylistDialog::dropEvent( QDropEvent *event ) void PlaylistDialog::dropEvent( QDropEvent *event )
{ {
......
...@@ -397,9 +397,6 @@ void MainInterface::handleMainUi( QSettings *settings ) ...@@ -397,9 +397,6 @@ void MainInterface::handleMainUi( QSettings *settings )
if( videoEmbeddedFlag ) if( videoEmbeddedFlag )
{ {
videoWidget = new VideoWidget( p_intf ); videoWidget = new VideoWidget( p_intf );
//videoWidget->widgetSize = QSize( 16, 16 );
//videoWidget->hide();
//videoWidget->resize( videoWidget->widgetSize );
mainLayout->insertWidget( 0, videoWidget ); mainLayout->insertWidget( 0, videoWidget );
p_intf->pf_request_window = ::DoRequest; p_intf->pf_request_window = ::DoRequest;
...@@ -702,7 +699,7 @@ void MainInterface::togglePlaylist() ...@@ -702,7 +699,7 @@ void MainInterface::togglePlaylist()
If no playlist exist, then create one and attach it to the DockPL*/ If no playlist exist, then create one and attach it to the DockPL*/
if( !playlistWidget ) if( !playlistWidget )
{ {
playlistWidget = new PlaylistWidget( p_intf, settings ); playlistWidget = new PlaylistWidget( p_intf, settings, dockPL );
/* Add it to the parent DockWidget */ /* Add it to the parent DockWidget */
dockPL->setWidget( playlistWidget ); dockPL->setWidget( playlistWidget );
...@@ -718,6 +715,10 @@ void MainInterface::togglePlaylist() ...@@ -718,6 +715,10 @@ void MainInterface::togglePlaylist()
dockPL->setFloating( true ); dockPL->setFloating( true );
} }
settings->endGroup(); settings->endGroup();
settings->beginGroup( "playlist" );
dockPL->move( settings->value( "pos", QPoint( 0,0 ) ).toPoint() );
dockPL->resize( settings->value( "size", QSize( 400, 300 ) ).toSize() );
settings->endGroup();
dockPL->show(); dockPL->show();
} }
else else
......
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