extract InfoRow component from applet key-value rows
This commit is contained in:
parent
d38c4b5161
commit
e50dd155fa
5 changed files with 57 additions and 172 deletions
|
|
@ -210,62 +210,26 @@ Column {
|
|||
}
|
||||
|
||||
// Rate row
|
||||
Item {
|
||||
width: parent.width
|
||||
height: 20
|
||||
InfoRow {
|
||||
visible: S.BatteryService.changeRate !== 0
|
||||
|
||||
Text {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 12
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: S.BatteryService.charging ? "Charging" : "Discharging"
|
||||
color: S.Theme.base04
|
||||
font.pixelSize: S.Theme.fontSize - 2
|
||||
font.family: S.Theme.fontFamily
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 12
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: {
|
||||
const r = Math.abs(S.BatteryService.changeRate);
|
||||
return r > 0 ? r.toFixed(1) + " W" : "";
|
||||
}
|
||||
color: root._stateColor
|
||||
font.pixelSize: S.Theme.fontSize - 2
|
||||
font.family: S.Theme.fontFamily
|
||||
height: 20
|
||||
label: S.BatteryService.charging ? "Charging" : "Discharging"
|
||||
value: {
|
||||
const r = Math.abs(S.BatteryService.changeRate);
|
||||
return r > 0 ? r.toFixed(1) + " W" : "";
|
||||
}
|
||||
valueColor: root._stateColor
|
||||
}
|
||||
|
||||
// Health row
|
||||
Item {
|
||||
width: parent.width
|
||||
height: 20
|
||||
InfoRow {
|
||||
visible: S.BatteryService.healthSupported
|
||||
|
||||
Text {
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 12
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: "Health"
|
||||
color: S.Theme.base04
|
||||
font.pixelSize: S.Theme.fontSize - 2
|
||||
font.family: S.Theme.fontFamily
|
||||
}
|
||||
|
||||
Text {
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 12
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
text: Math.round(S.BatteryService.healthPercent) + "%"
|
||||
color: {
|
||||
const h = S.BatteryService.healthPercent;
|
||||
return h < 50 ? S.Theme.base08 : h < 75 ? S.Theme.base0A : S.Theme.base0B;
|
||||
}
|
||||
font.pixelSize: S.Theme.fontSize - 2
|
||||
font.family: S.Theme.fontFamily
|
||||
height: 20
|
||||
label: "Health"
|
||||
value: Math.round(S.BatteryService.healthPercent) + "%"
|
||||
valueColor: {
|
||||
const h = S.BatteryService.healthPercent;
|
||||
return h < 50 ? S.Theme.base08 : h < 75 ? S.Theme.base0A : S.Theme.base0B;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue