mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
QML UI: Replace checkboxes on settingspage with switches
Replace the checkboxes for location services and developer with switches. Signed-off-by: Joakim Bygdell <j.bygdell@gmail.com>
This commit is contained in:
parent
a5d43bc5f8
commit
a56e98ffc6
1 changed files with 45 additions and 37 deletions
|
@ -322,38 +322,42 @@ Kirigami.ScrollablePage {
|
||||||
}
|
}
|
||||||
GridLayout {
|
GridLayout {
|
||||||
id: locationService
|
id: locationService
|
||||||
columns: 2
|
columns: 4
|
||||||
width: parent.width
|
width: parent.width
|
||||||
CheckBox {
|
Kirigami.Label {
|
||||||
id: locationCheckbox
|
text: qsTr("Run location service")
|
||||||
|
Layout.preferredWidth: settingsPage.col1Width + settingsPage.col2Width + settingsPage.col3Width
|
||||||
|
}
|
||||||
|
Switch {
|
||||||
|
id: locationButton
|
||||||
|
Layout.preferredWidth: settingsPage.col4Width
|
||||||
visible: manager.locationServiceAvailable
|
visible: manager.locationServiceAvailable
|
||||||
checked: manager.locationServiceEnabled
|
checked: manager.locationServiceEnabled
|
||||||
onClicked: {
|
onClicked: {
|
||||||
manager.locationServiceEnabled = checked
|
manager.locationServiceEnabled = checked
|
||||||
}
|
}
|
||||||
indicator: Rectangle {
|
indicator: Rectangle {
|
||||||
implicitWidth: 20
|
implicitWidth: Kirigami.Units.largeSpacing * 3
|
||||||
implicitHeight: 20
|
implicitHeight: Kirigami.Units.largeSpacing
|
||||||
x: locationCheckbox.leftPadding
|
x: locationButton.leftPadding
|
||||||
y: parent.height / 2 - height / 2
|
y: parent.height / 2 - height / 2
|
||||||
radius: 4
|
radius: Kirigami.Units.largeSpacing * 0.5
|
||||||
border.color: locationCheckbox.down ? subsurfaceTheme.primaryColor : subsurfaceTheme.darkerPrimaryColor
|
color: locationButton.checked ?
|
||||||
color: subsurfaceTheme.backgroundColor
|
subsurfaceTheme.lightPrimaryColor : subsurfaceTheme.backgroundColor
|
||||||
|
border.color: subsurfaceTheme.darkerPrimaryColor
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: 12
|
x: locationButton.checked ? parent.width - width : 0
|
||||||
height: 12
|
y: parent.height / 2 - height / 2
|
||||||
x: 4
|
width: Kirigami.Units.largeSpacing * 1.5
|
||||||
y: 4
|
height: Kirigami.Units.largeSpacing * 1.5
|
||||||
radius: 3
|
radius: height / 2
|
||||||
color: locationCheckbox.down ? subsurfaceTheme.primaryColor : subsurfaceTheme.darkerPrimaryColor
|
color: locationButton.down || locationButton.checked ?
|
||||||
visible: locationCheckbox.checked
|
subsurfaceTheme.primaryColor : subsurfaceTheme.lightPrimaryColor
|
||||||
|
border.color: subsurfaceTheme.darkerPrimaryColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Kirigami.Label {
|
|
||||||
text: qsTr("Run location service")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
GridLayout {
|
GridLayout {
|
||||||
id: libdclogprefs
|
id: libdclogprefs
|
||||||
|
@ -404,7 +408,7 @@ Kirigami.ScrollablePage {
|
||||||
}
|
}
|
||||||
GridLayout {
|
GridLayout {
|
||||||
id: developer
|
id: developer
|
||||||
columns: 2
|
columns: 4
|
||||||
width: parent.width - Kirigami.Units.gridUnit
|
width: parent.width - Kirigami.Units.gridUnit
|
||||||
Kirigami.Heading {
|
Kirigami.Heading {
|
||||||
text: qsTr("Developer")
|
text: qsTr("Developer")
|
||||||
|
@ -412,38 +416,42 @@ Kirigami.ScrollablePage {
|
||||||
level: 4
|
level: 4
|
||||||
Layout.topMargin: Kirigami.Units.largeSpacing
|
Layout.topMargin: Kirigami.Units.largeSpacing
|
||||||
Layout.bottomMargin: Kirigami.Units.largeSpacing / 2
|
Layout.bottomMargin: Kirigami.Units.largeSpacing / 2
|
||||||
Layout.columnSpan: 2
|
Layout.columnSpan: 4
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckBox {
|
Kirigami.Label {
|
||||||
|
text: qsTr("Display Developer menu")
|
||||||
|
Layout.preferredWidth: settingsPage.col1Width + settingsPage.col2Width + settingsPage.col3Width
|
||||||
|
}
|
||||||
|
Switch {
|
||||||
id: developerButton
|
id: developerButton
|
||||||
checked: manager.developer
|
checked: manager.developer
|
||||||
|
Layout.preferredWidth: settingsPage.col4Width
|
||||||
onClicked: {
|
onClicked: {
|
||||||
manager.developer = checked
|
manager.developer = checked
|
||||||
}
|
}
|
||||||
indicator: Rectangle {
|
indicator: Rectangle {
|
||||||
implicitWidth: 20
|
implicitWidth: Kirigami.Units.largeSpacing * 3
|
||||||
implicitHeight: 20
|
implicitHeight: Kirigami.Units.largeSpacing
|
||||||
x: developerButton.leftPadding
|
x: developerButton.leftPadding
|
||||||
y: parent.height / 2 - height / 2
|
y: parent.height / 2 - height / 2
|
||||||
radius: 4
|
radius: Kirigami.Units.largeSpacing * 0.5
|
||||||
border.color: developerButton.down ? subsurfaceTheme.primaryColor : subsurfaceTheme.darkerPrimaryColor
|
color: developerButton.checked ?
|
||||||
color: subsurfaceTheme.backgroundColor
|
subsurfaceTheme.lightPrimaryColor : subsurfaceTheme.backgroundColor
|
||||||
|
border.color: subsurfaceTheme.darkerPrimaryColor
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
width: 12
|
x: developerButton.checked ? parent.width - width : 0
|
||||||
height: 12
|
y: parent.height / 2 - height / 2
|
||||||
x: 4
|
width: Kirigami.Units.largeSpacing * 1.5
|
||||||
y: 4
|
height: Kirigami.Units.largeSpacing * 1.5
|
||||||
radius: 3
|
radius: height / 2
|
||||||
color: developerButton.down ? subsurfaceTheme.primaryColor : subsurfaceTheme.darkerPrimaryColor
|
color: developerButton.down || developerButton.checked ?
|
||||||
visible: developerButton.checked
|
subsurfaceTheme.primaryColor : subsurfaceTheme.lightPrimaryColor
|
||||||
|
border.color: subsurfaceTheme.darkerPrimaryColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Kirigami.Label {
|
|
||||||
text: qsTr("Display Developer menu")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Item {
|
Item {
|
||||||
height: Kirigami.Units.gridUnit * 6
|
height: Kirigami.Units.gridUnit * 6
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue