diff options
Diffstat (limited to 'modules/bar')
| -rw-r--r-- | modules/bar/popouts/Battery.qml | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/modules/bar/popouts/Battery.qml b/modules/bar/popouts/Battery.qml index 90a6181..e36b3e2 100644 --- a/modules/bar/popouts/Battery.qml +++ b/modules/bar/popouts/Battery.qml @@ -35,6 +35,65 @@ Column { text: UPower.displayDevice.isLaptopBattery ? qsTr("Time %1: %2").arg(UPower.onBattery ? "remaining" : "until charged").arg(UPower.onBattery ? formatSeconds(UPower.displayDevice.timeToEmpty, "Calculating...") : formatSeconds(UPower.displayDevice.timeToFull, "Fully charged!")) : qsTr("Power profile: %1").arg(PowerProfile.toString(PowerProfiles.profile)) } + Loader { + anchors.horizontalCenter: parent.horizontalCenter + + active: PowerProfiles.degradationReason !== PerformanceDegradationReason.None + asynchronous: true + + height: active ? (item?.implicitHeight ?? 0) : 0 + + sourceComponent: StyledRect { + implicitWidth: child.implicitWidth + Appearance.padding.normal * 2 + implicitHeight: child.implicitHeight + Appearance.padding.smaller * 2 + + color: Colours.palette.m3error + radius: Appearance.rounding.normal + + Column { + id: child + + anchors.centerIn: parent + + Row { + anchors.horizontalCenter: parent.horizontalCenter + spacing: Appearance.spacing.small + + MaterialIcon { + anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenterOffset: -font.pointSize / 10 + + text: "warning" + color: Colours.palette.m3onError + } + + StyledText { + anchors.verticalCenter: parent.verticalCenter + text: qsTr("Performance Degraded") + color: Colours.palette.m3onError + font.family: Appearance.font.family.mono + font.weight: 500 + } + + MaterialIcon { + anchors.verticalCenter: parent.verticalCenter + anchors.verticalCenterOffset: -font.pointSize / 10 + + text: "warning" + color: Colours.palette.m3onError + } + } + + StyledText { + anchors.horizontalCenter: parent.horizontalCenter + + text: qsTr("Reason: %1").arg(PerformanceDegradationReason.toString(PowerProfiles.degradationReason)) + color: Colours.palette.m3onError + } + } + } + } + StyledRect { id: profiles |