fix: add generic gpu vram support
This commit is contained in:
@@ -9,6 +9,7 @@ CustomRect {
|
||||
|
||||
readonly property color accent: DynamicColors.palette.m3tertiary
|
||||
|
||||
Layout.fillWidth: true
|
||||
color: DynamicColors.tPalette.m3surfaceContainer
|
||||
implicitHeight: layout.implicitHeight + Appearance.padding.large * 2
|
||||
implicitWidth: layout.implicitWidth + Appearance.padding.extraLargeIncreased * 2
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import ZShell.Internal
|
||||
import qs.Modules.Resources
|
||||
import qs.Helpers
|
||||
import qs.Components
|
||||
import qs.Config
|
||||
@@ -9,8 +8,6 @@ import qs.Config
|
||||
CustomRect {
|
||||
id: root
|
||||
|
||||
required property Wrapper wrapper
|
||||
|
||||
color: DynamicColors.tPalette.m3surfaceContainer
|
||||
implicitHeight: 220
|
||||
implicitWidth: 300
|
||||
|
||||
@@ -0,0 +1,89 @@
|
||||
import QtQuick
|
||||
import QtQuick.Layouts
|
||||
import ZShell.Services
|
||||
import qs.Components
|
||||
import qs.Config
|
||||
|
||||
CustomRect {
|
||||
id: root
|
||||
|
||||
readonly property color accent: DynamicColors.palette.m3tertiary
|
||||
|
||||
Layout.fillWidth: true
|
||||
color: DynamicColors.tPalette.m3surfaceContainer
|
||||
implicitHeight: layout.implicitHeight + Appearance.padding.large * 2
|
||||
implicitWidth: layout.implicitWidth + Appearance.padding.extraLargeIncreased
|
||||
radius: Appearance.rounding.medium
|
||||
|
||||
ServiceRef {
|
||||
service: Gpu
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: layout
|
||||
|
||||
anchors.centerIn: parent
|
||||
spacing: Appearance.spacing.extraSmall
|
||||
|
||||
RowLayout {
|
||||
Layout.leftMargin: -Appearance.padding.extraSmall
|
||||
spacing: Appearance.spacing.small
|
||||
|
||||
MaterialIcon {
|
||||
color: root.accent
|
||||
fill: 1
|
||||
text: "memory_alt"
|
||||
}
|
||||
|
||||
CustomText {
|
||||
text: qsTr("Video memory")
|
||||
}
|
||||
}
|
||||
|
||||
CircularProgress {
|
||||
id: circularIndicator
|
||||
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
Layout.topMargin: Appearance.spacing.large
|
||||
fgColor: root.accent
|
||||
implicitSize: usageColumn.implicitHeight + thickness + Appearance.padding.largeIncreased * 2
|
||||
startAngle: -225
|
||||
sweepAngle: 270
|
||||
value: Gpu.memoryUsed / Gpu.memoryTotal
|
||||
|
||||
Behavior on clampedVal {
|
||||
Anim {
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
id: usageColumn
|
||||
|
||||
anchors.centerIn: parent
|
||||
anchors.verticalCenterOffset: Appearance.padding.extraSmall
|
||||
spacing: 0
|
||||
|
||||
CustomText {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
color: root.accent
|
||||
font.pointSize: Appearance.font.size.large
|
||||
text: Math.round(circularIndicator.value * 100) + "%"
|
||||
}
|
||||
|
||||
CustomText {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
color: DynamicColors.palette.m3onSurfaceVariant
|
||||
text: qsTr("Used")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CustomText {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
text: {
|
||||
const fmt = UsageFmt.formatKib(Gpu.memoryUsed, Gpu.memoryTotal);
|
||||
return `${fmt.value.toFixed(1)} / ${Math.floor(fmt.total)} ${fmt.unit}`;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@ Item {
|
||||
|
||||
RowLayout {
|
||||
spacing: Appearance.spacing.normal
|
||||
visible: storageCard.active || networkCard.active || memoryCard.active
|
||||
visible: storageCard.active || memoryCard.active || vramCard.active || networkCard1.active
|
||||
|
||||
WrappedLoader {
|
||||
id: storageCard
|
||||
@@ -95,15 +95,32 @@ Item {
|
||||
}
|
||||
|
||||
WrappedLoader {
|
||||
id: networkCard
|
||||
id: vramCard
|
||||
|
||||
active: Config.dashboard.performance.showNetwork
|
||||
active: Config.dashboard.performance.showVram
|
||||
|
||||
sourceComponent: VramCard {
|
||||
}
|
||||
}
|
||||
|
||||
WrappedLoader {
|
||||
id: networkCard1
|
||||
|
||||
active: Config.dashboard.performance.showNetwork && !vramCard.active
|
||||
|
||||
sourceComponent: NetworkCard {
|
||||
wrapper: root.wrapper
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WrappedLoader {
|
||||
id: networkCard2
|
||||
|
||||
active: Config.dashboard.performance.showNetwork && vramCard.active
|
||||
|
||||
sourceComponent: NetworkCard {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
WrappedLoader {
|
||||
|
||||
@@ -56,6 +56,14 @@ PageBase {
|
||||
onToggled: Config.dashboard.performance.showGpu = checked
|
||||
}
|
||||
|
||||
ToggleRow {
|
||||
checked: Config.dashboard.performance.showVram
|
||||
settingAnchor: "resources-vram"
|
||||
text: qsTr("Video memory")
|
||||
|
||||
onToggled: Config.dashboard.performance.showVram = checked
|
||||
}
|
||||
|
||||
ToggleRow {
|
||||
checked: Config.dashboard.performance.showCpu
|
||||
settingAnchor: "resources-cpu"
|
||||
|
||||
Reference in New Issue
Block a user