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
@ -32,7 +33,7 @@ Column {
readonly property int _u: S.CpuService.cores[index]?.usage ?? 0
readonly property real _f: S.CpuService.cores[index]?.freq_ghz ?? 0
readonly property color _barColor: S.Theme.loadColor(_u)
readonly property color _barColor: S.ThemeUtil.loadColor(_u)
readonly property bool _throttled: {
const maxF = S.CpuService.coreMaxFreq[index] ?? 0;
return maxF > 0 && _f < maxF * 0.85 && _u >= 60;
@ -56,7 +57,7 @@ Column {
anchors.horizontalCenter: parent.horizontalCenter
width: parent.width - 16
height: 1
color: S.Theme.base03
color: NS.ThemeService.base03
}
// Row content pinned to bottom of delegate
@ -71,9 +72,9 @@ Column {
anchors.leftMargin: 12
anchors.verticalCenter: parent.verticalCenter
text: index
color: S.Theme.base04
font.pixelSize: S.Theme.fontSize - 2
font.family: S.Theme.fontFamily
color: NS.ThemeService.base04
font.pixelSize: NS.ThemeService.fontSize - 2
font.family: NS.ThemeService.fontFamily
width: 16
}
@ -88,7 +89,7 @@ Column {
Rectangle {
anchors.fill: parent
color: S.Theme.base02
color: NS.ThemeService.base02
radius: 2
}
@ -115,7 +116,7 @@ Column {
height: 10
history: S.CpuService.cores[parent.parent.index]?.history ?? []
strokeColor: parent.parent._barColor
colorAt: v => S.Theme.loadColor(v)
colorAt: v => S.ThemeUtil.loadColor(v)
active: root.active
}
@ -125,9 +126,9 @@ Column {
anchors.rightMargin: 12
anchors.verticalCenter: parent.verticalCenter
text: parent.parent._f.toFixed(2)
color: parent.parent._throttled ? S.Theme.base08 : S.Theme.base04
font.pixelSize: S.Theme.fontSize - 2
font.family: S.Theme.fontFamily
color: parent.parent._throttled ? NS.ThemeService.base08 : NS.ThemeService.base04
font.pixelSize: NS.ThemeService.fontSize - 2
font.family: NS.ThemeService.fontFamily
width: 34
horizontalAlignment: Text.AlignRight
}
@ -141,7 +142,7 @@ Column {
InfoRow {
label: "Total"
value: S.CpuService.usage + "% @ " + S.CpuService.freqGhz.toFixed(2) + " GHz"
valueColor: S.Theme.loadColor(S.CpuService.usage)
valueColor: S.ThemeUtil.loadColor(S.CpuService.usage)
}
SparklineCanvas {
@ -152,7 +153,7 @@ Column {
height: 32
history: S.CpuService.history
strokeColor: root.accentColor
colorAt: v => S.Theme.loadColor(v)
colorAt: v => S.ThemeUtil.loadColor(v)
active: root.active
}
@ -172,9 +173,9 @@ Column {
anchors.leftMargin: 12
anchors.verticalCenter: parent.verticalCenter
text: "PROCESS"
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: 1
}
@ -183,9 +184,9 @@ Column {
anchors.rightMargin: 12
anchors.verticalCenter: parent.verticalCenter
text: "CPU"
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: 1
}
}
@ -203,9 +204,9 @@ Column {
anchors.leftMargin: 12
anchors.verticalCenter: parent.verticalCenter
text: modelData.cmd
color: S.Theme.base05
font.pixelSize: S.Theme.fontSize - 2
font.family: S.Theme.fontFamily
color: NS.ThemeService.base05
font.pixelSize: NS.ThemeService.fontSize - 2
font.family: NS.ThemeService.fontFamily
elide: Text.ElideRight
width: parent.width - 80
}
@ -215,9 +216,9 @@ Column {
anchors.rightMargin: 12
anchors.verticalCenter: parent.verticalCenter
text: modelData.cpu.toFixed(1) + "%"
color: S.Theme.loadColor(modelData.cpu)
font.pixelSize: S.Theme.fontSize - 2
font.family: S.Theme.fontFamily
color: S.ThemeUtil.loadColor(modelData.cpu)
font.pixelSize: NS.ThemeService.fontSize - 2
font.family: NS.ThemeService.fontFamily
width: 36
horizontalAlignment: Text.AlignRight
}