Conversation
Make the GitHub Actions PowerShell more robust when updating .rc files: check for existing FILEVERSION/PRODUCTVERSION and VALUE entries and insert them if missing, otherwise replace them. Update Inkeys resources: set FileVersion to 3.0.0.0, update copyright year to 2026, and remove the ProductVersion line. The binary .aps file changed accordingly.
📝 WalkthroughWalkthrough此 PR:调整 CI 的 msbuild 工作流以使用 " UTC" 作为 ProductVersion 显示并改为有条件插入/替换;将三份 i18n JSONC 加入项目并生成/扩展 i18n 键;重命名配置字段并在设置页新增对应开关;更新 .rc 中部分版本/版权字符串。 Changes
Sequence Diagram(s)(无) Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 Clang (14.0.6)Inkeys/IdtPlug-in.cppPLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Inkeys/Inkeys/UI/Setting/Setting.cppPLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/msbuild.yml:
- Around line 200-206: 当前脚本通过检测 rcContent 中是否存在 'VALUE
"ProductVersion"',在不存在时(else 分支)又把该字符串资源重新插回去,导致 CI 构件与仓库及本地构建不一致;请修改与 rcContent
相关的逻辑:在处理匹配 '(?m)^\s*VALUE\s+"ProductVersion",' 的 if/else 结构中删除或取消 else 分支中将
'VALUE "ProductVersion"' 重新插入的替换操作(即移除对 rcContent 的那次 -replace
插入),确保当资源被移除时脚本不再补写该字符串资源。
- Around line 191-198: The string-form VALUE "FileVersion" is being set to
$editionVersion which can differ from the normalized numeric version
(major,minor,patch,0); update the replacement to reuse the exact normalized
version string used earlier when constructing the numeric FileVersion (the same
value you used for the numeric 4-part version) instead of $editionVersion so the
string and numeric FileVersion (and the .rc contents) remain identical; locate
the VALUE "FileVersion" replacement logic (rcContent and the regex matching
VALUE "FileVersion") and swap in the normalized version variable rather than
$editionVersion.
In `@Inkeys/Inkeys.rc`:
- Around line 246-248: The FileVersion string ("FileVersion", "3.0.0.0") was
updated but the fixed numeric fields FILEVERSION/PRODUCTVERSION in the
VERSIONINFO block remain at 1,0,0,0; update the numeric VERSIONINFO entries
(FILEVERSION and PRODUCTVERSION) to match the string value (3,0,0,0) so the
fixed-version fields and the StringFileInfo "FileVersion" are synchronized
(ensure any macros/defines used for FILEVERSION/PRODUCTVERSION are also updated
if present).
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 86165dcc-9fa0-4fa3-8190-d4d34342348c
📒 Files selected for processing (5)
.github/workflows/msbuild.ymlInkeys/Inkeys.apsInkeys/Inkeys.rcInkeys/Inkeys.vcxprojInkeys/Inkeys.vcxproj.filters
.github/workflows/msbuild.yml
Outdated
| if ($rcContent -match '(?m)^\s*VALUE\s+"FileVersion",') | ||
| { | ||
| $rcContent = $rcContent -replace '(?m)^(\s*VALUE\s+"FileVersion",\s*").*("\r?)$', ('${1}' + $editionVersion + '${2}') | ||
| } | ||
| else | ||
| { | ||
| $rcContent = $rcContent -replace '(?m)^(\s*VALUE\s+"CompanyName",.*\r?\n)', ('${1} VALUE "FileVersion", "' + $editionVersion + '"' + "`r`n") | ||
| } |
There was a problem hiding this comment.
字符串版 FileVersion 还是会和固定版本号打架。
前面已经把固定字段归一化成 major,minor,patch,0,这里却直接把 VALUE "FileVersion" 写回 $editionVersion。由于前面的校验只接受三段 SemVer,CI 产物最终会出现 3,0,0,0 对 3.0.0 这类不一致,和当前 .rc 中提交的 3.0.0.0 也对不上。
建议复用同一个归一化版本字符串
$versionNumber = "{0},{1},{2},0" -f $semverMatch.Groups['major'].Value, $semverMatch.Groups['minor'].Value, $semverMatch.Groups['patch'].Value
+ $versionString = "{0}.{1}.{2}.0" -f $semverMatch.Groups['major'].Value, $semverMatch.Groups['minor'].Value, $semverMatch.Groups['patch'].Value
...
- $rcContent = $rcContent -replace '(?m)^(\s*VALUE\s+"FileVersion",\s*").*("\r?)$', ('${1}' + $editionVersion + '${2}')
+ $rcContent = $rcContent -replace '(?m)^(\s*VALUE\s+"FileVersion",\s*").*("\r?)$', ('${1}' + $versionString + '${2}')
...
- $rcContent = $rcContent -replace '(?m)^(\s*VALUE\s+"CompanyName",.*\r?\n)', ('${1} VALUE "FileVersion", "' + $editionVersion + '"' + "`r`n")
+ $rcContent = $rcContent -replace '(?m)^(\s*VALUE\s+"CompanyName",.*\r?\n)', ('${1} VALUE "FileVersion", "' + $versionString + '"' + "`r`n")🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/msbuild.yml around lines 191 - 198, The string-form VALUE
"FileVersion" is being set to $editionVersion which can differ from the
normalized numeric version (major,minor,patch,0); update the replacement to
reuse the exact normalized version string used earlier when constructing the
numeric FileVersion (the same value you used for the numeric 4-part version)
instead of $editionVersion so the string and numeric FileVersion (and the .rc
contents) remain identical; locate the VALUE "FileVersion" replacement logic
(rcContent and the regex matching VALUE "FileVersion") and swap in the
normalized version variable rather than $editionVersion.
.github/workflows/msbuild.yml
Outdated
| if ($rcContent -match '(?m)^\s*VALUE\s+"ProductVersion",') | ||
| { | ||
| $rcContent = $rcContent -replace '(?m)^(\s*VALUE\s+"ProductVersion",\s*").*("\r?)$', ('${1}' + $editionVersion + '${2}') | ||
| } | ||
| else | ||
| { | ||
| $rcContent = $rcContent -replace '(?m)^(\s*VALUE\s+"ProductName",.*\r?\n)', ('${1} VALUE "ProductVersion", "' + $editionVersion + '"' + "`r`n") |
There was a problem hiding this comment.
这段会把刚删掉的 ProductVersion 字符串资源补回去。
Inkeys/Inkeys.rc 已经去掉 VALUE "ProductVersion",但这里在字段缺失时会按 ProductName 后重新插入。结果是 CI 构建产物会和仓库里的 .rc、本地构建结果不一致。
如果目标是移除该字符串资源,建议删掉补写分支
if ($rcContent -match '(?m)^\s*VALUE\s+"ProductVersion",')
{
$rcContent = $rcContent -replace '(?m)^(\s*VALUE\s+"ProductVersion",\s*").*("\r?)$', ('${1}' + $editionVersion + '${2}')
}
- else
- {
- $rcContent = $rcContent -replace '(?m)^(\s*VALUE\s+"ProductName",.*\r?\n)', ('${1} VALUE "ProductVersion", "' + $editionVersion + '"' + "`r`n")
- }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if ($rcContent -match '(?m)^\s*VALUE\s+"ProductVersion",') | |
| { | |
| $rcContent = $rcContent -replace '(?m)^(\s*VALUE\s+"ProductVersion",\s*").*("\r?)$', ('${1}' + $editionVersion + '${2}') | |
| } | |
| else | |
| { | |
| $rcContent = $rcContent -replace '(?m)^(\s*VALUE\s+"ProductName",.*\r?\n)', ('${1} VALUE "ProductVersion", "' + $editionVersion + '"' + "`r`n") | |
| if ($rcContent -match '(?m)^\s*VALUE\s+"ProductVersion",') | |
| { | |
| $rcContent = $rcContent -replace '(?m)^(\s*VALUE\s+"ProductVersion",\s*").*("\r?)$', ('${1}' + $editionVersion + '${2}') | |
| } |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In @.github/workflows/msbuild.yml around lines 200 - 206, 当前脚本通过检测 rcContent
中是否存在 'VALUE "ProductVersion"',在不存在时(else 分支)又把该字符串资源重新插回去,导致 CI
构件与仓库及本地构建不一致;请修改与 rcContent 相关的逻辑:在处理匹配 '(?m)^\s*VALUE\s+"ProductVersion",' 的
if/else 结构中删除或取消 else 分支中将 'VALUE "ProductVersion"' 重新插入的替换操作(即移除对 rcContent 的那次
-replace 插入),确保当资源被移除时脚本不再补写该字符串资源。
Inkeys/Inkeys.rc
Outdated
| VALUE "FileVersion", "3.0.0.0" | ||
| VALUE "InternalName", "Inkeys" | ||
| VALUE "LegalCopyright", "Copyright © 2023-2025 AlanCRL(陈润林) 工作室" | ||
| VALUE "LegalCopyright", "Copyright © 2023-2026 AlanCRL(陈润林) 工作室" |
There was a problem hiding this comment.
固定版本字段还停留在旧值。
这里只改了 StringFileInfo 里的 FileVersion,但同一 VERSIONINFO 块上的 FILEVERSION / PRODUCTVERSION 仍然是 1,0,0,0。Windows 常见读取路径更依赖固定字段,所以任何没走这段 CI 回写的构建产物都会继续显示旧版本。
建议同步固定版本字段
VS_VERSION_INFO VERSIONINFO
- FILEVERSION 1,0,0,0
- PRODUCTVERSION 1,0,0,0
+ FILEVERSION 3,0,0,0
+ PRODUCTVERSION 3,0,0,0🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@Inkeys/Inkeys.rc` around lines 246 - 248, The FileVersion string
("FileVersion", "3.0.0.0") was updated but the fixed numeric fields
FILEVERSION/PRODUCTVERSION in the VERSIONINFO block remain at 1,0,0,0; update
the numeric VERSIONINFO entries (FILEVERSION and PRODUCTVERSION) to match the
string value (3,0,0,0) so the fixed-version fields and the StringFileInfo
"FileVersion" are synchronized (ensure any macros/defines used for
FILEVERSION/PRODUCTVERSION are also updated if present).
Introduce experimental PPT helper options: add AutoTakeOver and AutoTakeOverExpand config fields (rename autoClean -> AutoClean), expose them in the INKEYS_CONFIG_SCHEMA, and update config loading to use the new AutoClean name. Add UI controls in Setting.cpp for the PPT takeover feature (toggles, descriptions, and persistence via config.Write), import the config module, and adjust minor formatting. Add corresponding i18n keys in en-US and zh-TW (empty placeholders) and provide Chinese translations in zh-CN. Update generated i18n header (IdtI18nKeys.g.h) to include the new keys.
There was a problem hiding this comment.
Actionable comments posted: 3
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
Inkeys/Inkeys/Other/Other.Config.cppm (1)
41-53:⚠️ Potential issue | 🟠 Major重命名 JSON 键会导致用户现有配置丢失
将配置字段从 camelCase 重命名为 PascalCase(
autoClean→AutoClean,autoTakeOver→AutoTakeOver等)是一个破坏性变更。根据Other.Config.cpp中的JsonReadingHandler::HandleValue和TryGetValueAtPath逻辑,当新的 PascalCase 键名在 JSON 文件中找不到时,代码会直接返回并使用默认值,而不会尝试读取旧的 camelCase 键名。这意味着用户升级后,之前在配置文件中保存的
autoTakeOver: true等设置会被静默忽略,恢复为默认值false。建议添加迁移逻辑,在
TryGetValueAtPath或HandleValue中检查旧键名作为 fallback:🛠️ 参考迁移方案
可以在
Other.Config.cpp中添加一个旧键名映射表,并在TryGetValueAtPath找不到新键时尝试旧键:// 旧键名到新键名的映射(用于向后兼容) static const std::unordered_map<std::string, std::string> legacyKeyMap = { {"autoClean", "AutoClean"}, {"autoTakeOver", "AutoTakeOver"}, {"autoTakeOverExpand", "AutoTakeOverExpand"}, }; // 在 TryGetValueAtPath 中,如果新键不存在,尝试旧键 if (!current->isMember(leaf)) { // 尝试查找旧键名 for (const auto& [oldKey, newKey] : legacyKeyMap) { if (newKey == leaf && current->isMember(oldKey)) { return &(*current)[oldKey]; } } return nullptr; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Inkeys/Inkeys/Other/Other.Config.cppm` around lines 41 - 53, The config renaming to PascalCase lost backward compatibility; update the JSON reading to fallback to legacy camelCase keys by adding a legacy key map and checking it when TryGetValueAtPath (used by JsonReadingHandler::HandleValue) fails to find the new key: add a static legacyKeyMap mapping old->new names (e.g., "autoClean"->"AutoClean", "autoTakeOver"->"AutoTakeOver", etc.), and modify TryGetValueAtPath so that if current->isMember(leaf) is false it iterates the map to find a matching old key for the requested new leaf and returns that value pointer before returning nullptr. Ensure the change is used by JsonReadingHandler::HandleValue so existing user JSON values are preserved.
🧹 Nitpick comments (2)
Inkeys/Inkeys/Other/Other.Config.cppm (2)
250-250: 文件末尾缺少换行符按照 POSIX 标准和大多数代码风格指南,文本文件应以换行符结尾。这可能会在某些工具(如
git diff)中产生警告。🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Inkeys/Inkeys/Other/Other.Config.cppm` at line 250, 在文件 Inkeys/Other/Other.Config.cppm 的末尾(当前以 "*/" 结尾)添加一个单一的换行符以确保文件以换行结束,遵循 POSIX 标准并消除 git diff 等工具的警告;只需在文件尾部插入一个 '\n' 并保存即可。
64-64: 示例代码中的字段名与实际 schema 不一致注释中的示例代码仍然使用旧的 camelCase 命名
autoTakeOver,但实际 schema 已更改为AutoTakeOver。此外,文件后半部分的维护说明(第 157、171-173、193、234、236 行)也多处使用旧命名。建议同步更新所有注释和文档,保持与代码一致:
📝 建议的修改
- bool enabled = cfg.PlugIn.PPTHelper.autoTakeOver.load(); + bool enabled = cfg.PlugIn.PPTHelper.AutoTakeOver.load();同时更新第 157、171-173、193、234、236 行中的
autoClean、autoTakeOver、autoTakeOverExpand为对应的 PascalCase 形式。🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Inkeys/Inkeys/Other/Other.Config.cppm` at line 64, 示例注释和维护说明中仍使用旧的 camelCase 字段名(例如 autoTakeOver、autoClean、autoTakeOverExpand),需要在此文件(Other.Config.cppm)中把所有这些字段统一改为 schema 的 PascalCase 形式(AutoTakeOver、AutoClean、AutoTakeOverExpand);具体修复点包括把代码引用 cfg.PlugIn.PPTHelper.autoTakeOver.load() 改为 cfg.PlugIn.PPTHelper.AutoTakeOver.load(),并同步更新注释示例与文档片段中出现的相同字段名(包括后半部分的维护说明处),确保所有出现的旧命名都被替换为新命名以保持一致性。
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@Inkeys/Inkeys/UI/Setting/Setting.cpp`:
- Around line 6467-6594: The outer BeginChild("PPT演示助手#7", { 750.0f *
settingGlobalScale,165.0f * settingGlobalScale }, ...) is too short and clips
inner children; change it to compute or set a larger height that accommodates
the title area + the 100px child + the 60px child + inter-block spacing (or sum
them dynamically) so the inner blocks like "接管放映批注" and "接管放映批注拓展" are fully
visible; locate the call to ImGui::BeginChild with the "PPT演示助手#7" ID and
replace the fixed 165.0f * settingGlobalScale with either a computed value
(e.g., titleHeight + 100.0f*settingGlobalScale + 60.0f*settingGlobalScale +
gaps) or a larger constant to avoid clipping.
In `@Inkeys/src/i18n/en-US.jsonc`:
- Around line 392-394: The i18n keys "AutoTakeOver", "AutoTakeOverE", and
"AutoTakeOverExpand" are empty and cause missing text on the English settings
page; populate these keys with meaningful English strings: set "AutoTakeOver" to
a short label like "Auto Takeover", "AutoTakeOverE" to the toggle/option
description like "Enable automatic takeover of input when criteria are met", and
"AutoTakeOverExpand" to a longer explanatory/help string clarifying what the
auto-takeover does and any caveats so the settings control has a title and
description.
In `@Inkeys/src/i18n/zh-TW.jsonc`:
- Around line 392-394: The three new localization keys "AutoTakeOver",
"AutoTakeOverE", and "AutoTakeOverExpand" were committed with empty string
values, causing visible UI labels to render blank; update the zh-TW translations
to non-empty strings (provide appropriate Traditional Chinese text) for these
keys so the settings UI reads correctly where they are rendered (the Settings UI
reads these keys and displays them as titles/descriptions).
---
Outside diff comments:
In `@Inkeys/Inkeys/Other/Other.Config.cppm`:
- Around line 41-53: The config renaming to PascalCase lost backward
compatibility; update the JSON reading to fallback to legacy camelCase keys by
adding a legacy key map and checking it when TryGetValueAtPath (used by
JsonReadingHandler::HandleValue) fails to find the new key: add a static
legacyKeyMap mapping old->new names (e.g., "autoClean"->"AutoClean",
"autoTakeOver"->"AutoTakeOver", etc.), and modify TryGetValueAtPath so that if
current->isMember(leaf) is false it iterates the map to find a matching old key
for the requested new leaf and returns that value pointer before returning
nullptr. Ensure the change is used by JsonReadingHandler::HandleValue so
existing user JSON values are preserved.
---
Nitpick comments:
In `@Inkeys/Inkeys/Other/Other.Config.cppm`:
- Line 250: 在文件 Inkeys/Other/Other.Config.cppm 的末尾(当前以 "*/"
结尾)添加一个单一的换行符以确保文件以换行结束,遵循 POSIX 标准并消除 git diff 等工具的警告;只需在文件尾部插入一个 '\n' 并保存即可。
- Line 64: 示例注释和维护说明中仍使用旧的 camelCase 字段名(例如
autoTakeOver、autoClean、autoTakeOverExpand),需要在此文件(Other.Config.cppm)中把所有这些字段统一改为
schema 的 PascalCase 形式(AutoTakeOver、AutoClean、AutoTakeOverExpand);具体修复点包括把代码引用
cfg.PlugIn.PPTHelper.autoTakeOver.load() 改为
cfg.PlugIn.PPTHelper.AutoTakeOver.load(),并同步更新注释示例与文档片段中出现的相同字段名(包括后半部分的维护说明处),确保所有出现的旧命名都被替换为新命名以保持一致性。
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 778741ae-8d51-4386-ad09-e506b7fe62e9
📒 Files selected for processing (7)
Inkeys/IdtI18nKeys.g.hInkeys/Inkeys/Other/Other.Config.cppInkeys/Inkeys/Other/Other.Config.cppmInkeys/Inkeys/UI/Setting/Setting.cppInkeys/src/i18n/en-US.jsoncInkeys/src/i18n/zh-CN.jsoncInkeys/src/i18n/zh-TW.jsonc
✅ Files skipped from review due to trivial changes (2)
- Inkeys/IdtI18nKeys.g.h
- Inkeys/src/i18n/zh-CN.jsonc
| ImGui::BeginChild("PPT演示助手#7", { 750.0f * settingGlobalScale,165.0f * settingGlobalScale }, false, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse); | ||
|
|
||
| { | ||
| ImGui::SetCursorPos({ 0.0f * settingGlobalScale, 0.0f * settingGlobalScale }); | ||
| ImFontMain->Scale = 0.6f, PushFontNum++, ImGui::PushFont(ImFontMain); | ||
| PushStyleColorNum++, ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(0, 0, 0, 255)); | ||
| ImGui::TextUnformatted(IA(I18nKey.SettingsUI.PlugIn.PPTHelper.Tentative.N).c_str()); | ||
| } | ||
|
|
||
| { | ||
| ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 10.0f * settingGlobalScale); | ||
| PushStyleVarNum++, ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f)); | ||
| PushStyleVarNum++, ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 4.0f); | ||
| PushStyleColorNum++, ImGui::PushStyleColor(ImGuiCol_ChildBg, IM_COL32(251, 251, 251, 255)); | ||
| ImGui::BeginChild("接管放映批注", { 750.0f * settingGlobalScale,100.0f * settingGlobalScale }, true, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse); | ||
|
|
||
| float cursosPosY = 0; | ||
| { | ||
| ImGui::SetCursorPos({ 20.0f * settingGlobalScale, cursosPosY + 22.0f * settingGlobalScale }); | ||
| ImFontMain->Scale = 0.6f, PushFontNum++, ImGui::PushFont(ImFontMain); | ||
| PushStyleColorNum++, ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(0, 0, 0, 255)); | ||
| ImGui::TextUnformatted(IA(I18nKey.SettingsUI.PlugIn.PPTHelper.Tentative.AutoTakeOver).c_str()); | ||
| } | ||
| { | ||
| bool value = Inkeys::config.PlugIn.PPTHelper.AutoTakeOver; | ||
|
|
||
| ImGui::SetCursorPos({ 690.0f * settingGlobalScale, cursosPosY + 20.0f * settingGlobalScale }); | ||
| PushStyleColorNum++, ImGui::PushStyleColor(ImGuiCol_FrameBg, IM_COL32(0, 0, 0, 6)); | ||
| PushStyleColorNum++, ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, IM_COL32(0, 0, 0, 15)); | ||
| PushStyleColorNum++, ImGui::PushStyleColor(ImGuiCol_Button, IM_COL32(0, 95, 184, 255)); | ||
| PushStyleColorNum++, ImGui::PushStyleColor(ImGuiCol_ButtonHovered, IM_COL32(0, 95, 184, 230)); | ||
| if (!value) | ||
| { | ||
| PushStyleColorNum++, ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(0, 0, 0, 155)); | ||
| PushStyleColorNum++, ImGui::PushStyleColor(ImGuiCol_BorderShadow, IM_COL32(0, 0, 0, 155)); | ||
| } | ||
| else | ||
| { | ||
| PushStyleColorNum++, ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(255, 255, 255, 255)); | ||
| PushStyleColorNum++, ImGui::PushStyleColor(ImGuiCol_BorderShadow, IM_COL32(0, 95, 184, 255)); | ||
| } | ||
| ImGui::Toggle("##接管放映批注", &value, config); | ||
|
|
||
| if (Inkeys::config.PlugIn.PPTHelper.AutoTakeOver != value) | ||
| { | ||
| Inkeys::config.PlugIn.PPTHelper.AutoTakeOver = value; | ||
| Inkeys::config.Write(); | ||
| } | ||
| } | ||
|
|
||
| cursosPosY = ImGui::GetCursorPosY(); | ||
| { | ||
| ImGui::SetCursorPos({ 20.0f * settingGlobalScale, cursosPosY + 10.0f * settingGlobalScale }); | ||
|
|
||
| PushStyleVarNum++, ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f)); | ||
| PushStyleVarNum++, ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 0.0f); | ||
| ImGui::BeginChild("接管放映批注-介绍", { 710.0f * settingGlobalScale,30.0f * settingGlobalScale }, false); | ||
|
|
||
| { | ||
| ImFontMain->Scale = 0.5f, PushFontNum++, ImGui::PushFont(ImFontMain); | ||
| PushStyleColorNum++, ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(120, 120, 120, 255)); | ||
|
|
||
| ImGui::TextWrapped(IA(I18nKey.SettingsUI.PlugIn.PPTHelper.Tentative.AutoTakeOverE).c_str()); | ||
| } | ||
|
|
||
| { | ||
| if (PushStyleColorNum >= 0) ImGui::PopStyleColor(PushStyleColorNum), PushStyleColorNum = 0; | ||
| if (PushStyleVarNum >= 0) ImGui::PopStyleVar(PushStyleVarNum), PushStyleVarNum = 0; | ||
| while (PushFontNum) PushFontNum--, ImGui::PopFont(); | ||
| } | ||
| ImGui::EndChild(); | ||
| } | ||
|
|
||
| { | ||
| if (PushStyleColorNum >= 0) ImGui::PopStyleColor(PushStyleColorNum), PushStyleColorNum = 0; | ||
| if (PushStyleVarNum >= 0) ImGui::PopStyleVar(PushStyleVarNum), PushStyleVarNum = 0; | ||
| while (PushFontNum) PushFontNum--, ImGui::PopFont(); | ||
| } | ||
| ImGui::EndChild(); | ||
| } | ||
| { | ||
| ImGui::SetCursorPosY(ImGui::GetCursorPosY() + 5.0f * settingGlobalScale); | ||
| PushStyleVarNum++, ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f)); | ||
| PushStyleVarNum++, ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 4.0f); | ||
| PushStyleColorNum++, ImGui::PushStyleColor(ImGuiCol_ChildBg, IM_COL32(251, 251, 251, 255)); | ||
| ImGui::BeginChild("接管放映批注拓展", { 750.0f * settingGlobalScale,60.0f * settingGlobalScale }, true, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse); | ||
|
|
||
| float cursosPosY = 0; | ||
| { | ||
| ImGui::SetCursorPos({ 20.0f * settingGlobalScale, cursosPosY + 22.0f * settingGlobalScale }); | ||
| ImFontMain->Scale = 0.6f, PushFontNum++, ImGui::PushFont(ImFontMain); | ||
| PushStyleColorNum++, ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(0, 0, 0, 255)); | ||
| ImGui::TextUnformatted(IA(I18nKey.SettingsUI.PlugIn.PPTHelper.Tentative.AutoTakeOverExpand).c_str()); | ||
| } | ||
| { | ||
| bool value = Inkeys::config.PlugIn.PPTHelper.AutoTakeOverExpand; | ||
|
|
||
| ImGui::SetCursorPos({ 690.0f * settingGlobalScale, cursosPosY + 20.0f * settingGlobalScale }); | ||
| PushStyleColorNum++, ImGui::PushStyleColor(ImGuiCol_FrameBg, IM_COL32(0, 0, 0, 6)); | ||
| PushStyleColorNum++, ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, IM_COL32(0, 0, 0, 15)); | ||
| PushStyleColorNum++, ImGui::PushStyleColor(ImGuiCol_Button, IM_COL32(0, 95, 184, 255)); | ||
| PushStyleColorNum++, ImGui::PushStyleColor(ImGuiCol_ButtonHovered, IM_COL32(0, 95, 184, 230)); | ||
| if (!value) | ||
| { | ||
| PushStyleColorNum++, ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(0, 0, 0, 155)); | ||
| PushStyleColorNum++, ImGui::PushStyleColor(ImGuiCol_BorderShadow, IM_COL32(0, 0, 0, 155)); | ||
| } | ||
| else | ||
| { | ||
| PushStyleColorNum++, ImGui::PushStyleColor(ImGuiCol_Text, IM_COL32(255, 255, 255, 255)); | ||
| PushStyleColorNum++, ImGui::PushStyleColor(ImGuiCol_BorderShadow, IM_COL32(0, 95, 184, 255)); | ||
| } | ||
| ImGui::Toggle("##接管放映批注拓展", &value, config); | ||
|
|
||
| if (Inkeys::config.PlugIn.PPTHelper.AutoTakeOverExpand != value) | ||
| { | ||
| Inkeys::config.PlugIn.PPTHelper.AutoTakeOverExpand = value; | ||
| Inkeys::config.Write(); | ||
| } | ||
| } | ||
|
|
||
| { | ||
| if (PushStyleColorNum >= 0) ImGui::PopStyleColor(PushStyleColorNum), PushStyleColorNum = 0; | ||
| if (PushStyleVarNum >= 0) ImGui::PopStyleVar(PushStyleVarNum), PushStyleVarNum = 0; | ||
| while (PushFontNum) PushFontNum--, ImGui::PopFont(); | ||
| } | ||
| ImGui::EndChild(); | ||
| } |
There was a problem hiding this comment.
增大 PPT演示助手#7 的外层容器高度。
Line 6467 把外层 BeginChild 固定成 165 * settingGlobalScale,但里面已经放了标题区、一个 100px 子块、一个 60px 子块和中间间距,实际内容高度明显超过这个值。这里又禁用了滚动,所以“接管放映批注拓展”这块会被裁掉,低缩放下甚至可能点不到。
💡 建议修改
- ImGui::BeginChild("PPT演示助手#7", { 750.0f * settingGlobalScale,165.0f * settingGlobalScale }, false, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse);
+ ImGui::BeginChild("PPT演示助手#7", { 750.0f * settingGlobalScale,195.0f * settingGlobalScale }, false, ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse);🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@Inkeys/Inkeys/UI/Setting/Setting.cpp` around lines 6467 - 6594, The outer
BeginChild("PPT演示助手#7", { 750.0f * settingGlobalScale,165.0f *
settingGlobalScale }, ...) is too short and clips inner children; change it to
compute or set a larger height that accommodates the title area + the 100px
child + the 60px child + inter-block spacing (or sum them dynamically) so the
inner blocks like "接管放映批注" and "接管放映批注拓展" are fully visible; locate the call to
ImGui::BeginChild with the "PPT演示助手#7" ID and replace the fixed 165.0f *
settingGlobalScale with either a computed value (e.g., titleHeight +
100.0f*settingGlobalScale + 60.0f*settingGlobalScale + gaps) or a larger
constant to avoid clipping.
| "AutoTakeOver": "", | ||
| "AutoTakeOverE": "", | ||
| "AutoTakeOverExpand": "" |
There was a problem hiding this comment.
新增 i18n 键为空字符串会造成英文设置页文本缺失。
Line 392-394 目前是空值;这些键在设置页被直接显示,最终会出现“开关有控件但无标题/说明”的问题。
建议修复(示例)
- "AutoTakeOver": "",
- "AutoTakeOverE": "",
- "AutoTakeOverExpand": ""
+ "AutoTakeOver": "Auto take over slideshow annotations",
+ "AutoTakeOverE": "Automatically take over annotation controls when a slideshow starts.",
+ "AutoTakeOverExpand": "Enable advanced takeover options"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "AutoTakeOver": "", | |
| "AutoTakeOverE": "", | |
| "AutoTakeOverExpand": "" | |
| "AutoTakeOver": "Auto take over slideshow annotations", | |
| "AutoTakeOverE": "Automatically take over annotation controls when a slideshow starts.", | |
| "AutoTakeOverExpand": "Enable advanced takeover options" |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@Inkeys/src/i18n/en-US.jsonc` around lines 392 - 394, The i18n keys
"AutoTakeOver", "AutoTakeOverE", and "AutoTakeOverExpand" are empty and cause
missing text on the English settings page; populate these keys with meaningful
English strings: set "AutoTakeOver" to a short label like "Auto Takeover",
"AutoTakeOverE" to the toggle/option description like "Enable automatic takeover
of input when criteria are met", and "AutoTakeOverExpand" to a longer
explanatory/help string clarifying what the auto-takeover does and any caveats
so the settings control has a title and description.
| "AutoTakeOver": "", | ||
| "AutoTakeOverE": "", | ||
| "AutoTakeOverExpand": "" |
There was a problem hiding this comment.
请不要提交空翻译值,这会让设置项文案显示为空。
Line 392-394 新增键值为空字符串;这些键在设置页被直接渲染为可见文本(Inkeys/Inkeys/UI/Setting/Setting.cpp Line 6481-6585)。当前会导致用户看不到开关标题/说明。
建议修复(示例)
- "AutoTakeOver": "",
- "AutoTakeOverE": "",
- "AutoTakeOverExpand": ""
+ "AutoTakeOver": "自動接管放映批註",
+ "AutoTakeOverE": "偵測到放映開始後自動接管批註控制。",
+ "AutoTakeOverExpand": "啟用接管批註擴展選項"📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "AutoTakeOver": "", | |
| "AutoTakeOverE": "", | |
| "AutoTakeOverExpand": "" | |
| "AutoTakeOver": "自動接管放映批註", | |
| "AutoTakeOverE": "偵測到放映開始後自動接管批註控制。", | |
| "AutoTakeOverExpand": "啟用接管批註擴展選項" |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@Inkeys/src/i18n/zh-TW.jsonc` around lines 392 - 394, The three new
localization keys "AutoTakeOver", "AutoTakeOverE", and "AutoTakeOverExpand" were
committed with empty string values, causing visible UI labels to render blank;
update the zh-TW translations to non-empty strings (provide appropriate
Traditional Chinese text) for these keys so the settings UI reads correctly
where they are rendered (the Settings UI reads these keys and displays them as
titles/descriptions).
Update msbuild workflow to write a ProductVersion string that appends the UTC build timestamp to the edition version instead of trying to parse SemVer and derive numeric FILEVERSION/PRODUCTVERSION tokens. Rename the workflow step to "写入 RC 产品版本号" and replace ProductVersion value with "<edition> <UTC time> UTC". Remove the previous FILEVERSION/PRODUCTVERSION numeric replacements in the script. Also update Inkeys.rc FileVersion to 1.0.0.0 and include the related Inkeys.aps resource change.
Hook PPT takeover logic to the new config flags and clean up related code: import the Config module, remove the unused pptTakeoverHostInk flag, and use config.PlugIn.PPTHelper.AutoTakeOver/AutoTakeOverExpand in PptInfo. Change default AutoTakeOverExpand to true. Update the settings UI to show a compact layout with inline explanatory text for the takeover option. Refresh Chinese i18n strings to match the updated behavior and wording.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
Inkeys/IdtPlug-in.cpp (1)
54-55: 建议避免在该实现文件使用全局using namespace Inkeys;。该文件体量很大,全局导入命名空间会放大符号冲突和可读性成本;建议改为局部
using或显式Inkeys::。🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Inkeys/IdtPlug-in.cpp` around lines 54 - 55, 在实现文件中全局使用 `using namespace Inkeys;` 会引入符号冲突和可读性问题;请删除这一全局声明并改为局部导入或显式限定符:在需要的函数或小范围作用域内使用 `using Inkeys::SymbolName;` 引入具体符号,或将所有 Inkeys 符号改为显式 `Inkeys::...` 调用(查找并替换文件中使用未限定名的标识符以引用 `Inkeys::` 前缀或添加局部 using)。Inkeys/Inkeys/UI/Setting/Setting.cpp (1)
6462-6585: 可以把这里抽成一个“开关设置项” helper。这两段 UI 除了标题、说明文案和绑定字段不同,布局、样式和持久化逻辑几乎完全一致。后面再加类似选项时,这种复制很容易漏掉
Push/Pop配对,或者把配置字段复制错。🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@Inkeys/Inkeys/UI/Setting/Setting.cpp` around lines 6462 - 6585, Extract a reusable helper (e.g., RenderToggleSetting or RenderToggleChild) that encapsulates the repeated ImGui push/pop logic, BeginChild/EndChild calls, text layout and the toggle + persistence step so you avoid duplicated PushStyleColorNum/PushStyleVarNum/PushFontNum handling and mismatched Pop calls; the helper should accept unique identifiers/labels (the child names like "接管放映批注" / "接管放映批注拓展" or the outer BeginChild title), i18n keys (IA(I18nKey.SettingsUI.PlugIn.PPTHelper.Tentative.AutoTakeOver/E/...)), and a reference to the bool config field (Inkeys::config.PlugIn.PPTHelper.AutoTakeOver or AutoTakeOverExpand) and perform ImGui::Toggle plus config write when changed; replace the two duplicated blocks with calls to this helper so all PushStyleColorNum/PushStyleVarNum/PushFontNum increments and corresponding PopStyleColor/PopStyleVar/PopFont happen only inside the helper.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@Inkeys/IdtPlug-in.cpp`:
- Around line 2389-2390: 条件判断过度依赖 config.PlugIn.PPTHelper.AutoTakeOver
导致未显式配置的用户行为回归;在使用该变量的判断(位于包含
Initialization、PptInfoState.TotalPage、pptTakeoverConsumedInCurrentShow 的 else if
语句)中改为先检测字段是否存在/已初始化,若该配置缺失则按历史默认(例如 treat missing AutoTakeOver as
true)处理,或者在程序启动/配置加载时回填缺省值到
config.PlugIn.PPTHelper.AutoTakeOver;在修改时请定位使用该符号的条件并确保逻辑为 (Initialization &&
PptInfoState.TotalPage != -1 && (AutoTakeOver_is_set ?
config.PlugIn.PPTHelper.AutoTakeOver : true) &&
!pptTakeoverConsumedInCurrentShow) 以保兼容。
---
Nitpick comments:
In `@Inkeys/IdtPlug-in.cpp`:
- Around line 54-55: 在实现文件中全局使用 `using namespace Inkeys;`
会引入符号冲突和可读性问题;请删除这一全局声明并改为局部导入或显式限定符:在需要的函数或小范围作用域内使用 `using
Inkeys::SymbolName;` 引入具体符号,或将所有 Inkeys 符号改为显式 `Inkeys::...`
调用(查找并替换文件中使用未限定名的标识符以引用 `Inkeys::` 前缀或添加局部 using)。
In `@Inkeys/Inkeys/UI/Setting/Setting.cpp`:
- Around line 6462-6585: Extract a reusable helper (e.g., RenderToggleSetting or
RenderToggleChild) that encapsulates the repeated ImGui push/pop logic,
BeginChild/EndChild calls, text layout and the toggle + persistence step so you
avoid duplicated PushStyleColorNum/PushStyleVarNum/PushFontNum handling and
mismatched Pop calls; the helper should accept unique identifiers/labels (the
child names like "接管放映批注" / "接管放映批注拓展" or the outer BeginChild title), i18n keys
(IA(I18nKey.SettingsUI.PlugIn.PPTHelper.Tentative.AutoTakeOver/E/...)), and a
reference to the bool config field (Inkeys::config.PlugIn.PPTHelper.AutoTakeOver
or AutoTakeOverExpand) and perform ImGui::Toggle plus config write when changed;
replace the two duplicated blocks with calls to this helper so all
PushStyleColorNum/PushStyleVarNum/PushFontNum increments and corresponding
PopStyleColor/PopStyleVar/PopFont happen only inside the helper.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 5c842b40-3718-4c4f-9974-b5cf7d58437e
📒 Files selected for processing (4)
Inkeys/IdtPlug-in.cppInkeys/Inkeys/Other/Other.Config.cppmInkeys/Inkeys/UI/Setting/Setting.cppInkeys/src/i18n/zh-CN.jsonc
🚧 Files skipped from review as they are similar to previous changes (2)
- Inkeys/src/i18n/zh-CN.jsonc
- Inkeys/Inkeys/Other/Other.Config.cppm
Make the GitHub Actions PowerShell more robust when updating .rc files: check for existing FILEVERSION/PRODUCTVERSION and VALUE entries and insert them if missing, otherwise replace them. Update Inkeys resources: set FileVersion to 3.0.0.0, update copyright year to 2026, and remove the ProductVersion line. The binary .aps file changed accordingly.
Summary by CodeRabbit
新功能
修复 / 优化