plugin: rust-side modules + theme services with serde-typed config

This commit is contained in:
Damocles 2026-05-04 22:58:12 +02:00
parent a86e90e927
commit f34f3f2f4e
95 changed files with 2477 additions and 1011 deletions

View file

@ -1,5 +1,6 @@
import QtQuick
import "../services" as S
import NovaStats as NS
Column {
id: root
@ -8,7 +9,7 @@ Column {
property bool active: true
readonly property color _stateColor: S.BatteryService.charging ? S.Theme.base0B : S.BatteryService.critical ? S.Theme.base09 : S.BatteryService.percent < S.BatteryService.warnThresh ? S.Theme.base0A : root.accentColor
readonly property color _stateColor: S.BatteryService.charging ? NS.ThemeService.base0B : S.BatteryService.critical ? NS.ThemeService.base09 : S.BatteryService.percent < S.BatteryService.warnThresh ? NS.ThemeService.base0A : root.accentColor
// Header - pct + time
Item {
@ -25,8 +26,8 @@ Column {
return Math.round(S.BatteryService.percent) + "%" + (ts ? " " + ts : "");
}
color: root._stateColor
font.pixelSize: S.Theme.fontSize
font.family: S.Theme.fontFamily
font.pixelSize: NS.ThemeService.fontSize
font.family: NS.ThemeService.fontFamily
font.bold: true
}
}
@ -46,7 +47,7 @@ Column {
Rectangle {
anchors.fill: parent
color: S.Theme.base02
color: NS.ThemeService.base02
radius: 3
}
@ -70,7 +71,7 @@ Column {
width: 1
height: parent.height + 4
anchors.verticalCenter: parent.verticalCenter
color: S.Theme.base0A
color: NS.ThemeService.base0A
opacity: 0.6
}
@ -80,7 +81,7 @@ Column {
width: 1
height: parent.height + 4
anchors.verticalCenter: parent.verticalCenter
color: S.Theme.base08
color: NS.ThemeService.base08
opacity: 0.6
}
}
@ -99,11 +100,11 @@ Column {
thresholds: [
{
value: S.BatteryService.warnThresh,
color: S.Theme.base0A
color: NS.ThemeService.base0A
},
{
value: S.BatteryService.critThresh,
color: S.Theme.base08
color: NS.ThemeService.base08
}
]
}
@ -118,9 +119,9 @@ Column {
anchors.leftMargin: 12
anchors.verticalCenter: parent.verticalCenter
text: "warn " + S.BatteryService.warnThresh + "% crit " + S.BatteryService.critThresh + "%"
color: S.Theme.base03
font.pixelSize: S.Theme.fontSize - 3
font.family: S.Theme.fontFamily
color: NS.ThemeService.base03
font.pixelSize: NS.ThemeService.fontSize - 3
font.family: NS.ThemeService.fontFamily
font.letterSpacing: 0.5
}
@ -129,9 +130,9 @@ Column {
anchors.rightMargin: 12
anchors.verticalCenter: parent.verticalCenter
text: "24h"
color: S.Theme.base03
font.pixelSize: S.Theme.fontSize - 3
font.family: S.Theme.fontFamily
color: NS.ThemeService.base03
font.pixelSize: NS.ThemeService.fontSize - 3
font.family: NS.ThemeService.fontFamily
}
}
@ -159,7 +160,7 @@ Column {
height: 24
history: S.BatteryService.rateHistory
strokeColor: root._stateColor
colorAt: v => v >= 0 ? S.Theme.base0B : root._stateColor
colorAt: v => v >= 0 ? NS.ThemeService.base0B : root._stateColor
active: root.active
maxValue: null
minValue: null
@ -173,7 +174,7 @@ Column {
value: Math.round(S.BatteryService.healthPercent) + "%"
valueColor: {
const h = S.BatteryService.healthPercent;
return h < 50 ? S.Theme.base08 : h < 75 ? S.Theme.base0A : S.Theme.base0B;
return h < 50 ? NS.ThemeService.base08 : h < 75 ? NS.ThemeService.base0A : NS.ThemeService.base0B;
}
}