mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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 <j.bygdell@gmail.com>
This commit is contained in:
parent
011158b25c
commit
02af3463d0
2 changed files with 46 additions and 1 deletions
|
@ -10,6 +10,9 @@ import org.subsurfacedivelog.mobile 1.0
|
||||||
Kirigami.ScrollablePage {
|
Kirigami.ScrollablePage {
|
||||||
objectName: "Settings"
|
objectName: "Settings"
|
||||||
id: settingsPage
|
id: settingsPage
|
||||||
|
property alias defaultCylinderModel: defaultCylinderBox.model
|
||||||
|
property alias defaultCylinderIndex: defaultCylinderBox.currentIndex
|
||||||
|
|
||||||
title: qsTr("Settings")
|
title: qsTr("Settings")
|
||||||
background: Rectangle { color: subsurfaceTheme.backgroundColor }
|
background: Rectangle { color: subsurfaceTheme.backgroundColor }
|
||||||
|
|
||||||
|
@ -300,6 +303,41 @@ Kirigami.ScrollablePage {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Rectangle {
|
||||||
|
color: subsurfaceTheme.darkerPrimaryColor
|
||||||
|
height: 1
|
||||||
|
opacity: 0.5
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
GridLayout {
|
||||||
|
id: defaultCylinder
|
||||||
|
columns: 2
|
||||||
|
width: parent.width - Kirigami.Units.gridUnit
|
||||||
|
|
||||||
|
Kirigami.Heading {
|
||||||
|
text: qsTr("Default Cylinder")
|
||||||
|
color: subsurfaceTheme.textColor
|
||||||
|
level: 4
|
||||||
|
Layout.topMargin: Kirigami.Units.largeSpacing
|
||||||
|
Layout.bottomMargin: Kirigami.Units.largeSpacing / 2
|
||||||
|
Layout.columnSpan: 2
|
||||||
|
}
|
||||||
|
Controls.Label {
|
||||||
|
Layout.alignment: Qt.AlignRight
|
||||||
|
text: qsTr("Cylinder:")
|
||||||
|
font.pointSize: subsurfaceTheme.smallPointSize
|
||||||
|
}
|
||||||
|
Controls.ComboBox {
|
||||||
|
id: defaultCylinderBox
|
||||||
|
flat: true
|
||||||
|
inputMethodHints: Qt.ImhNoPredictiveText
|
||||||
|
Layout.fillWidth: true
|
||||||
|
onActivated: {
|
||||||
|
general.set_default_cylinder(defaultCylinderBox.currentText)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
color: subsurfaceTheme.darkerPrimaryColor
|
color: subsurfaceTheme.darkerPrimaryColor
|
||||||
height: 1
|
height: 1
|
||||||
|
|
|
@ -27,6 +27,7 @@ Kirigami.ApplicationWindow {
|
||||||
property alias locationServiceEnabled: manager.locationServiceEnabled
|
property alias locationServiceEnabled: manager.locationServiceEnabled
|
||||||
property alias pluggedInDeviceName: manager.pluggedInDeviceName
|
property alias pluggedInDeviceName: manager.pluggedInDeviceName
|
||||||
property alias showPin: prefs.showPin
|
property alias showPin: prefs.showPin
|
||||||
|
property alias defaultCylinderIndex: settingsWindow.defaultCylinderIndex
|
||||||
onNotificationTextChanged: {
|
onNotificationTextChanged: {
|
||||||
if (notificationText != "") {
|
if (notificationText != "") {
|
||||||
// there's a risk that we have a >5 second gap in update events;
|
// 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.cylinderModel2 = manager.cylinderInit
|
||||||
detailsWindow.cylinderModel3 = manager.cylinderInit
|
detailsWindow.cylinderModel3 = manager.cylinderInit
|
||||||
detailsWindow.cylinderModel4 = manager.cylinderInit
|
detailsWindow.cylinderModel4 = manager.cylinderInit
|
||||||
detailsWindow.cylinderIndex0 = -1
|
detailsWindow.cylinderIndex0 = general.default_cylinder == "" ? -1 : detailsWindow.cylinderModel0.indexOf(general.default_cylinder)
|
||||||
detailsWindow.usedCyl = ["",]
|
detailsWindow.usedCyl = ["",]
|
||||||
detailsWindow.weight = ""
|
detailsWindow.weight = ""
|
||||||
detailsWindow.usedGas = []
|
detailsWindow.usedGas = []
|
||||||
|
@ -371,6 +372,8 @@ if you have network connectivity and want to sync your data to cloud storage."),
|
||||||
text: qsTr("Settings")
|
text: qsTr("Settings")
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
globalDrawer.close()
|
globalDrawer.close()
|
||||||
|
settingsWindow.defaultCylinderModel = manager.cylinderInit
|
||||||
|
general.default_cylinder === "" ? defaultCylinderIndex = "-1" : defaultCylinderIndex = settingsWindow.defaultCylinderModel.indexOf(general.default_cylinder)
|
||||||
stackView.push(settingsWindow)
|
stackView.push(settingsWindow)
|
||||||
detailsWindow.endEditMode()
|
detailsWindow.endEditMode()
|
||||||
}
|
}
|
||||||
|
@ -619,6 +622,10 @@ if you have network connectivity and want to sync your data to cloud storage."),
|
||||||
visible: false
|
visible: false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SsrfGeneralPrefs {
|
||||||
|
id: general
|
||||||
|
}
|
||||||
|
|
||||||
onPluggedInDeviceNameChanged: {
|
onPluggedInDeviceNameChanged: {
|
||||||
if (detailsWindow.state === 'edit' || detailsWindow.state === 'add') {
|
if (detailsWindow.state === 'edit' || detailsWindow.state === 'add') {
|
||||||
/* we're in the middle of editing / adding a dive */
|
/* we're in the middle of editing / adding a dive */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue