Skip to content

Commit 80968ac

Browse files
committed
it works but looks bad idk have fun with that ig
1 parent e97cf32 commit 80968ac

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

Modules/Bar/Widgets/SystemMonitor.qml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,20 @@ Rectangle {
108108
}
109109

110110
TextMetrics {
111-
id: networkMetrics
111+
id: downloadMetrics
112112
font.family: Settings.data.ui.fontFixed
113113
font.weight: Style.fontWeightMedium
114114
font.pointSize: textSize * Settings.data.ui.fontFixedScale
115-
text: "99.9Gbit" // Use the longest possible string for measurement
115+
text: SystemStatService.formatSpeed(SystemStatService.rxSpeed) + " "
116116
}
117117

118-
readonly property int networkTextWidth: Math.ceil(networkMetrics.boundingRect.width + 2)
118+
TextMetrics {
119+
id: uploadMetrics
120+
font.family: Settings.data.ui.fontFixed
121+
font.weight: Style.fontWeightMedium
122+
font.pointSize: textSize * Settings.data.ui.fontFixedScale
123+
text: SystemStatService.formatSpeed(SystemStatService.txSpeed) + " "
124+
}
119125

120126
anchors.centerIn: parent
121127
implicitWidth: isVertical ? Style.capsuleHeight : Math.round(mainGrid.implicitWidth + Style.marginM * 2)
@@ -428,7 +434,7 @@ Rectangle {
428434

429435
// Network Download Speed Component
430436
Item {
431-
Layout.preferredWidth: isVertical ? root.width : iconSize + networkTextWidth + (Style.marginXXS)
437+
Layout.preferredWidth: isVertical ? root.width : iconSize + Math.ceil(downloadMetrics.boundingRect.width) + (Style.marginXXS)
432438
Layout.preferredHeight: Style.capsuleHeight
433439
Layout.alignment: isVertical ? Qt.AlignHCenter : Qt.AlignVCenter
434440
visible: showNetworkStats
@@ -465,7 +471,7 @@ Rectangle {
465471
applyUiScale: false
466472
font.weight: Style.fontWeightMedium
467473
Layout.alignment: Qt.AlignCenter
468-
Layout.preferredWidth: isVertical ? -1 : networkTextWidth
474+
Layout.preferredWidth: isVertical ? -1 : Math.ceil(downloadMetrics.boundingRect.width)
469475
horizontalAlignment: isVertical ? Text.AlignHCenter : Text.AlignRight
470476
verticalAlignment: Text.AlignVCenter
471477
color: textColor
@@ -478,7 +484,7 @@ Rectangle {
478484

479485
// Network Upload Speed Component
480486
Item {
481-
Layout.preferredWidth: isVertical ? root.width : iconSize + networkTextWidth + (Style.marginXXS)
487+
Layout.preferredWidth: isVertical ? root.width : iconSize + Math.ceil(uploadMetrics.boundingRect.width) + (Style.marginXXS)
482488
Layout.preferredHeight: Style.capsuleHeight
483489
Layout.alignment: isVertical ? Qt.AlignHCenter : Qt.AlignVCenter
484490
visible: showNetworkStats
@@ -515,7 +521,7 @@ Rectangle {
515521
applyUiScale: false
516522
font.weight: Style.fontWeightMedium
517523
Layout.alignment: Qt.AlignCenter
518-
Layout.preferredWidth: isVertical ? -1 : networkTextWidth
524+
Layout.preferredWidth: isVertical ? -1 : Math.ceil(uploadMetrics.boundingRect.width)
519525
horizontalAlignment: isVertical ? Text.AlignHCenter : Text.AlignRight
520526
verticalAlignment: Text.AlignVCenter
521527
color: textColor

0 commit comments

Comments
 (0)