diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2016-02-15 07:51:23 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-02-15 07:54:35 -0800 |
commit | 97d6a1e779c91c434e00086c90e0e8b3fcf540dc (patch) | |
tree | 42d887061a846f80d0c0e8c3a0481a2c68eba19e | |
parent | 75bd37e3e518dc2a647018cb2d0ebd1e110c9c92 (diff) | |
download | subsurface-97d6a1e779c91c434e00086c90e0e8b3fcf540dc.tar.gz |
QML UI: no longer change unit preferences when parsing edits
When the user explicitly sets the units when editing or adding dives, we
used to change the display preferences. This was changed for some but not
all fields in commit 6252d0cd3bda ("While parsing weight and pressure we
should not change the users settings")
Now we do this consistently for all inputs.
Also, when editing the depth of a manually added dive, we now throw away
the samples (as those are certain to be inconsistent).
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | qt-mobile/qmlmanager.cpp | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/qt-mobile/qmlmanager.cpp b/qt-mobile/qmlmanager.cpp index ffa88d12e..ede1d3a6b 100644 --- a/qt-mobile/qmlmanager.cpp +++ b/qt-mobile/qmlmanager.cpp @@ -477,28 +477,19 @@ QString QMLManager::commitChanges(QString diveId, QString date, QString location } if (get_depth_string(d->maxdepth.mm, true, true) != depth) { diveChanged = true; - if (depth.contains(tr("ft"))) - prefs.units.length = units::FEET; - else if (depth.contains(tr("m"))) - prefs.units.length = units::METERS; d->maxdepth.mm = parseLengthToMm(depth); - if (same_string(d->dc.model, "manually added dive")) + if (same_string(d->dc.model, "manually added dive")) { d->dc.maxdepth.mm = d->maxdepth.mm; + free(d->dc.sample); + d->dc.samples = 0; + } } if (get_temperature_string(d->airtemp, true) != airtemp) { diveChanged = true; - if (airtemp.contains(tr("C"))) - prefs.units.temperature = units::CELSIUS; - else if (airtemp.contains(tr("F"))) - prefs.units.temperature = units::FAHRENHEIT; d->airtemp.mkelvin = parseTemperatureToMkelvin(airtemp); } if (get_temperature_string(d->watertemp, true) != watertemp) { diveChanged = true; - if (watertemp.contains(tr("C"))) - prefs.units.temperature = units::CELSIUS; - else if (watertemp.contains(tr("F"))) - prefs.units.temperature = units::FAHRENHEIT; d->watertemp.mkelvin = parseTemperatureToMkelvin(watertemp); } // not sure what we'd do if there was more than one weight system |