feat: loader dash perf cards + fix when some disabled

This commit is contained in:
2 * r + 2 * t 2026-04-26 14:32:12 +10:00
parent 76b4a0b63c
commit 9543e761ec
2 changed files with 62 additions and 43 deletions

View file

@ -55,14 +55,6 @@ Item {
spacing: Tokens.spacing.medium spacing: Tokens.spacing.medium
visible: !placeholder.active visible: !placeholder.active
ServiceRef {
service: root.Config.dashboard.performance.showCpu ? Cpu : null
}
ServiceRef {
service: root.Config.dashboard.performance.showGpu && Gpu.type !== Gpu.None ? Gpu : null
}
ColumnLayout { ColumnLayout {
id: mainColumn id: mainColumn
@ -70,59 +62,85 @@ Item {
spacing: Tokens.spacing.medium spacing: Tokens.spacing.medium
RowLayout { RowLayout {
Layout.fillWidth: true
spacing: Tokens.spacing.medium spacing: Tokens.spacing.medium
visible: Config.dashboard.performance.showCpu || (Config.dashboard.performance.showGpu && Gpu.type !== Gpu.None) visible: cpuCard.active || gpuCard.active
HeroCard { WrappedLoader {
Layout.fillWidth: true id: cpuCard
visible: Config.dashboard.performance.showCpu
icon: "memory" active: Config.dashboard.performance.showCpu
label: qsTr("CPU")
subLabel: Cpu.name sourceComponent: HeroCard {
usage: Cpu.percentage icon: "memory"
temperature: Cpu.temperature label: qsTr("CPU")
accent: Colours.palette.m3primary subLabel: Cpu.name
usage: Cpu.percentage
temperature: Cpu.temperature
accent: Colours.palette.m3primary
ServiceRef {
service: Cpu
}
}
} }
HeroCard { WrappedLoader {
Layout.fillWidth: true id: gpuCard
visible: Config.dashboard.performance.showGpu && Gpu.type !== Gpu.None
icon: "desktop_windows" active: Config.dashboard.performance.showGpu && Gpu.type !== Gpu.None
label: qsTr("GPU")
subLabel: Gpu.name sourceComponent: HeroCard {
usage: Gpu.percentage icon: "desktop_windows"
temperature: Gpu.temperature label: qsTr("GPU")
accent: Colours.palette.m3secondary subLabel: Gpu.name
usage: Gpu.percentage
temperature: Gpu.temperature
accent: Colours.palette.m3secondary
ServiceRef {
service: Gpu
}
}
} }
} }
RowLayout { RowLayout {
Layout.fillWidth: true
spacing: Tokens.spacing.medium spacing: Tokens.spacing.medium
visible: Config.dashboard.performance.showMemory || Config.dashboard.performance.showStorage || Config.dashboard.performance.showNetwork visible: storageCard.active || networkCard.active || memoryCard.active
StorageCard { WrappedLoader {
Layout.fillHeight: true id: storageCard
visible: Config.dashboard.performance.showStorage
active: Config.dashboard.performance.showStorage
sourceComponent: StorageCard {}
} }
NetworkCard { WrappedLoader {
Layout.fillWidth: true id: networkCard
Layout.fillHeight: true
visible: Config.dashboard.performance.showNetwork active: Config.dashboard.performance.showNetwork
sourceComponent: NetworkCard {}
} }
MemoryCard { WrappedLoader {
Layout.fillHeight: true id: memoryCard
visible: Config.dashboard.performance.showMemory
active: Config.dashboard.performance.showMemory
sourceComponent: MemoryCard {}
} }
} }
} }
BatteryTank { WrappedLoader {
Layout.fillHeight: true Layout.fillWidth: false
visible: UPower.displayDevice.isLaptopBattery && Config.dashboard.performance.showBattery active: UPower.displayDevice.isLaptopBattery && Config.dashboard.performance.showBattery
sourceComponent: BatteryTank {}
} }
} }
component WrappedLoader: Loader {
Layout.fillWidth: true
Layout.fillHeight: true
visible: active
}
} }

View file

@ -35,6 +35,7 @@ StyledRect {
RowLayout { RowLayout {
id: row id: row
Layout.alignment: Qt.AlignHCenter
spacing: Tokens.spacing.large spacing: Tokens.spacing.large
CircularProgress { CircularProgress {