From ae116c5bc80f152f4eb5061252f52e70903398c6 Mon Sep 17 00:00:00 2001 From: Joakim Bygdell Date: Sat, 13 Feb 2016 18:34:31 +0100 Subject: QML UI: enable edit of gasmix First cylinder only, show warning if there are more than one cylinder defined. Signed-off-by: Joakim Bygdell Signed-off-by: Dirk Hohndel --- qt-mobile/qml/DiveDetails.qml | 3 +++ qt-mobile/qml/DiveDetailsEdit.qml | 13 ++++++++++++- qt-mobile/qml/main.qml | 1 + 3 files changed, 16 insertions(+), 1 deletion(-) (limited to 'qt-mobile/qml') diff --git a/qt-mobile/qml/DiveDetails.qml b/qt-mobile/qml/DiveDetails.qml index 5a39576e8..c906ba268 100644 --- a/qt-mobile/qml/DiveDetails.qml +++ b/qt-mobile/qml/DiveDetails.qml @@ -24,6 +24,7 @@ MobileComponents.Page { property alias weight: detailsEdit.weightText property alias startpressure: detailsEdit.startpressureText property alias endpressure: detailsEdit.endpressureText + property alias gasmix: detailsEdit.gasmixText state: "view" @@ -128,10 +129,12 @@ MobileComponents.Page { if (diveDetailsListView.currentItem.modelData.dive.getCylinder != "Multiple" ) { startpressure = diveDetailsListView.currentItem.modelData.dive.startPressure endpressure = diveDetailsListView.currentItem.modelData.dive.endPressure + gasmix = diveDetailsListView.currentItem.modelData.dive.firstGas } else { // careful when translating, this text is "magic" in DiveDetailsEdit.qml startpressure = "cannot edit multiple cylinders" endpressure = "cannot edit multiple cylinders" + gasmix = "cannot edit multiple gases" } diveDetailsPage.state = "edit" diff --git a/qt-mobile/qml/DiveDetailsEdit.qml b/qt-mobile/qml/DiveDetailsEdit.qml index f2b046258..ae943ca03 100644 --- a/qt-mobile/qml/DiveDetailsEdit.qml +++ b/qt-mobile/qml/DiveDetailsEdit.qml @@ -24,6 +24,7 @@ Item { property alias weightText: txtWeight.text property alias startpressureText: txtStartPressure.text property alias endpressureText: txtEndPressure.text + property alias gasmixText: txtGasMix.text height: editArea.height ColumnLayout { @@ -145,6 +146,16 @@ Item { Layout.fillWidth: true } + MobileComponents.Label { + Layout.alignment: Qt.AlignRight + text: "Gas mix:" + } + TextField { + id: txtGasMix + readOnly: (text == "cannot edit multiple gases" ? true : false) + Layout.fillWidth: true + } + MobileComponents.Label { Layout.alignment: Qt.AlignRight text: "Start Pressure:" @@ -192,7 +203,7 @@ Item { manager.commitChanges(dive_id, detailsEdit.dateText, detailsEdit.locationText, detailsEdit.gpsText, detailsEdit.durationText, detailsEdit.depthText, detailsEdit.airtempText, detailsEdit.watertempText, detailsEdit.suitText, detailsEdit.buddyText, detailsEdit.divemasterText, detailsEdit.weightText, detailsEdit.notesText, - detailsEdit.startpressureText, detailsEdit.endpressureText) + detailsEdit.startpressureText, detailsEdit.endpressureText, detailsEdit.gasmixText) // apply the changes to the dive detail view - since the edit could have changed the order // first make sure that we are looking at the correct dive - our model allows us to look // up the index based on the unique dive_id diff --git a/qt-mobile/qml/main.qml b/qt-mobile/qml/main.qml index 2c066e242..68696b6aa 100644 --- a/qt-mobile/qml/main.qml +++ b/qt-mobile/qml/main.qml @@ -84,6 +84,7 @@ MobileComponents.ApplicationWindow { detailsWindow.duration = "" detailsWindow.suit = "" detailsWindow.weight = "" + detailsWindow.gasmix = "" detailsWindow.startpressure = "" detailsWindow.endpressure = "" stackView.push(detailsWindow) -- cgit v1.2.3-70-g09d2