feat: persist template/batch-mode, per-aspect resets, de-dup template actions

§17.1 Preferences persistence:
- Wire the previously-unused config_service; remember and restore the
  last-selected template and last batch mode. main_window loads config,
  distributes initial values, then persists on change (save-on-change).
- template_panel: template_changed signal, select_template,
  current_template_state. queue_panel: set_batch_mode + batch_mode_changed.

§17.2 Independent resets:
- Replace the combined reset and 归零 with per-section 位置/尺寸/旋转 reset
  buttons (quiet ghost styling) that restore only their own aspect to the
  selected template. Size reset changes width/height only, leaving X/Y.

Button de-dup:
- Remove the export panel's 应用为模板 / 重置为模板 — literal duplicates of
  the template panel's 另存为 / 重置为模板. Template actions now live only
  in the template area; the export panel handles output only.

Docs: PRD (6.6/6.9/9/10), architecture (4.12), UI design (7.x/10),
development-rules (6, single-home actions + consistent naming), tasks.md (17).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-16 17:01:58 +08:00
co-authored by Claude Opus 4.8
parent 69a6dc892a
commit f767ec2660
11 changed files with 300 additions and 115 deletions
+70 -3
View File
@@ -435,8 +435,8 @@
- [x] 实现输出格式选择
- [x] 实现质量选择
- [x] 实现导出当前单张
- [x] 实现应用为模板入口
- [x] 实现重置为模板入口
- [x] ~~实现应用为模板入口~~(后移除:与模板区域「另存为」重复,见 17.3)
- [x] ~~实现重置为模板入口~~(后移除:与模板区域「重置为模板」重复,见 17.3)
- [x] 显示当前操作影响范围提示
验收:
@@ -541,7 +541,74 @@
- [ ] 打包产物可在无 Python 环境的 Windows 电脑启动
- [x] 发布包不包含源代码、缓存、测试输出和私人配置
## 17. 后续暂缓任务
## 17. 体验优化(持久化与独立重置)
第二阶段根据实际使用反馈新增。
### 17.1 用户偏好持久化
前置阅读:
- `docs/02-prd.md`(6.6 模板选择、6.9 批量合成导出、9 数据与文件结构)
- `docs/05-project-architecture.md`(4.12 config_service)
任务:
- [ ] 先读取 `src/services/config_service.py` 与 `src/app/main_window.py` 现有内容
- [ ] 在 `main_window` 启动时调用 `load_config()` 并把初值分发给各面板(集中管理,不让控件各自读写)
- [ ] 在 `config_service` 默认配置中新增 `last_template`、`last_batch_mode`
- [ ] 记住并在启动时恢复上次选择的模板;自定义模板已删除时回退到第一个内置模板
- [ ] 记住并在启动时恢复上次选择的批量模式;持久化值非法时回退默认(全组合)
- [ ] 面板选择变化时「改一次存一次」回写配置
- [ ] `template_panel` 增加模板选择变化信号(携带模板名)
- [ ] `queue_panel` 增加 `set_batch_mode()` 与批量模式变化信号
验收:
- [ ] 重启后自动恢复上次选择的模板和批量模式
- [ ] 自定义模板被删除或批量模式值非法时安全回退,不报错
- [ ] UI 控件不直接读写配置文件
### 17.2 位置 / 尺寸 / 旋转独立重置
前置阅读:
- `docs/07-ui-design.md`(7 右侧参数栏、10 视觉规范)
- `docs/08-image-editor-design.md`
任务:
- [ ] 先读取 `src/app/widgets/transform_panel.py` 现有内容
- [ ] 在 `位置` / `尺寸` / `旋转` 三个分区标题右侧各加一个独立 `重置` 按钮
- [ ] 各重置只把对应参数还原为当前选中模板的值,互不影响(位置→仅 X/Y;尺寸→仅宽/高,位置不变;旋转→仅角度)
- [ ] 移除合并的 `重置位置 / 尺寸 / 角度` 按钮与角度旁的 `归零` 按钮
- [ ] 重置按钮采用幽灵样式(静止灰、悬停蓝、按下深蓝、禁用更灰),不使用红色
- [ ] 未选模板或未加载衣服/印花时三个按钮置灰
- [ ] 由 `main_window` 取模板换算值并按项合并进当前 `TransformState`
验收:
- [ ] 位置、尺寸、旋转可分别独立重置,互不影响
- [ ] 尺寸重置只改变宽 / 高,不改变位置 X / Y
- [ ] 按钮视觉层级符合 `docs/07-ui-design.md` 第 10 节
### 17.3 按钮去重(导出面板模板入口)
前置阅读:
- `docs/07-ui-design.md`(7.1 模板区域、7.7 操作按钮)
任务:
- [ ] 移除导出面板的 `应用为模板` 与 `重置为模板` 按钮(与模板区域的 `另存为` / `重置为模板` 是同一动作的重复入口)
- [ ] 模板相关操作统一留在模板区域,导出面板只负责输出与导出
验收:
- [ ] 同一个动作在界面上只出现一次,命名一致
- [ ] 导出面板仅保留输出设置与 `导出当前单张`
## 18. 后续暂缓任务
以下任务第一阶段暂不做,后续需要时再新增设计文档: