[vlc-devel] commit: Qt: save and honour the above-video parameter to allow old-fashion GUI. ( Jean-Baptiste Kempf )

git version control git at videolan.org
Mon Jan 19 01:42:12 CET 2009


vlc | branch: master | Jean-Baptiste Kempf <jb at videolan.org> | Mon Jan 19 01:41:04 2009 +0100| [46bc555885a3b1dfa7765cc63258fd1fd3e2d242] | committer: Jean-Baptiste Kempf 

Qt: save and honour the above-video parameter to allow old-fashion GUI.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=46bc555885a3b1dfa7765cc63258fd1fd3e2d242
---

 modules/gui/qt4/components/controller.cpp |   16 +++++++---------
 modules/gui/qt4/components/controller.hpp |    7 +++++++
 modules/gui/qt4/dialogs/toolbar.cpp       |   25 +++++++++++++++----------
 modules/gui/qt4/dialogs/toolbar.hpp       |    2 ++
 modules/gui/qt4/main_interface.cpp        |   18 +++++++++---------
 5 files changed, 40 insertions(+), 28 deletions(-)

diff --git a/modules/gui/qt4/components/controller.cpp b/modules/gui/qt4/components/controller.cpp
index b46b7f7..9ea8b7d 100644
--- a/modules/gui/qt4/components/controller.cpp
+++ b/modules/gui/qt4/components/controller.cpp
@@ -704,14 +704,14 @@ ControlsWidget::ControlsWidget( intf_thread_t *_p_i,
     QHBoxLayout *controlLayout1 = new QHBoxLayout;
     controlLayout1->setSpacing( 0 );
 
-    QString line1 = getSettings()->value( "MainToolbar1",
-            "64;38;64;37-4;65;").toString();
+    QString line1 = getSettings()->value( "MainToolbar1", MAIN_TB1_DEFAULT )
+                                        .toString();
     parseAndCreate( line1, controlLayout1 );
 
     QHBoxLayout *controlLayout2 = new QHBoxLayout;
     controlLayout2->setSpacing( 0 );
-    QString line2 = getSettings()->value( "MainToolbar2",
-            "0-2;64;3;1;4;64;7;10;9;64-4;36-4;65;35-4;" ).toString();
+    QString line2 = getSettings()->value( "MainToolbar2", MAIN_TB2_DEFAULT )
+                                        .toString();
     parseAndCreate( line2, controlLayout2 );
 
     if( !b_advancedVisible && advControls ) advControls->hide();
@@ -747,7 +747,7 @@ AdvControlsWidget::AdvControlsWidget( intf_thread_t *_p_i, QWidget *_parent ) :
     controlLayout->setMargin( 0 );
     controlLayout->setSpacing( 0 );
 
-    QString line = getSettings()->value( "AdvToolbar", "12;11;13;14" )
+    QString line = getSettings()->value( "AdvToolbar", ADV_TB_DEFAULT )
         .toString();
     parseAndCreate( line, controlLayout );
 }
