mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
SystemMonitorCard: fixed scaling and revamped to a simpler layout.
This commit is contained in:
@@ -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}`
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user