Add network stats to SystemMonitor, fix ActiveWindow text display

SystemMonitor: add network up/down stats (also added setting to disable
it in BarTab)
ActiveWindow: add elide if not hovered
This commit is contained in:
Ly-sec 2025-08-31 09:22:33 +02:00
parent 724e55c37d
commit 2ebdc74f15
8 changed files with 135 additions and 10 deletions

View file

@ -141,10 +141,12 @@ NPanel {
Layout.fillWidth: true
color: (modelData?.enabled
?? true) ? (mouseArea.containsMouse ? Color.mOnTertiary : Color.mOnSurface) : Color.mOnSurfaceVariant
text: modelData?.text !== "" ? modelData?.text.replace(/[\n\r]+/g, ' ') : "..."
text: modelData?.text !== "" ? modelData?.text.replace(/[\n\r]+/g, ' ').replace(/\s+/g,
' ').trim() : "..."
font.pointSize: Style.fontSizeS * scaling
verticalAlignment: Text.AlignVCenter
wrapMode: Text.WordWrap
wrapMode: Text.NoWrap
elide: Text.ElideRight
}
Image {

View file

@ -86,18 +86,18 @@ Row {
NText {
id: titleText
// Fix collapsed width to 120px to avoid layout shifts with neighbors
// Expand up to 400px on hover
width: mouseArea.containsMouse ? Math.min(Math.max(minWidth * scaling, fullTitleMetrics.contentWidth),
400 * scaling) : minWidth * scaling
// Collapsed width when not hovered, expand on hover
width: mouseArea.containsMouse ? Math.min(fullTitleMetrics.contentWidth + (Style.marginS * scaling),
400 * scaling) : (minWidth * scaling)
horizontalAlignment: Text.AlignLeft
text: getTitle()
font.pointSize: Style.fontSizeS * scaling
font.weight: Style.fontWeightMedium
elide: Text.ElideRight
elide: mouseArea.containsMouse ? Text.ElideNone : Text.ElideRight
anchors.verticalCenter: parent.verticalCenter
verticalAlignment: Text.AlignVCenter
color: Color.mSecondary
clip: true
Behavior on width {
NumberAnimation {

View file

@ -97,6 +97,50 @@ Row {
color: Color.mPrimary
}
}
// Network Download Speed Component
Row {
id: networkDownloadLayout
spacing: Style.marginXS * scaling
visible: Settings.data.bar.showNetworkStats
NIcon {
text: "download"
anchors.verticalCenter: parent.verticalCenter
}
NText {
text: SystemStatService.formatSpeed(SystemStatService.rxSpeed)
font.family: Settings.data.ui.fontFixed
font.pointSize: Style.fontSizeS * scaling
font.weight: Style.fontWeightMedium
anchors.verticalCenter: parent.verticalCenter
verticalAlignment: Text.AlignVCenter
color: Color.mPrimary
}
}
// Network Upload Speed Component
Row {
id: networkUploadLayout
spacing: Style.marginXS * scaling
visible: Settings.data.bar.showNetworkStats
NIcon {
text: "upload"
anchors.verticalCenter: parent.verticalCenter
}
NText {
text: SystemStatService.formatSpeed(SystemStatService.txSpeed)
font.family: Settings.data.ui.fontFixed
font.pointSize: Style.fontSizeS * scaling
font.weight: Style.fontWeightMedium
anchors.verticalCenter: parent.verticalCenter
verticalAlignment: Text.AlignVCenter
color: Color.mPrimary
}
}
}
}
}