44 lines
1.2 KiB
QML
44 lines
1.2 KiB
QML
import QtQuick
|
|
import QtQuick.Layouts
|
|
import "../config"
|
|
import "../services"
|
|
|
|
// Down/up throughput on the active interface, with a wifi/ethernet icon.
|
|
Pill {
|
|
Text {
|
|
text: SysStats.iface.startsWith("wl") ? Icons.wifi : Icons.ethernet
|
|
font.family: Theme.monoFont
|
|
font.pixelSize: Theme.fontSize + 1
|
|
color: Theme.sky
|
|
Layout.alignment: Qt.AlignVCenter
|
|
}
|
|
|
|
// reserve the width of the widest rate string so values never shift
|
|
TextMetrics {
|
|
id: rateMetrics
|
|
font: rxText.font
|
|
text: Icons.down + " 99.9M"
|
|
}
|
|
|
|
Text {
|
|
id: rxText
|
|
text: Icons.down + " " + SysStats.fmtRate(SysStats.rxRate)
|
|
font.family: Theme.monoFont
|
|
font.pixelSize: Theme.fontSize - 1
|
|
color: Theme.green
|
|
horizontalAlignment: Text.AlignRight
|
|
Layout.alignment: Qt.AlignVCenter
|
|
Layout.preferredWidth: rateMetrics.advanceWidth
|
|
}
|
|
|
|
Text {
|
|
text: Icons.up + " " + SysStats.fmtRate(SysStats.txRate)
|
|
font.family: Theme.monoFont
|
|
font.pixelSize: Theme.fontSize - 1
|
|
color: Theme.peach
|
|
horizontalAlignment: Text.AlignRight
|
|
Layout.alignment: Qt.AlignVCenter
|
|
Layout.preferredWidth: rateMetrics.advanceWidth
|
|
}
|
|
}
|