SystemMonitorCard: fixed scaling and revamped to a simpler layout.

This commit is contained in:
Lemmy
2025-12-29 11:23:59 -05:00
parent 4a9ce163a5
commit 10490e8ac3
+55 -37
View File
@@ -19,53 +19,71 @@ NBox {
return Settings.data.systemMonitor.diskPath || "/";
}
readonly property real contentScale: 0.95 * Style.uiScaleRatio
Item {
id: content
anchors.fill: parent
anchors.margins: Style.marginS
property int widgetHeight: Math.round(65 * Style.uiScaleRatio)
Column {
anchors.fill: parent
ColumnLayout {
anchors.centerIn: parent
spacing: Style.marginXS
Item {
width: parent.width
height: parent.height / 4
NCircleStat {
ratio: SystemStatService.cpuUsage / 100
icon: "cpu-usage"
contentScale: 0.95
height: content.widgetHeight
Layout.alignment: Qt.AlignHCenter
fillColor: SystemStatService.cpuColor
tooltipText: I18n.tr("system-monitor.cpu-usage") + `: ${Math.round(SystemStatService.cpuUsage)}%`
NCircleStat {
anchors.centerIn: parent
ratio: SystemStatService.cpuUsage / 100
icon: "cpu-usage"
contentScale: root.contentScale
fillColor: SystemStatService.cpuColor
tooltipText: I18n.tr("system-monitor.cpu-usage") + `: ${Math.round(SystemStatService.cpuUsage)}%`
}
}
NCircleStat {
ratio: SystemStatService.cpuTemp / 100
suffix: "°C"
icon: "cpu-temperature"
contentScale: 0.95
height: content.widgetHeight
Layout.alignment: Qt.AlignHCenter
fillColor: SystemStatService.tempColor
tooltipText: I18n.tr("system-monitor.cpu-temp") + `: ${Math.round(SystemStatService.cpuTemp)}°C`
Item {
width: parent.width
height: parent.height / 4
NCircleStat {
anchors.centerIn: parent
ratio: SystemStatService.cpuTemp / 100
suffix: "°C"
icon: "cpu-temperature"
contentScale: root.contentScale
fillColor: SystemStatService.tempColor
tooltipText: I18n.tr("system-monitor.cpu-temp") + `: ${Math.round(SystemStatService.cpuTemp)}°C`
}
}
NCircleStat {
ratio: SystemStatService.memPercent / 100
icon: "memory"
contentScale: 0.95
height: content.widgetHeight
Layout.alignment: Qt.AlignHCenter
fillColor: SystemStatService.memColor
tooltipText: I18n.tr("system-monitor.memory") + `: ${Math.round(SystemStatService.memPercent)}%`
Item {
width: parent.width
height: parent.height / 4
NCircleStat {
anchors.centerIn: parent
ratio: SystemStatService.memPercent / 100
icon: "memory"
contentScale: root.contentScale
fillColor: SystemStatService.memColor
tooltipText: I18n.tr("system-monitor.memory") + `: ${Math.round(SystemStatService.memPercent)}%`
}
}
NCircleStat {
ratio: (SystemStatService.diskPercents[root.diskPath] ?? 0) / 100
icon: "storage"
contentScale: 0.95
height: content.widgetHeight
Layout.alignment: Qt.AlignHCenter
fillColor: SystemStatService.getDiskColor(root.diskPath)
tooltipText: I18n.tr("system-monitor.disk") + `: ${SystemStatService.diskPercents[root.diskPath] || 0}%\n${root.diskPath}`
Item {
width: parent.width
height: parent.height / 4
NCircleStat {
anchors.centerIn: parent
ratio: (SystemStatService.diskPercents[root.diskPath] ?? 0) / 100
icon: "storage"
contentScale: root.contentScale
fillColor: SystemStatService.getDiskColor(root.diskPath)
tooltipText: I18n.tr("system-monitor.disk") + `: ${SystemStatService.diskPercents[root.diskPath] || 0}%\n${root.diskPath}`
}
}
}
}