]> git.sesse.net Git - vlc/blobdiff - modules/gui/qt4/dialogs/preferences.cpp
Qt: warn when we cannot save the configuration
[vlc] / modules / gui / qt4 / dialogs / preferences.cpp
index 39373720a76279e258531422a362cc479cfd7bee..2bfa9db793a3488580724f2b5ef0fa7256551e67 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "dialogs/preferences.hpp"
 #include "util/qvlcframe.hpp"
+#include "dialogs/errors.hpp"
 
 #include "components/complete_preferences.hpp"
 #include "components/simple_preferences.hpp"
@@ -45,6 +46,7 @@ PrefsDialog::PrefsDialog( QWidget *parent, intf_thread_t *_p_intf )
     QGridLayout *main_layout = new QGridLayout( this );
     setWindowTitle( qtr( "Preferences" ) );
     setWindowRole( "vlc-preferences" );
+    setWindowModality( Qt::WindowModal );
 
     /* Whether we want it or not, we need to destroy on close to get
        consistency when reset */
@@ -114,7 +116,8 @@ PrefsDialog::PrefsDialog( QWidget *parent, intf_thread_t *_p_intf )
     setMaximumHeight( p_intf->p_sys->i_screenHeight );
     for( int i = 0; i < SPrefsMax ; i++ ) simple_panels[i] = NULL;
 
-    if( config_GetInt( p_intf, "qt-advanced-pref" ) || config_GetInt( p_intf, "advanced" ) )
+    if( var_InheritBool( p_intf, "qt-advanced-pref" )
+     || var_InheritBool( p_intf, "advanced" ) )
         setAdvanced();
     else
         setSmall();
@@ -292,7 +295,11 @@ void PrefsDialog::save()
     }
 
     /* Save to file */
-    config_SaveConfigFile( p_intf, NULL );
+    if( config_SaveConfigFile( p_intf, NULL ) != 0 )
+    {
+        ErrorsDialog::getInstance (p_intf)->addError( qtr( "Cannot save Configuration" ),
+            qtr("Preferences file could not be saved") );
+    }
     accept();
 }