SystemMonitor: fix network stats, move text above storage icon (vertical bar)
This commit is contained in:
parent
26a27c3393
commit
758f2f2e55
1 changed files with 46 additions and 26 deletions
|
|
@ -43,6 +43,26 @@ Rectangle {
|
||||||
radius: Math.round(Style.radiusM * scaling)
|
radius: Math.round(Style.radiusM * scaling)
|
||||||
color: Color.mSurfaceVariant
|
color: Color.mSurfaceVariant
|
||||||
|
|
||||||
|
// Compact speed formatter for vertical bar display
|
||||||
|
function formatCompactSpeed(bytesPerSecond) {
|
||||||
|
if (!bytesPerSecond || bytesPerSecond <= 0)
|
||||||
|
return "0"
|
||||||
|
const units = ["", "k", "M", "G"]
|
||||||
|
let value = bytesPerSecond
|
||||||
|
let unitIndex = 0
|
||||||
|
while (value >= 1024 && unitIndex < units.length - 1) {
|
||||||
|
value = value / 1024.0
|
||||||
|
unitIndex++
|
||||||
|
}
|
||||||
|
// Promote at ~100 of current unit (e.g., 100k -> ~0.1M shown as 0.1M or 0M if rounded)
|
||||||
|
if (unitIndex < units.length - 1 && value >= 100) {
|
||||||
|
value = value / 1024.0
|
||||||
|
unitIndex++
|
||||||
|
}
|
||||||
|
const display = (value >= 10) ? Math.round(value).toString() : value.toFixed(1)
|
||||||
|
return display + units[unitIndex]
|
||||||
|
}
|
||||||
|
|
||||||
// Horizontal layout for top/bottom bars
|
// Horizontal layout for top/bottom bars
|
||||||
RowLayout {
|
RowLayout {
|
||||||
id: horizontalLayout
|
id: horizontalLayout
|
||||||
|
|
@ -347,21 +367,21 @@ Rectangle {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
spacing: Style.marginXXS * scaling
|
spacing: Style.marginXXS * scaling
|
||||||
|
|
||||||
|
NText {
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
text: formatCompactSpeed(SystemStatService.rxSpeed)
|
||||||
|
font.family: Settings.data.ui.fontFixed
|
||||||
|
font.pointSize: Style.fontSizeXXS * scaling
|
||||||
|
font.weight: Style.fontWeightMedium
|
||||||
|
color: Color.mPrimary
|
||||||
|
}
|
||||||
|
|
||||||
NIcon {
|
NIcon {
|
||||||
icon: "download-speed"
|
icon: "download-speed"
|
||||||
font.pointSize: Style.fontSizeS * scaling
|
font.pointSize: Style.fontSizeS * scaling
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
NText {
|
|
||||||
text: SystemStatService.formatSpeed(SystemStatService.rxSpeed)
|
|
||||||
font.family: Settings.data.ui.fontFixed
|
|
||||||
font.pointSize: Style.fontSizeXXS * scaling
|
|
||||||
font.weight: Style.fontWeightMedium
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
color: Color.mPrimary
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -377,21 +397,21 @@ Rectangle {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
spacing: Style.marginXXS * scaling
|
spacing: Style.marginXXS * scaling
|
||||||
|
|
||||||
|
NText {
|
||||||
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
|
horizontalAlignment: Text.AlignHCenter
|
||||||
|
text: formatCompactSpeed(SystemStatService.txSpeed)
|
||||||
|
font.family: Settings.data.ui.fontFixed
|
||||||
|
font.pointSize: Style.fontSizeXXS * scaling
|
||||||
|
font.weight: Style.fontWeightMedium
|
||||||
|
color: Color.mPrimary
|
||||||
|
}
|
||||||
|
|
||||||
NIcon {
|
NIcon {
|
||||||
icon: "upload-speed"
|
icon: "upload-speed"
|
||||||
font.pointSize: Style.fontSizeS * scaling
|
font.pointSize: Style.fontSizeS * scaling
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
anchors.horizontalCenter: parent.horizontalCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
NText {
|
|
||||||
text: SystemStatService.formatSpeed(SystemStatService.txSpeed)
|
|
||||||
font.family: Settings.data.ui.fontFixed
|
|
||||||
font.pointSize: Style.fontSizeXXS * scaling
|
|
||||||
font.weight: Style.fontWeightMedium
|
|
||||||
anchors.horizontalCenter: parent.horizontalCenter
|
|
||||||
horizontalAlignment: Text.AlignHCenter
|
|
||||||
color: Color.mPrimary
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -407,12 +427,6 @@ Rectangle {
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
spacing: Style.marginXXS * scaling
|
spacing: Style.marginXXS * scaling
|
||||||
|
|
||||||
NIcon {
|
|
||||||
icon: "storage"
|
|
||||||
font.pointSize: Style.fontSizeS * scaling
|
|
||||||
Layout.alignment: Qt.AlignHCenter
|
|
||||||
}
|
|
||||||
|
|
||||||
NText {
|
NText {
|
||||||
text: `${SystemStatService.diskPercent}%`
|
text: `${SystemStatService.diskPercent}%`
|
||||||
font.family: Settings.data.ui.fontFixed
|
font.family: Settings.data.ui.fontFixed
|
||||||
|
|
@ -422,6 +436,12 @@ Rectangle {
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
color: Color.mPrimary
|
color: Color.mPrimary
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NIcon {
|
||||||
|
icon: "storage"
|
||||||
|
font.pointSize: Style.fontSizeS * scaling
|
||||||
|
Layout.alignment: Qt.AlignHCenter
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue