diff options
author | Tomaz Canabrava <tomaz.canabrava@intel.com> | 2015-10-02 11:09:13 -0300 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2015-10-30 10:36:51 -0700 |
commit | 8a54a46779bac174cb9216d1c8aa76a3bfc1bc84 (patch) | |
tree | e9e769fb2a300b854935a4eff986fd206b119d54 /desktop-widgets/preferences/preferences_units.cpp | |
parent | d9595ad266021575522f73bb87dfc51517461d59 (diff) | |
download | subsurface-8a54a46779bac174cb9216d1c8aa76a3bfc1bc84.tar.gz |
Preferences: random fixes
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'desktop-widgets/preferences/preferences_units.cpp')
-rw-r--r-- | desktop-widgets/preferences/preferences_units.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/desktop-widgets/preferences/preferences_units.cpp b/desktop-widgets/preferences/preferences_units.cpp index 76f2078d7..cc77e51bb 100644 --- a/desktop-widgets/preferences/preferences_units.cpp +++ b/desktop-widgets/preferences/preferences_units.cpp @@ -17,23 +17,6 @@ PreferencesUnits::~PreferencesUnits() void PreferencesUnits::refreshSettings() { - QSettings s; - s.beginGroup("Units"); - 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(); -} - -void PreferencesUnits::syncSettings() -{ switch(prefs.unit_system) { case METRIC: ui->metric->setChecked(true); break; case IMPERIAL: ui->imperial->setChecked(true); break; @@ -58,3 +41,20 @@ void PreferencesUnits::syncSettings() ui->vertical_speed_minutes->setChecked(prefs.units.vertical_speed_time == units::MINUTES); ui->vertical_speed_seconds->setChecked(prefs.units.vertical_speed_time == units::SECONDS); } + +void PreferencesUnits::syncSettings() +{ + QSettings s; + s.beginGroup("Units"); + 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(); +} |