summaryrefslogtreecommitdiffstats
path: root/core/settings
diff options
context:
space:
mode:
authorGravatar jan Iversen <jan@casacondor.com>2020-01-08 09:32:47 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-01-20 09:55:57 -0800
commited4e7e3fc416831d9a5ff18bae9de2ca715b4f46 (patch)
tree20f13cacfb251570b257750c4e9f6f9224c97cce /core/settings
parent6e065506317e2595a0df19dba147576d392c9506 (diff)
downloadsubsurface-ed4e7e3fc416831d9a5ff18bae9de2ca715b4f46.tar.gz
core/settings: correct signal error
prefs.unit = x needs to be after the setters are called, otherwise the setter will not do anything, and result in an inconsistency between the values stored on disk and in prefs.units. Signed-off-by: jan Iversen <jan@casacondor.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core/settings')
-rw-r--r--core/settings/qPrefUnit.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/core/settings/qPrefUnit.cpp b/core/settings/qPrefUnit.cpp
index c4f32490f..d995169d6 100644
--- a/core/settings/qPrefUnit.cpp
+++ b/core/settings/qPrefUnit.cpp
@@ -46,23 +46,29 @@ void qPrefUnits::set_unit_system(unit_system_values value)
{
prefs.unit_system = value;
if (prefs.unit_system == METRIC) {
- prefs.units = SI_units;
-
// make sure all types are updated when changing
set_volume(units::VOLUME::LITER);
set_weight(units::WEIGHT::KG);
set_length(units::LENGTH::METERS);
set_pressure(units::PRESSURE::BAR);
set_temperature(units::TEMPERATURE::CELSIUS);
- } else if (prefs.unit_system == IMPERIAL) {
- prefs.units = IMPERIAL_units;
+ // this statement need to be AFTER the setters are called
+ // because it sets all of prefs.units without calling the
+ // setters
+ prefs.units = SI_units;
+ } else if (prefs.unit_system == IMPERIAL) {
// make sure all types are updated when changing
set_volume(units::VOLUME::CUFT);
set_weight(units::WEIGHT::LBS);
set_length(units::LENGTH::FEET);
set_pressure(units::PRESSURE::PSI);
set_temperature(units::TEMPERATURE::FAHRENHEIT);
+
+ // this statement need to be AFTER the setters are called
+ // because it sets all of prefs.units without calling the
+ // setters
+ prefs.units = IMPERIAL_units;
} else {
prefs.unit_system = PERSONALIZE;
}