From a0aa27e86471ec94e00acfd874ca7cdd9c793308 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 1 Jan 2016 00:32:30 -0800 Subject: QML UI: handle editing of depth Getting closer to being able to really edit / add dives in the mobile UI. This works for manually added dives - needs a bit more thought for dives downloaded from dive computers as we don't necessarily want to change the maxdepth in conflict with the samples. Signed-off-by: Dirk Hohndel --- qt-mobile/qmlmanager.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'qt-mobile/qmlmanager.cpp') diff --git a/qt-mobile/qmlmanager.cpp b/qt-mobile/qmlmanager.cpp index d711e8945..70bc5264a 100644 --- a/qt-mobile/qmlmanager.cpp +++ b/qt-mobile/qmlmanager.cpp @@ -361,6 +361,16 @@ void QMLManager::commitChanges(QString diveId, QString location, QString gps, QS } d->duration.seconds = h * 3600 + m * 60 + s; } + 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")) + d->dc.maxdepth.mm = d->maxdepth.mm; + } if (get_temperature_string(d->airtemp) != airtemp) { diveChanged = true; if (airtemp.contains(tr("C"))) -- cgit v1.2.3-70-g09d2