From e5b2060ff04f78466981d73cad308a7123779019 Mon Sep 17 00:00:00 2001 From: Jokul Date: Sun, 9 Aug 2026 07:07:29 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=B5=81=E9=87=8F=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E5=9B=9B=E4=B8=AA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. 窗口宽度 560->620 容纳列宽,关闭按钮不再被遮挡 2. tab 切换无效:onCurrentTabChanged 已生效,补充窗口可见时立即刷新 3. 数值不刷新:新增 5 秒定时器(窗口可见时运行),不依赖 C++ 30 秒信号 4. 国际化:补全 TrafficStatistics/ByDay/ByMonth 等 12 条翻译 --- package/components/TrafficStatsWindow.qml | 14 ++++- translations/jnetapplet_zh_CN.ts | 63 +++++++++++++++++++++++ 2 files changed, 76 insertions(+), 1 deletion(-) diff --git a/package/components/TrafficStatsWindow.qml b/package/components/TrafficStatsWindow.qml index e7b9c88..114ea0e 100644 --- a/package/components/TrafficStatsWindow.qml +++ b/package/components/TrafficStatsWindow.qml @@ -94,7 +94,7 @@ Window { root.totals = { rx: tRx, tx: tTx, total: tRx + tTx } } - width: 560 + width: 620 height: 440 visible: false flags: Qt.FramelessWindowHint | Qt.Window @@ -113,6 +113,18 @@ Window { // 切换 tab 或首次创建时重建表格模型 onCurrentTabChanged: buildStatsModel() Component.onCompleted: buildStatsModel() + // 窗口显示时立即刷新一次,确保数据最新 + onVisibleChanged: if (visible) buildStatsModel() + + // 定时刷新:窗口可见时每 5 秒重建表格,不依赖 C++ 30 秒信号 + // 设计原因:C++ 降频 30 秒通知,用户打开窗口期间看不到实时更新; + // 窗口可见时主动 5 秒刷新,关闭时停止,兼顾实时性与性能 + Timer { + interval: 5000 + repeat: true + running: root.visible + onTriggered: buildStatsModel() + } // 窗口主体:圆角卡片(背景与边框随 isDarkMode 切换深浅),1px 边框模拟 DTK 窗口描边 Rectangle { diff --git a/translations/jnetapplet_zh_CN.ts b/translations/jnetapplet_zh_CN.ts index fda7c1c..922f832 100644 --- a/translations/jnetapplet_zh_CN.ts +++ b/translations/jnetapplet_zh_CN.ts @@ -270,5 +270,68 @@ About 关于 + + + Traffic Statistics + 流量统计 + + + + TrafficStatsWindow + + + Traffic Statistics + 流量统计 + + + + By Day + 按日 + + + + By Month + 按月 + + + + Accumulated by interface + 按接口累计 + + + + Date + 日期 + + + + Month + 月份 + + + + Interface + 接口 + + + + Download + 下载 + + + + Upload + 上传 + + + + Total + 总计 + + + + No traffic records yet + 暂无流量记录 +