]> git.sesse.net Git - vlc/commitdiff
Qt: save and honour the above-video parameter to allow old-fashion GUI.
authorJean-Baptiste Kempf <jb@videolan.org>
Mon, 19 Jan 2009 00:41:04 +0000 (01:41 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Mon, 19 Jan 2009 00:41:48 +0000 (01:41 +0100)
modules/gui/qt4/components/controller.cpp
modules/gui/qt4/components/controller.hpp
modules/gui/qt4/dialogs/toolbar.cpp
modules/gui/qt4/dialogs/toolbar.hpp
modules/gui/qt4/main_interface.cpp

index b46b7f786e2aeaabb08be480e60a3845bffb9c11..9ea8b7d2d83f66bac43dc98a017a8c01103aa950 100644 (file)
@@ -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 );
 
index ffc482100f9ecf98e0af59cb5a396e035a52c3d4..b85c53c7957491e0b4a46490631afde93612c61b 100644 (file)
 
 #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;
 
index 6d0477675e535645e7d6ddf30f16698255139845..83108b35bb19de4e764fe93b27e4b770752e4fd5 100644 (file)
@@ -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() );
index cc0653e351f5348f174ed42303b55c9d7e0659e7..1fb3560ea48f621b06e062bd4ee805897d4de0ae 100644 (file)
@@ -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;
index fcbde2a200b7125e457f9d90cf2996504015d7a7..980e8c69bb09054c11b6759c1833a1f7169303e1 100644 (file)
@@ -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();