@@ -759,8 +759,7 @@ InputControlsWidget::InputControlsWidget( intf_thread_t *_p_i, QWidget *_parent
     controlLayout->setMargin( 0 );
     controlLayout->setSpacing( 0 );
 
-    QString line = getSettings()->value( "InputToolbar",
-                   "5-1;33;6-1" ).toString();
+    QString line = getSettings()->value( "InputToolbar", INPT_TB_DEFAULT ).toString();
     parseAndCreate( line, controlLayout );
 }
 /**********************************************************************
@@ -799,8 +798,7 @@ FullscreenControllerWidget::FullscreenControllerWidget( intf_thread_t *_p_i )
     controlLayout2->addWidget( inputC );
 
     controlLayout = new QHBoxLayout;
-    QString line = getSettings()->value( "FSCtoolbar",
-            "0-2;64;3;1;4;64;36;64;37;64;8;65;35-4;34;" ).toString();
+    QString line = getSettings()->value( "FSCtoolbar", FSC_TB_DEFAULT ).toString();
     parseAndCreate( line, controlLayout );
     controlLayout2->addLayout( controlLayout );
 
diff --git a/modules/gui/qt4/components/controller.hpp b/modules/gui/qt4/components/controller.hpp
index ffc4821..b85c53c 100644
--- a/modules/gui/qt4/components/controller.hpp
+++ b/modules/gui/qt4/components/controller.hpp
@@ -35,6 +35,13 @@
 
 #define I_PLAY_TOOLTIP N_("Play\nIf the playlist is empty, open a media")
 
+#define MAIN_TB1_DEFAULT "64;38;64;37-4;65"
+#define MAIN_TB2_DEFAULT "0-2;64;3;1;4;64;7;10;9;64-4;36-4;65;35-4"
+#define ADV_TB_DEFAULT "12;11;13;14"
+#define INPT_TB_DEFAULT "5-1;33;6-1"
+#define FSC_TB_DEFAULT "0-2;64;3;1;4;64;36;64;37;64;8;65;35-4;34"
+
+
 class QPixmap;
 class QLabel;
 
diff --git a/modules/gui/qt4/dialogs/toolbar.cpp b/modules/gui/qt4/dialogs/toolbar.cpp
index 6d04776..83108b3 100644
--- a/modules/gui/qt4/dialogs/toolbar.cpp
+++ b/modules/gui/qt4/dialogs/toolbar.cpp
@@ -74,20 +74,22 @@ ToolbarEditDialog::ToolbarEditDialog( intf_thread_t *_p_intf)
     QLabel *label = new QLabel( qtr( "Toolbar position:" ) );
     mainTboxLayout->addWidget(label, 0, 0, 1, 2);
 
-    QComboBox *positionCombo = new QComboBox;
-    positionCombo->addItems( QStringList() << qtr( "Above the Video" )
-                                           << qtr( "Under the Video" ) );
+    positionCombo = new QComboBox;
+    positionCombo->addItem( qtr( "Under the Video" ), QVariant( 0 ) );
+    positionCombo->addItem( qtr( "Above the Video" ), QVariant( 1 ) );
     mainTboxLayout->addWidget( positionCombo, 0, 2, 1, 1 );
 
     QLabel *line1Label = new QLabel( "Line 1:" );
-    QString line1 = getSettings()->value( "MainWindow/MainToolbar1" ).toString();
+    QString line1 = getSettings()->value( "MainWindow/MainToolbar1",
+                                          MAIN_TB1_DEFAULT ).toString();
     controller1 = new DroppingController( p_intf, line1,
             this );
     mainTboxLayout->addWidget( line1Label, 1, 0, 1, 1 );
     mainTboxLayout->addWidget( controller1, 1, 1, 1, 2 );
 
     QLabel *line2Label = new QLabel( "Line 2:" );
-    QString line2 = getSettings()->value( "MainWindow/MainToolbar2" ).toString();
+    QString line2 = getSettings()->value( "MainWindow/MainToolbar2",
+                                          MAIN_TB2_DEFAULT ).toString();
     controller2 = new DroppingController( p_intf, line2,
             this );
     mainTboxLayout->addWidget( line2Label, 2, 0, 1, 1 );
@@ -95,8 +97,8 @@ ToolbarEditDialog::ToolbarEditDialog( intf_thread_t *_p_intf)
 
     /* Advanced ToolBar */
     QLabel *advLabel = new QLabel( qtr( "Advanced Widget toolbar:" ) );
-    QString lineA = getSettings()->value( "MainWindow/AdvToolbar" )
-                        .toString();
+    QString lineA = getSettings()->value( "MainWindow/AdvToolbar",
+                                          ADV_TB_DEFAULT ).toString();
     controllerA = new DroppingController( p_intf, lineA,
             this );
     mainTboxLayout->addWidget( advLabel, 3, 0, 1, 2 );
@@ -108,7 +110,8 @@ ToolbarEditDialog::ToolbarEditDialog( intf_thread_t *_p_intf)
     QGroupBox *timeToolbarBox = new QGroupBox( qtr( "Time Toolbar" ) , this );
     QGridLayout *timeTboxLayout = new QGridLayout( timeToolbarBox );
 
