feat: C++后端功能扩展(链路速率/刷新间隔/TCP连接数/WiFi信号)

P7 链路速率:读 /sys/class/net/<iface>/speed,无线失败时降级解析 iw bitrate,
弹窗接口名旁显示(>=1000 显示 Gbps)
P5 可配置刷新间隔:新增 refreshInterval 属性,设置窗口可选 1/2/5 秒并持久化
P3 TCP 连接数:统计 /proc/net/tcp 与 tcp6 的 ESTABLISHED 连接数,弹窗展示
P6 WiFi 信号强度:读 /proc/net/wireless 的 level(dBm),弹窗接口信息区展示
所有读取均优雅降级(文件缺失/读取失败返回默认值),不改动速度计算逻辑
This commit is contained in:
2026-08-09 00:07:41 +08:00
parent 34e163c6d2
commit 640cc2ab84
6 changed files with 371 additions and 7 deletions
+53 -3
View File
@@ -59,11 +59,11 @@ Window {
property string uninstallButtonText: qsTr("Uninstall Plugin")
width: 350
height: 390
height: 450
minimumWidth: 350
maximumWidth: 350
minimumHeight: 390
maximumHeight: 390
minimumHeight: 450
maximumHeight: 450
visible: false
flags: Qt.FramelessWindowHint | Qt.Window
// NonModal:不阻塞桌面其他区域,用户可同时操作任务栏
@@ -345,6 +345,56 @@ Window {
onColorSelected: if (applet) applet.textColor = color
}
// 刷新间隔选择区:1 秒 / 2 秒 / 5 秒
// 设计原因:用户可能觉得每秒刷新开销大或过于频繁,提供更长的间隔选项;
// 选择结果通过 applet.refreshInterval 持久化并即时生效,
// 速度计算基于真实流逝时间(elapsedSec),改变间隔不影响计算正确性
Text {
text: qsTr("Refresh Interval")
font.pixelSize: 13
font.weight: Font.Bold
color: root.textSecondary
}
// 三个间隔选项按钮:1 秒 / 2 秒 / 5 秒
RowLayout {
Layout.fillWidth: true
spacing: 8
Repeater {
model: [1000, 2000, 5000]
Rectangle {
id: intervalOption
Layout.fillWidth: true
Layout.preferredHeight: 34
radius: 8
// 选中态蓝色填充边框,未选中态卡片背景,hover 态加深
color: applet && applet.refreshInterval === modelData
? root.selBg : (intervalMouse.containsMouse ? root.hoverBg : root.cardBg)
border.width: 1
border.color: applet && applet.refreshInterval === modelData
? root.selBorder : root.lineColor
Text {
anchors.centerIn: parent
text: (modelData / 1000) + "s"
font.pixelSize: 13
color: applet && applet.refreshInterval === modelData
? root.selText : root.textPrimary
}
MouseArea {
id: intervalMouse
anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor
onClicked: if (applet) applet.refreshInterval = modelData
}
}
}
}
Item { Layout.preferredHeight: 4 }
// 卸载插件按钮:文字可动态切换(复制命令后显示提示)