From 1e14c3f0d38ac8ef9f0726daf1d8f0c990da6ef2 Mon Sep 17 00:00:00 2001 From: jan Iversen Date: Wed, 8 Jan 2020 11:35:07 +0100 Subject: 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 Signed-off-by: Dirk Hohndel --- mobile-widgets/qml/DivePlannerSetup.qml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/mobile-widgets/qml/DivePlannerSetup.qml b/mobile-widgets/qml/DivePlannerSetup.qml index abf5de363..58bbb1ac9 100644 --- a/mobile-widgets/qml/DivePlannerSetup.qml +++ b/mobile-widgets/qml/DivePlannerSetup.qml @@ -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 -- cgit v1.2.3-70-g09d2