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