diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2016-01-22 16:55:03 -0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-01-24 21:26:45 -0800 |
commit | c3137cf07c6947b162d3fae9cb580fe1efc78ec7 (patch) | |
tree | 28b907481dd71effc0dbd266c8b920785565c062 /subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp | |
parent | 15fece7da2c8e9c78fe6c61dbcea0c0b0654b6a8 (diff) | |
download | subsurface-c3137cf07c6947b162d3fae9cb580fe1efc78ec7.tar.gz |
Language Settings Wrapper
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp')
-rw-r--r-- | subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp | 97 |
1 files changed, 97 insertions, 0 deletions
diff --git a/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp b/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp index 5d42d1829..ec36e069e 100644 --- a/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp +++ b/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp @@ -1389,3 +1389,100 @@ void DisplaySettingsObjectWrapper::setDisplayInvalidDives(short value) prefs.display_invalid_dives = value.; emit displayInvalidDivesChanged(value); } + +LanguageSettingsObjectWrapper::LanguageSettingsObjectWrapper(QObject *parent) : + QObject(parent), + group("Language") +{ +} + +QString LanguageSettingsObjectWrapper::language() const +{ + return prefs.locale.language; +} + +QString LanguageSettingsObjectWrapper::timeFormat() const +{ + return prefs.time_format; +} + +QString LanguageSettingsObjectWrapper::dateFormat() const +{ + return prefs.date_format; +} + +QString LanguageSettingsObjectWrapper::dateFormatShort() const +{ + return prefs.date_format_short; +} + +bool LanguageSettingsObjectWrapper::timeFormatOverride() const +{ + return prefs.time_format_override; +} + +bool LanguageSettingsObjectWrapper::dateFormatOverride() const +{ + return prefs.date_format_override; +} + +bool LanguageSettingsObjectWrapper::useSystemLanguage() const +{ + return prefs.locale.use_system_language; +} + +void LanguageSettingsObjectWrapper::setUseSystemLanguage(bool value) +{ + QSettings s; + s.setValue("UseSystemLanguage", value); + prefs.locale.use_system_language = copy_string(qPrintable(value)); + emit useSystemLanguageChanged(value); +} + +void LanguageSettingsObjectWrapper::setLanguage(const QString& value) +{ + QSettings s; + s.setValue("UiLanguage", value); + prefs.locale.language = copy_string(qPrintable(value)); + emit languageChanged(value); +} + +void LanguageSettingsObjectWrapper::setTimeFormat(const QString& value) +{ + QSettings s; + s.setValue("time_format", value); + prefs.time_format = copy_string(qPrintable(value));; + emit timeFormatChanged(value); +} + +void LanguageSettingsObjectWrapper::setDateFormat(const QString& value) +{ + QSettings s; + s.setValue("date_format", value); + prefs.date_format = copy_string(qPrintable(value));; + emit dateFormatChanged(value); +} + +void LanguageSettingsObjectWrapper::setDateFormatShort(const QString& value) +{ + QSettings s; + s.setValue("date_format_short", value); + prefs.date_format_short = copy_string(qPrintable(value));; + emit dateFormatShortChanged(value); +} + +void LanguageSettingsObjectWrapper::setTimeFormatOverride(bool value) +{ + QSettings s; + s.setValue("time_format_override", value); + prefs.time_format_override = value.; + emit timeFormatOverrideChanged(value); +} + +void LanguageSettingsObjectWrapper::setDateFormatOverride(bool value) +{ + QSettings s; + s.setValue("date_format_override", value); + prefs.date_format_override = value.; + emit dateFormatOverrideChanged(value); +} |