mobile-widgets/qml/settings.qml: show all colors

Show all colors in a theme, allowing user to change theme.

This is preparation for allowing users to click on the individual
colors and change them.

Signed-off-by: jan Iversen <jan@casacondor.com>
This commit is contained in:
jan Iversen 2020-01-27 23:12:40 +01:00 committed by Dirk Hohndel
parent 15fbcb655a
commit c3be85fbd9

View file

@ -139,171 +139,181 @@ TemplatePage {
title: qsTr("Theme") title: qsTr("Theme")
GridLayout { GridLayout {
id: themeSettings
visible: sectionTheme.isExpanded visible: sectionTheme.isExpanded
columns: 3 columns: 2
TemplateLabel { TemplateComboBox {
text: qsTr("Blue") editable: false
rightPadding: Kirigami.Units.gridUnit Layout.columnSpan: 2
Layout.preferredWidth: gridWidth * 0.15 currentIndex: (ThemeNew.currentTheme === "Blue") ? 0 :
} (ThemeNew.currentTheme === "Pink") ? 1 : 2
Row { model: ListModel {
Layout.preferredWidth: gridWidth * 0.6 ListElement {text: qsTr("Blue")}
Rectangle { ListElement {text: qsTr("Pink")}
id: blueRect ListElement {text: qsTr("Dark")}
color: ThemeNew.blueBackgroundColor
border.color: "black"
width: sampleRegularBlue.width + Kirigami.Units.gridUnit
height: Kirigami.Units.gridUnit * 2
Text {
id: sampleRegularBlue
text: qsTr("regular text")
font.pointSize: subsurfaceTheme.regularPointSize
color: ThemeNew.blueTextColor
anchors {
horizontalCenter: parent.horizontalCenter
verticalCenter: parent.verticalCenter
}
}
} }
Rectangle { onActivated: {
color: ThemeNew.bluePrimaryColor ThemeNew.currentTheme = currentIndex === 0 ? "Blue" :
border.color: "black" currentIndex === 1 ? "Pink" : "Dark"
width: sampleHighlightBlue.width + Kirigami.Units.gridUnit
height: Kirigami.Units.gridUnit * 2
Text {
id: sampleHighlightBlue
text: qsTr("Highlight")
font.pointSize: subsurfaceTheme.regularPointSize
color: ThemeNew.bluePrimaryTextColor
anchors {
horizontalCenter: parent.horizontalCenter
verticalCenter: parent.verticalCenter
}
}
}
}
SsrfSwitch {
id: blueButton
Layout.preferredWidth: gridWidth * 0.25
checked: ThemeNew.currentTheme === "Blue"
enabled: ThemeNew.currentTheme !== "Blue"
onClicked: {
ThemeNew.currentTheme = "Blue"
} }
} }
TemplateLabel { Rectangle {
id: pinkLabel border.width: 2
text: qsTr("Pink") border.color: "black"
rightPadding: Kirigami.Units.gridUnit color: subsurfaceTheme.backgroundColor
Layout.preferredWidth: gridWidth * 0.15
} width: rootItem.width / 2 - 20
Row { height: subsurfaceTheme.regularPointSize + 10
Layout.preferredWidth: gridWidth * 0.6
Rectangle { TemplateLabel {
id: pinkRect text: qsTr("background")
color: ThemeNew.pinkBackgroundColor color: "black"
border.color: "black" anchors.horizontalCenter: parent.horizontalCenter
width: sampleRegularPink.width + Kirigami.Units.gridUnit anchors.verticalCenter: parent.verticalCenter
height: Kirigami.Units.gridUnit * 2
Text {
id: sampleRegularPink
text: qsTr("regular text")
font.pointSize: subsurfaceTheme.regularPointSize
color: ThemeNew.pinkTextColor
anchors {
horizontalCenter: parent.horizontalCenter
verticalCenter: parent.verticalCenter
}
}
} }
Rectangle { }
color: ThemeNew.pinkPrimaryColor Rectangle {
border.color: "black" border.width: 2
width: sampleHighlightPink.width + Kirigami.Units.gridUnit border.color: "black"
height: Kirigami.Units.gridUnit * 2 color: "white"
Text { width: rootItem.width / 2 - 60
id: sampleHighlightPink height: subsurfaceTheme.regularPointSize + 10
text: qsTr("Highlight")
font.pointSize: subsurfaceTheme.regularPointSize TemplateLabel {
color: ThemeNew.pinkPrimaryTextColor text: qsTr("text")
anchors { color: subsurfaceTheme.textColor
horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
}
}
} }
} }
SsrfSwitch { Rectangle {
id: pinkButton border.width: 2
Layout.preferredWidth: gridWidth * 0.25 border.color: "black"
checked: ThemeNew.currentTheme === "Pink" color: subsurfaceTheme.primaryColor
enabled: ThemeNew.currentTheme !== "Pink"
onClicked: { width: rootItem.width / 2 - 20
ThemeNew.currentTheme = "Pink" height: subsurfaceTheme.regularPointSize + 10
TemplateLabel {
text: qsTr("primary")
color: "black"
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
}
}
Rectangle {
border.width: 2
border.color: "black"
color: "white"
width: rootItem.width / 2 - 60
height: subsurfaceTheme.regularPointSize + 10
TemplateLabel {
text: qsTr("text")
color: subsurfaceTheme.primaryTextColor
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
} }
} }
Rectangle {
border.width: 2
border.color: "black"
color: subsurfaceTheme.darkerPrimaryColor
width: rootItem.width / 2 - 20
height: subsurfaceTheme.regularPointSize + 10
TemplateLabel {
text: qsTr("darker primary")
color: "black"
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
}
}
Rectangle {
border.width: 2
border.color: "black"
color: "white"
width: rootItem.width / 2 - 60
height: subsurfaceTheme.regularPointSize + 10
TemplateLabel {
text: qsTr("text")
color: subsurfaceTheme.darkerPrimaryTextColor
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
}
}
Rectangle {
border.width: 2
border.color: "black"
color: subsurfaceTheme.lightPrimaryColor
width: rootItem.width / 2 - 20
height: subsurfaceTheme.regularPointSize + 10
TemplateLabel {
text: qsTr("light primary")
color: "black"
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
}
}
Rectangle {
border.width: 2
border.color: "black"
color: "white"
width: rootItem.width / 2 - 60
height: subsurfaceTheme.regularPointSize + 10
TemplateLabel {
text: qsTr("text")
color: subsurfaceTheme.lightPrimaryTextColor
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
}
}
TemplateLabel { TemplateLabel {
text: qsTr("Dark") text: ""
rightPadding: Kirigami.Units.gridUnit
Layout.preferredWidth: gridWidth * 0.15
} }
Row { Rectangle {
Layout.preferredWidth: gridWidth * 0.6 border.width: 2
Rectangle { border.color: "black"
id: blackRect color: "white"
color: ThemeNew.darkBackgroundColor width: rootItem.width / 2 - 60
border.color: "black" height: subsurfaceTheme.regularPointSize + 10
width: sampleRegularDark.width + Kirigami.Units.gridUnit
height: Kirigami.Units.gridUnit * 2 TemplateLabel {
Text { text: qsTr("secondary text")
id: sampleRegularDark color: subsurfaceTheme.secondaryTextColor
text: qsTr("regular text") anchors.horizontalCenter: parent.horizontalCenter
font.pointSize: subsurfaceTheme.regularPointSize anchors.verticalCenter: parent.verticalCenter
color: ThemeNew.darkTextColor
anchors {
horizontalCenter: parent.horizontalCenter
verticalCenter: parent.verticalCenter
}
}
}
Rectangle {
color: ThemeNew.darkPrimaryColor
border.color: "black"
width: sampleHighlightDark.width + Kirigami.Units.gridUnit
height: Kirigami.Units.gridUnit * 2
Text {
id: sampleHighlightDark
text: qsTr("Highlight")
font.pointSize: subsurfaceTheme.regularPointSize
color: ThemeNew.darkPrimaryTextColor
anchors {
horizontalCenter: parent.horizontalCenter
verticalCenter: parent.verticalCenter
}
}
} }
} }
SsrfSwitch {
id: darkButton Rectangle {
Layout.preferredWidth: gridWidth * 0.25 border.width: 2
checked: ThemeNew.currentTheme === "Dark" border.color: "black"
enabled: ThemeNew.currentTheme !== "Dark" color: subsurfaceTheme.drawerColor
onClicked: {
ThemeNew.currentTheme = "Dark" width: rootItem.width / 2 - 20
height: subsurfaceTheme.regularPointSize + 10
TemplateLabel {
text: qsTr("drawer")
color: "black"
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
} }
} }
TemplateLabel { TemplateLabel {
text: qsTr("Scaling") text: ""
font.pointSize: subsurfaceTheme.headingPointSize
font.weight: Font.Light
Layout.topMargin: Kirigami.Units.largeSpacing
Layout.bottomMargin: Kirigami.Units.largeSpacing / 2
Layout.columnSpan: 3
} }
Row { Row {
Layout.preferredWidth: gridWidth * 0.8 Layout.preferredWidth: gridWidth * 0.8
@ -331,9 +341,10 @@ TemplatePage {
} }
} }
} }
Rectangle {
}
} }
} }
TemplateSection { TemplateSection {
id: sectionUnits id: sectionUnits
title: qsTr("Units") title: qsTr("Units")