headsetcontrol-battery-widget/package/contents/ui/config/general.qml

200 lines
4.9 KiB
QML
Raw Normal View History

2024-01-19 00:54:33 +00:00
import QtQuick 2.0
2024-01-19 01:57:59 +00:00
import QtQuick.Layouts 1.3
import org.kde.plasma.core 2.0 as PlasmaCore
2024-01-22 00:58:17 +00:00
import org.kde.plasma.components 2.0 as PlasmaComponents
import QtQuick.Controls 2.5 as QQC2
2024-01-19 00:54:33 +00:00
import org.kde.kirigami 2.4 as Kirigami
2024-01-20 12:16:48 +00:00
import org.kde.kquickcontrols 2.0 as KQControls
2024-01-22 02:08:31 +00:00
import "../lib/helper.js" as Helper
2024-01-19 00:54:33 +00:00
2024-01-22 00:58:17 +00:00
QQC2.Pane {
2024-01-19 00:54:33 +00:00
id: root
property alias cfg_pollingrate: pollingrate.value
2024-01-20 10:36:02 +00:00
property alias cfg_batteryheight: batteryheight.value
2024-01-20 12:16:48 +00:00
property alias cfg_colorEmpty: colorEmpty.color
2024-01-20 14:16:18 +00:00
property alias cfg_colorHalf: colorHalf.color
2024-01-20 12:16:48 +00:00
property alias cfg_colorFull: colorFull.color
2024-01-19 00:54:33 +00:00
2024-01-25 15:21:39 +00:00
property alias cfg_notifications: notifications.checked
property alias cfg_batteryThreshold: batteryThreshold.value
2024-01-19 00:54:33 +00:00
Kirigami.FormLayout {
anchors.fill: parent
wideMode: false
2024-01-19 01:57:59 +00:00
GridLayout {
columns: 3
2024-01-20 10:36:02 +00:00
rows: 2
rowSpacing: 10
2024-01-19 01:57:59 +00:00
2024-01-20 10:36:02 +00:00
// first row
2024-01-19 01:57:59 +00:00
Text {
text: "polling rate:"
color: PlasmaCore.Theme.textColor
}
2024-01-21 18:54:24 +00:00
PlasmaComponents.Slider {
2024-01-19 01:57:59 +00:00
id: pollingrate
2024-01-21 18:54:24 +00:00
value: 10
2024-01-22 00:58:17 +00:00
minimumValue: 2
maximumValue: 60
2024-01-21 18:54:24 +00:00
stepSize: 2
2024-01-19 01:57:59 +00:00
}
Text {
2024-01-20 12:16:48 +00:00
text: cfg_pollingrate + " seconds"
2024-01-19 01:57:59 +00:00
color: PlasmaCore.Theme.textColor
2024-01-19 00:54:33 +00:00
}
2024-01-20 10:36:02 +00:00
// second row
Text {
text: "battery height:"
color: PlasmaCore.Theme.textColor
}
2024-01-21 18:54:24 +00:00
PlasmaComponents.Slider {
2024-01-20 10:36:02 +00:00
id: batteryheight
value: 8.0
2024-01-22 00:58:17 +00:00
minimumValue: 1
maximumValue: 10
stepSize: 1
2024-01-20 10:36:02 +00:00
}
2024-01-20 12:16:48 +00:00
Text {
text: cfg_batteryheight
color: PlasmaCore.Theme.textColor
}
}
// color config
GridLayout {
columns: 3
2024-01-20 14:16:18 +00:00
rows: 3
2024-01-20 12:16:48 +00:00
rowSpacing: 1
// first row
Text {
text: "empty:"
color: PlasmaCore.Theme.textColor
}
KQControls.ColorButton {
id: colorEmpty
color: cfg_colorEmpty
}
Text {
text: cfg_colorEmpty
color: PlasmaCore.Theme.textColor
}
2024-01-20 14:16:18 +00:00
// secod row
Text {
text: "half:"
color: PlasmaCore.Theme.textColor
}
KQControls.ColorButton {
id: colorHalf
color: cfg_colorHalf
}
Text {
text: cfg_colorHalf
color: PlasmaCore.Theme.textColor
}
// third row
2024-01-20 12:16:48 +00:00
Text {
text: "full:"
color: PlasmaCore.Theme.textColor
}
KQControls.ColorButton {
id: colorFull
color: cfg_colorFull
}
Text {
text: cfg_colorFull
2024-01-20 10:36:02 +00:00
color: PlasmaCore.Theme.textColor
}
2024-01-19 00:54:33 +00:00
}
2024-01-20 12:16:48 +00:00
// color gradient example
GridLayout {
columns: 10
rows: 1
rowSpacing: 0
Text {
text: "█"
2024-01-20 15:20:14 +00:00
color: Helper.interpolateColor(.1, [ cfg_colorEmpty.toString(), cfg_colorHalf.toString(), cfg_colorFull.toString() ])
2024-01-20 12:16:48 +00:00
}
Text {
text: "█"
2024-01-20 15:20:14 +00:00
color: Helper.interpolateColor(.2, [ cfg_colorEmpty.toString(), cfg_colorHalf.toString(), cfg_colorFull.toString() ])
2024-01-20 12:16:48 +00:00
}
Text {
text: "█"
2024-01-20 15:20:14 +00:00
color: Helper.interpolateColor(.3, [ cfg_colorEmpty.toString(), cfg_colorHalf.toString(), cfg_colorFull.toString() ])
2024-01-20 12:16:48 +00:00
}
Text {
text: "█"
2024-01-20 15:20:14 +00:00
color: Helper.interpolateColor(.4, [ cfg_colorEmpty.toString(), cfg_colorHalf.toString(), cfg_colorFull.toString() ])
2024-01-20 12:16:48 +00:00
}
Text {
text: "█"
2024-01-20 15:20:14 +00:00
color: Helper.interpolateColor(.5, [ cfg_colorEmpty.toString(), cfg_colorHalf.toString(), cfg_colorFull.toString() ])
2024-01-20 12:16:48 +00:00
}
Text {
text: "█"
2024-01-20 15:20:14 +00:00
color: Helper.interpolateColor(.6, [ cfg_colorEmpty.toString(), cfg_colorHalf.toString(), cfg_colorFull.toString() ])
2024-01-20 12:16:48 +00:00
}
Text {
text: "█"
2024-01-20 15:20:14 +00:00
color: Helper.interpolateColor(.7, [ cfg_colorEmpty.toString(), cfg_colorHalf.toString(), cfg_colorFull.toString() ])
2024-01-20 12:16:48 +00:00
}
Text {
text: "█"
2024-01-20 15:20:14 +00:00
color: Helper.interpolateColor(.8, [ cfg_colorEmpty.toString(), cfg_colorHalf.toString(), cfg_colorFull.toString() ])
2024-01-20 12:16:48 +00:00
}
Text {
text: "█"
2024-01-20 15:20:14 +00:00
color: Helper.interpolateColor(.9, [ cfg_colorEmpty.toString(), cfg_colorHalf.toString(), cfg_colorFull.toString() ])
2024-01-20 12:16:48 +00:00
}
Text {
text: "█"
2024-01-20 15:20:14 +00:00
color: Helper.interpolateColor( 1, [ cfg_colorEmpty.toString(), cfg_colorHalf.toString(), cfg_colorFull.toString() ])
2024-01-20 12:16:48 +00:00
}
}
2024-01-25 15:21:39 +00:00
GridLayout {
columns: 3
rows: 2
rowSpacing: 10
// first row
Text {
text: "notifications:"
color: PlasmaCore.Theme.textColor
}
PlasmaComponents.CheckBox {
id: notifications
}
Text {
text: ""
}
// second row
Text {
text: "battery threshold:"
color: PlasmaCore.Theme.textColor
}
PlasmaComponents.Slider {
id: batteryThreshold
value: 10
minimumValue: 1
maximumValue: 50
stepSize: 1
}
Text {
text: cfg_batteryThreshold
color: PlasmaCore.Theme.textColor
}
}
2024-01-19 00:54:33 +00:00
}
}