mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
QML UI: replace all switches with our own
As per title, helps simplify theme modifications. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
This commit is contained in:
parent
93ec03105e
commit
071db08b14
2 changed files with 8 additions and 133 deletions
|
@ -96,7 +96,7 @@ Item {
|
||||||
text: qsTr("Show password")
|
text: qsTr("Show password")
|
||||||
Layout.preferredWidth: col1Width
|
Layout.preferredWidth: col1Width
|
||||||
}
|
}
|
||||||
Switch {
|
SsrfSwitch {
|
||||||
checked: false
|
checked: false
|
||||||
id: showPassword
|
id: showPassword
|
||||||
Layout.preferredWidth: col2Width
|
Layout.preferredWidth: col2Width
|
||||||
|
@ -105,27 +105,6 @@ Item {
|
||||||
password.text = "" // don't show a hidden password
|
password.text = "" // don't show a hidden password
|
||||||
password.echoMode = checked ? TextInput.Normal : TextInput.Password
|
password.echoMode = checked ? TextInput.Normal : TextInput.Password
|
||||||
}
|
}
|
||||||
indicator: Rectangle {
|
|
||||||
implicitWidth: Kirigami.Units.largeSpacing * 3
|
|
||||||
implicitHeight: Kirigami.Units.largeSpacing
|
|
||||||
x: showPassword.leftPadding
|
|
||||||
y: parent.height / 2 - height / 2
|
|
||||||
radius: Kirigami.Units.largeSpacing * 0.5
|
|
||||||
color: showPassword.checked ?
|
|
||||||
subsurfaceTheme.lightPrimaryColor : subsurfaceTheme.backgroundColor
|
|
||||||
border.color: subsurfaceTheme.darkerPrimaryColor
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
x: showPassword.checked ? parent.width - width : 0
|
|
||||||
y: parent.height / 2 - height / 2
|
|
||||||
width: Kirigami.Units.largeSpacing * 1.5
|
|
||||||
height: Kirigami.Units.largeSpacing * 1.5
|
|
||||||
radius: height / 2
|
|
||||||
color: showPassword.down || showPassword.checked ?
|
|
||||||
subsurfaceTheme.primaryColor : subsurfaceTheme.lightPrimaryColor
|
|
||||||
border.color: subsurfaceTheme.darkerPrimaryColor
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,7 +82,7 @@ Kirigami.ScrollablePage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Switch {
|
SsrfSwitch {
|
||||||
id: blueButton
|
id: blueButton
|
||||||
Layout.preferredWidth: gridWidth * 0.25
|
Layout.preferredWidth: gridWidth * 0.25
|
||||||
checked: subsurfaceTheme.currentTheme === "Blue"
|
checked: subsurfaceTheme.currentTheme === "Blue"
|
||||||
|
@ -92,27 +92,6 @@ Kirigami.ScrollablePage {
|
||||||
manager.theme = subsurfaceTheme.currentTheme
|
manager.theme = subsurfaceTheme.currentTheme
|
||||||
manager.savePreferences()
|
manager.savePreferences()
|
||||||
}
|
}
|
||||||
indicator: Rectangle {
|
|
||||||
implicitWidth: Kirigami.Units.largeSpacing * 3
|
|
||||||
implicitHeight: Kirigami.Units.largeSpacing
|
|
||||||
x: blueButton.leftPadding
|
|
||||||
y: parent.height / 2 - height / 2
|
|
||||||
radius: Kirigami.Units.largeSpacing * 0.5
|
|
||||||
color: blueButton.checked ?
|
|
||||||
subsurfaceTheme.lightPrimaryColor : subsurfaceTheme.backgroundColor
|
|
||||||
border.color: subsurfaceTheme.darkerPrimaryColor
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
x: blueButton.checked ? parent.width - width : 0
|
|
||||||
y: parent.height / 2 - height / 2
|
|
||||||
width: Kirigami.Units.largeSpacing * 1.5
|
|
||||||
height: Kirigami.Units.largeSpacing * 1.5
|
|
||||||
radius: height / 2
|
|
||||||
color: blueButton.down || blueButton.checked ?
|
|
||||||
subsurfaceTheme.primaryColor : subsurfaceTheme.lightPrimaryColor
|
|
||||||
border.color: subsurfaceTheme.darkerPrimaryColor
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Kirigami.Label {
|
Kirigami.Label {
|
||||||
|
@ -156,7 +135,7 @@ Kirigami.ScrollablePage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Switch {
|
SsrfSwitch {
|
||||||
id: pinkButton
|
id: pinkButton
|
||||||
Layout.preferredWidth: gridWidth * 0.25
|
Layout.preferredWidth: gridWidth * 0.25
|
||||||
checked: subsurfaceTheme.currentTheme === "Pink"
|
checked: subsurfaceTheme.currentTheme === "Pink"
|
||||||
|
@ -166,27 +145,6 @@ Kirigami.ScrollablePage {
|
||||||
manager.theme = subsurfaceTheme.currentTheme
|
manager.theme = subsurfaceTheme.currentTheme
|
||||||
manager.savePreferences()
|
manager.savePreferences()
|
||||||
}
|
}
|
||||||
indicator: Rectangle {
|
|
||||||
implicitWidth: Kirigami.Units.largeSpacing * 3
|
|
||||||
implicitHeight: Kirigami.Units.largeSpacing
|
|
||||||
x: pinkButton.leftPadding
|
|
||||||
y: parent.height / 2 - height / 2
|
|
||||||
radius: Kirigami.Units.largeSpacing * 0.5
|
|
||||||
color: pinkButton.checked ?
|
|
||||||
subsurfaceTheme.lightPrimaryColor : subsurfaceTheme.backgroundColor
|
|
||||||
border.color: subsurfaceTheme.darkerPrimaryColor
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
x: pinkButton.checked ? parent.width - width : 0
|
|
||||||
y: parent.height / 2 - height / 2
|
|
||||||
width: Kirigami.Units.largeSpacing * 1.5
|
|
||||||
height: Kirigami.Units.largeSpacing * 1.5
|
|
||||||
radius: height / 2
|
|
||||||
color: pinkButton.down || pinkButton.checked ?
|
|
||||||
subsurfaceTheme.primaryColor : subsurfaceTheme.lightPrimaryColor
|
|
||||||
border.color: subsurfaceTheme.darkerPrimaryColor
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Kirigami.Label {
|
Kirigami.Label {
|
||||||
|
@ -229,7 +187,7 @@ Kirigami.ScrollablePage {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Switch {
|
SsrfSwitch {
|
||||||
id: darkButton
|
id: darkButton
|
||||||
Layout.preferredWidth: gridWidth * 0.25
|
Layout.preferredWidth: gridWidth * 0.25
|
||||||
checked: subsurfaceTheme.currentTheme === "Dark"
|
checked: subsurfaceTheme.currentTheme === "Dark"
|
||||||
|
@ -239,29 +197,9 @@ Kirigami.ScrollablePage {
|
||||||
manager.theme = subsurfaceTheme.currentTheme
|
manager.theme = subsurfaceTheme.currentTheme
|
||||||
manager.savePreferences()
|
manager.savePreferences()
|
||||||
}
|
}
|
||||||
indicator: Rectangle {
|
|
||||||
implicitWidth: Kirigami.Units.largeSpacing * 3
|
|
||||||
implicitHeight: Kirigami.Units.largeSpacing
|
|
||||||
x: darkButton.leftPadding
|
|
||||||
y: parent.height / 2 - height / 2
|
|
||||||
radius: Kirigami.Units.largeSpacing * 0.5
|
|
||||||
color: darkButton.checked ?
|
|
||||||
subsurfaceTheme.lightPrimaryColor : subsurfaceTheme.backgroundColor
|
|
||||||
border.color: subsurfaceTheme.darkerPrimaryColor
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
x: darkButton.checked ? parent.width - width : 0
|
|
||||||
y: parent.height / 2 - height / 2
|
|
||||||
width: Kirigami.Units.largeSpacing * 1.5
|
|
||||||
height: Kirigami.Units.largeSpacing * 1.5
|
|
||||||
radius: height / 2
|
|
||||||
color: darkButton.down || darkButton.checked ?
|
|
||||||
subsurfaceTheme.primaryColor : subsurfaceTheme.lightPrimaryColor
|
|
||||||
border.color: subsurfaceTheme.darkerPrimaryColor
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
color: subsurfaceTheme.darkerPrimaryColor
|
color: subsurfaceTheme.darkerPrimaryColor
|
||||||
height: 1
|
height: 1
|
||||||
|
@ -338,34 +276,13 @@ Kirigami.ScrollablePage {
|
||||||
text: qsTr("Save detailed log")
|
text: qsTr("Save detailed log")
|
||||||
Layout.preferredWidth: gridWidth * 0.75
|
Layout.preferredWidth: gridWidth * 0.75
|
||||||
}
|
}
|
||||||
Switch {
|
SsrfSwitch {
|
||||||
id: libdclogButton
|
id: libdclogButton
|
||||||
checked: manager.libdcLog
|
checked: manager.libdcLog
|
||||||
Layout.preferredWidth: gridWidth * 0.25
|
Layout.preferredWidth: gridWidth * 0.25
|
||||||
onClicked: {
|
onClicked: {
|
||||||
manager.libdcLog = checked
|
manager.libdcLog = checked
|
||||||
}
|
}
|
||||||
indicator: Rectangle {
|
|
||||||
implicitWidth: Kirigami.Units.largeSpacing * 3
|
|
||||||
implicitHeight: Kirigami.Units.largeSpacing
|
|
||||||
x: libdclogButton.leftPadding
|
|
||||||
y: parent.height / 2 - height / 2
|
|
||||||
radius: Kirigami.Units.largeSpacing * 0.5
|
|
||||||
color: libdclogButton.checked ?
|
|
||||||
subsurfaceTheme.lightPrimaryColor : subsurfaceTheme.backgroundColor
|
|
||||||
border.color: subsurfaceTheme.darkerPrimaryColor
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
x: libdclogButton.checked ? parent.width - width : 0
|
|
||||||
y: parent.height / 2 - height / 2
|
|
||||||
width: Kirigami.Units.largeSpacing * 1.5
|
|
||||||
height: Kirigami.Units.largeSpacing * 1.5
|
|
||||||
radius: height / 2
|
|
||||||
color: libdclogButton.down || libdclogButton.checked ?
|
|
||||||
subsurfaceTheme.primaryColor : subsurfaceTheme.lightPrimaryColor
|
|
||||||
border.color: subsurfaceTheme.darkerPrimaryColor
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
@ -391,34 +308,13 @@ Kirigami.ScrollablePage {
|
||||||
text: qsTr("Display Developer menu")
|
text: qsTr("Display Developer menu")
|
||||||
Layout.preferredWidth: gridWidth * 0.75
|
Layout.preferredWidth: gridWidth * 0.75
|
||||||
}
|
}
|
||||||
Switch {
|
SsrfSwitch {
|
||||||
id: developerButton
|
id: developerButton
|
||||||
checked: manager.developer
|
checked: manager.developer
|
||||||
Layout.preferredWidth: gridWidth * 0.25
|
Layout.preferredWidth: gridWidth * 0.25
|
||||||
onClicked: {
|
onClicked: {
|
||||||
manager.developer = checked
|
manager.developer = checked
|
||||||
}
|
}
|
||||||
indicator: Rectangle {
|
|
||||||
implicitWidth: Kirigami.Units.largeSpacing * 3
|
|
||||||
implicitHeight: Kirigami.Units.largeSpacing
|
|
||||||
x: developerButton.leftPadding
|
|
||||||
y: parent.height / 2 - height / 2
|
|
||||||
radius: Kirigami.Units.largeSpacing * 0.5
|
|
||||||
color: developerButton.checked ?
|
|
||||||
subsurfaceTheme.lightPrimaryColor : subsurfaceTheme.backgroundColor
|
|
||||||
border.color: subsurfaceTheme.darkerPrimaryColor
|
|
||||||
|
|
||||||
Rectangle {
|
|
||||||
x: developerButton.checked ? parent.width - width : 0
|
|
||||||
y: parent.height / 2 - height / 2
|
|
||||||
width: Kirigami.Units.largeSpacing * 1.5
|
|
||||||
height: Kirigami.Units.largeSpacing * 1.5
|
|
||||||
radius: height / 2
|
|
||||||
color: developerButton.down || developerButton.checked ?
|
|
||||||
subsurfaceTheme.primaryColor : subsurfaceTheme.lightPrimaryColor
|
|
||||||
border.color: subsurfaceTheme.darkerPrimaryColor
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Item {
|
Item {
|
||||||
|
|
Loading…
Add table
Reference in a new issue