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
+25
View File
@@ -164,6 +164,8 @@
- 模板的 `width_ratio` / `height_ratio` 定义衣服上的**目标框**,而非强制拉伸尺寸。已知印花原始尺寸时,印花按自身宽高比缩放后 contain 进目标框并居中,不被拉伸变形;未知印花尺寸时退化为铺满目标框。
- 内置模板尺寸以贴近真实印花占比为准(例如正方形模板约为衣服宽度的 1/3),避免印花占据过大面积。
- 选中的模板是**粘性**的:在预览区切换衣服或切换印花时,印花不应丢失,应按当前选中模板基于新的衣服/印花尺寸重新计算落位,而非回退到画布的写死默认值。已手动微调的项不受影响,仍使用其自身参数。
- **记住上次选择的模板**:程序退出前持久化当前选中的模板,下次启动自动恢复选中该模板。若该模板为自定义模板且已被删除,则回退到第一个内置模板。
- 提供 `位置` / `尺寸` / `旋转` **三项独立的重置**,分别只把对应参数还原为当前选中模板的值(位置→模板居中位置;尺寸→模板目标框内适配的大小;旋转→模板角度,通常为 0),三者互不影响;不再使用单一的合并重置。未选模板或未加载衣服/印花时,重置不可用。
### 6.7 自定义模板
@@ -203,6 +205,7 @@
要求:
- 用户可以选择批量模式。
- **记住上次选择的批量模式**:程序退出前持久化当前批量模式,下次启动自动恢复;持久化值非法时回退到默认模式(全组合)。
- 批量导出使用当前模板或当前编辑参数。
- 显示合成进度。
- 支持取消批量任务。
@@ -308,6 +311,26 @@ AutoPrint/
}
```
应用配置建议(`app_config.json`,记录用户偏好,缺失或损坏时使用安全默认值):
```json
{
"output_format": "PNG",
"output_quality": 95,
"output_dir": "",
"last_garment_dir": "",
"last_print_dir": "",
"last_template": "正方形模板",
"last_batch_mode": "full_combo"
}
```
说明:
- `last_template`:上次选中的模板名称,用于启动恢复。
- `last_batch_mode`:上次选择的批量模式(取 `BatchMode` 枚举值,如 `full_combo` / `many_garments` / `many_prints` / `one_to_one`)。
- 偏好的读取、分发与「改一次存一次」由主窗口集中处理,UI 控件不直接读写配置文件。
## 10. 验收标准
- 可以加载衣服图片文件夹和印花图片文件夹。
@@ -318,6 +341,8 @@ AutoPrint/
- 可以旋转印花并同步角度。
- 可以选择内置模板并应用到预览。
- 可以保存和复用自定义模板。
- 程序重启后自动恢复上一次选择的模板和批量模式。
- 可以分别把印花的位置、尺寸、旋转独立重置为当前选中模板的值。
- 可以导出当前单张合成图。
- 可以按多衣服 × 单印花模式批量导出。
- 可以按单衣服 × 多印花模式批量导出。