mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
QML UI: Enable cylinder edit
This adds the option to select a cylinder when adding or editing a dive. Due to limited screen size we restrict the editing to the first cylinder only. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
7b3665827a
commit
674d8331f5
6 changed files with 74 additions and 16 deletions
|
@ -29,6 +29,8 @@ Kirigami.Page {
|
|||
property alias weight: detailsEdit.weightText
|
||||
property alias startpressure: detailsEdit.startpressureText
|
||||
property alias endpressure: detailsEdit.endpressureText
|
||||
property alias cylinderIndex: detailsEdit.cylinderIndex
|
||||
property alias cylinderModel: detailsEdit.cylinderModel
|
||||
property alias gasmix: detailsEdit.gasmixText
|
||||
property alias gpsCheckbox: detailsEdit.gpsCheckbox
|
||||
property int updateCurrentIdx: manager.updateSelectedDive
|
||||
|
@ -168,6 +170,7 @@ Kirigami.Page {
|
|||
startpressure = diveDetailsListView.currentItem.modelData.dive.startPressure
|
||||
endpressure = diveDetailsListView.currentItem.modelData.dive.endPressure
|
||||
gasmix = diveDetailsListView.currentItem.modelData.dive.firstGas
|
||||
cylinderIndex = diveDetailsListView.currentItem.modelData.dive.cylinderList.indexOf(diveDetailsListView.currentItem.modelData.dive.getCylinder)
|
||||
} else {
|
||||
// careful when translating, this text is "magic" in DiveDetailsEdit.qml
|
||||
startpressure = "cannot edit multiple cylinders"
|
||||
|
|
|
@ -18,6 +18,7 @@ Item {
|
|||
property alias suitIndex: suitBox.currentIndex
|
||||
property alias buddyIndex: buddyBox.currentIndex
|
||||
property alias divemasterIndex: divemasterBox.currentIndex
|
||||
property alias cylinderIndex: cylinderBox.currentIndex
|
||||
property alias notesText: txtNotes.text
|
||||
property alias durationText: txtDuration.text
|
||||
property alias depthText: txtDepth.text
|
||||
|
@ -29,13 +30,14 @@ Item {
|
|||
property alias suitModel: suitBox.model
|
||||
property alias divemasterModel: divemasterBox.model
|
||||
property alias buddyModel: buddyBox.model
|
||||
property alias cylinderModel: cylinderBox.model
|
||||
|
||||
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, suitBox.editText,
|
||||
buddyBox.editText, divemasterBox.editText, detailsEdit.weightText, detailsEdit.notesText,
|
||||
detailsEdit.startpressureText, detailsEdit.endpressureText, detailsEdit.gasmixText)
|
||||
detailsEdit.depthText, detailsEdit.airtempText, detailsEdit.watertempText, suitBox.editText, buddyBox.editText,
|
||||
divemasterBox.editText, detailsEdit.weightText, detailsEdit.notesText, detailsEdit.startpressureText,
|
||||
detailsEdit.endpressureText, detailsEdit.gasmixText, cylinderBox.editText)
|
||||
// trigger the profile to be redrawn
|
||||
QMLProfile.diveId = dive_id
|
||||
|
||||
|
@ -53,6 +55,7 @@ Item {
|
|||
diveDetailsListView.currentItem.modelData.suit = suitBox.currentText
|
||||
diveDetailsListView.currentItem.modelData.buddy = buddyBox.currentText
|
||||
diveDetailsListView.currentItem.modelData.divemaster = divemasterBox.currentText
|
||||
diveDetailsListView.currentItem.modelData.cylinder = cylinderBox.currentText
|
||||
diveDetailsListView.currentItem.modelData.notes = detailsEdit.notesText
|
||||
diveDetailsPage.state = "view"
|
||||
Qt.inputMethod.hide()
|
||||
|
@ -208,6 +211,21 @@ Item {
|
|||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Kirigami.Label {
|
||||
Layout.alignment: Qt.AlignRight
|
||||
text: qsTr("Cylinder:")
|
||||
}
|
||||
ComboBox {
|
||||
id: cylinderBox
|
||||
editable: true
|
||||
model: diveDetailsListView.currentItem.modelData.dive.cylinderList
|
||||
inputMethodHints: Qt.ImhNoPredictiveText
|
||||
Layout.fillWidth: true
|
||||
style: ComboBoxStyle {
|
||||
dropDownButtonWidth: 0
|
||||
}
|
||||
}
|
||||
|
||||
Kirigami.Label {
|
||||
Layout.alignment: Qt.AlignRight
|
||||
text: qsTr("Gas mix:")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue