diff options
author | Joakim Bygdell <j.bygdell@gmail.com> | 2016-05-16 19:59:05 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-05-16 11:05:20 -0700 |
commit | 0e4e8edf78999fa6e9e1052c9022661949b9d00b (patch) | |
tree | 28702946ee44062e434748e46ada902c6f918de4 /mobile-widgets | |
parent | fcc370b2fe532c42f52834ec7200c07f8e853313 (diff) | |
download | subsurface-0e4e8edf78999fa6e9e1052c9022661949b9d00b.tar.gz |
QML UI: add comboboxes to DiveDetailsEdit
This adds autocompleting text input fields for suit, buddy and
divemaster.
[Dirk Hohndel: some whitespace cleanup]
Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'mobile-widgets')
-rw-r--r-- | mobile-widgets/qml/DiveDetails.qml | 12 | ||||
-rw-r--r-- | mobile-widgets/qml/DiveDetailsEdit.qml | 37 |
2 files changed, 29 insertions, 20 deletions
diff --git a/mobile-widgets/qml/DiveDetails.qml b/mobile-widgets/qml/DiveDetails.qml index 8e258d746..fb55706de 100644 --- a/mobile-widgets/qml/DiveDetails.qml +++ b/mobile-widgets/qml/DiveDetails.qml @@ -15,14 +15,14 @@ Kirigami.Page { property alias date: detailsEdit.dateText property alias airtemp: detailsEdit.airtempText property alias watertemp: detailsEdit.watertempText - property alias buddy: detailsEdit.buddyText - property alias divemaster: detailsEdit.divemasterText + property alias buddyIndex: detailsEdit.buddyIndex + property alias divemasterIndex: detailsEdit.divemasterIndex property alias depth: detailsEdit.depthText property alias duration: detailsEdit.durationText property alias location: detailsEdit.locationText property alias gps: detailsEdit.gpsText property alias notes: detailsEdit.notesText - property alias suit: detailsEdit.suitText + property alias suitIndex: detailsEdit.suitIndex property alias weight: detailsEdit.weightText property alias startpressure: detailsEdit.startpressureText property alias endpressure: detailsEdit.endpressureText @@ -149,9 +149,9 @@ Kirigami.Page { depth = diveDetailsListView.currentItem.modelData.dive.depth airtemp = diveDetailsListView.currentItem.modelData.dive.airTemp watertemp = diveDetailsListView.currentItem.modelData.dive.waterTemp - suit = diveDetailsListView.currentItem.modelData.dive.suit - buddy = diveDetailsListView.currentItem.modelData.dive.buddy - divemaster = diveDetailsListView.currentItem.modelData.dive.divemaster + suitIndex = diveDetailsListView.currentItem.modelData.dive.suitList.indexOf(diveDetailsListView.currentItem.modelData.dive.suit) + buddyIndex = diveDetailsListView.currentItem.modelData.dive.buddyList.indexOf(diveDetailsListView.currentItem.modelData.dive.buddy) + divemasterIndex = diveDetailsListView.currentItem.modelData.dive.divemasterList.indexOf(diveDetailsListView.currentItem.modelData.dive.divemaster) notes = diveDetailsListView.currentItem.modelData.dive.notes if (diveDetailsListView.currentItem.modelData.dive.singleWeight) { // we have only one weight, go ahead, have fun and edit it diff --git a/mobile-widgets/qml/DiveDetailsEdit.qml b/mobile-widgets/qml/DiveDetailsEdit.qml index 7ff511da8..9986d234f 100644 --- a/mobile-widgets/qml/DiveDetailsEdit.qml +++ b/mobile-widgets/qml/DiveDetailsEdit.qml @@ -15,9 +15,9 @@ Item { property alias gpsText: txtGps.text property alias airtempText: txtAirTemp.text property alias watertempText: txtWaterTemp.text - property alias suitText: txtSuit.text - property alias buddyText: txtBuddy.text - property alias divemasterText: txtDiveMaster.text + property alias suitIndex: suitBox.currentIndex + property alias buddyIndex: buddyBox.currentIndex + property alias divemasterIndex: divemasterBox.currentIndex property alias notesText: txtNotes.text property alias durationText: txtDuration.text property alias depthText: txtDepth.text @@ -30,8 +30,8 @@ Item { function saveData() { // apply the changes to the dive_table 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.depthText, detailsEdit.airtempText, detailsEdit.watertempText, suitBox.editText, + buddyBox.editText, divemasterBox.editText, detailsEdit.weightText, detailsEdit.notesText, detailsEdit.startpressureText, detailsEdit.endpressureText, detailsEdit.gasmixText) // trigger the profile to be redrawn QMLProfile.diveId = dive_id @@ -47,9 +47,9 @@ Item { diveDetailsListView.currentItem.modelData.depth = detailsEdit.depthText diveDetailsListView.currentItem.modelData.airtemp = detailsEdit.airtempText diveDetailsListView.currentItem.modelData.watertemp = detailsEdit.watertempText - diveDetailsListView.currentItem.modelData.suit = detailsEdit.suitText - diveDetailsListView.currentItem.modelData.buddy = detailsEdit.buddyText - diveDetailsListView.currentItem.modelData.divemaster = detailsEdit.divemasterText + diveDetailsListView.currentItem.modelData.suit = suitBox.currentText + diveDetailsListView.currentItem.modelData.buddy = buddyBox.currentText + diveDetailsListView.currentItem.modelData.divemaster = divemasterBox.currentText diveDetailsListView.currentItem.modelData.notes = detailsEdit.notesText diveDetailsPage.state = "view" Qt.inputMethod.hide() @@ -154,8 +154,11 @@ Item { Layout.alignment: Qt.AlignRight text: qsTr("Suit:") } - StyledTextField { - id: txtSuit + ComboBox { + id: suitBox + editable: true + model: diveDetailsListView.currentItem.modelData.dive.suitList + inputMethodHints: Qt.ImhNoPredictiveText Layout.fillWidth: true } @@ -163,8 +166,11 @@ Item { Layout.alignment: Qt.AlignRight text: qsTr("Buddy:") } - StyledTextField { - id: txtBuddy + ComboBox { + id: buddyBox + editable: true + model: diveDetailsListView.currentItem.modelData.dive.buddyList + inputMethodHints: Qt.ImhNoPredictiveText Layout.fillWidth: true } @@ -172,8 +178,11 @@ Item { Layout.alignment: Qt.AlignRight text: qsTr("Dive Master:") } - StyledTextField { - id: txtDiveMaster + ComboBox { + id: divemasterBox + editable: true + model: diveDetailsListView.currentItem.modelData.dive.divemasterList + inputMethodHints: Qt.ImhNoPredictiveText Layout.fillWidth: true } |