Repository navigation
fix(shot): remember save location only after a successful save - #952
Conversation
Stop clearing save_dir and flipping save_dir_change before the image is actually written; only persist the chosen folder after saveImg succeeds. 保存失败不再清空 save_dir、也不再把「保存时更新位置」提前改成固定路径, 避免下次启动静默存到桌面;成功后才记住所选位置。同时修正菜单勾选落到 隐藏项、导致可见菜单项没有选中状态的问题。 Log: 修复保存失败后静默存到桌面与保存位置未选中 PMS: BUG-378117 Influence: 保存失败时保留原配置,下次仍然弹出位置选择框;保存成功后菜单 正确选中已保存的位置。
|
Sorry @dengzhongyuan365-dev, you've used your own review budget of 250,000 diff characters for the last 7 days. You can request another review in 2 days and 18 hours by commenting |
Reviewer's GuideThe PR makes save-location configuration updates transactional: failed saves preserve the existing configuration and continue prompting for a location, while successful saves persist the newly chosen directory. It also corrects save-menu checkmarks so the selected state remains on a visible option, with regression tests covering both behaviors. Sequence diagram for transactional screenshot save locationsequenceDiagram
participant User
participant MainWindow
participant QFileDialog
participant ImageWriter
participant ConfigSettings
User->>MainWindow: saveAction(pix)
MainWindow->>ConfigSettings: getValue(save_dir)
MainWindow->>ConfigSettings: getValue(save_dir_change)
alt invalid path and choose-on-save enabled
MainWindow->>QFileDialog: getExistingDirectory()
QFileDialog-->>MainWindow: selected directory
else invalid fixed path
MainWindow-->>User: saveAction returns false
end
MainWindow->>ImageWriter: saveImg(...)
alt save succeeds
ImageWriter-->>MainWindow: success
MainWindow->>ConfigSettings: setValue(save_dir, selected directory)
MainWindow->>ConfigSettings: setValue(save_dir_change, false)
MainWindow-->>User: save succeeds
else save fails
ImageWriter-->>MainWindow: failure
MainWindow-->>User: saveAction returns false
Note over ConfigSettings: Existing save location configuration is preserved
end
Flow diagram for save-menu location checkmarksflowchart TD
A[Load save-location configuration] --> B{Specified location with choose-on-save?}
B -- No --> C[Keep visible menu selection]
B -- Yes --> D{Update-on-save enabled and custom path exists?}
D -- Yes --> E[Check update-on-save]
D -- No --> F[Leave update-on-save unchecked]
F --> G[Visible choose-on-save option retains correct state]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 继续保持良好的逻辑结构和边界条件处理 2. 代码质量 ✅评价: 优秀 ✅ 通过 潜在问题:
建议: 可考虑将配置持久化操作分离到单独的函数中,在初始化完成后显式调用 3. 代码性能 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: 继续保持良好的性能实践 4. 代码安全 🔒评价: 优秀 ✅ 通过
安全漏洞详情: 建议: 继续保持安全编码实践 💡 改进建议代码示例// 建议将 initializeFromConfig() 中的配置持久化分离到单独函数
void SaveMenuManager::persistFallbackState()
{
ConfigSettings::instance()->setValue("shot", "location_state",
static_cast<int>(LocationState::ChooseOnSave));
ConfigSettings::instance()->setValue("shot", "save_dir_change", true);
}
// 在 initializeFromConfig() 完成后调用
void SaveMenuManager::initializeFromConfig()
{
// ... 初始化逻辑 ...
if (invalidPath) {
m_currentLocationState = LocationState::ChooseOnSave;
updateSubMenuForFirstTime();
m_chooseOnSaveAction->setChecked(true);
persistFallbackState(); // 显式调用持久化
}
}本报告由 AI 代码审查工具自动生成 |
Add shortcut hints to toolbar tooltips and align the shortcut panel. 为工具栏提示补充快捷键,并同步调整快捷键面板内容与顺序。 Log: 完善工具栏提示和快捷键面板 PMS: TASK-393987 Influence: 工具栏提示和快捷键面板显示更完整,Ctrl+S 行为改为保存。
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: dengzhongyuan365-dev The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
1 similar comment
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: dengzhongyuan365-dev The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/forcemerge |
|
This pr force merged! (status: blocked) |
Stop clearing save_dir and flipping save_dir_change before the image is actually written; only persist the chosen folder after saveImg succeeds.
保存失败不再清空 save_dir、也不再把「保存时更新位置」提前改成固定路径,
避免下次启动静默存到桌面;成功后才记住所选位置。同时修正菜单勾选落到
隐藏项、导致可见菜单项没有选中状态的问题。
Log: 修复保存失败后静默存到桌面与保存位置未选中
PMS: BUG-378117
Influence: 保存失败时保留原配置,下次仍然弹出位置选择框;保存成功后菜单
正确选中已保存的位置。
Summary by Sourcery
Persist screenshot save-location changes only after successful saves and align shortcut presentation and save-menu selection across the interface.
New Features:
Bug Fixes:
Enhancements:
Tests:
Chores: