Repository navigation
Conversation
1. Root cause: saveComposite() passed raw Qt/OS errorString() to saveFailed signal, bypassing app translation and showing English on some paths while other paths used tr() showing Chinese 2. Fix: replace all three errorString() calls with tr() of a unified user-facing message, add missing translation entries in .ts files 3. Impact: save failure dialogs now show consistent localized text; signal signature unchanged, no caller impact Log: save failure prompts now display consistent language Influence: 1. Test saving to a read-only system directory, verify Chinese prompt 2. Test saving to a folder under system disk, verify Chinese prompt 3. Verify normal save operation is unaffected fix: 统一保存失败提示的应用级翻译 1. 根因:saveComposite() 直接透传 Qt/OS 的 errorString() 到 saveFailed 信号,绕过应用翻译体系,部分错误路径显示英文, 而其他路径使用 tr() 显示中文,导致提示语不一致 2. 方案:将三处 errorString() 替换为统一的 tr() 用户提示, 并在 .ts 翻译文件中补充缺失的翻译条目 3. 影响:保存失败弹窗在所有路径下统一显示本地化文本, 信号签名不变,不影响调用方 Log: 保存失败提示语现已统一显示中文 Influence: 1. 测试保存到只读系统目录,验证提示为中文 2. 测试保存到系统盘下文件夹,验证提示为中文 3. 验证正常保存操作不受影响 PMS: BUG-376893
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: JWWTSL 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 |
Reviewer's GuideThe PR makes all saveComposite() failure paths emit one tr()-localized user-facing message, replacing raw platform error text, and updates the English and Simplified Chinese catalogs so save-failure dialogs are consistent without changing signal consumers or normal save behavior. Sequence diagram for localized composite image save failuressequenceDiagram
participant Controller as ImageEditController
participant File as QSaveFile
participant Writer as QImageWriter
participant Dialog as Save failure dialog
Controller->>File: open(QIODevice::WriteOnly)
alt open fails
Controller->>Dialog: saveFailed(tr("Failed to save the image. Please check the file path and permissions."))
else open succeeds
Controller->>Writer: write(result)
alt write fails
Controller->>Dialog: saveFailed(tr("Failed to save the image. Please check the file path and permissions."))
else write succeeds
Controller->>File: commit()
alt commit fails
Controller->>Dialog: saveFailed(tr("Failed to save the image. Please check the file path and permissions."))
end
end
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 建议: ['无需修改,语法逻辑完全正确。'] 2. 代码质量 ✅评价: 代码结构清晰,注释完整 ✅ 通过 潜在问题: 建议: ['建议将重复的 tr() 字符串提取为函数级局部常量,例如: const QString errorMsg = tr("Failed to save the image. Please check the file path and permissions."); 以减少重复并便于未来统一修改。'] 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: ['无性能优化建议,当前实现性能良好。'] 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: ['无需安全加固,当前实现安全合规。'] 💡 改进建议代码示例// 可选优化:提取重复字符串为局部常量 bool ImageEditController::saveComposite(const QUrl &destination, const QVariantList &sources) {
// ...
const QString saveFailMsg = tr("Failed to save the image. Please check the file path and permissions.");
QSaveFile file(targetPath);
if (!file.open(QIODevice::WriteOnly)) {
Q_EMIT saveFailed(saveFailMsg);
return false;
}
QImageWriter writer(&file, normalizedSource);
if (!writer.write(result)) {
Q_EMIT saveFailed(saveFailMsg);
file.cancelWriting();
return false;
}
if (!file.commit()) {
Q_EMIT saveFailed(saveFailMsg);
return false;
}
return true;
}本报告由 AI 代码审查工具自动生成 |
fix: unify save failure messages with tr()
saveFailed signal, bypassing app translation and showing English
on some paths while other paths used tr() showing Chinese
user-facing message, add missing translation entries in .ts files
signal signature unchanged, no caller impact
Log: save failure prompts now display consistent language
Influence:
fix: 统一保存失败提示的应用级翻译
saveFailed 信号,绕过应用翻译体系,部分错误路径显示英文,
而其他路径使用 tr() 显示中文,导致提示语不一致
并在 .ts 翻译文件中补充缺失的翻译条目
信号签名不变,不影响调用方
Log: 保存失败提示语现已统一显示中文
Influence:
PMS: BUG-376893
Summary by Sourcery
Ensure image save failures display consistent localized guidance across all save error paths.
Bug Fixes: