BatteryPanel: extend battery health hover area & SystemMonitorCard: live tooltips

This commit is contained in:
notiant
2026-02-04 04:05:51 +01:00
committed by GitHub
parent 34a25f78d2
commit f0cc2735e1
2 changed files with 53 additions and 8 deletions
+40
View File
@@ -26,6 +26,7 @@ NBox {
height: parent.height / 4
NCircleStat {
id: cpuUsageGauge
anchors.centerIn: parent
ratio: SystemStatService.cpuUsage / 100
icon: "cpu-usage"
@@ -33,6 +34,15 @@ NBox {
fillColor: SystemStatService.cpuColor
tooltipText: I18n.tr("system-monitor.cpu-usage") + `: ${Math.round(SystemStatService.cpuUsage)}%`
}
Connections {
target: SystemStatService
function onCpuUsageChanged() {
if (TooltipService.activeTooltip && TooltipService.activeTooltip.targetItem === cpuUsageGauge) {
TooltipService.updateText(I18n.tr("system-monitor.cpu-usage") + `: ${Math.round(SystemStatService.cpuUsage)}%`)
}
}
}
}
Item {
@@ -40,6 +50,7 @@ NBox {
height: parent.height / 4
NCircleStat {
id: cpuTempGauge
anchors.centerIn: parent
ratio: SystemStatService.cpuTemp / 100
suffix: "°C"
@@ -48,6 +59,15 @@ NBox {
fillColor: SystemStatService.tempColor
tooltipText: I18n.tr("system-monitor.cpu-temp") + `: ${Math.round(SystemStatService.cpuTemp)}°C`
}
Connections {
target: SystemStatService
function onCpuTempChanged() {
if (TooltipService.activeTooltip && TooltipService.activeTooltip.targetItem === cpuTempGauge) {
TooltipService.updateText(I18n.tr("system-monitor.cpu-temp") + `: ${Math.round(SystemStatService.cpuTemp)}%`)
}
}
}
}
Item {
@@ -55,6 +75,7 @@ NBox {
height: parent.height / 4
NCircleStat {
id: memPercentGauge
anchors.centerIn: parent
ratio: SystemStatService.memPercent / 100
icon: "memory"
@@ -62,6 +83,15 @@ NBox {
fillColor: SystemStatService.memColor
tooltipText: I18n.tr("common.memory") + `: ${Math.round(SystemStatService.memPercent)}%`
}
Connections {
target: SystemStatService
function onMemPercentChanged() {
if (TooltipService.activeTooltip && TooltipService.activeTooltip.targetItem === memPercentGauge) {
TooltipService.updateText(I18n.tr("common.memory") + `: ${Math.round(SystemStatService.memPercent)}%`)
}
}
}
}
Item {
@@ -69,6 +99,7 @@ NBox {
height: parent.height / 4
NCircleStat {
id: diskPercentsGauge
anchors.centerIn: parent
ratio: (SystemStatService.diskPercents[root.diskPath] ?? 0) / 100
icon: "storage"
@@ -76,6 +107,15 @@ NBox {
fillColor: SystemStatService.getDiskColor(root.diskPath)
tooltipText: I18n.tr("system-monitor.disk") + `: ${SystemStatService.diskPercents[root.diskPath] || 0}%\n${root.diskPath}`
}
Connections {
target: SystemStatService
function onDiskPercentsChanged() {
if (TooltipService.activeTooltip && TooltipService.activeTooltip.targetItem === diskPercentsGauge) {
TooltipService.updateText(I18n.tr("system-monitor.disk") + `: ${SystemStatService.diskPercents[panelContent.diskPath] || 0}%\n${panelContent.diskPath}`)
}
}
}
}
}
}