add full proj
This commit is contained in:
43
widgets/Network.qml
Normal file
43
widgets/Network.qml
Normal file
@@ -0,0 +1,43 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user