From 02af3463d07a05334389b2d87429f97755a2bd82 Mon Sep 17 00:00:00 2001 From: Jocke Date: Mon, 20 Aug 2018 20:02:54 +0200 Subject: Mobile: add default cylinder UI Add the UI components to let the user set the default cylinder and select the chosen cylinder when adding a new dive. Signed-off-by: Joakim Bygdell --- mobile-widgets/qml/main.qml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'mobile-widgets/qml/main.qml') diff --git a/mobile-widgets/qml/main.qml b/mobile-widgets/qml/main.qml index 6e9b98ce7..930740a93 100644 --- a/mobile-widgets/qml/main.qml +++ b/mobile-widgets/qml/main.qml @@ -27,6 +27,7 @@ Kirigami.ApplicationWindow { property alias locationServiceEnabled: manager.locationServiceEnabled property alias pluggedInDeviceName: manager.pluggedInDeviceName property alias showPin: prefs.showPin + property alias defaultCylinderIndex: settingsWindow.defaultCylinderIndex onNotificationTextChanged: { if (notificationText != "") { // there's a risk that we have a >5 second gap in update events; @@ -101,7 +102,7 @@ Kirigami.ApplicationWindow { detailsWindow.cylinderModel2 = manager.cylinderInit detailsWindow.cylinderModel3 = manager.cylinderInit detailsWindow.cylinderModel4 = manager.cylinderInit - detailsWindow.cylinderIndex0 = -1 + detailsWindow.cylinderIndex0 = general.default_cylinder == "" ? -1 : detailsWindow.cylinderModel0.indexOf(general.default_cylinder) detailsWindow.usedCyl = ["",] detailsWindow.weight = "" detailsWindow.usedGas = [] @@ -371,6 +372,8 @@ if you have network connectivity and want to sync your data to cloud storage."), text: qsTr("Settings") onTriggered: { globalDrawer.close() + settingsWindow.defaultCylinderModel = manager.cylinderInit + general.default_cylinder === "" ? defaultCylinderIndex = "-1" : defaultCylinderIndex = settingsWindow.defaultCylinderModel.indexOf(general.default_cylinder) stackView.push(settingsWindow) detailsWindow.endEditMode() } @@ -619,6 +622,10 @@ if you have network connectivity and want to sync your data to cloud storage."), visible: false } + SsrfGeneralPrefs { + id: general + } + onPluggedInDeviceNameChanged: { if (detailsWindow.state === 'edit' || detailsWindow.state === 'add') { /* we're in the middle of editing / adding a dive */ -- cgit v1.2.3-70-g09d2