fix(shortcuts): display correct group name for each shortcut type#270
Merged
deepin-bot[bot] merged 1 commit intoMay 9, 2026
Merged
Conversation
Replace hardcoded "Settings" group name with type-specific names (Settings, File, Display, Tools, Edit) based on ShortCutType enum. 修复快捷键分组名称硬编码为"Settings"的bug,根据ShortCutType枚举 正确显示对应的分组名称。 Log: 修复快捷键分组名称显示错误 Bug: https://pms.uniontech.com/bug-view-354843.html Influence: 快捷键列表中各分组将显示正确的名称,不再统一显示为"Settings"。
deepin pr auto review这段代码的修改主要是将快捷键组的名称从硬编码的字符串改为根据 1. 语法逻辑与代码结构现状:
改进建议:
2. 代码质量现状:
改进建议:
3. 性能现状:
改进建议:
4. 安全性现状:
改进建议:
5. 其他建议
改进后的代码示例void ShortCutShow::show() {
// ... 其他代码
for (ShortCutType type : listType) {
QJsonObject group;
QString groupDisplayName = getGroupDisplayName(type); // 提取映射逻辑
group.insert("groupName", groupDisplayName);
QJsonArray items;
for (const auto &d : m_shortcutMap[type]) {
QJsonObject jsonItem;
jsonItem.insert("name", d.second);
// ... 其他代码
}
}
}
QString ShortCutShow::getGroupDisplayName(ShortCutType type) {
switch (type) {
case ShortCutType::Settings: return tr("Settings");
case ShortCutType::File: return tr("File");
case ShortCutType::Display: return tr("Display");
case ShortCutType::Tools: return tr("Tools");
case ShortCutType::Edit: return tr("Edit");
default: return tr("Unknown"); // 防御性编程
}
}总结这段代码的修改是合理的,但可以通过提取映射逻辑、增加 |
lzwind
approved these changes
May 9, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: GongHeng2017, lzwind 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 |
Contributor
Author
|
/merge |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace hardcoded "Settings" group name with type-specific names (Settings, File, Display, Tools, Edit) based on ShortCutType enum.
修复快捷键分组名称硬编码为"Settings"的bug,根据ShortCutType枚举
正确显示对应的分组名称。
Log: 修复快捷键分组名称显示错误
Bug: https://pms.uniontech.com/bug-view-354843.html
Influence: 快捷键列表中各分组将显示正确的名称,不再统一显示为"Settings"。