feat(shortcut): add dynamic category metadata#93
Conversation
Reviewer's GuideThis PR refactors shortcut and gesture category handling to use string-based category keys, exposes translated category metadata over D-Bus, and updates translation extraction and TS files so both display names and categories are localized consistently across apps and the keybinding framework. Sequence diagram for ListCategories D-Bus metadata flowsequenceDiagram
actor ControlCenter
participant KeybindingManager
participant TranslationManager
ControlCenter->>KeybindingManager: ListCategories()
KeybindingManager->>KeybindingManager: reservedCategoryOrder()
loop each distinct config.category in m_keyConfigsMap
KeybindingManager->>TranslationManager: translate(config.appId, config.category)
TranslationManager-->>KeybindingManager: localizedCategory
KeybindingManager->>KeybindingManager: build CategoryInfo
end
KeybindingManager->>KeybindingManager: std_sort_by_order(result)
KeybindingManager-->>ControlCenter: QList<CategoryInfo]
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
0415f93 to
f0d6d00
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: yixinshark 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 |
Expose shortcut category keys as strings, add a ListCategories D-Bus API, and return localized category display names from the shortcut service. Update DConfig shortcut categories and i18n extraction so system, window, workspace, custom, and app-provided categories are translated through the same per-app translation path. 将快捷键分类从数字枚举改为字符串键,新增 ListCategories D-Bus 接口,并由快捷键服务返回本地化后的分类显示名。同步更新 DConfig 快捷键分类和翻译提取逻辑,使系统、窗口、工作区、自定义以及应用提供的分类都走同一套按应用翻译的路径。 Log: add dynamic category metadata Pms: BUG-367657,BUG-365993 Change-Id: I3c0440ff9a91c48b1946b228ac942973ba40c41c
f0d6d00 to
37ceced
Compare
deepin pr auto review★ 总体评分:60分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 --- a/src/plugin-qt/shortcut/tools/extract_shortcuts_i18n.py
+++ b/src/plugin-qt/shortcut/tools/extract_shortcuts_i18n.py
@@ -48,7 +48,9 @@ def extract_translations(config_dir, output_file, app_id):
f.write('// The array is marked as unused to suppress compiler warnings\n')
f.write('[[maybe_unused]] static const char* shortcut_names[] = {\n')
for name in sorted(translatable):
- f.write(f' QT_TRANSLATE_NOOP("{app_id}", "{name}"),\n')
+ safe_name = name.replace('\\', '\\\\').replace('"', '\\"')
+ safe_app_id = app_id.replace('\\', '\\\\').replace('"', '\\"')
+ f.write(f' QT_TRANSLATE_NOOP("{safe_app_id}", "{safe_name}"),\n')
f.write('};\n') |
|
@yixinshark: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
Summary
Test plan
Log: add dynamic category metadata
Pms: BUG-367657,BUG-365993
Summary by Sourcery
Introduce string-based shortcut categories and expose localized category metadata over D-Bus for shortcuts and gestures.
New Features:
Enhancements: