Commit 51c74204 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

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

This reverts commit ffa7a222.
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
parent 76ec5a93
...@@ -334,17 +334,37 @@ MainWindow::initVlmcPreferences() ...@@ -334,17 +334,37 @@ MainWindow::initVlmcPreferences()
VLMC_CREATE_PRIVATE_PREFERENCE_STRING( "private/VlmcVersion", PROJECT_VERSION_MAJOR ); 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 void
MainWindow::loadVlmcPreferences() MainWindow::loadVlmcPreferencesCategory( const QString &subPart )
{ {
//FIXME: Manually load vlmc version to force settings clear?
QSettings s; QSettings s;
s.setFallbacksEnabled( false ); s.setFallbacksEnabled( false );
s.beginGroup( subPart );
foreach ( QString key, s.allKeys() ) foreach ( QString key, s.allKeys() )
{ {
QVariant value = s.value( key ); QVariant value = s.value( key );
vlmcDebug() << "Loading" << key << "=>" << value; QString fullKey = subPart + "/" + key;
SettingsManager::getInstance()->setValue( key, value, SettingsManager::Vlmc ); vlmcDebug() << "Loading" << fullKey << "=>" << value;
SettingsManager::getInstance()->setValue( fullKey, value, SettingsManager::Vlmc );
} }
} }
......
...@@ -72,6 +72,7 @@ private: ...@@ -72,6 +72,7 @@ private:
void clearTemporaryFiles(); void clearTemporaryFiles();
void initVlmcPreferences(); void initVlmcPreferences();
void loadVlmcPreferences(); void loadVlmcPreferences();
void loadVlmcPreferencesCategory( const QString& category );
void loadGlobalProxySettings(); void loadGlobalProxySettings();
void initToolbar(); void initToolbar();
bool saveSettings(); bool saveSettings();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment