diff options
Diffstat (limited to 'Swift/QtUI')
-rw-r--r-- | Swift/QtUI/QtSettingsProvider.cpp | 9 | ||||
-rw-r--r-- | Swift/QtUI/QtSettingsProvider.h | 2 |
2 files changed, 11 insertions, 0 deletions
diff --git a/Swift/QtUI/QtSettingsProvider.cpp b/Swift/QtUI/QtSettingsProvider.cpp index 42540c1..cf02d83 100644 --- a/Swift/QtUI/QtSettingsProvider.cpp +++ b/Swift/QtUI/QtSettingsProvider.cpp @@ -19,5 +19,14 @@ void QtSettingsProvider::storeString(const String &settingPath, const String &se settings_.setValue(P2QSTRING(settingPath), P2QSTRING(settingValue)); } +bool QtSettingsProvider::getBoolSetting(const String &settingPath, bool defaultValue) { + QVariant setting = settings_.value(P2QSTRING(settingPath)); + return setting.isNull() ? defaultValue : setting.toBool(); +} + +void QtSettingsProvider::storeBool(const String &settingPath, bool settingValue) { + settings_.setValue(P2QSTRING(settingPath), settingValue); +} + } diff --git a/Swift/QtUI/QtSettingsProvider.h b/Swift/QtUI/QtSettingsProvider.h index 4739f60..fec4101 100644 --- a/Swift/QtUI/QtSettingsProvider.h +++ b/Swift/QtUI/QtSettingsProvider.h @@ -13,6 +13,8 @@ class QtSettingsProvider : public SettingsProvider { virtual ~QtSettingsProvider(); virtual String getStringSetting(const String &settingPath); virtual void storeString(const String &settingPath, const String &settingValue); + virtual bool getBoolSetting(const String &settingPath, bool defaultValue); + virtual void storeBool(const String &settingPath, bool settingValue); private: QSettings settings_; }; |