From de22aa9a7b19cba5c27bda465c9bffca6b700542 Mon Sep 17 00:00:00 2001 From: Dorian Zedler Date: Mon, 28 Dec 2020 16:17:12 +0100 Subject: [PATCH] implemented "notCharging" Battery state --- resources/qml/components/BatteryIndicator.qml | 56 +++++++++++++++++++ .../qml/components/ConnectionDelegate.qml | 1 + .../qml/components/ExtensionOverview.qml | 2 +- shared-libraries | 2 +- 4 files changed, 59 insertions(+), 2 deletions(-) diff --git a/resources/qml/components/BatteryIndicator.qml b/resources/qml/components/BatteryIndicator.qml index d2045e5..2814e2e 100644 --- a/resources/qml/components/BatteryIndicator.qml +++ b/resources/qml/components/BatteryIndicator.qml @@ -8,6 +8,7 @@ Rectangle { property color warningColor: "orange" property color criticalColor: "red" property color unknownColor: "grey" + property color notChargingColor: "red" property color backgroundColor: "white" property double indicatorSize: 1 @@ -78,6 +79,25 @@ Rectangle { } } + Text { + id: questionMarkText + visible: false + anchors.centerIn: parent + + height: parent.height * 0.7 + width: parent.width * 0.7 + + color: outerRect.color + + verticalAlignment: Text.AlignVCenter + horizontalAlignment: Text.AlignHCenter + + font.bold: true + font.pixelSize: height + + text: "?" + + } ParallelAnimation { id: chargingAnimation @@ -133,6 +153,24 @@ Rectangle { } }, + State { + name: "notCharging" + PropertyChanges { + target: control + border.color: control.notChargingColor + } + + PropertyChanges { + target: innerRect + amountFilled: 0 + } + + PropertyChanges { + target: questionMarkText + visible: true + } + }, + State { name: "fine" PropertyChanges { @@ -170,6 +208,24 @@ Rectangle { target: innerRect amountFilled: 0.1 } + }, + + State { + name: "unknown" + PropertyChanges { + target: control + border.color: control.unknownColor + } + + PropertyChanges { + target: innerRect + amountFilled: 0 + } + + PropertyChanges { + target: questionMarkText + visible: true + } } ] diff --git a/resources/qml/components/ConnectionDelegate.qml b/resources/qml/components/ConnectionDelegate.qml index e3bfee2..3edeb8d 100644 --- a/resources/qml/components/ConnectionDelegate.qml +++ b/resources/qml/components/ConnectionDelegate.qml @@ -69,6 +69,7 @@ SmoothItemDelegate { fineColor: appTheme.theme.colors.success warningColor: appTheme.theme.colors.warning criticalColor: appTheme.theme.colors.error + notChargingColor: warningColor state: control.batteryState diff --git a/resources/qml/components/ExtensionOverview.qml b/resources/qml/components/ExtensionOverview.qml index b435cd6..c1f272a 100644 --- a/resources/qml/components/ExtensionOverview.qml +++ b/resources/qml/components/ExtensionOverview.qml @@ -93,7 +93,7 @@ ListView { delegate: ConnectionDelegate { property var thisExtension: speedBackend.scStwClient.extensions[laneContainerRect.thisLane][index] property var stateTranslations: ["disconnected", "connecting", "connecting", "connected"] - property var batteryStateStrings: ["critical", "warning", "fine", "charging"] + property var batteryStateStrings: ["critical", "warning", "fine", "charging", "notCharging"] color: control.backgroundColor batteryState: thisExtension["batteryState"] === -1 ? "unknown":batteryStateStrings[thisExtension["batteryState"]] diff --git a/shared-libraries b/shared-libraries index 35fb805..92fae09 160000 --- a/shared-libraries +++ b/shared-libraries @@ -1 +1 @@ -Subproject commit 35fb805849889295ed21b20f21423dba3253d622 +Subproject commit 92fae096726f559cf36a87816ab97093db555d8b