diff options
Diffstat (limited to 'logic/settings/INISettingsObject.cpp')
-rw-r--r-- | logic/settings/INISettingsObject.cpp | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/logic/settings/INISettingsObject.cpp b/logic/settings/INISettingsObject.cpp index e872d608..5ccc7446 100644 --- a/logic/settings/INISettingsObject.cpp +++ b/logic/settings/INISettingsObject.cpp @@ -33,6 +33,20 @@ bool INISettingsObject::reload() return m_ini.loadFile(m_filePath) && SettingsObject::reload(); } +void INISettingsObject::suspendSave() +{ + m_suspendSave = true; +} + +void INISettingsObject::resumeSave() +{ + m_suspendSave = false; + if(m_doSave) + { + m_ini.saveFile(m_filePath); + } +} + void INISettingsObject::changeSetting(const Setting &setting, QVariant value) { if (contains(setting.id())) @@ -51,6 +65,18 @@ void INISettingsObject::changeSetting(const Setting &setting, QVariant value) for(auto iter: setting.configKeys()) m_ini.remove(iter); } + doSave(); + } +} + +void INISettingsObject::doSave() +{ + if(m_suspendSave) + { + m_doSave = true; + } + else + { m_ini.saveFile(m_filePath); } } @@ -62,7 +88,7 @@ void INISettingsObject::resetSetting(const Setting &setting) { for(auto iter: setting.configKeys()) m_ini.remove(iter); - m_ini.saveFile(m_filePath); + doSave(); } } |