summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/preferences/preferences_units.cpp
diff options
context:
space:
mode:
authorGravatar jan Iversen <jani@apache.org>2018-08-15 11:50:53 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-08-15 16:11:39 -0700
commit6aee600aa7022dd8f0453c658c967d5268c611b3 (patch)
tree6c3547dc39c59d4cd79eb72adb45bc3e3760a58f /desktop-widgets/preferences/preferences_units.cpp
parent3b84dbe554a76e2f024b7254c079c761429223ac (diff)
downloadsubsurface-6aee600aa7022dd8f0453c658c967d5268c611b3.tar.gz
desktop-widgets/preferences: reemove SettingsObjectWrapper
remove use of SettingsObjectWrapper:: remove include of SettingsObjectWrapper.h use qPrefFoo:: for setters and getters replace prefs.foo with qPrefXYZ::foo() where feasible (this expands to the same code, but gives us more control over the variable). Signed-off-by: Jan Iversen <jani@apache.org>
Diffstat (limited to 'desktop-widgets/preferences/preferences_units.cpp')
-rw-r--r--desktop-widgets/preferences/preferences_units.cpp23
1 files changed, 11 insertions, 12 deletions
diff --git a/desktop-widgets/preferences/preferences_units.cpp b/desktop-widgets/preferences/preferences_units.cpp
index 7985ffb0c..eaef36b39 100644
--- a/desktop-widgets/preferences/preferences_units.cpp
+++ b/desktop-widgets/preferences/preferences_units.cpp
@@ -2,7 +2,7 @@
#include "preferences_units.h"
#include "ui_preferences_units.h"
#include "core/qthelper.h"
-#include "core/subsurface-qt/SettingsObjectWrapper.h"
+#include "core/settings/qPrefUnit.h"
PreferencesUnits::PreferencesUnits(): AbstractPreferencesWidget(tr("Units"),QIcon(":units-icon"),1), ui(new Ui::PreferencesUnits())
{
@@ -47,18 +47,17 @@ void PreferencesUnits::refreshSettings()
void PreferencesUnits::syncSettings()
{
- auto units = SettingsObjectWrapper::instance()->unit_settings;
QString unitSystem[] = {"metric", "imperial", "personal"};
short unitValue = ui->metric->isChecked() ? METRIC : (ui->imperial->isChecked() ? IMPERIAL : PERSONALIZE);
- units->set_unit_system(unitSystem[unitValue]);
- units->set_temperature(ui->fahrenheit->isChecked() ? units::FAHRENHEIT : units::CELSIUS);
- units->set_length(ui->feet->isChecked() ? units::FEET : units::METERS);
- units->set_pressure(ui->psi->isChecked() ? units::PSI : units::BAR);
- units->set_volume(ui->cuft->isChecked() ? units::CUFT : units::LITER);
- units->set_weight(ui->lbs->isChecked() ? units::LBS : units::KG);
- units->set_vertical_speed_time(ui->vertical_speed_minutes->isChecked() ? units::MINUTES : units::SECONDS);
- units->set_coordinates_traditional(ui->gpsTraditional->isChecked());
- units->set_duration_units(ui->duration_mixed->isChecked() ? units::MIXED : (ui->duration_no_hours->isChecked() ? units::MINUTES_ONLY : units::ALWAYS_HOURS));
- units->set_show_units_table(ui->show_units_table->isChecked());
+ qPrefUnits::set_unit_system(unitSystem[unitValue]);
+ qPrefUnits::set_temperature(ui->fahrenheit->isChecked() ? units::FAHRENHEIT : units::CELSIUS);
+ qPrefUnits::set_length(ui->feet->isChecked() ? units::FEET : units::METERS);
+ qPrefUnits::set_pressure(ui->psi->isChecked() ? units::PSI : units::BAR);
+ qPrefUnits::set_volume(ui->cuft->isChecked() ? units::CUFT : units::LITER);
+ qPrefUnits::set_weight(ui->lbs->isChecked() ? units::LBS : units::KG);
+ qPrefUnits::set_vertical_speed_time(ui->vertical_speed_minutes->isChecked() ? units::MINUTES : units::SECONDS);
+ qPrefUnits::set_coordinates_traditional(ui->gpsTraditional->isChecked());
+ qPrefUnits::set_duration_units(ui->duration_mixed->isChecked() ? units::MIXED : (ui->duration_no_hours->isChecked() ? units::MINUTES_ONLY : units::ALWAYS_HOURS));
+ qPrefUnits::set_show_units_table(ui->show_units_table->isChecked());
}