summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/preferences/preferences_units.cpp
diff options
context:
space:
mode:
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());
}