1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-03 20:32:07 -04:00

cc: fix invalid number displays on percentages

fixes #2010
This commit is contained in:
bbedward
2026-03-16 11:18:42 -04:00
parent 7826d827dd
commit 28c9bb0925

View File

@@ -458,11 +458,11 @@ BasePill {
height: { height: {
switch (modelData.id) { switch (modelData.id) {
case "audio": case "audio":
return root.vIconSize + (root.showAudioPercent ? audioPercentV.implicitHeight + 2 : 0); return root.vIconSize + (audioPercentV.visible ? audioPercentV.implicitHeight + 2 : 0);
case "microphone": case "microphone":
return root.vIconSize + (root.showMicPercent ? micPercentV.implicitHeight + 2 : 0); return root.vIconSize + (micPercentV.visible ? micPercentV.implicitHeight + 2 : 0);
case "brightness": case "brightness":
return root.vIconSize + (root.showBrightnessPercent ? brightnessPercentV.implicitHeight + 2 : 0); return root.vIconSize + (brightnessPercentV.visible ? brightnessPercentV.implicitHeight + 2 : 0);
default: default:
return root.vIconSize; return root.vIconSize;
} }
@@ -538,7 +538,7 @@ BasePill {
NumericText { NumericText {
id: audioPercentV id: audioPercentV
visible: verticalGroupItem.modelData.id === "audio" && root.showAudioPercent visible: verticalGroupItem.modelData.id === "audio" && root.showAudioPercent && isFinite(AudioService.sink?.audio?.volume)
text: Math.round((AudioService.sink?.audio?.volume ?? 0) * 100) + "%" text: Math.round((AudioService.sink?.audio?.volume ?? 0) * 100) + "%"
reserveText: "100%" reserveText: "100%"
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText) font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
@@ -560,7 +560,7 @@ BasePill {
NumericText { NumericText {
id: micPercentV id: micPercentV
visible: verticalGroupItem.modelData.id === "microphone" && root.showMicPercent visible: verticalGroupItem.modelData.id === "microphone" && root.showMicPercent && isFinite(AudioService.source?.audio?.volume)
text: Math.round((AudioService.source?.audio?.volume ?? 0) * 100) + "%" text: Math.round((AudioService.source?.audio?.volume ?? 0) * 100) + "%"
reserveText: "100%" reserveText: "100%"
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText) font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
@@ -582,7 +582,7 @@ BasePill {
NumericText { NumericText {
id: brightnessPercentV id: brightnessPercentV
visible: verticalGroupItem.modelData.id === "brightness" && root.showBrightnessPercent visible: verticalGroupItem.modelData.id === "brightness" && root.showBrightnessPercent && isFinite(getBrightness())
text: Math.round(getBrightness() * 100) + "%" text: Math.round(getBrightness() * 100) + "%"
reserveText: "100%" reserveText: "100%"
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText) font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
@@ -724,7 +724,7 @@ BasePill {
NumericText { NumericText {
id: audioPercent id: audioPercent
visible: root.showAudioPercent visible: root.showAudioPercent && isFinite(AudioService.sink?.audio?.volume)
text: Math.round((AudioService.sink?.audio?.volume ?? 0) * 100) + "%" text: Math.round((AudioService.sink?.audio?.volume ?? 0) * 100) + "%"
reserveText: "100%" reserveText: "100%"
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText) font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
@@ -761,7 +761,7 @@ BasePill {
NumericText { NumericText {
id: micPercent id: micPercent
visible: root.showMicPercent visible: root.showMicPercent && isFinite(AudioService.source?.audio?.volume)
text: Math.round((AudioService.source?.audio?.volume ?? 0) * 100) + "%" text: Math.round((AudioService.source?.audio?.volume ?? 0) * 100) + "%"
reserveText: "100%" reserveText: "100%"
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText) font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)
@@ -798,7 +798,7 @@ BasePill {
NumericText { NumericText {
id: brightnessPercent id: brightnessPercent
visible: root.showBrightnessPercent visible: root.showBrightnessPercent && isFinite(getBrightness())
text: Math.round(getBrightness() * 100) + "%" text: Math.round(getBrightness() * 100) + "%"
reserveText: "100%" reserveText: "100%"
font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText) font.pixelSize: Theme.barTextSize(root.barThickness, root.barConfig?.fontScale, root.barConfig?.maximizeWidgetText)