From 8a54a46779bac174cb9216d1c8aa76a3bfc1bc84 Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Fri, 2 Oct 2015 11:09:13 -0300 Subject: Preferences: random fixes Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- desktop-widgets/preferences/preferences_units.cpp | 34 +++++++++++------------ 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'desktop-widgets/preferences/preferences_units.cpp') 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 @@ -16,23 +16,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; @@ -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(); +} -- cgit v1.2.3-70-g09d2