diff options
author | Tomaz Canabrava <tomaz.canabrava@gmail.com> | 2016-08-10 14:10:38 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-08-27 10:55:40 -0700 |
commit | 4f2057cd3077f0d91ec3696b96fa5ef6cfcf1755 (patch) | |
tree | 7876412243a616af67897bcbd7d7b5cf45ef8fa9 /desktop-widgets/preferences | |
parent | b5e98ec993c2648dd0f6e19eab490963625931a2 (diff) | |
download | subsurface-4f2057cd3077f0d91ec3696b96fa5ef6cfcf1755.tar.gz |
Settings update: Fix "Units"
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets/preferences')
-rw-r--r-- | desktop-widgets/preferences/preferences_units.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/desktop-widgets/preferences/preferences_units.cpp b/desktop-widgets/preferences/preferences_units.cpp index 8fb67a813..c62fb1cdc 100644 --- a/desktop-widgets/preferences/preferences_units.cpp +++ b/desktop-widgets/preferences/preferences_units.cpp @@ -2,6 +2,7 @@ #include "ui_preferences_units.h" #include "core/prefs-macros.h" #include "core/qthelper.h" +#include "core/subsurface-qt/SettingsObjectWrapper.h" #include <QSettings> @@ -44,17 +45,16 @@ void PreferencesUnits::refreshSettings() void PreferencesUnits::syncSettings() { - QSettings s; - s.beginGroup("Units"); + auto units = SettingsObjectWrapper::instance()->unit_settings; QString unitSystem[] = {"metric", "imperial", "personal"}; short unitValue = ui->metric->isChecked() ? METRIC : (ui->imperial->isChecked() ? IMPERIAL : PERSONALIZE); - SAVE_OR_REMOVE_SPECIAL("unit_system", default_prefs.unit_system, unitValue, unitSystem[unitValue]); - s.setValue("temperature", ui->fahrenheit->isChecked() ? units::FAHRENHEIT : units::CELSIUS); - s.setValue("length", ui->feet->isChecked() ? units::FEET : units::METERS); - s.setValue("pressure", ui->psi->isChecked() ? units::PSI : units::BAR); - s.setValue("volume", ui->cuft->isChecked() ? units::CUFT : units::LITER); - s.setValue("weight", ui->lbs->isChecked() ? units::LBS : units::KG); - s.setValue("vertical_speed_time", ui->vertical_speed_minutes->isChecked() ? units::MINUTES : units::SECONDS); - s.setValue("coordinates", ui->gpsTraditional->isChecked()); - s.endGroup(); + + units->setUnitSystem(unitSystem[unitValue]); + units->setTemperature(ui->fahrenheit->isChecked() ? units::FAHRENHEIT : units::CELSIUS); + units->setLength(ui->feet->isChecked() ? units::FEET : units::METERS); + units->setPressure(ui->psi->isChecked() ? units::PSI : units::BAR); + units->setVolume(ui->cuft->isChecked() ? units::CUFT : units::LITER); + units->setWeight(ui->lbs->isChecked() ? units::LBS : units::KG); + units->setVerticalSpeedTime(ui->vertical_speed_minutes->isChecked() ? units::MINUTES : units::SECONDS); + units->setCoordinatesTraditional(ui->gpsTraditional->isChecked()); } |