]> git.sesse.net Git - vlc/commitdiff
Qt4 - SPrefs: use a switch to remove stupid iterative ifs.
authorJean-Baptiste Kempf <jb@videolan.org>
Tue, 6 Nov 2007 02:43:01 +0000 (02:43 +0000)
committerJean-Baptiste Kempf <jb@videolan.org>
Tue, 6 Nov 2007 02:43:01 +0000 (02:43 +0000)
modules/gui/qt4/components/simple_preferences.cpp

index 71a7631a24754e496a7d91d0b1696450532b68af..d9017772654daf5387c2e4b96a6a2ad60d5ee7e7 100644 (file)
@@ -460,6 +460,7 @@ void SPrefsPanel::updateAudioOptions( int number)
     optionWidgets[fileW]->setVisible( ( value == "aout_file" ) );
 }
 
+/* Function called from the main Preferences dialog on each SPrefs Panel */
 void SPrefsPanel::apply()
 {
     msg_Dbg( p_intf, "Trying to save the %i simple panel", number );
@@ -472,8 +473,9 @@ void SPrefsPanel::apply()
         c->doApply( p_intf );
     }
 
-    /* Devices */
-    if( number == SPrefsInputAndCodecs )
+    switch( number )
+    {
+    case SPrefsInputAndCodecs:
     {
         /* Device default selection */
         char *psz_devicepath =
@@ -526,18 +528,20 @@ void SPrefsPanel::apply()
             #endif
             //CaCi( "dv-caching" ) too short...
         }
+        break;
     }
 
     /* Interfaces */
-    if( number == SPrefsInterface )
+    case SPrefsInterface:
     {
         if( qobject_cast<QRadioButton *>(optionWidgets[skinRB])->isChecked() )
             config_PutPsz( p_intf, "intf", "skins2" );
         if( qobject_cast<QRadioButton *>(optionWidgets[qtRB])->isChecked() )
             config_PutPsz( p_intf, "intf", "qt4" );
+        break;
     }
 
-    if( number == SPrefsAudio )
+    case SPrefsAudio:
     {
         bool b_normChecked =
             qobject_cast<QCheckBox *>(optionWidgets[normalizerChB])->isChecked();
@@ -564,6 +568,8 @@ void SPrefsPanel::apply()
                 if( b_normChecked ) qs_filter.append( ":volnorm" );
         }
         config_PutPsz( p_intf, "audio-filter", qtu( qs_filter ) );
+        break;
+    }
     }
 }