mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
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>
This commit is contained in:
parent
fcc370b2fe
commit
0e4e8edf78
3 changed files with 38 additions and 29 deletions
|
@ -371,9 +371,9 @@ QStringList DiveObjectHelper::suitList() const
|
||||||
if (!temp.isEmpty())
|
if (!temp.isEmpty())
|
||||||
suits << d->suit;
|
suits << d->suit;
|
||||||
}
|
}
|
||||||
suits.removeDuplicates();
|
suits.removeDuplicates();
|
||||||
suits.sort();
|
suits.sort();
|
||||||
return suits;
|
return suits;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList DiveObjectHelper::buddyList() const
|
QStringList DiveObjectHelper::buddyList() const
|
||||||
|
@ -392,9 +392,9 @@ QStringList DiveObjectHelper::buddyList() const
|
||||||
buddies << tempList;
|
buddies << tempList;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
buddies.removeDuplicates();
|
buddies.removeDuplicates();
|
||||||
buddies.sort();
|
buddies.sort();
|
||||||
return buddies;
|
return buddies;
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList DiveObjectHelper::divemasterList() const
|
QStringList DiveObjectHelper::divemasterList() const
|
||||||
|
@ -407,7 +407,7 @@ QStringList DiveObjectHelper::divemasterList() const
|
||||||
if (!temp.isEmpty())
|
if (!temp.isEmpty())
|
||||||
divemasters << d->divemaster;
|
divemasters << d->divemaster;
|
||||||
}
|
}
|
||||||
divemasters.removeDuplicates();
|
divemasters.removeDuplicates();
|
||||||
divemasters.sort();
|
divemasters.sort();
|
||||||
return divemasters;
|
return divemasters;
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,14 +15,14 @@ Kirigami.Page {
|
||||||
property alias date: detailsEdit.dateText
|
property alias date: detailsEdit.dateText
|
||||||
property alias airtemp: detailsEdit.airtempText
|
property alias airtemp: detailsEdit.airtempText
|
||||||
property alias watertemp: detailsEdit.watertempText
|
property alias watertemp: detailsEdit.watertempText
|
||||||
property alias buddy: detailsEdit.buddyText
|
property alias buddyIndex: detailsEdit.buddyIndex
|
||||||
property alias divemaster: detailsEdit.divemasterText
|
property alias divemasterIndex: detailsEdit.divemasterIndex
|
||||||
property alias depth: detailsEdit.depthText
|
property alias depth: detailsEdit.depthText
|
||||||
property alias duration: detailsEdit.durationText
|
property alias duration: detailsEdit.durationText
|
||||||
property alias location: detailsEdit.locationText
|
property alias location: detailsEdit.locationText
|
||||||
property alias gps: detailsEdit.gpsText
|
property alias gps: detailsEdit.gpsText
|
||||||
property alias notes: detailsEdit.notesText
|
property alias notes: detailsEdit.notesText
|
||||||
property alias suit: detailsEdit.suitText
|
property alias suitIndex: detailsEdit.suitIndex
|
||||||
property alias weight: detailsEdit.weightText
|
property alias weight: detailsEdit.weightText
|
||||||
property alias startpressure: detailsEdit.startpressureText
|
property alias startpressure: detailsEdit.startpressureText
|
||||||
property alias endpressure: detailsEdit.endpressureText
|
property alias endpressure: detailsEdit.endpressureText
|
||||||
|
@ -149,9 +149,9 @@ Kirigami.Page {
|
||||||
depth = diveDetailsListView.currentItem.modelData.dive.depth
|
depth = diveDetailsListView.currentItem.modelData.dive.depth
|
||||||
airtemp = diveDetailsListView.currentItem.modelData.dive.airTemp
|
airtemp = diveDetailsListView.currentItem.modelData.dive.airTemp
|
||||||
watertemp = diveDetailsListView.currentItem.modelData.dive.waterTemp
|
watertemp = diveDetailsListView.currentItem.modelData.dive.waterTemp
|
||||||
suit = diveDetailsListView.currentItem.modelData.dive.suit
|
suitIndex = diveDetailsListView.currentItem.modelData.dive.suitList.indexOf(diveDetailsListView.currentItem.modelData.dive.suit)
|
||||||
buddy = diveDetailsListView.currentItem.modelData.dive.buddy
|
buddyIndex = diveDetailsListView.currentItem.modelData.dive.buddyList.indexOf(diveDetailsListView.currentItem.modelData.dive.buddy)
|
||||||
divemaster = diveDetailsListView.currentItem.modelData.dive.divemaster
|
divemasterIndex = diveDetailsListView.currentItem.modelData.dive.divemasterList.indexOf(diveDetailsListView.currentItem.modelData.dive.divemaster)
|
||||||
notes = diveDetailsListView.currentItem.modelData.dive.notes
|
notes = diveDetailsListView.currentItem.modelData.dive.notes
|
||||||
if (diveDetailsListView.currentItem.modelData.dive.singleWeight) {
|
if (diveDetailsListView.currentItem.modelData.dive.singleWeight) {
|
||||||
// we have only one weight, go ahead, have fun and edit it
|
// we have only one weight, go ahead, have fun and edit it
|
||||||
|
|
|
@ -15,9 +15,9 @@ Item {
|
||||||
property alias gpsText: txtGps.text
|
property alias gpsText: txtGps.text
|
||||||
property alias airtempText: txtAirTemp.text
|
property alias airtempText: txtAirTemp.text
|
||||||
property alias watertempText: txtWaterTemp.text
|
property alias watertempText: txtWaterTemp.text
|
||||||
property alias suitText: txtSuit.text
|
property alias suitIndex: suitBox.currentIndex
|
||||||
property alias buddyText: txtBuddy.text
|
property alias buddyIndex: buddyBox.currentIndex
|
||||||
property alias divemasterText: txtDiveMaster.text
|
property alias divemasterIndex: divemasterBox.currentIndex
|
||||||
property alias notesText: txtNotes.text
|
property alias notesText: txtNotes.text
|
||||||
property alias durationText: txtDuration.text
|
property alias durationText: txtDuration.text
|
||||||
property alias depthText: txtDepth.text
|
property alias depthText: txtDepth.text
|
||||||
|
@ -30,8 +30,8 @@ Item {
|
||||||
function saveData() {
|
function saveData() {
|
||||||
// apply the changes to the dive_table
|
// apply the changes to the dive_table
|
||||||
manager.commitChanges(dive_id, detailsEdit.dateText, detailsEdit.locationText, detailsEdit.gpsText, detailsEdit.durationText,
|
manager.commitChanges(dive_id, detailsEdit.dateText, detailsEdit.locationText, detailsEdit.gpsText, detailsEdit.durationText,
|
||||||
detailsEdit.depthText, detailsEdit.airtempText, detailsEdit.watertempText, detailsEdit.suitText,
|
detailsEdit.depthText, detailsEdit.airtempText, detailsEdit.watertempText, suitBox.editText,
|
||||||
detailsEdit.buddyText, detailsEdit.divemasterText, detailsEdit.weightText, detailsEdit.notesText,
|
buddyBox.editText, divemasterBox.editText, detailsEdit.weightText, detailsEdit.notesText,
|
||||||
detailsEdit.startpressureText, detailsEdit.endpressureText, detailsEdit.gasmixText)
|
detailsEdit.startpressureText, detailsEdit.endpressureText, detailsEdit.gasmixText)
|
||||||
// trigger the profile to be redrawn
|
// trigger the profile to be redrawn
|
||||||
QMLProfile.diveId = dive_id
|
QMLProfile.diveId = dive_id
|
||||||
|
@ -47,9 +47,9 @@ Item {
|
||||||
diveDetailsListView.currentItem.modelData.depth = detailsEdit.depthText
|
diveDetailsListView.currentItem.modelData.depth = detailsEdit.depthText
|
||||||
diveDetailsListView.currentItem.modelData.airtemp = detailsEdit.airtempText
|
diveDetailsListView.currentItem.modelData.airtemp = detailsEdit.airtempText
|
||||||
diveDetailsListView.currentItem.modelData.watertemp = detailsEdit.watertempText
|
diveDetailsListView.currentItem.modelData.watertemp = detailsEdit.watertempText
|
||||||
diveDetailsListView.currentItem.modelData.suit = detailsEdit.suitText
|
diveDetailsListView.currentItem.modelData.suit = suitBox.currentText
|
||||||
diveDetailsListView.currentItem.modelData.buddy = detailsEdit.buddyText
|
diveDetailsListView.currentItem.modelData.buddy = buddyBox.currentText
|
||||||
diveDetailsListView.currentItem.modelData.divemaster = detailsEdit.divemasterText
|
diveDetailsListView.currentItem.modelData.divemaster = divemasterBox.currentText
|
||||||
diveDetailsListView.currentItem.modelData.notes = detailsEdit.notesText
|
diveDetailsListView.currentItem.modelData.notes = detailsEdit.notesText
|
||||||
diveDetailsPage.state = "view"
|
diveDetailsPage.state = "view"
|
||||||
Qt.inputMethod.hide()
|
Qt.inputMethod.hide()
|
||||||
|
@ -154,8 +154,11 @@ Item {
|
||||||
Layout.alignment: Qt.AlignRight
|
Layout.alignment: Qt.AlignRight
|
||||||
text: qsTr("Suit:")
|
text: qsTr("Suit:")
|
||||||
}
|
}
|
||||||
StyledTextField {
|
ComboBox {
|
||||||
id: txtSuit
|
id: suitBox
|
||||||
|
editable: true
|
||||||
|
model: diveDetailsListView.currentItem.modelData.dive.suitList
|
||||||
|
inputMethodHints: Qt.ImhNoPredictiveText
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,8 +166,11 @@ Item {
|
||||||
Layout.alignment: Qt.AlignRight
|
Layout.alignment: Qt.AlignRight
|
||||||
text: qsTr("Buddy:")
|
text: qsTr("Buddy:")
|
||||||
}
|
}
|
||||||
StyledTextField {
|
ComboBox {
|
||||||
id: txtBuddy
|
id: buddyBox
|
||||||
|
editable: true
|
||||||
|
model: diveDetailsListView.currentItem.modelData.dive.buddyList
|
||||||
|
inputMethodHints: Qt.ImhNoPredictiveText
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,8 +178,11 @@ Item {
|
||||||
Layout.alignment: Qt.AlignRight
|
Layout.alignment: Qt.AlignRight
|
||||||
text: qsTr("Dive Master:")
|
text: qsTr("Dive Master:")
|
||||||
}
|
}
|
||||||
StyledTextField {
|
ComboBox {
|
||||||
id: txtDiveMaster
|
id: divemasterBox
|
||||||
|
editable: true
|
||||||
|
model: diveDetailsListView.currentItem.modelData.dive.divemasterList
|
||||||
|
inputMethodHints: Qt.ImhNoPredictiveText
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue