mobile-widgets/qml: add slot for volume change

Catch when volume type is changed and update bottomsac/decosac.

Also update text l/min <-> cuft/min and add a space between value and unit.

Signed-off-by: jan Iversen <jan@casacondor.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
jan Iversen 2020-01-08 11:35:07 +01:00 committed by Dirk Hohndel
parent 2ef0d23c29
commit 1e14c3f0d3

View file

@ -10,7 +10,8 @@ import org.kde.kirigami 2.4 as Kirigami
Kirigami.ScrollablePage {
title: qsTr("Dive planner setup")
property string speedUnit: (Backend.length === Enums.METERS) ? qsTr("m/min") : qsTr("ft/min")
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")
Connections {
target: Backend
onLengthChanged: {
@ -20,6 +21,10 @@ Kirigami.ScrollablePage {
spinAscratelast6m.value = Backend.ascratelast6m
spinDescrate.value = Backend.descrate
}
onVolumeChanged: {
spinBottomsac.value = Planner.bottomsac
spinDecosac.value = Planner.decosac
}
}
Column {
width: parent.width
@ -220,12 +225,13 @@ Kirigami.ScrollablePage {
text: qsTr("Bottom SAC")
}
TemplateSpinBox {
id: spinBottomsac
from: 1
to: 99
stepSize: 1
value: Planner.bottomsac
textFromValue: function (value, locale) {
return value + qsTr("l/min")
return value + volumeUnit
}
onValueModified: {
Planner.bottomsac = value
@ -235,12 +241,13 @@ Kirigami.ScrollablePage {
text: qsTr("Deco SAC")
}
TemplateSpinBox {
id: spinDecosac
from: 1
to: 99
stepSize: 1
value: Planner.decosac
textFromValue: function (value, locale) {
return value + qsTr("l/min")
return value + volumeUnit
}
onValueModified: {
Planner.decosac = value
@ -315,7 +322,7 @@ Kirigami.ScrollablePage {
stepSize: 1
value: Planner.bestmixend
textFromValue: function (value, locale) {
return value + qsTr("m")
return value + speedUnit
}
onValueModified: {
Planner.bestmixend = value