mobile-widgets/qml: create units section and move unit_settings

Move gridlayout unit_settings to TemplateSection units, without changing
anything (apart from adding a visible: attribute).

Removed first label in units_settings, since it is the title of the section

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-15 19:46:48 +01:00 committed by Dirk Hohndel
parent 0443d7f2c9
commit 5bce4895cc

View file

@ -338,12 +338,48 @@ Kirigami.ScrollablePage {
} }
} }
Rectangle { TemplateSection {
color: subsurfaceTheme.darkerPrimaryColor id: sectionUnits
height: 1 title: qsTr("Units")
opacity: 0.5
Layout.fillWidth: true GridLayout {
id: unit_system
visible: sectionUnits.isExpanded
columns: 2
TemplateLabel {
text: qsTr("Use Imperial Units")
Layout.preferredWidth: gridWidth * 0.75
}
SsrfSwitch {
id: imperialButton
checked: PrefUnits.unit_system === "imperial"
enabled: PrefUnits.unit_system === "metric"
Layout.preferredWidth: gridWidth * 0.25
onClicked: {
PrefUnits.unit_system = "imperial"
manager.changesNeedSaving()
manager.refreshDiveList()
}
}
TemplateLabel {
text: qsTr("Use Metric Units")
Layout.preferredWidth: gridWidth * 0.75
}
SsrfSwitch {
id: metricButtton
checked: PrefUnits.unit_system === "metric"
enabled: PrefUnits.unit_system === "imperial"
Layout.preferredWidth: gridWidth * 0.25
onClicked: {
PrefUnits.unit_system = "metric"
manager.changesNeedSaving()
manager.refreshDiveList()
}
}
}
} }
GridLayout { GridLayout {
id: gpsPrefs id: gpsPrefs
columns: 2 columns: 2
@ -393,56 +429,6 @@ Kirigami.ScrollablePage {
Layout.fillWidth: true Layout.fillWidth: true
} }
GridLayout {
id: unit_system
columns: 2
TemplateLabel {
text: qsTr("Units")
font.pointSize: subsurfaceTheme.headingPointSize
font.weight: Font.Light
Layout.topMargin: Kirigami.Units.largeSpacing
Layout.bottomMargin: Kirigami.Units.largeSpacing / 2
Layout.columnSpan: 2
}
TemplateLabel {
text: qsTr("Use Imperial Units")
Layout.preferredWidth: gridWidth * 0.75
}
SsrfSwitch {
id: imperialButton
checked: PrefUnits.unit_system === "imperial"
enabled: PrefUnits.unit_system === "metric"
Layout.preferredWidth: gridWidth * 0.25
onClicked: {
PrefUnits.unit_system = "imperial"
manager.changesNeedSaving()
manager.refreshDiveList()
}
}
TemplateLabel {
text: qsTr("Use Metric Units")
Layout.preferredWidth: gridWidth * 0.75
}
SsrfSwitch {
id: metricButtton
checked: PrefUnits.unit_system === "metric"
enabled: PrefUnits.unit_system === "imperial"
Layout.preferredWidth: gridWidth * 0.25
onClicked: {
PrefUnits.unit_system = "metric"
manager.changesNeedSaving()
manager.refreshDiveList()
}
}
}
Rectangle {
color: subsurfaceTheme.darkerPrimaryColor
height: 1
opacity: 0.5
Layout.fillWidth: true
}
GridLayout { GridLayout {
id: filterPrefs id: filterPrefs
columns: 2 columns: 2