From 97d6a1e779c91c434e00086c90e0e8b3fcf540dc Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Mon, 15 Feb 2016 07:51:23 -0800 Subject: 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 --- qt-mobile/qmlmanager.cpp | 17 ++++------------- 1 file 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 -- cgit v1.2.3-70-g09d2