diff options
author | Tomaz Canabrava <tomaz.canabrava@gmail.com> | 2016-08-10 12:42:18 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-08-27 10:55:40 -0700 |
commit | bc95138f96aeb990d3882cd3b8cad5a97fb4f84d (patch) | |
tree | 479468ba29d247835ec63f959d49779fa2483c3c /desktop-widgets/preferences/preferences_language.cpp | |
parent | 906d62ac7a25ba5d868a974a133384d6acaaf418 (diff) | |
download | subsurface-bc95138f96aeb990d3882cd3b8cad5a97fb4f84d.tar.gz |
Settings update: Use internal prefs structure to read preferences
Don't use a QSettings to read properties, it's really
easy to mispell something. Just use the internal prefs structure.
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets/preferences/preferences_language.cpp')
-rw-r--r-- | desktop-widgets/preferences/preferences_language.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/desktop-widgets/preferences/preferences_language.cpp b/desktop-widgets/preferences/preferences_language.cpp index 264e2a1a5..a1af676fa 100644 --- a/desktop-widgets/preferences/preferences_language.cpp +++ b/desktop-widgets/preferences/preferences_language.cpp @@ -30,19 +30,16 @@ PreferencesLanguage::~PreferencesLanguage() void PreferencesLanguage::refreshSettings() { - QSettings s; - s.beginGroup("Language"); - ui->languageSystemDefault->setChecked(s.value("UseSystemLanguage", true).toBool()); - ui->timeFormatSystemDefault->setChecked(!s.value("time_format_override", false).toBool()); - ui->dateFormatSystemDefault->setChecked(!s.value("date_format_override", false).toBool()); - ui->timeFormatEntry->setText(s.value("time_format").toString()); - ui->dateFormatEntry->setText(s.value("date_format").toString()); - ui->shortDateFormatEntry->setText(s.value("date_format_short").toString()); + ui->languageSystemDefault->setChecked(prefs.locale.use_system_language); + ui->timeFormatSystemDefault->setChecked(!prefs.time_format_override); + ui->dateFormatSystemDefault->setChecked(!prefs.date_format_override); + ui->timeFormatEntry->setText(prefs.time_format); + ui->dateFormatEntry->setText(prefs.date_format); + ui->shortDateFormatEntry->setText(prefs.date_format_short); QAbstractItemModel *m = ui->languageDropdown->model(); - QModelIndexList languages = m->match(m->index(0, 0), Qt::UserRole, s.value("UiLanguage").toString()); + QModelIndexList languages = m->match(m->index(0, 0), Qt::UserRole, prefs.locale.language); if (languages.count()) ui->languageDropdown->setCurrentIndex(languages.first().row()); - s.endGroup(); } void PreferencesLanguage::syncSettings() |