From 51c74204821bf80b298a494b16067c23e655f726 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= Date: Mon, 10 Feb 2014 20:29:30 +0200 Subject: [PATCH] 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 --- 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 3b79b37c7..0f9376c3f 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 47e5fb2f3..af6f6bbce 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(); -- GitLab