-    QString line = getSettings()->value( "MainWindow/InputToolbar" ).toString();
+    QString line = getSettings()->value( "MainWindow/InputToolbar",
+                                         INPT_TB_DEFAULT ).toString();
     controller = new DroppingController( p_intf, line,
             this );
     timeTboxLayout->addWidget( controller, 0, 0, 1, -1 );
@@ -120,8 +123,8 @@ ToolbarEditDialog::ToolbarEditDialog( intf_thread_t *_p_intf)
                                               this );
     QGridLayout *FSCTboxLayout = new QGridLayout( FSCToolbarBox );
 
-    QString lineFSC = getSettings()->value( "MainWindow/FSCtoolbar" )
-                       .toString();
+    QString lineFSC = getSettings()->value( "MainWindow/FSCtoolbar",
+                                            FSC_TB_DEFAULT ).toString();
     controllerFSC = new DroppingController( p_intf,
             lineFSC, this );
     FSCTboxLayout->addWidget( controllerFSC, 0, 0, 1, -1 );
@@ -149,6 +152,8 @@ 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() );
     getSettings()->setValue( "MainWindow/MainToolbar2", controller2->getValue() );
     getSettings()->setValue( "MainWindow/AdvToolbar", controllerA->getValue() );
diff --git a/modules/gui/qt4/dialogs/toolbar.hpp b/modules/gui/qt4/dialogs/toolbar.hpp
index cc0653e..1fb3560 100644
--- a/modules/gui/qt4/dialogs/toolbar.hpp
+++ b/modules/gui/qt4/dialogs/toolbar.hpp
@@ -34,6 +34,7 @@
 class ToolbarEditDialog;
 class DroppingController;
 class QCheckBox;
+class QComboBox;
 
 class WidgetListing : public QListWidget
 {
@@ -65,6 +66,7 @@ private:
     static ToolbarEditDialog *instance;
 
     QCheckBox *flatBox, *bigBox, *shinyBox;
+    QComboBox *positionCombo;
 
     WidgetListing *widgetListing;
     DroppingController *controller1, *controller2, *controllerA;
diff --git a/modules/gui/qt4/main_interface.cpp b/modules/gui/qt4/main_interface.cpp
index fcbde2a..980e8c6 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -362,11 +362,7 @@ void MainInterface::handleMainUi( QSettings *settings )
              this, doComponentsUpdate() );
     inputC = new InputControlsWidget( p_intf, this );
 
-    /* Add the controls Widget to the main Widget */
-    mainLayout->insertWidget( 0, controls, 0, Qt::AlignBottom );
-    mainLayout->insertWidget( 0, inputC, 0, Qt::AlignBottom );
-
-    /* Visualisation */
+        /* Visualisation */
     /* Disabled for now, they SUCK */
     #if 0
     visualSelector = new VisualSelector( p_intf );
@@ -379,7 +375,6 @@ void MainInterface::handleMainUi( QSettings *settings )
     bgWidget->resize(
             settings->value( "backgroundSize", QSize( 300, 200 ) ).toSize() );
     bgWidget->updateGeometry();
-    mainLayout->insertWidget( 0, bgWidget );
     CONNECT( this, askBgWidgetToToggle(), bgWidget, toggle() );
 
     if( i_visualmode != QT_ALWAYS_VIDEO_MODE &&
@@ -390,10 +385,15 @@ void MainInterface::handleMainUi( QSettings *settings )
 
     /* And video Outputs */
     if( videoEmbeddedFlag )
-    {
         videoWidget = new VideoWidget( p_intf );
-        mainLayout->insertWidget( 0, videoWidget, 10 );
-    }
+
+    /* Add the controls Widget to the main Widget */
+    mainLayout->insertWidget( 0, bgWidget );
+    if( videoWidget ) mainLayout->insertWidget( 0, videoWidget, 10 );
+    mainLayout->insertWidget( 2, inputC, 0, Qt::AlignBottom );
+    mainLayout->insertWidget( settings->value( "ToolbarPos", 0 ).toInt() ? 0: 3,
+                              controls, 0, Qt::AlignBottom );
+
 
     /* Finish the sizing */
     main->updateGeometry();




More information about the vlc-devel mailing list