aboutsummaryrefslogtreecommitdiffstats
path: root/qt-ui/mainwindow.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2013-06-02 19:52:18 +0900
committerGravatar Dirk Hohndel <dirk@hohndel.org>2013-06-02 19:52:18 +0900
commita98a7a135199bbe3dc25290da47c1915861b2300 (patch)
tree269eeb5fce2a6b04d8e66d2da240b6aa187c0fbd /qt-ui/mainwindow.cpp
parent9a65798daf3dc0e7991305ce759d42d40d2dc98c (diff)
downloadsubsurface-a98a7a135199bbe3dc25290da47c1915861b2300.tar.gz
Correctly implement Metric / Imperial / Personalize preference
The code so far had completely ignored Metric / Imperial. Turning this into a three way radio box seemed to make much more sense. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/mainwindow.cpp')
-rw-r--r--qt-ui/mainwindow.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp
index d3cd951d8..e04d824fb 100644
--- a/qt-ui/mainwindow.cpp
+++ b/qt-ui/mainwindow.cpp
@@ -376,11 +376,17 @@ void MainWindow::readSettings()
settings.endGroup();
settings.beginGroup("Units");
- GET_UNIT(v, "length", length, units::FEET, units::METERS);
- GET_UNIT(v, "pressure", pressure, units::PSI, units::BAR);
- GET_UNIT(v, "volume", volume, units::CUFT, units::LITER);
- GET_UNIT(v, "temperature", temperature, units::FAHRENHEIT, units::CELSIUS);
- GET_UNIT(v, "weight", weight, units::LBS, units::KG);
+ if (settings.value("unit_system").toString() == "metric") {
+ prefs.units = SI_units;
+ } else if (settings.value("unit_system").toString() == "imperial") {
+ prefs.units = IMPERIAL_units;
+ } else {
+ GET_UNIT(v, "length", length, units::FEET, units::METERS);
+ GET_UNIT(v, "pressure", pressure, units::PSI, units::BAR);
+ GET_UNIT(v, "volume", volume, units::CUFT, units::LITER);
+ GET_UNIT(v, "temperature", temperature, units::FAHRENHEIT, units::CELSIUS);
+ GET_UNIT(v, "weight", weight, units::LBS, units::KG);
+ }
settings.endGroup();
settings.beginGroup("DisplayListColumns");
GET_BOOL(v, "CYLINDER", prefs.visible_cols.cylinder);