[vlmc-devel] Manually Revert "MainWindow: don' t bother list settings categories to load. Just load them all"

Hugo Beauzée-Luyssen git at videolan.org
Mon Feb 10 19:44:19 CET 2014


vlmc | branch: master | Hugo Beauzée-Luyssen <hugo at beauzee.fr> | Mon Feb 10 20:29:30 2014 +0200| [51c74204821bf80b298a494b16067c23e655f726] | committer: Hugo Beauzée-Luyssen

Manually Revert "MainWindow: don't bother list settings categories to load. Just load them all"

This reverts commit ffa7a222d7e4c1163143a9a727ba0db0e3a9f290.
Slightly refactor the original version, but load settings by categories.
Loading everything from the settings file won't work on MacOS

Conflicts:
	src/Gui/MainWindow.cpp

> http://git.videolan.org/gitweb.cgi/vlmc.git/?a=commit;h=51c74204821bf80b298a494b16067c23e655f726
---

 src/Gui/MainWindow.cpp |   28 ++++++++++++++++++++++++----
 src/Gui/MainWindow.h   |    1 +
 2 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp
index 3b79b37..0f9376c 100644
--- a/src/Gui/MainWindow.cpp
+++ b/src/Gui/MainWindow.cpp
@@ -334,17 +334,37 @@ MainWindow::initVlmcPreferences()
     VLMC_CREATE_PRIVATE_PREFERENCE_STRING( "private/VlmcVersion", PROJECT_VERSION_MAJOR );
 }
 
+void MainWindow::loadVlmcPreferences()
+{
+    //Load saved preferences :
+    loadVlmcPreferencesCategory( "private" );
+    if ( VLMC_GET_STRING( "private/VlmcVersion" ) == PROJECT_VERSION_MAJOR )
+    {
+        loadVlmcPreferencesCategory( "keyboard" );
+        loadVlmcPreferencesCategory( "vlmc" );
+        loadVlmcPreferencesCategory( "youtube" );
+        loadVlmcPreferencesCategory( "network" );
+    }
+    else
+    {
+        QSettings s;
+        s.clear();
+    }
+    SettingsManager::getInstance()->setValue( "private/VlmcVersion", PROJECT_VERSION_MAJOR, SettingsManager::Vlmc );
+}
+
 void
-MainWindow::loadVlmcPreferences()
+MainWindow::loadVlmcPreferencesCategory( const QString &subPart )
 {
-    //FIXME: Manually load vlmc version to force settings clear?
     QSettings       s;
     s.setFallbacksEnabled( false );
+    s.beginGroup( subPart );
     foreach ( QString key, s.allKeys() )
     {
         QVariant value = s.value( key );
-        vlmcDebug() << "Loading" << key << "=>" << value;
-        SettingsManager::getInstance()->setValue( key, value, SettingsManager::Vlmc );
+        QString fullKey = subPart + "/" + key;
+        vlmcDebug() << "Loading" << fullKey << "=>" << value;
+        SettingsManager::getInstance()->setValue( fullKey, value, SettingsManager::Vlmc );
     }
 }
 
diff --git a/src/Gui/MainWindow.h b/src/Gui/MainWindow.h
index 47e5fb2..af6f6bb 100644
--- a/src/Gui/MainWindow.h
+++ b/src/Gui/MainWindow.h
@@ -72,6 +72,7 @@ private:
     void        clearTemporaryFiles();
     void        initVlmcPreferences();
     void        loadVlmcPreferences();
+    void        loadVlmcPreferencesCategory( const QString& category );
     void        loadGlobalProxySettings();
     void        initToolbar();
     bool        saveSettings();



More information about the Vlmc-devel mailing list