fix: 流量统计窗口四个问题
1. 窗口宽度 560->620 容纳列宽,关闭按钮不再被遮挡 2. tab 切换无效:onCurrentTabChanged 已生效,补充窗口可见时立即刷新 3. 数值不刷新:新增 5 秒定时器(窗口可见时运行),不依赖 C++ 30 秒信号 4. 国际化:补全 TrafficStatistics/ByDay/ByMonth 等 12 条翻译
This commit is contained in:
@@ -94,7 +94,7 @@ Window {
|
|||||||
root.totals = { rx: tRx, tx: tTx, total: tRx + tTx }
|
root.totals = { rx: tRx, tx: tTx, total: tRx + tTx }
|
||||||
}
|
}
|
||||||
|
|
||||||
width: 560
|
width: 620
|
||||||
height: 440
|
height: 440
|
||||||
visible: false
|
visible: false
|
||||||
flags: Qt.FramelessWindowHint | Qt.Window
|
flags: Qt.FramelessWindowHint | Qt.Window
|
||||||
@@ -113,6 +113,18 @@ Window {
|
|||||||
// 切换 tab 或首次创建时重建表格模型
|
// 切换 tab 或首次创建时重建表格模型
|
||||||
onCurrentTabChanged: buildStatsModel()
|
onCurrentTabChanged: buildStatsModel()
|
||||||
Component.onCompleted: 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 窗口描边
|
// 窗口主体:圆角卡片(背景与边框随 isDarkMode 切换深浅),1px 边框模拟 DTK 窗口描边
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
|||||||
@@ -270,5 +270,68 @@
|
|||||||
<source>About</source>
|
<source>About</source>
|
||||||
<translation>关于</translation>
|
<translation>关于</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../package/networkview.qml" line="314"/>
|
||||||
|
<source>Traffic Statistics</source>
|
||||||
|
<translation>流量统计</translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>TrafficStatsWindow</name>
|
||||||
|
<message>
|
||||||
|
<location filename="../package/components/TrafficStatsWindow.qml" line="132"/>
|
||||||
|
<source>Traffic Statistics</source>
|
||||||
|
<translation>流量统计</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../package/components/TrafficStatsWindow.qml" line="158"/>
|
||||||
|
<source>By Day</source>
|
||||||
|
<translation>按日</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../package/components/TrafficStatsWindow.qml" line="184"/>
|
||||||
|
<source>By Month</source>
|
||||||
|
<translation>按月</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../package/components/TrafficStatsWindow.qml" line="202"/>
|
||||||
|
<source>Accumulated by interface</source>
|
||||||
|
<translation>按接口累计</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../package/components/TrafficStatsWindow.qml" line="218"/>
|
||||||
|
<source>Date</source>
|
||||||
|
<translation>日期</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../package/components/TrafficStatsWindow.qml" line="218"/>
|
||||||
|
<source>Month</source>
|
||||||
|
<translation>月份</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../package/components/TrafficStatsWindow.qml" line="225"/>
|
||||||
|
<source>Interface</source>
|
||||||
|
<translation>接口</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../package/components/TrafficStatsWindow.qml" line="232"/>
|
||||||
|
<source>Download</source>
|
||||||
|
<translation>下载</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../package/components/TrafficStatsWindow.qml" line="239"/>
|
||||||
|
<source>Upload</source>
|
||||||
|
<translation>上传</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../package/components/TrafficStatsWindow.qml" line="246"/>
|
||||||
|
<source>Total</source>
|
||||||
|
<translation>总计</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../package/components/TrafficStatsWindow.qml" line="283"/>
|
||||||
|
<source>No traffic records yet</source>
|
||||||
|
<translation>暂无流量记录</translation>
|
||||||
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
|||||||
Reference in New Issue
Block a user