diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index 3b79b37c7d47224d341459e5e55e7ecb6a178ab7..0f9376c3f7739aa162dfbc98b89349a430d8e3a3 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 47e5fb2f34d12717714e27a18a95901e4e157bc2..af6f6bbceb2c4000060c082842ee84a15762223b 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();