From 194936e5e68faded4d765e9ced936561011f2cde Mon Sep 17 00:00:00 2001 From: reionwong Date: Sun, 1 Aug 2021 03:24:53 +0800 Subject: [PATCH] New battery health design --- src/qml/Battery/Main.qml | 75 +++++++++++++------------------ src/qml/User/UserDelegateItem.qml | 1 + 2 files changed, 31 insertions(+), 45 deletions(-) diff --git a/src/qml/Battery/Main.qml b/src/qml/Battery/Main.qml index b217004..31cf11c 100644 --- a/src/qml/Battery/Main.qml +++ b/src/qml/Battery/Main.qml @@ -194,24 +194,19 @@ ItemPage { height: _poorLabel.implicitHeight + 4 + FishUI.Units.smallSpacing width: _poorLabel.implicitWidth + FishUI.Units.largeSpacing - Label { - id: _poorLabel - anchors.horizontalCenter: parent.horizontalCenter - text: qsTr("Poor") + Rectangle { + id: _poorRect + anchors.fill: parent color: "#FF8738" + radius: FishUI.Theme.mediumRadius + visible: battery.capacity >= 0 && battery.capacity <= 79 } - Rectangle { - id: _poorLine - anchors.top: _poorLabel.bottom - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - anchors.topMargin: FishUI.Units.smallSpacing - height: 2 - radius: 2 - color: _poorLabel.color - visible: battery.capacity >= 0 && battery.capacity <= 79 + Label { + id: _poorLabel + anchors.centerIn: parent + text: qsTr("Poor") + color: _poorRect.visible ? "#FFFFFF" : "#FF8738" } } @@ -223,24 +218,19 @@ ItemPage { height: _normalLabel.implicitHeight + 4 + FishUI.Units.smallSpacing width: _normalLabel.implicitWidth + FishUI.Units.largeSpacing - Label { - id: _normalLabel - anchors.horizontalCenter: parent.horizontalCenter - text: qsTr("Normal") + Rectangle { + id: _normalRect + anchors.fill: parent color: "#3385FF" + radius: FishUI.Theme.mediumRadius + visible: battery.capacity >= 80 && battery.capacity <= 89 } - Rectangle { - id: _normalLine - anchors.top: _normalLabel.bottom - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - anchors.topMargin: FishUI.Units.smallSpacing - height: 2 - radius: 2 - color: _normalLabel.color - visible: battery.capacity >= 80 && battery.capacity <= 89 + Label { + id: _normalLabel + anchors.centerIn: parent + text: qsTr("Normal") + color: _normalRect.visible ? "#FFFFFF" : "#3385FF" } } @@ -252,24 +242,19 @@ ItemPage { height: _excellentLabel.implicitHeight + 4 + FishUI.Units.smallSpacing width: _excellentLabel.implicitWidth + FishUI.Units.largeSpacing - Label { - id: _excellentLabel - anchors.horizontalCenter: parent.horizontalCenter - text: qsTr("Excellent") + Rectangle { + id: _excellentRect + anchors.fill: parent color: "#00CD23" + radius: FishUI.Theme.mediumRadius + visible: battery.capacity >= 90 && battery.capacity <= 100 } - Rectangle { - id: _excellentLine - anchors.top: _excellentLabel.bottom - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - anchors.topMargin: FishUI.Units.smallSpacing - height: 2 - radius: 2 - color: _excellentLabel.color - visible: battery.capacity >= 90 && battery.capacity <= 100 + Label { + id: _excellentLabel + anchors.centerIn: parent + text: qsTr("Excellent") + color: _excellentRect.visible ? "#FFFFFF" : "#00CD23" } } } diff --git a/src/qml/User/UserDelegateItem.qml b/src/qml/User/UserDelegateItem.qml index 1a3036c..c77345e 100644 --- a/src/qml/User/UserDelegateItem.qml +++ b/src/qml/User/UserDelegateItem.qml @@ -190,6 +190,7 @@ RoundedItem { text: qsTr("Delete this user") enabled: model.userId !== loggedUser.userId onClicked: accountsManager.deleteUser(userId, true) + backgroundColor: FishUI.Theme.darkMode ? "#363636" : FishUI.Theme.backgroundColor Layout.fillWidth: true } }