mobile-widgets/qml: create theme section and move themesettings

Move gridlayout themesetting to TemplateSection theme and use the
TemplateTitle.  Also switch from using PrefDisplay.mobile_scale to
subsurfaceTheme.currentScale

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:42:16 +01:00 committed by Dirk Hohndel
parent ba7a8f68bc
commit 0443d7f2c9

View file

@ -132,19 +132,15 @@ Kirigami.ScrollablePage {
} }
} }
TemplateSection {
id: sectionTheme
title: qsTr("Theme")
GridLayout { GridLayout {
id: themeSettings id: themeSettings
visible: sectionTheme.isExpanded
columns: 3 columns: 3
TemplateLabel {
text: qsTr("Theme")
font.pointSize: subsurfaceTheme.headingPointSize
font.weight: Font.Light
Layout.topMargin: Kirigami.Units.largeSpacing
Layout.bottomMargin: Kirigami.Units.largeSpacing / 2
Layout.columnSpan: 3
}
TemplateLabel { TemplateLabel {
text: qsTr("Blue") text: qsTr("Blue")
rightPadding: Kirigami.Units.gridUnit rightPadding: Kirigami.Units.gridUnit
@ -316,7 +312,7 @@ Kirigami.ScrollablePage {
spacing: Kirigami.Units.largeSpacing spacing: Kirigami.Units.largeSpacing
SsrfButton { SsrfButton {
text: qsTr("smaller") text: qsTr("smaller")
enabled: PrefDisplay.mobile_scale !== 0.85 enabled: subsurfaceTheme.currentScale !== 0.85
onClicked: { onClicked: {
PrefDisplay.mobile_scale = 0.85 PrefDisplay.mobile_scale = 0.85
fontMetrics.font.pointSize = subsurfaceTheme.basePointSize * PrefDisplay.mobile_scale; fontMetrics.font.pointSize = subsurfaceTheme.basePointSize * PrefDisplay.mobile_scale;
@ -324,7 +320,7 @@ Kirigami.ScrollablePage {
} }
SsrfButton { SsrfButton {
text: qsTr("regular") text: qsTr("regular")
enabled: PrefDisplay.mobile_scale !== 1.0 enabled: subsurfaceTheme.currentScale !== 1.0
onClicked: { onClicked: {
PrefDisplay.mobile_scale = 1.0 PrefDisplay.mobile_scale = 1.0
fontMetrics.font.pointSize = subsurfaceTheme.basePointSize * PrefDisplay.mobile_scale; fontMetrics.font.pointSize = subsurfaceTheme.basePointSize * PrefDisplay.mobile_scale;
@ -332,14 +328,14 @@ Kirigami.ScrollablePage {
} }
SsrfButton { SsrfButton {
text: qsTr("larger") text: qsTr("larger")
enabled: PrefDisplay.mobile_scale !== 1.15 enabled: subsurfaceTheme.currentScale !== 1.15
onClicked: { onClicked: {
PrefDisplay.mobile_scale = 1.15 PrefDisplay.mobile_scale = 1.15
fontMetrics.font.pointSize = subsurfaceTheme.basePointSize * PrefDisplay.mobile_scale; fontMetrics.font.pointSize = subsurfaceTheme.basePointSize * PrefDisplay.mobile_scale;
} }
} }
} }
}
} }
Rectangle { Rectangle {