]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/components/simple_preferences.cpp
Qt: restore system's default theme without having to guess
[vlc] / modules / gui / qt4 / components / simple_preferences.cpp
index 29110522de0ee1b0d91fad61f6aa19868e68a24f..f428a5d97e63a152de324e08d1f751dacb048797 100644 (file)
@@ -510,6 +510,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
             optionWidgets.append( ui.skins );
             optionWidgets.append( ui.qt4 );
 #if !defined(NDEBUG) || !defined( WIN32)
+            ui.stylesCombo->addItem( qtr("System's default") );
             ui.stylesCombo->addItems( QStyleFactory::keys() );
             ui.stylesCombo->setCurrentIndex( ui.stylesCombo->findText(
                         getSettings()->value( "MainWindow/QtStyle", "" ).toString() ) );
@@ -519,6 +520,7 @@ SPrefsPanel::SPrefsPanel( intf_thread_t *_p_intf, QWidget *_parent,
             optionWidgets.append( ui.stylesCombo );
 #else
             ui.stylesCombo->hide();
+            optionWidgets.append( NULL );
 #endif
 
             ui.skins_zone->setEnabled( ui.skins->isChecked() );
@@ -760,8 +762,9 @@ void SPrefsPanel::apply()
             config_PutPsz( p_intf, "intf", "skins2" );
         if( qobject_cast<QRadioButton *>(optionWidgets[qtRB])->isChecked() )
             config_PutPsz( p_intf, "intf", "qt" );
-        getSettings()->setValue( "MainWindow/QtStyle",
-            qobject_cast<QComboBox *>(optionWidgets[styleCB])->currentText() );
+        if( qobject_cast<QComboBox *>(optionWidgets[styleCB]) )
+            getSettings()->setValue( "MainWindow/QtStyle",
+                qobject_cast<QComboBox *>(optionWidgets[styleCB])->currentText() );
 
         break;
     }