]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/dialogs/preferences.cpp
Forgotten method for Input Slave Selection.
[vlc] / modules / gui / qt4 / dialogs / preferences.cpp
index 8c5989261e7129685fbbf90ccd7b62e94bb3f453..aa57119f26e2d964dbd48f181c78418020d875a9 100644 (file)
@@ -21,6 +21,9 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
 
 #include "dialogs/preferences.hpp"
 #include "dialogs_provider.hpp"
@@ -40,7 +43,8 @@
 
 PrefsDialog *PrefsDialog::instance = NULL;
 
-PrefsDialog::PrefsDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
+PrefsDialog::PrefsDialog( QWidget *parent, intf_thread_t *_p_intf )
+            : QVLCDialog( parent, _p_intf )
 {
     QGridLayout *main_layout = new QGridLayout( this );
     setWindowTitle( qtr( "Preferences" ) );
@@ -58,7 +62,7 @@ PrefsDialog::PrefsDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
     types->setAlignment( Qt::AlignHCenter );
     QHBoxLayout *types_l = new QHBoxLayout;
     types_l->setSpacing( 3 ); types_l->setMargin( 3 );
-    small = new QRadioButton( qtr("Basic"), types );
+    small = new QRadioButton( qtr( "Simple" ), types );
     types_l->addWidget( small );
     all = new QRadioButton( qtr("All"), types ); types_l->addWidget( all );
     types->setLayout( types_l );
@@ -78,25 +82,28 @@ PrefsDialog::PrefsDialog( intf_thread_t *_p_intf ) : QVLCFrame( _p_intf )
 
     buttonsBox->addButton( save, QDialogButtonBox::AcceptRole );
     buttonsBox->addButton( cancel, QDialogButtonBox::RejectRole );
-    buttonsBox->addButton( reset, QDialogButtonBox::ActionRole );
+    buttonsBox->addButton( reset, QDialogButtonBox::ResetRole );
 
     /* Layout  */
     main_layout->addWidget( tree_panel, 0, 0, 3, 1 );
     main_layout->addWidget( types, 3, 0, 2, 1 );
-    main_layout->addWidget( main_panel, 0, 1, 4, 1 );
-    main_layout->addWidget( buttonsBox, 4, 1, 1 ,2 );
+    main_layout->addWidget( main_panel, 0, 1, 4, 2 );
+    main_layout->addWidget( buttonsBox, 4, 2, 1 ,1 );
 
     main_layout->setColumnMinimumWidth( 0, 150 );
+    main_layout->setColumnMinimumWidth( 1, 10 );
     main_layout->setColumnStretch( 0, 1 );
-    main_layout->setColumnStretch( 1, 3 );
+    main_layout->setColumnStretch( 1, 0 );
+    main_layout->setColumnStretch( 2, 3 );
 
     main_layout->setRowStretch( 2, 4 );
 
+    main_layout->setMargin( 9 );
     setLayout( main_layout );
 
     /* Margins */
     tree_panel_l->setMargin( 1 );
-    main_panel_l->setMargin( 3 );
+    main_panel_l->setLayoutMargins( 6, 0, 0, 3, 3 );
 
     for( int i = 0; i < SPrefsMax ; i++ ) simple_panels[i] = NULL;
 
@@ -148,6 +155,11 @@ void PrefsDialog::setAdvanced()
     }
     advanced_panel->show();
 
+    /* Select the first Item of the preferences. Maybe you want to select a specified
+       category... */
+    advanced_tree->setCurrentIndex(
+            advanced_tree->model()->index( 0, 0, QModelIndex() ) );
+
     all->setChecked( true );
 }
 
@@ -274,6 +286,14 @@ void PrefsDialog::save()
     /* Save to file */
     config_SaveConfigFile( p_intf, NULL );
 
+    destroyPanels();
+
+    hide();
+}
+
+void PrefsDialog::destroyPanels()
+{
+    msg_Dbg( p_intf, "Destroying the Panels" );
     /* Delete the other panel in order to force its reload after clicking
        on apply. In fact, if we don't do that, the preferences from the other
        panels won't be accurate, so we would have to recreate the whole dialog,
@@ -298,10 +318,9 @@ void PrefsDialog::save()
         }
         current_simple_panel  = NULL;
     }
-
-    hide();
 }
 
+
 /* Clean the preferences, dunno if it does something really */
 void PrefsDialog::cancel()
 {
@@ -333,5 +352,7 @@ void PrefsDialog::reset()
     {
         config_ResetAll( p_intf );
         config_SaveConfigFile( p_intf, NULL );
+        /* FIXME reset the panels */
+        destroyPanels();
     }
 }