diff options
author | jan Iversen <jan@casacondor.com> | 2020-01-02 09:12:40 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-01-04 10:56:55 -0800 |
commit | fdff61f6af1147ff691b1453764cbc55fdd40fc6 (patch) | |
tree | ccf8b96013263dec09fc4d72ab76d98b7bc15fc7 /core | |
parent | 14db76004484a56c6b3a2237732d7a2acad05953 (diff) | |
download | subsurface-fdff61f6af1147ff691b1453764cbc55fdd40fc6.tar.gz |
core/settings: change measurements when changing metric/imperial
When switching between imperial/metric it is important to change the single
measurements as well (e.g. METER <-> FEET).
Signed-off-by: Jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'core')
-rw-r--r-- | core/settings/qPrefUnit.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/core/settings/qPrefUnit.cpp b/core/settings/qPrefUnit.cpp index c415f8287..8fe2477b9 100644 --- a/core/settings/qPrefUnit.cpp +++ b/core/settings/qPrefUnit.cpp @@ -102,9 +102,23 @@ void qPrefUnits::set_unit_system(unit_system_values value) if (value == METRIC) { 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 (value == IMPERIAL) { prefs.unit_system = IMPERIAL; prefs.units = IMPERIAL_units; + + // 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); } else { prefs.unit_system = PERSONALIZE; } |