Tie all the pieces together and make Preferences work as intended

Not Apply / Close without Saving / OK work as designed. And things get
correctly stored and reset.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2013-06-03 21:08:49 +09:00
parent 77c4b8ef87
commit b38e2ab485
5 changed files with 91 additions and 74 deletions

View file

@ -379,10 +379,13 @@ void MainWindow::readSettings()
settings.endGroup();
settings.beginGroup("Units");
if (settings.value("unit_system").toString() == "metric") {
prefs.unit_system = METRIC;
prefs.units = SI_units;
} else if (settings.value("unit_system").toString() == "imperial") {
prefs.unit_system = IMPERIAL;
prefs.units = IMPERIAL_units;
} else {
prefs.unit_system = PERSONALIZE;
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);