diff --git a/AGENTS.md b/AGENTS.md index f82f5ba..0180951 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -15,14 +15,18 @@ for the UI. The C++ backend reads `/proc/net/dev` to monitor network traffic. ## Features -- Real-time download/upload speed monitoring (1-second refresh) -- Total data transfer statistics -- Multiple network interface support with interface switching +- Real-time download/upload speed monitoring (1-second refresh, real elapsed time) +- Session cumulative download/upload traffic statistics +- Multiple network interface support with interface switching (popup + settings) - Taskbar icon displays live speed (changes color at high speeds) -- Hover tooltip shows speed summary -- Click to open detailed popup -- Popup shows active interface IP address, per-interface speed comparison and stats -- One-click plugin uninstall from the popup +- Customizable taskbar font color (follow system theme or pick from preset) +- Hover tooltip shows interface name + IP address +- Click to open detailed popup (speed, totals, interface chips) +- Popup shows active interface IPv4/IPv6 address +- Traffic chart window: 5-minute speed trend (download/upload dual line chart) +- Settings window: interface selection, font color picker, one-click uninstall +- Full dark mode support (taskbar icon, popup, all independent windows) +- All interfaces sampled in background; switching interfaces shows history immediately ## Build & install @@ -75,8 +79,13 @@ then restart `dde-shell` (it discovers applets by scanning the install dir for │ ├── metadata.json.in # Plugin metadata 模板(由 CMake 生成 metadata.json) │ ├── networkview.qml # QML UI 主入口 │ └── components/ # 拆分出的子组件 -│ └── AboutWindow.qml # 关于窗口组件 -├── docs/ # Design docs and implementation plans +│ ├── NetCommon.qml # 公共颜色与格式化函数 +│ ├── NetworkPopup.qml # 左键弹窗内容 +│ ├── SettingsWindow.qml # 设置窗口(接口/颜色/卸载) +│ ├── TrafficChartWindow.qml # 流量波动图窗口 +│ ├── TextColorPicker.qml # 字体颜色选择器 +│ └── AboutWindow.qml # 关于窗口 +├── docs/ # Design docs and review checklist └── AGENTS.md # This file ``` @@ -100,14 +109,16 @@ then restart `dde-shell` (it discovers applets by scanning the install dir for ## C++ Backend (NetworkMonitorApplet) Inherits from `DApplet`, provides: -- `downloadSpeed` / `uploadSpeed`: Current speed in bytes/sec -- `totalDownload` / `totalUpload`: Total data transferred +- `downloadSpeed` / `uploadSpeed`: Current speed in bytes/sec (real elapsed time) +- `totalDownload` / `totalUpload`: Session cumulative traffic - `networkInterfaces`: List of available interfaces -- `interfaceStats`: Per-interface statistics -- `activeInterface`: Currently selected interface -- `ipAddress`: IP address of the active interface -- `refresh()`: Manually trigger stats update -- `setActiveInterface(name)`: Switch active interface +- `activeInterface`: Currently selected interface (persisted to `~/.config/jnetapplet/settings.ini`) +- `ipAddress` / `ipv6Address`: IP address of the active interface +- `version`: Plugin version (from metadata, fallback to `PROJECT_VERSION` macro) +- `textColor`: Taskbar font color (empty = follow system theme, persisted) +- `speedHistoryDownload` / `speedHistoryUpload`: Per-interface speed history (QPointF list, 5-min window) +- `setActiveInterface(name)`: Switch active interface (validates against interface list) +- `refresh()`: Internal timer callback (not Q_INVOKABLE, called by m_refreshTimer every second) ## Identifier correspondence (keep in sync when renaming) diff --git a/README.md b/README.md index dbb1121..32b7c8a 100644 --- a/README.md +++ b/README.md @@ -9,13 +9,17 @@ QML 前端渲染界面,实时显示当前网卡的上行/下行速率与累计 ## 功能特性 -- 实时上行/下行速率监控(1 秒刷新) -- 累计上传/下载流量统计 -- 多网卡支持,可在弹窗中切换活动网卡 +- 实时上行/下行速率监控(1 秒刷新,按真实时间间隔计算) +- 本次会话累计上传/下载流量统计 +- 多网卡支持,可在弹窗或设置窗口中切换活动网卡 - 任务栏图标实时显示速率,高速时变色提示 -- 悬停显示速率摘要,点击展开详情弹窗 -- 详情弹窗展示活动网卡 IP 地址、各网卡速率对比与统计图表 -- 支持从弹窗一键卸载插件 +- 任务栏字体颜色可自定义,支持跟随系统主题 +- 悬停显示速率摘要与网卡 IP 地址,点击展开详情弹窗 +- 详情弹窗展示活动网卡 IPv4/IPv6 地址、各网卡速率对比与统计 +- 流量波动图窗口:展示活动接口最近 5 分钟网速趋势(下载/上传双折线) +- 设置窗口:网络接口选择、字体颜色自定义、一键卸载插件 +- 深色模式全适配(任务栏图标、弹窗、独立窗口均跟随系统主题) +- 所有接口后台持续采集速度历史,切换网卡时趋势图立即有数据 ## 构建与安装 @@ -89,8 +93,13 @@ bash build-deb.sh │ ├── metadata.json.in # 插件元数据模板(由 CMake 生成 metadata.json) │ ├── networkview.qml # QML 界面主入口 │ └── components/ # 拆分出的子组件 -│ └── AboutWindow.qml # 关于窗口组件 -├── docs/ # 设计文档与实现计划 +│ ├── NetCommon.qml # 公共颜色与格式化函数 +│ ├── NetworkPopup.qml # 左键弹窗内容(速度/总量/网卡切换) +│ ├── SettingsWindow.qml # 设置窗口(接口选择/字体颜色/卸载) +│ ├── TrafficChartWindow.qml # 流量波动图窗口(5分钟趋势折线) +│ ├── TextColorPicker.qml # 字体颜色选择器 +│ └── AboutWindow.qml # 关于窗口 +├── docs/ # 设计文档与审查清单 ├── README.md # 本文件 └── AGENTS.md # AI 代理工作指引 ``` diff --git a/docs/project-review.md b/docs/project-review.md index 8d53245..d4a4f2b 100644 --- a/docs/project-review.md +++ b/docs/project-review.md @@ -71,11 +71,9 @@ ~~`NetworkInterface` 结构体解析了 `rxErrors`/`txErrors`/`rxDropped`/`txDropped`,但 `interfaceStats()` 输出时丢弃了这些字段。~~ `interfaceStats()` 已随 #12 整体删除,不再有不完整的输出。结构体字段保留供未来使用。 -**15. README.md 和 AGENTS.md 严重过时** -- 项目结构只列 `AboutWindow.qml`,实际有 5 个组件(缺 `NetworkPopup`、`SettingsWindow`、`TextColorPicker`、`TrafficChartWindow`) -- README 功能特性未提及:设置窗口、字体颜色自定义、流量波动图、IPv6 显示 -- README 写"支持从弹窗一键卸载插件",但卸载功能实际在设置窗口 -- AGENTS.md "Project structure" 同样过时 +**15. ~~README.md 和 AGENTS.md 严重过时~~ ✅ 已修复** +~~项目结构只列 AboutWindow.qml,功能特性未提及设置窗口/字体颜色/流量波动图/IPv6/深色模式,README 写"从弹窗卸载"实际在设置窗口。~~ +已更新 README.md 和 AGENTS.md 的功能特性列表、项目结构(补全 6 个组件)、C++ Backend 属性列表(移除 interfaceStats,新增 ipv6Address/version/textColor/speedHistory 等)。 **16. `qsTr()` 源字符串为中文,无翻译基础设施** QML 中 `qsTr("网络速度监控")` 等以中文为源串,但项目无 `.ts` 翻译文件、无 `lupdate`/`lrelease` 构建步骤、C++ 无翻译加载逻辑。`qsTr()` 实质为空操作。若仅面向中文用户可接受;若计划国际化,需补全 i18n 基础设施并以英文为源串。