feat(qml): task #14c 提示词收藏 + 删除(持久化到 config.json)
config_util.py 加 save_config(path, config) → bool 原子写:tmp 文件 + replace,失败记日志返回 False(不抛异常) ImageGenBridge: - 构造函数加 saved_prompts / config_path 参数 - Property savedPrompts: list[str] - Slot addSavedPrompt(prompt): 去重 + 插入头部 + 持久化 + 信号 - Slot removeSavedPrompt(prompt): 移除 + 持久化 + 信号 - _persist_saved_prompts: load_config_safe → 改 saved_prompts → save_config main_qml.py: 装 saved_prompts + config_path 给 ImageGenBridge ImageGenTab.qml: - "收藏" enabled by promptArea.text.trim().length > 0,onClicked add - "删除" enabled by savedPrompts.length > 0,删除当前 ComboBox 选中项 - 快速选择 ComboBox model: imageGen.savedPrompts (响应 savedPromptsChanged 自动刷) - onActivated 仅在 currentText 非空时填到 promptArea 视觉验证:QML_AUTO_LOGIN=1 启动主窗口,ComboBox 已显示从 config.json 读到的 "主石换成闪耀的祖母绿",收藏按钮在 prompt 空时正确灰。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Showing
4 changed files
with
72 additions
and
5 deletions
-
Please register or sign in to post a comment