summaryrefslogtreecommitdiffstats
path: root/mobile-widgets
diff options
context:
space:
mode:
authorGravatar jan Iversen <jan@casacondor.com>2020-01-22 11:05:41 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-01-25 17:13:20 -0800
commitc1bbab6eaaa7339dbe0f072d8e36326ff2bf7b8c (patch)
treef59c92bc806f2a9b8ff1dd599d1011e547ebc08d /mobile-widgets
parentff360d28f5a8f95a0a8186ca601f8eb38c1192bf (diff)
downloadsubsurface-c1bbab6eaaa7339dbe0f072d8e36326ff2bf7b8c.tar.gz
mobile-widgets/qml: connect QML to Backend.
Add property pressureUnit to use as BAR/PSI text. Added slot to catch when user changes BAR <-> PSI. Add Backend variables to Planning section. Signed-off-by: jan Iversen <jan@casacondor.com>
Diffstat (limited to 'mobile-widgets')
-rw-r--r--mobile-widgets/qml/DivePlannerSetup.qml52
1 files changed, 43 insertions, 9 deletions
diff --git a/mobile-widgets/qml/DivePlannerSetup.qml b/mobile-widgets/qml/DivePlannerSetup.qml
index 76f085a3d..e854bab38 100644
--- a/mobile-widgets/qml/DivePlannerSetup.qml
+++ b/mobile-widgets/qml/DivePlannerSetup.qml
@@ -12,6 +12,7 @@ Kirigami.ScrollablePage {
property string speedUnit: (Backend.length === Enums.METERS) ? qsTr(" m/min") : qsTr(" ft/min")
property string volumeUnit: (Backend.volume === Enums.LITER) ? qsTr(" l/min") : qsTr(" cuft/min")
+ property string pressureUnit: (Backend.pressure === Enums.BAR) ? qsTr(" BAR") : qsTr(" PSI")
Connections {
target: Backend
onLengthChanged: {
@@ -26,6 +27,8 @@ Kirigami.ScrollablePage {
spinBottomsac.value = Backend.bottomsac
spinDecosac.value = Backend.decosac
}
+ onPressureChanged: {
+ }
}
Column {
width: parent.width
@@ -157,37 +160,46 @@ Kirigami.ScrollablePage {
}
TemplateComboBox {
editable: false
+ currentIndex: Backend.dive_mode
model: ListModel {
ListElement {text: qsTr("Open circuit")}
ListElement {text: qsTr("CCR")}
ListElement {text: qsTr("pSCR")}
}
onActivated: {
+ Backend.dive_mode = currentIndex
}
}
TemplateCheckBox {
text: qsTr("Bailout: Deco on OC")
Layout.columnSpan: 2
+ checked: Backend.dobailout
}
TemplateRadioButton {
text: qsTr("Recreational mode")
Layout.columnSpan: 2
+ checked: Backend.planner_deco_mode === Enums.RECREATIONAL
+ onClicked: {
+ Backend.planner_deco_mode = Enums.RECREATIONAL
+ }
}
TemplateLabel {
text: qsTr("Reserve gas")
leftPadding: Kirigami.Units.smallSpacing * 2
+ enabled: Backend.planner_deco_mode === Enums.RECREATIONAL
}
TemplateSpinBox {
from: 1
to: 99
stepSize: 1
- value: 50
+ value: Backend.reserve_gas
textFromValue: function (value, locale) {
return value + volumeUnit
}
onValueModified: {
+ Backend.reserve_gas = value
}
}
@@ -195,11 +207,19 @@ Kirigami.ScrollablePage {
text: qsTr("Safety stop")
Layout.columnSpan: 2
leftPadding: Kirigami.Units.smallSpacing * 6
+ checked: Backend.safetystop
+ onClicked: {
+ Backend.safetystop = checked
+ }
}
TemplateRadioButton {
text: qsTr("Bühlmannh deco")
Layout.columnSpan: 2
+ checked: Backend.planner_deco_mode === Enums.BUEHLMANN
+ onClicked: {
+ Backend.planner_deco_mode = Enums.BUEHLMANN
+ }
}
TemplateLabel {
@@ -210,11 +230,12 @@ Kirigami.ScrollablePage {
from: 1
to: 99
stepSize: 1
- value: 50
+ value: Backend.gflow
textFromValue: function (value, locale) {
return value + volumeUnit
}
onValueModified: {
+ Backend.gflow = value
}
}
@@ -226,17 +247,22 @@ Kirigami.ScrollablePage {
from: 1
to: 99
stepSize: 1
- value: 50
+ value: Backend.gfhigh
textFromValue: function (value, locale) {
return value + volumeUnit
}
onValueModified: {
+ Backend.gfhigh = value
}
}
TemplateRadioButton {
text: qsTr("VPM-B deco")
Layout.columnSpan: 2
+ checked: Backend.planner_deco_mode === Enums.VPMB
+ onClicked: {
+ Backend.planner_deco_mode = Enums.VPMB
+ }
}
TemplateLabel {
@@ -247,12 +273,12 @@ Kirigami.ScrollablePage {
from: 0
to: 4
stepSize: 1
- value: 2
+ value: Backend.vpmb_conservatism
textFromValue: function (value, locale) {
return qsTr("+") + value
}
onValueModified: {
- console.log("got value: " + value)
+ Backend.vpmb_conservatism = value
}
}
@@ -264,11 +290,19 @@ Kirigami.ScrollablePage {
TemplateCheckBox {
text: qsTr("Plan backgas breaks")
Layout.columnSpan: 2
+ checked: Backend.last_stop6m
+ onClicked: {
+ Backend.last_stop6m = checked
+ }
}
TemplateCheckBox {
text: qsTr("Only switch at required stops")
Layout.columnSpan: 2
+ checked: Backend.switch_at_req_stop
+ onClicked: {
+ Backend.switch_at_req_stop = checked
+ }
}
TemplateLabel {
@@ -278,12 +312,12 @@ Kirigami.ScrollablePage {
from: 0
to: 4
stepSize: 1
- value: 2
+ value: Backend.min_switch_duration
textFromValue: function (value, locale) {
return qsTr("+") + value
}
onValueModified: {
- console.log("got value: " + value)
+ Backend.min_switch_duration = value
}
}
@@ -294,12 +328,12 @@ Kirigami.ScrollablePage {
from: 0
to: 4
stepSize: 1
- value: 2
+ value: Backend.surface_segment
textFromValue: function (value, locale) {
return qsTr("+") + value
}
onValueModified: {
- console.log("got value: " + value)
+ Backend.surface_segment = value
}
}
}