mobile/UI: simplify and cleanup Settings

This is both cleaner and looks better.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2021-01-15 17:14:07 -08:00
parent 74bb2c49bf
commit da42c0b104

View file

@ -362,8 +362,6 @@ TemplatePage {
} }
} }
} }
Rectangle {
}
} }
} }
TemplateSection { TemplateSection {
@ -541,37 +539,31 @@ TemplatePage {
} }
TemplateLabel { TemplateLabel {
text: qsTr("Distance threshold (meters)") text: qsTr("Distance threshold (meters)")
//Layout.preferredWidth: gridWidth * 0.75
} }
TemplateTextField { TemplateTextField {
id: distanceThreshold id: distanceThreshold
Layout.preferredWidth: Kirigami.Units.gridUnit * 2
text: PrefLocationService.distance_threshold text: PrefLocationService.distance_threshold
//Layout.preferredWidth: gridWidth * 0.25
onEditingFinished: { onEditingFinished: {
PrefLocationService.distance_threshold = distanceThreshold.text PrefLocationService.distance_threshold = distanceThreshold.text
} }
} }
TemplateLabel { TemplateLabel {
text: qsTr("Time threshold (minutes)") text: qsTr("Time threshold (minutes)")
//Layout.preferredWidth: gridWidth * 0.75
} }
TemplateTextField { TemplateTextField {
id: timeThreshold id: timeThreshold
Layout.preferredWidth: Kirigami.Units.gridUnit * 2
text: PrefLocationService.time_threshold / 60 text: PrefLocationService.time_threshold / 60
//Layout.preferredWidth: gridWidth * 0.25
onEditingFinished: { onEditingFinished: {
PrefLocationService.time_threshold = timeThreshold.text * 60 PrefLocationService.time_threshold = timeThreshold.text * 60
} }
} }
}
TemplateLine { TemplateLine {
visible: sectionAdvanced.isExpanded visible: sectionAdvanced.isExpanded
} Layout.columnSpan: 2
GridLayout { }
id: whichBluetoothDevices
visible: sectionAdvanced.isExpanded
width: parent.width
columns: 2
TemplateLabel { TemplateLabel {
text: qsTr("Bluetooth") text: qsTr("Bluetooth")
font.pointSize: subsurfaceTheme.headingPointSize font.pointSize: subsurfaceTheme.headingPointSize
@ -583,25 +575,19 @@ TemplatePage {
TemplateLabel { TemplateLabel {
text: qsTr("Temporarily show all bluetooth devices \neven if not recognized as dive computers.\nPlease report DCs that need this setting") text: qsTr("Temporarily show all bluetooth devices \neven if not recognized as dive computers.\nPlease report DCs that need this setting")
Layout.fillWidth: true Layout.fillWidth: true
//Layout.preferredWidth: gridWidth * 0.75
} }
SsrfSwitch { SsrfSwitch {
id: nonDCButton id: nonDCButton
checked: manager.showNonDiveComputers checked: manager.showNonDiveComputers
//Layout.preferredWidth: gridWidth * 0.25
onClicked: { onClicked: {
manager.showNonDiveComputers = checked manager.showNonDiveComputers = checked
} }
} }
}
TemplateLine { TemplateLine {
visible: sectionAdvanced.isExpanded visible: sectionAdvanced.isExpanded
} Layout.columnSpan: 2
GridLayout { }
id: display
visible: sectionAdvanced.isExpanded
width: parent.width
columns: 2
TemplateLabel { TemplateLabel {
text: qsTr("Display") text: qsTr("Display")
font.pointSize: subsurfaceTheme.headingPointSize font.pointSize: subsurfaceTheme.headingPointSize
@ -613,25 +599,18 @@ TemplatePage {
TemplateLabel { TemplateLabel {
text: qsTr("Show only one column in Portrait mode") text: qsTr("Show only one column in Portrait mode")
Layout.fillWidth: true Layout.fillWidth: true
//Layout.preferredWidth: gridWidth * 0.75
} }
SsrfSwitch { SsrfSwitch {
id: singleColumnButton id: singleColumnButton
checked: PrefDisplay.singleColumnPortrait checked: PrefDisplay.singleColumnPortrait
//Layout.preferredWidth: gridWidth * 0.25
onClicked: { onClicked: {
PrefDisplay.singleColumnPortrait = checked PrefDisplay.singleColumnPortrait = checked
} }
} }
} TemplateLine {
TemplateLine { visible: sectionAdvanced.isExpanded
visible: sectionAdvanced.isExpanded Layout.columnSpan: 2
} }
GridLayout {
id: profilePrefs
visible: sectionAdvanced.isExpanded
width: parent.width
columns: 2
TemplateLabel { TemplateLabel {
text: qsTr("Profile deco ceiling") text: qsTr("Profile deco ceiling")
font.pointSize: subsurfaceTheme.headingPointSize font.pointSize: subsurfaceTheme.headingPointSize
@ -665,6 +644,7 @@ TemplatePage {
} }
TemplateTextField { TemplateTextField {
id: gfLow id: gfLow
Layout.preferredWidth: Kirigami.Units.gridUnit * 2
text: PrefTechnicalDetails.gflow text: PrefTechnicalDetails.gflow
inputMask: "99" inputMask: "99"
onEditingFinished: { onEditingFinished: {
@ -677,6 +657,7 @@ TemplatePage {
} }
TemplateTextField { TemplateTextField {
id: gfHigh id: gfHigh
Layout.preferredWidth: Kirigami.Units.gridUnit * 2
text: PrefTechnicalDetails.gfhigh text: PrefTechnicalDetails.gfhigh
inputMask: "99" inputMask: "99"
onEditingFinished: { onEditingFinished: {
@ -684,16 +665,10 @@ TemplatePage {
rootItem.settingsChanged() rootItem.settingsChanged()
} }
} }
} TemplateLine {
TemplateLine { visible: sectionAdvanced.isExpanded
visible: sectionAdvanced.isExpanded Layout.columnSpan: 2
} }
GridLayout {
id: developer
visible: sectionAdvanced.isExpanded
width: parent.width
columns: 2
TemplateLabel { TemplateLabel {
text: qsTr("Developer") text: qsTr("Developer")
font.pointSize: subsurfaceTheme.headingPointSize font.pointSize: subsurfaceTheme.headingPointSize
@ -705,12 +680,10 @@ TemplatePage {
TemplateLabel { TemplateLabel {
text: qsTr("Display Developer menu") text: qsTr("Display Developer menu")
Layout.fillWidth: true Layout.fillWidth: true
//Layout.preferredWidth: gridWidth * 0.75
} }
SsrfSwitch { SsrfSwitch {
id: developerButton id: developerButton
checked: PrefDisplay.show_developer checked: PrefDisplay.show_developer
//sLayout.preferredWidth: gridWidth * 0.25
onClicked: { onClicked: {
PrefDisplay.show_developer = checked PrefDisplay.show_developer = checked
} }