feat: settings dialog for update config (gear entry)

A low-key "⚙ 配置" button at the right end of the flow-tab row opens a settings
dialog to edit update_source / update_user / update_pass, with a test-connection
button that distinguishes "reachable & up to date" from "cannot connect".

- settings_dialog.py: pure-UI QDialog; password mask + show; test runs off the
  UI thread via load_manifest and reports the result
- update_service: add load_manifest() (raises on failure, unlike check_for_update)
- main_window: gear button, _open_settings persists via save_config and re-runs
  the update check; _update_found connected once to avoid duplicate banners
- tests: +2 for load_manifest

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-18 11:09:29 +08:00
co-authored by Claude Opus 4.8
parent 295dc803c6
commit 2d2c6c839d
5 changed files with 222 additions and 11 deletions
+10 -9
View File
@@ -953,18 +953,19 @@
任务:
- [x] 文档:`docs/07` §3 布局、§4.1 去掉「暂不提供设置入口」、新增 §4.3 入口 + §4.4 对话框
- [ ] 页签栏右端加低调 `⚙ 配置` 按钮(`addStretch` 与编号页签隔开,非编号页签)
- [ ] `src/app/widgets/settings_dialog.py`(`QDialog`,纯 UI):更新地址 / 账号 / 密码(掩码+显示) / 测试连接 / 当前版本 + 安全提示
- [ ] `测试连接`:调用 `update_service.check_for_update`,反馈最新/发现新版/连接失败
- [ ] `main_window`:打开时注入当前 config,保存时集中 `save_config`,UI 不直接写配置
- [ ] 保存后重新触发一次在线更新检查(横幅刷新)
- [ ] 取消不改动配置
- [x] 页签栏右端加低调 `⚙ 配置` 按钮(`addStretch` 与编号页签隔开,非编号页签)
- [x] `src/app/widgets/settings_dialog.py`(`QDialog`,纯 UI):更新地址 / 账号 / 密码(掩码+显示) / 测试连接 / 当前版本 + 安全提示
- [x] `测试连接`:后台线程调用 `update_service.load_manifest`(区分「连不上」与「已是最新」),反馈最新/发现新版/连接失败
- [x] `main_window`:打开时注入当前 config,保存时集中 `save_config`,UI 不直接写配置
- [x] 保存后重新触发一次在线更新检查(横幅刷新;`_update_found` 改为只连一次避免重复)
- [x] 取消不改动配置
验收:
- [ ] 可在界面上改更新地址/账号/密码并持久化到 `~/.cmbot/config/app_config.json`
- [ ] 测试连接能正确反馈三种结果
- [ ] 改完无需重启 launcher 也能让 app 内横幅按新配置刷新
- [x] 单测:`load_manifest` 返回 dict / 缺失抛错(2 个);对话框 Qt 符号导入校验通过
- [ ] GUI 实测:改更新地址/账号/密码并持久化到 `~/.cmbot/config/app_config.json`
- [ ] GUI 实测:测试连接正确反馈三种结果
- [ ] GUI 实测:改完无需重启 launcher,app 内横幅按新配置刷新
## 18. 后续暂缓任务