popouts: battery add perf degradation warning
This commit is contained in:
parent
1d3b59e33d
commit
eb10c60734
1 changed files with 59 additions and 0 deletions
|
|
@ -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))
|
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 {
|
StyledRect {
|
||||||
id: profiles
|
id: profiles
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue