diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2016-01-01 00:32:30 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-01-01 00:55:34 -0800 |
commit | a0aa27e86471ec94e00acfd874ca7cdd9c793308 (patch) | |
tree | ebd7c42a620723a8f57784715c19af8627de3887 /qt-mobile | |
parent | 2c28b16b26bd917670f84102d6535abf99a30d4d (diff) | |
download | subsurface-a0aa27e86471ec94e00acfd874ca7cdd9c793308.tar.gz |
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 <dirk@hohndel.org>
Diffstat (limited to 'qt-mobile')
-rw-r--r-- | qt-mobile/qml/DiveDetails.qml | 2 | ||||
-rw-r--r-- | qt-mobile/qml/DiveDetailsEdit.qml | 10 | ||||
-rw-r--r-- | qt-mobile/qmlmanager.cpp | 10 |
3 files changed, 21 insertions, 1 deletions
diff --git a/qt-mobile/qml/DiveDetails.qml b/qt-mobile/qml/DiveDetails.qml index 4b0ee8e23..b4f30dab9 100644 --- a/qt-mobile/qml/DiveDetails.qml +++ b/qt-mobile/qml/DiveDetails.qml @@ -59,7 +59,7 @@ MobileComponents.Page { location = detailsEdit.locationText // gps = detailsEdit.gps duration = detailsEdit.durationText - // depth = detailsEdit.depthText + depth = detailsEdit.depthText airtemp = detailsEdit.airtempText watertemp = detailsEdit.watertempText suit = detailsEdit.suitText diff --git a/qt-mobile/qml/DiveDetailsEdit.qml b/qt-mobile/qml/DiveDetailsEdit.qml index e77b3234a..051e38676 100644 --- a/qt-mobile/qml/DiveDetailsEdit.qml +++ b/qt-mobile/qml/DiveDetailsEdit.qml @@ -16,6 +16,7 @@ Item { property alias divemasterText: txtDiveMaster.text property alias notesText: txtNotes.text property alias durationText: txtDuration.text + property alias depthText: txtDepth.text ColumnLayout { anchors { left: parent.left @@ -51,6 +52,15 @@ Item { MobileComponents.Label { Layout.alignment: Qt.AlignRight + text: "Depth:" + } + TextField { + id: txtDepth + text: depth + Layout.fillWidth: true + } + MobileComponents.Label { + Layout.alignment: Qt.AlignRight text: "Duration:" } TextField { 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"))) |