Qt4 - saving size, position for the playlist and the extended panels.
authorJean-Baptiste Kempf <jb@videolan.org>
Mon, 26 Nov 2007 08:10:01 +0000 (08:10 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Mon, 26 Nov 2007 08:10:01 +0000 (08:10 +0000)
Be careful, if you have a config file, you may need to clean it.

modules/gui/qt4/components/interface_widgets.cpp
modules/gui/qt4/components/interface_widgets.hpp
modules/gui/qt4/dialogs/extended.cpp
modules/gui/qt4/dialogs/extended.hpp
modules/gui/qt4/dialogs/playlist.cpp
modules/gui/qt4/main_interface.cpp
modules/gui/qt4/util/qvlcframe.hpp

index 5e7adda..b8b26a3 100644 (file)
@@ -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();
 }
index 00acc5d..2581190 100644 (file)
@@ -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;
index c381866..f94f8c4 100644 (file)
@@ -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()
+{}
+
index 44bd256..b4f8a2f 100644 (file)
@@ -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
index b7d8f9a..ead03de 100644 (file)
@@ -54,7 +54,7 @@ PlaylistDialog::PlaylistDialog( intf_thread_t *_p_intf )
 
 PlaylistDialog::~PlaylistDialog()
 {
-    writeSettings( "playlist" );
+    writeSettings( "playlist" );    
 }
 
 void PlaylistDialog::dropEvent(QDropEvent *event)
index 474867c..b2c9e0b 100644 (file)
@@ -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 );
index 03a5db7..d1f2a61 100644 (file)
@@ -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();
          }
-
     }
 };