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,63 +210,27 @@ Column {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Rate row
|
// Rate row
|
||||||
Item {
|
InfoRow {
|
||||||
width: parent.width
|
|
||||||
height: 20
|
|
||||||
visible: S.BatteryService.changeRate !== 0
|
visible: S.BatteryService.changeRate !== 0
|
||||||
|
height: 20
|
||||||
Text {
|
label: S.BatteryService.charging ? "Charging" : "Discharging"
|
||||||
anchors.left: parent.left
|
value: {
|
||||||
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);
|
const r = Math.abs(S.BatteryService.changeRate);
|
||||||
return r > 0 ? r.toFixed(1) + " W" : "";
|
return r > 0 ? r.toFixed(1) + " W" : "";
|
||||||
}
|
}
|
||||||
color: root._stateColor
|
valueColor: root._stateColor
|
||||||
font.pixelSize: S.Theme.fontSize - 2
|
|
||||||
font.family: S.Theme.fontFamily
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Health row
|
// Health row
|
||||||
Item {
|
InfoRow {
|
||||||
width: parent.width
|
|
||||||
height: 20
|
|
||||||
visible: S.BatteryService.healthSupported
|
visible: S.BatteryService.healthSupported
|
||||||
|
height: 20
|
||||||
Text {
|
label: "Health"
|
||||||
anchors.left: parent.left
|
value: Math.round(S.BatteryService.healthPercent) + "%"
|
||||||
anchors.leftMargin: 12
|
valueColor: {
|
||||||
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;
|
const h = S.BatteryService.healthPercent;
|
||||||
return h < 50 ? S.Theme.base08 : h < 75 ? S.Theme.base0A : S.Theme.base0B;
|
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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
|
|
||||||
|
|
@ -182,30 +182,12 @@ Column {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Temperature row
|
// Temperature row
|
||||||
Item {
|
InfoRow {
|
||||||
width: parent.width
|
|
||||||
height: 22
|
|
||||||
visible: S.SystemStats.gpuTempC > 0
|
visible: S.SystemStats.gpuTempC > 0
|
||||||
|
height: 22
|
||||||
Text {
|
label: "Temp"
|
||||||
anchors.left: parent.left
|
value: S.SystemStats.gpuTempC + "\u00B0C"
|
||||||
anchors.leftMargin: 12
|
valueColor: S.SystemStats.gpuTempC > 85 ? S.Theme.base08 : S.SystemStats.gpuTempC > 70 ? S.Theme.base0A : S.Theme.base05
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
text: "Temp"
|
|
||||||
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: S.SystemStats.gpuTempC + "\u00B0C"
|
|
||||||
color: S.SystemStats.gpuTempC > 85 ? S.Theme.base08 : S.SystemStats.gpuTempC > 70 ? S.Theme.base0A : S.Theme.base05
|
|
||||||
font.pixelSize: S.Theme.fontSize - 2
|
|
||||||
font.family: S.Theme.fontFamily
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
|
|
||||||
33
shell/applets/InfoRow.qml
Normal file
33
shell/applets/InfoRow.qml
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
import QtQuick
|
||||||
|
import "../services" as S
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
|
||||||
|
required property string label
|
||||||
|
required property string value
|
||||||
|
property color valueColor: S.Theme.base05
|
||||||
|
|
||||||
|
width: parent?.width ?? 0
|
||||||
|
height: 18
|
||||||
|
|
||||||
|
Text {
|
||||||
|
anchors.left: parent.left
|
||||||
|
anchors.leftMargin: 12
|
||||||
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
|
text: root.label
|
||||||
|
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: root.value
|
||||||
|
color: root.valueColor
|
||||||
|
font.pixelSize: S.Theme.fontSize - 2
|
||||||
|
font.family: S.Theme.fontFamily
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -110,105 +110,10 @@ Column {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Breakdown rows
|
// Breakdown rows
|
||||||
Item {
|
InfoRow { label: "Used"; value: root._fmt(root.usedGb) }
|
||||||
width: root.width
|
InfoRow { label: "Cached"; value: root._fmt(root.cachedGb) }
|
||||||
height: 18
|
InfoRow { label: "Available"; value: root._fmt(root.availGb) }
|
||||||
|
InfoRow { label: "Total"; value: root._fmt(root.totalGb) }
|
||||||
Text {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: 12
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
text: "Used"
|
|
||||||
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: root._fmt(root.usedGb)
|
|
||||||
color: S.Theme.base05
|
|
||||||
font.pixelSize: S.Theme.fontSize - 2
|
|
||||||
font.family: S.Theme.fontFamily
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
width: root.width
|
|
||||||
height: 18
|
|
||||||
|
|
||||||
Text {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: 12
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
text: "Cached"
|
|
||||||
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: root._fmt(root.cachedGb)
|
|
||||||
color: S.Theme.base05
|
|
||||||
font.pixelSize: S.Theme.fontSize - 2
|
|
||||||
font.family: S.Theme.fontFamily
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
width: root.width
|
|
||||||
height: 18
|
|
||||||
|
|
||||||
Text {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: 12
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
text: "Available"
|
|
||||||
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: root._fmt(root.availGb)
|
|
||||||
color: S.Theme.base05
|
|
||||||
font.pixelSize: S.Theme.fontSize - 2
|
|
||||||
font.family: S.Theme.fontFamily
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Item {
|
|
||||||
width: root.width
|
|
||||||
height: 18
|
|
||||||
|
|
||||||
Text {
|
|
||||||
anchors.left: parent.left
|
|
||||||
anchors.leftMargin: 12
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
text: "Total"
|
|
||||||
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: root._fmt(root.totalGb)
|
|
||||||
color: S.Theme.base05
|
|
||||||
font.pixelSize: S.Theme.fontSize - 2
|
|
||||||
font.family: S.Theme.fontFamily
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Process list separator
|
// Process list separator
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ CpuApplet 1.0 CpuApplet.qml
|
||||||
DiskApplet 1.0 DiskApplet.qml
|
DiskApplet 1.0 DiskApplet.qml
|
||||||
GpuApplet 1.0 GpuApplet.qml
|
GpuApplet 1.0 GpuApplet.qml
|
||||||
HexWaveBackground 1.0 HexWaveBackground.qml
|
HexWaveBackground 1.0 HexWaveBackground.qml
|
||||||
|
InfoRow 1.0 InfoRow.qml
|
||||||
MemoryApplet 1.0 MemoryApplet.qml
|
MemoryApplet 1.0 MemoryApplet.qml
|
||||||
MprisApplet 1.0 MprisApplet.qml
|
MprisApplet 1.0 MprisApplet.qml
|
||||||
NetworkApplet 1.0 NetworkApplet.qml
|
NetworkApplet 1.0 NetworkApplet.qml
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue