]> git.sesse.net Git - vlc/commitdiff
Qt: no need to restart VLC to get the new toolbars.
authorJean-Baptiste Kempf <jb@videolan.org>
Mon, 20 Apr 2009 13:44:18 +0000 (15:44 +0200)
committerJean-Baptiste Kempf <jb@videolan.org>
Mon, 20 Apr 2009 13:45:08 +0000 (15:45 +0200)
modules/gui/qt4/dialogs/toolbar.cpp
modules/gui/qt4/dialogs_provider.cpp
modules/gui/qt4/dialogs_provider.hpp
modules/gui/qt4/main_interface.cpp
modules/gui/qt4/main_interface.hpp

index 90838c48515e9190984cc336504ef5ca94616695..0eca8e35a4efda5016b87ad0a3ac6b782ec642c8 100644 (file)
@@ -247,7 +247,6 @@ void ToolbarEditDialog::changeProfile( int i )
 void ToolbarEditDialog::close()
 {
     msg_Dbg( p_intf, "Close and save" );
-    hide();
     getSettings()->setValue( "MainWindow/ToolbarPos",
             positionCombo->itemData( positionCombo->currentIndex() ).toInt() );
     getSettings()->setValue( "MainWindow/MainToolbar1", controller1->getValue() );
@@ -255,11 +254,13 @@ void ToolbarEditDialog::close()
     getSettings()->setValue( "MainWindow/AdvToolbar", controllerA->getValue() );
     getSettings()->setValue( "MainWindow/InputToolbar", controller->getValue() );
     getSettings()->setValue( "MainWindow/FSCtoolbar", controllerFSC->getValue() );
+    getSettings()->sync();
+    accept();
 }
 
 void ToolbarEditDialog::cancel()
 {
-    hide();
+    reject();
 }
 
 /************************************************
index 746873e79707d4553b5f1cbf7764e38babd74acc..a708290c4a1763523b714a8e8c7dabb953fc0891 100644 (file)
@@ -242,7 +242,8 @@ void DialogsProvider::podcastConfigureDialog()
 void DialogsProvider::toolbarDialog()
 {
     ToolbarEditDialog *toolbarEditor = new ToolbarEditDialog( (QWidget *)p_intf->p_sys->p_mi, p_intf );
-    toolbarEditor->exec();
+    if( toolbarEditor->exec() == QDialog::Accepted )
+        emit toolBarConfUpdated();
 }
 
 void DialogsProvider::pluginDialog()
index d9854b8a1b9d6b2017bf381c5e6a8a5a843d2f19..105697cb5b247a6932ee84dc77746c0d0119e283 100644 (file)
@@ -193,6 +193,8 @@ private slots:
     void menuAction( QObject *);
     void menuUpdateAction( QObject * );
     void SDMenuAction( QString );
+signals:
+    void  toolBarConfUpdated();
 };
 
 class DialogEvent : public QEvent
index f02edac7389a7941c4a2d54f408106366f855ede..bcfcb503b7e9ef8516b4bb190ef37edb99ebabf8 100644 (file)
@@ -221,6 +221,7 @@ MainInterface::MainInterface( intf_thread_t *_p_intf ) : QVLCMW( _p_intf )
     }
 
     CONNECT( this, askUpdate(), this, doComponentsUpdate() );
+    CONNECT( THEDP, toolBarConfUpdated(), this, recreateToolbars() );
 
     /* Size and placement of interface */
     settings->beginGroup( "MainWindow" );
@@ -408,6 +409,24 @@ void MainInterface::setVLCWindowsTitle( QString aTitle )
     }
 }
 
+void MainInterface::recreateToolbars()
+{
+    settings->beginGroup( "MainWindow" );
+    delete controls;
+    delete inputC;
+    controls = new ControlsWidget( p_intf, false, this ); /* FIXME */
+    CONNECT( controls, advancedControlsToggled( bool ),
+             this, doComponentsUpdate() );
+    CONNECT( controls, sizeChanged(),
+             this, doComponentsUpdate() );
+    inputC = new InputControlsWidget( p_intf, this );
+
+    mainLayout->insertWidget( 2, inputC, 0, Qt::AlignBottom );
+    mainLayout->insertWidget( settings->value( "ToolbarPos", 0 ).toInt() ? 0: 3,
+                              controls, 0, Qt::AlignBottom );
+    settings->endGroup();
+}
+
 void MainInterface::handleMainUi( QSettings *settings )
 {
     /* Create the main Widget and the mainLayout */
@@ -421,16 +440,7 @@ void MainInterface::handleMainUi( QSettings *settings )
     mainLayout->setSpacing( 0 );
     mainLayout->setMargin( 0 );
 
-    /* Create the CONTROLS Widget */
-    controls = new ControlsWidget( p_intf,
-                   settings->value( "adv-controls", false ).toBool(), this );
-    CONNECT( controls, advancedControlsToggled( bool ),
-             this, doComponentsUpdate() );
-    CONNECT( controls, sizeChanged(),
-             this, doComponentsUpdate() );
-    inputC = new InputControlsWidget( p_intf, this );
-
-        /* Visualisation */
+    /* Visualisation */
     /* Disabled for now, they SUCK */
     #if 0
     visualSelector = new VisualSelector( p_intf );
@@ -455,6 +465,16 @@ void MainInterface::handleMainUi( QSettings *settings )
     if( videoEmbeddedFlag )
         videoWidget = new VideoWidget( p_intf );
 
+    /* Create the CONTROLS Widget */
+    controls = new ControlsWidget( p_intf,
+                   settings->value( "adv-controls", false ).toBool(), this );
+    CONNECT( controls, advancedControlsToggled( bool ),
+             this, doComponentsUpdate() );
+    CONNECT( controls, sizeChanged(),
+             this, doComponentsUpdate() );
+    inputC = new InputControlsWidget( p_intf, this );
+
+
     /* Add the controls Widget to the main Widget */
     mainLayout->insertWidget( 0, bgWidget );
     if( videoWidget ) mainLayout->insertWidget( 0, videoWidget, 10 );
index af0dcbc015f00c85929948d1419367c030540744..04aa24155f6eb99ceacbe21fc62158f9daab9527 100644 (file)
@@ -166,6 +166,7 @@ public slots:
 
 private slots:
     void debug();
+    void recreateToolbars();
     void doComponentsUpdate();
     void setName( QString );
     void setVLCWindowsTitle( QString title = "" );