make battery icons adapt to battery percentage

This commit is contained in:
end-4
2026-03-11 23:33:45 +01:00
parent 09d92aff7b
commit 247da26c7b
6 changed files with 16 additions and 5 deletions
@@ -15,7 +15,7 @@ StyledPopup {
// Header
StyledPopupHeaderRow {
icon: "battery_android_full"
icon: Icons.getBatteryIcon(Battery.percentage * 100)
label: Translation.tr("Battery")
}
@@ -307,7 +307,7 @@ MouseArea {
IconAndTextPair {
visible: Battery.available
icon: Battery.isCharging ? "bolt" : "battery_android_full"
icon: Battery.isCharging ? "bolt" : Icons.getBatteryIcon(Battery.percentage * 100)
text: Math.round(Battery.percentage * 100)
color: (Battery.isLow && !Battery.isCharging) ? Appearance.colors.colError : Appearance.colors.colOnSurfaceVariant
}
@@ -92,7 +92,7 @@ Rectangle {
id: boltIcon
anchors.verticalCenter: parent.verticalCenter
fill: 1
text: Battery.isCharging ? "bolt" : "battery_android_full"
text: Battery.isCharging ? "bolt" : Icons.getBatteryIcon(Battery.percentage * 100)
color: batteryWidget.colText
iconSize: 24
animateChange: true
@@ -44,7 +44,7 @@ MouseArea {
id: boltIcon
Layout.alignment: Qt.AlignHCenter
fill: 1
text: isCharging ? "bolt" : "battery_android_full"
text: isCharging ? "bolt" : Icons.getBatteryIcon(Battery.percentage * 100)
iconSize: Appearance.font.pixelSize.normal
animateChange: true
}