nosignal-shell/modules/dashboard/performance/MemoryCard.qml
28allday 83c6b62c13 feat(nosignal): finish Nerd Font icon remap — core surfaces
Convert remaining reachable surfaces to NsIcon (launcher, utilities, windowinfo,
sidebar, dashboard, notification toast, shared controls IconTextButton/Menu/
SplitButton/ToggleButton/CollapsibleSection/CustomSpinBox, CoverArt). Handles
the `sourceComponent: MaterialIcon {` form and icon-via-alias controls.

- IconTextButton: alias -> plain `icon` property + bound NsIcon (cross-file alias
  to a custom property was rejected).
- Reverted IconButton `font:` (the controls-wide font->fontStyle sweep wrongly
  hit ButtonBase, which uses font not fontStyle).
- Glyphs map: +31 names (dashboard/utilities/launcher leftovers) — no "?" glyphs.

Old collapsed bar + old lock sub-components left as-is (unused, never render).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14 12:59:28 +01:00

93 lines
2.6 KiB
QML

import QtQuick
import QtQuick.Layouts
import Caelestia.Config
import Caelestia.Services
import qs.components
import qs.components.controls
import qs.services
StyledRect {
id: root
readonly property color accent: Colours.palette.m3tertiary
color: Colours.tPalette.m3surfaceContainer
radius: Tokens.rounding.medium
implicitWidth: layout.implicitWidth + Tokens.padding.extraLargeIncreased * 2
implicitHeight: layout.implicitHeight + Tokens.padding.large * 2
ServiceRef {
service: Memory
}
ColumnLayout {
id: layout
anchors.centerIn: parent
spacing: Tokens.spacing.extraSmall
RowLayout {
Layout.leftMargin: -Tokens.padding.extraSmall
spacing: Tokens.spacing.small
NsIcon {
icon: "memory_alt"
fill: 1
color: root.accent
fontStyle: Tokens.font.icon.builders.medium.weight(Font.DemiBold).build() // DemiBold to fix fill issues
}
StyledText {
text: qsTr("Memory")
font: Tokens.font.title.medium
}
}
CircularProgress {
Layout.topMargin: Tokens.spacing.large
Layout.alignment: Qt.AlignHCenter
implicitSize: usageColumn.implicitHeight + thickness + Tokens.padding.largeIncreased * 2
startAngle: -225
sweepAngle: 270
fgColour: root.accent
value: Memory.percentage
Behavior on clampedVal {
Anim {}
}
ColumnLayout {
id: usageColumn
anchors.centerIn: parent
anchors.verticalCenterOffset: Tokens.padding.extraSmall
spacing: 0
StyledText {
Layout.alignment: Qt.AlignHCenter
text: Math.round(Memory.percentage * 100) + "%"
font: Tokens.font.title.builders.large.width(90).build()
color: root.accent
}
StyledText {
Layout.alignment: Qt.AlignHCenter
text: qsTr("Used")
font: Tokens.font.body.small
color: Colours.palette.m3onSurfaceVariant
}
}
}
StyledText {
Layout.alignment: Qt.AlignHCenter
text: {
const fmt = UsageFmt.formatKib(Memory.used, Memory.total);
return `${fmt.value.toFixed(1)} / ${Math.floor(fmt.total)} ${fmt.unit}`;
}
font: Tokens.font.body.medium
}
}
}