[AC] Support USB+AC Charging: QML

This commit is contained in:
nephros 2023-02-23 16:07:05 +01:00
parent af767e4b09
commit e1cc4cd0f7
2 changed files with 9 additions and 1 deletions

View file

@ -45,6 +45,7 @@ Item {
property int counter: 0
running: (enableLowBatteryAnimation
&& !battery.chargerConnected
&& !battery.acConnected
&& _charge <= settings.lowAlert)
repeat: true
interval: 400

View file

@ -132,8 +132,15 @@ Page {
}
MyDetailItem {
property bool connected: (battery.chargerConnected || battery.acConnected)
property string chargerType: {
if ( battery.chargerConnected && !battery.acConnected) { return qsTr("USB") }
else if (!battery.chargerConnected && battery.acConnected) { return qsTr("AC") }
else if ( battery.chargerConnected && battery.acConnected) { return qsTr("USB") + "/" + qsTr("AC") }
return "unknown power source"
}
label: qsTr("Charger connected:")
value: battery.chargerConnected ? qsTr("yes") : qsTr("no")
value: connected ? (qsTr("yes") + " (" + chargerType + ")") : qsTr("no")
}
MyDetailItem {
label: qsTr("State:")