@sonicloud/dsh-sonicloud-device 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/CHANGELOG.zh.md +28 -0
  3. package/README.md +24 -1
  4. package/README.zh.md +24 -1
  5. package/dist/build.json +1 -1
  6. package/dist/client.js +101 -2
  7. package/docs/contributing/development.md +31 -3
  8. package/docs/specs/smart-mouse-plugin.md +31 -1
  9. package/native/README.md +4 -0
  10. package/native/desktop/VOICE_SOURCE.json +16 -0
  11. package/native/desktop/VoicePanel.swift +27 -0
  12. package/native/desktop/darwin-arm64/Sonicloud Voice.app/Contents/MacOS/sonicloud-voice +0 -0
  13. package/native/desktop/darwin-arm64/Sonicloud Voice.app/Contents/_CodeSignature/CodeResources +115 -0
  14. package/native/screenshot/README.md +34 -0
  15. package/native/screenshot/SOURCE.json +218 -0
  16. package/native/screenshot/darwin-arm64/screentool-macos-1.2.2.zip +0 -0
  17. package/native/screenshot/patches/hide-cloud-actions.patch +202 -0
  18. package/native/screenshot/patches/mac-permissions.patch +545 -0
  19. package/native/screenshot/patches/upstream-files.json +22 -0
  20. package/native/screenshot/win32-x64/PixPinScrollCapture.dll +0 -0
  21. package/native/screenshot/win32-x64/Qt5Core.dll +0 -0
  22. package/native/screenshot/win32-x64/Qt5Gui.dll +0 -0
  23. package/native/screenshot/win32-x64/Qt5Network.dll +0 -0
  24. package/native/screenshot/win32-x64/Qt5Svg.dll +0 -0
  25. package/native/screenshot/win32-x64/Qt5Widgets.dll +0 -0
  26. package/native/screenshot/win32-x64/iconengines/qsvgicon.dll +0 -0
  27. package/native/screenshot/win32-x64/imageformats/qjpeg.dll +0 -0
  28. package/native/screenshot/win32-x64/imageformats/qsvg.dll +0 -0
  29. package/native/screenshot/win32-x64/libcrypto-1_1-x64.dll +0 -0
  30. package/native/screenshot/win32-x64/libssl-1_1-x64.dll +0 -0
  31. package/native/screenshot/win32-x64/msvcp140.dll +0 -0
  32. package/native/screenshot/win32-x64/platforms/qwindows.dll +0 -0
  33. package/native/screenshot/win32-x64/qwindowsvistastyle.dll +0 -0
  34. package/native/screenshot/win32-x64/screenhelper.exe +0 -0
  35. package/native/screenshot/win32-x64/screentool.dll +0 -0
  36. package/native/screenshot/win32-x64/vcruntime140.dll +0 -0
  37. package/native/screenshot/win32-x64/vcruntime140_1.dll +0 -0
  38. package/package.json +1 -1
  39. package/src/desktop/presentation.mjs +18 -4
  40. package/src/desktop/screenshot-worker.mjs +225 -0
  41. package/src/desktop/screenshot.mjs +185 -0
  42. package/src/devices/manager.mjs +37 -3
  43. package/src/host/index.mjs +5 -1
  44. package/src/shared/remote.mjs +5 -0
@@ -0,0 +1,115 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>files</key>
6
+ <dict/>
7
+ <key>files2</key>
8
+ <dict/>
9
+ <key>rules</key>
10
+ <dict>
11
+ <key>^Resources/</key>
12
+ <true/>
13
+ <key>^Resources/.*\.lproj/</key>
14
+ <dict>
15
+ <key>optional</key>
16
+ <true/>
17
+ <key>weight</key>
18
+ <real>1000</real>
19
+ </dict>
20
+ <key>^Resources/.*\.lproj/locversion.plist$</key>
21
+ <dict>
22
+ <key>omit</key>
23
+ <true/>
24
+ <key>weight</key>
25
+ <real>1100</real>
26
+ </dict>
27
+ <key>^Resources/Base\.lproj/</key>
28
+ <dict>
29
+ <key>weight</key>
30
+ <real>1010</real>
31
+ </dict>
32
+ <key>^version.plist$</key>
33
+ <true/>
34
+ </dict>
35
+ <key>rules2</key>
36
+ <dict>
37
+ <key>.*\.dSYM($|/)</key>
38
+ <dict>
39
+ <key>weight</key>
40
+ <real>11</real>
41
+ </dict>
42
+ <key>^(.*/)?\.DS_Store$</key>
43
+ <dict>
44
+ <key>omit</key>
45
+ <true/>
46
+ <key>weight</key>
47
+ <real>2000</real>
48
+ </dict>
49
+ <key>^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/</key>
50
+ <dict>
51
+ <key>nested</key>
52
+ <true/>
53
+ <key>weight</key>
54
+ <real>10</real>
55
+ </dict>
56
+ <key>^.*</key>
57
+ <true/>
58
+ <key>^Info\.plist$</key>
59
+ <dict>
60
+ <key>omit</key>
61
+ <true/>
62
+ <key>weight</key>
63
+ <real>20</real>
64
+ </dict>
65
+ <key>^PkgInfo$</key>
66
+ <dict>
67
+ <key>omit</key>
68
+ <true/>
69
+ <key>weight</key>
70
+ <real>20</real>
71
+ </dict>
72
+ <key>^Resources/</key>
73
+ <dict>
74
+ <key>weight</key>
75
+ <real>20</real>
76
+ </dict>
77
+ <key>^Resources/.*\.lproj/</key>
78
+ <dict>
79
+ <key>optional</key>
80
+ <true/>
81
+ <key>weight</key>
82
+ <real>1000</real>
83
+ </dict>
84
+ <key>^Resources/.*\.lproj/locversion.plist$</key>
85
+ <dict>
86
+ <key>omit</key>
87
+ <true/>
88
+ <key>weight</key>
89
+ <real>1100</real>
90
+ </dict>
91
+ <key>^Resources/Base\.lproj/</key>
92
+ <dict>
93
+ <key>weight</key>
94
+ <real>1010</real>
95
+ </dict>
96
+ <key>^[^/]+$</key>
97
+ <dict>
98
+ <key>nested</key>
99
+ <true/>
100
+ <key>weight</key>
101
+ <real>10</real>
102
+ </dict>
103
+ <key>^embedded\.provisionprofile$</key>
104
+ <dict>
105
+ <key>weight</key>
106
+ <real>20</real>
107
+ </dict>
108
+ <key>^version\.plist$</key>
109
+ <dict>
110
+ <key>weight</key>
111
+ <real>20</real>
112
+ </dict>
113
+ </dict>
114
+ </dict>
115
+ </plist>
@@ -0,0 +1,34 @@
1
+ # 截图运行组件
2
+
3
+ 随插件提供 ScreenTool 1.2.2 的 Windows x64、macOS ARM64 客户端与独立 helper。两端 helper 均应用 [入口显隐补丁](patches/hide-cloud-actions.patch) 后重建;macOS 另叠加[权限前检补丁](patches/mac-permissions.patch)。来源与文件 SHA-256 见 [SOURCE.json](SOURCE.json)。
4
+
5
+ - Windows:使用 Qt 5.15.2 重建 helper,保留原包的 Qt、图像格式、TLS、滚动截图与 VC 运行依赖;客户端 `screentool.dll` 来自同套 Electron 示例的 `lib/`。
6
+ - macOS:使用 Qt 6.2.4 重建 ARM64 helper,复用原包客户端、框架、PixPin 和 `Info.plist`,以原 Team `F3TYM6YPF7` 的 Developer ID 签名并通过 `codesign --verify --deep --strict`。本次未执行 Apple 公证。交付包要求 macOS 26.0+,该最低版本来自保留的客户端库。
7
+ - macOS 权限检查或截图前通过系统 `ditto` 将 `screentool-macos-1.2.2.zip` 解压到按压缩包 SHA-256 区分的用户缓存,保留签名、软链接与执行权限;新包使用新的缓存目录。
8
+ - 截图在独立进程执行,插件通过隔离的 Node worker 调用客户端库。停用插件时关闭 helper 及贴图,并等待原生回调线程退出。
9
+ - 选区、标注、复制、保存、贴图及滚动截图由 helper 提供。OCR、图像翻译与 Word 云转换未接入;界面效果与完整操作由用户人工验收。
10
+
11
+ ## 两端入口隐藏机制
12
+
13
+ 截图 worker 每次连接 helper 后先通过 `sct_set_config` 下发 `ocr_visible: false`、`trans_enabled: false`,配置成功后再发起截图。两端使用相同补丁:
14
+
15
+ - `trans_enabled: false` 使 Qt 工具条隐藏图片翻译按钮。
16
+ - `ocr_visible: false` 隐藏普通 OCR,并在每次滚动截图开始前移除自定义 OCR 动作;该动作原本用于启动 Word 导出。`onConvertImage` 同时检查此开关,阻止旧动作启动转换。
17
+ - 工具条宽度随隐藏按钮收缩;滚动截图按钮、PixPin 拼接以及复制、保存、贴图操作保留。
18
+
19
+ ## macOS 权限前检
20
+
21
+ 安装后的首次启用和服务重连会查询权限,在“声云设备”中显示持久引导;检查本身不申请系统权限、不创建截图蒙层。各组件所需权限与人工操作见[用户指南](../../README.zh.md#macos-首次授权)。
22
+
23
+ - helper 宣告 `permission_preflight` 能力,通过 `sct_query_state` 返回屏幕录制、辅助功能和组件路径。只有用户点击授权按钮后,宿主才以 `sct_set_config` 的 `permission_request` 字段请求 `screen` 或 `accessibility`,由 screenhelper 调用系统接口;请求受理不等于已授权。
24
+ - 宿主在发送截图命令前检查屏幕录制权限;原生进程也在创建选区、抓屏和显示蒙层前再次检查。缺权限时回报状态并结束截图会话,不显示蒙层,也避免触发客户端会话启动看门狗。
25
+ - 普通截图和手动滚动不要求辅助功能。重新检查时,仅在无活动截图或贴图的情况下重启截图 helper,以重新读取系统权限;不打断已有截图和贴图。
26
+
27
+ ## 重建
28
+
29
+ - Windows:`node scripts/native/build-screenshot.mjs --source <ScreenTool源码目录>`。
30
+ - macOS:`node scripts/native/build-screenshot-macos.mjs --source <ScreenTool源码目录>`;需要 Qt 6.2.4、构建工具及原 Team 的有效签名身份。
31
+
32
+ 脚本在插件 `work/` 中应用补丁、编译并运行原生离屏回归。macOS 脚本依次应用入口显隐与权限前检补丁,使用 `ditto` 复用并重新归档原 bundle,严格验签后生成新 ZIP 和构建回执;正式随包文件与来源记录由交付流程核对后更新。离屏回归与签名校验不代替首次授权、弹窗层级和完整截图操作的人工验收。
33
+
34
+ 这些供应商二进制及 Qt、OpenSSL、Microsoft VC Runtime、PixPinScrollCapture 等依赖保留各自许可,不适用仓库代码的 MIT 许可。原压缩包未提供单独的组件许可文件;公开再分发所需的完整声明与授权材料待供应商补齐。
@@ -0,0 +1,218 @@
1
+ {
2
+ "version": "1.2.2",
3
+ "importedAt": "2026-11-20",
4
+ "sources": [
5
+ {
6
+ "name": "screenTool.zip",
7
+ "platform": "win32-x64",
8
+ "sha256": "39b9643b750b4a0bd34ccda31ef61cbce5265729ca04337b3e871fb7f3ad1f1f"
9
+ },
10
+ {
11
+ "name": "screentool.dll",
12
+ "platform": "win32-x64",
13
+ "source": "uMouseToolsDemo/electron/lib/screentool.dll",
14
+ "sha256": "f7a2c5f306fd001f5066b291e63e0f2be463fd084688d4c547aeb5751d42a2fe"
15
+ },
16
+ {
17
+ "name": "screentool-macos-1.2.2.zip",
18
+ "platform": "darwin-arm64",
19
+ "sha256": "72c9d253e0e5789e86ded113d00d07d7247cb234151dccf9baf7577a42d6ea16"
20
+ }
21
+ ],
22
+ "files": [
23
+ {
24
+ "path": "darwin-arm64/screentool-macos-1.2.2.zip",
25
+ "sha256": "7da241467ded4df1dbf59052c70c0f238c13b60de5e9f698a888e6ff7a5b52a6"
26
+ },
27
+ {
28
+ "path": "win32-x64/iconengines/qsvgicon.dll",
29
+ "sha256": "42dde60befcf1d9f96b8366a9988626b97d7d0d829ebea32f756d6ecd9ea99a8"
30
+ },
31
+ {
32
+ "path": "win32-x64/imageformats/qjpeg.dll",
33
+ "sha256": "fb4e980cb5fafa8a4cd4239329aed93f7c32ed939c94b61fb2df657f3c6ad158"
34
+ },
35
+ {
36
+ "path": "win32-x64/imageformats/qsvg.dll",
37
+ "sha256": "b3498f0a10ac4cb42cf7213db4944a34594ff36c78c50a0f249c9085d1b1ff39"
38
+ },
39
+ {
40
+ "path": "win32-x64/libcrypto-1_1-x64.dll",
41
+ "sha256": "bbba422cb9f46bf3b1b8ecbb49668eab0b7d6a01547edb6b3e34eb6c0dcfc43f"
42
+ },
43
+ {
44
+ "path": "win32-x64/libssl-1_1-x64.dll",
45
+ "sha256": "3ec048166435783dbdae066a145e6586cd87b941bd1e9a5e70a0d6b226688538"
46
+ },
47
+ {
48
+ "path": "win32-x64/msvcp140.dll",
49
+ "sha256": "0f885b509a685d2bbfa652fed26b5fb31d88fbdab0a978c641d1c7b8aa460aa9"
50
+ },
51
+ {
52
+ "path": "win32-x64/PixPinScrollCapture.dll",
53
+ "sha256": "8831ce8ed6dd7eb41d21ac3b7195fb1afbd0762caa4c30b05e263fad961f0640"
54
+ },
55
+ {
56
+ "path": "win32-x64/platforms/qwindows.dll",
57
+ "sha256": "3333ba244c97264e3bd19db5953efa80a6e47aaced9d337ac3287ec718162b85"
58
+ },
59
+ {
60
+ "path": "win32-x64/Qt5Core.dll",
61
+ "sha256": "8d2ff4ce9096ddccc4f4cd62c2e41fc854cfd1b0d6e8d296645a7f5fd4ae565a"
62
+ },
63
+ {
64
+ "path": "win32-x64/Qt5Gui.dll",
65
+ "sha256": "5e7d2d41b8b92a880e83b8cc0ca173f5da61218604186196787ee1600956be1e"
66
+ },
67
+ {
68
+ "path": "win32-x64/Qt5Network.dll",
69
+ "sha256": "4ef341ae9302e793878020f0740b09b0f31cb380408a697f75c69fdbd20fc7a1"
70
+ },
71
+ {
72
+ "path": "win32-x64/Qt5Svg.dll",
73
+ "sha256": "7348cfc6444438b8845fb3f59381227325d40ca2187d463e82fc7b8e93e38db5"
74
+ },
75
+ {
76
+ "path": "win32-x64/Qt5Widgets.dll",
77
+ "sha256": "3788c669d4b645e5a576de9fc77fca776bf516d43c89143dc2ca28291ba14358"
78
+ },
79
+ {
80
+ "path": "win32-x64/qwindowsvistastyle.dll",
81
+ "sha256": "d9b21182952682fe7ba63af1df24e23ace592c35b3f31eceef9f0eabeb5881b9"
82
+ },
83
+ {
84
+ "path": "win32-x64/screenhelper.exe",
85
+ "sha256": "f3ddba8434f807e4b53e65cd842a2d79c2e921bdcfa8de30aec389d2c4f780b8"
86
+ },
87
+ {
88
+ "path": "win32-x64/screentool.dll",
89
+ "sha256": "f7a2c5f306fd001f5066b291e63e0f2be463fd084688d4c547aeb5751d42a2fe"
90
+ },
91
+ {
92
+ "path": "win32-x64/vcruntime140.dll",
93
+ "sha256": "d5e4d9a3e835fa679450145d6a7d94e36573a509317111904d9b3712c30d9066"
94
+ },
95
+ {
96
+ "path": "win32-x64/vcruntime140_1.dll",
97
+ "sha256": "1f2d41c4aa5db0bc33ebf7b66d72943a817d7ce6cbe880502a9403823633093f"
98
+ }
99
+ ],
100
+ "derived": {
101
+ "patch": "patches/hide-cloud-actions.patch",
102
+ "patchSha256": "886fd6810b7c467d747d66876fa043eaafc486bf6d0fa5ed0cbfce081b9e0bf5",
103
+ "upstreamFiles": "patches/upstream-files.json",
104
+ "upstreamBinarySha256": "c0d05cc76e865c838374fd76c58675768e9e9a5dd0bc466a0c7652f43ade5bf2",
105
+ "output": "win32-x64/screenhelper.exe",
106
+ "outputSha256": "f3ddba8434f807e4b53e65cd842a2d79c2e921bdcfa8de30aec389d2c4f780b8",
107
+ "build": "Windows x64 / Qt 5.15.2 / MSVC 2022 / Release",
108
+ "tests": [
109
+ {
110
+ "name": "test_cloud_actions",
111
+ "passed": 4,
112
+ "failed": 0,
113
+ "skipped": 0
114
+ },
115
+ {
116
+ "name": "test_helper_config",
117
+ "passed": 8,
118
+ "failed": 0,
119
+ "skipped": 0
120
+ }
121
+ ]
122
+ },
123
+ "derivedMacos": {
124
+ "patch": "patches/hide-cloud-actions.patch",
125
+ "patchSha256": "886fd6810b7c467d747d66876fa043eaafc486bf6d0fa5ed0cbfce081b9e0bf5",
126
+ "upstreamArchiveSha256": "72c9d253e0e5789e86ded113d00d07d7247cb234151dccf9baf7577a42d6ea16",
127
+ "output": "darwin-arm64/screentool-macos-1.2.2.zip",
128
+ "outputSha256": "7da241467ded4df1dbf59052c70c0f238c13b60de5e9f698a888e6ff7a5b52a6",
129
+ "helperSha256": "3eba261e2f25dc3173eae1198c2a5e77750f6aa16a1ea46c1f80e83e33c26a3d",
130
+ "preservedClientSha256": "f085323a3a17b3458b126b21c60372659022b33ebfa1e175434060d8a8a085e5",
131
+ "qtVersion": "6.2.4",
132
+ "deploymentTarget": "26.0",
133
+ "teamId": "F3TYM6YPF7",
134
+ "bundleId": "com.clawmouse.screenhelper",
135
+ "signingIdentitySha1": "98EE53FADB629032FF9F0E2A125CC878A20E6247",
136
+ "signingFlags": "0x0",
137
+ "sameDesignatedRequirement": true,
138
+ "codesignVerified": true,
139
+ "archiveCodesignVerified": true,
140
+ "notarizationPerformed": false,
141
+ "tests": [
142
+ {
143
+ "name": "test_cloud_actions",
144
+ "passed": 4,
145
+ "failed": 0,
146
+ "skipped": 0,
147
+ "report": "test_cloud_actions.txt"
148
+ },
149
+ {
150
+ "name": "test_helper_config",
151
+ "passed": 8,
152
+ "failed": 0,
153
+ "skipped": 0,
154
+ "report": "test_helper_config.txt"
155
+ },
156
+ {
157
+ "name": "test_mac_permissions",
158
+ "passed": 8,
159
+ "failed": 0,
160
+ "skipped": 0,
161
+ "report": "test_mac_permissions.txt"
162
+ }
163
+ ],
164
+ "preservedVendorRpaths": [
165
+ {
166
+ "path": "helper/screenhelper.app/Contents/Frameworks/QtSvg.framework/Versions/A/QtSvg",
167
+ "rpath": "/Users/qt/work/install/lib",
168
+ "baselineSha256": "529ce57919a34b9a1f91f54c04c63264c10a3ac5eca3aa9f192decdf6195b674",
169
+ "currentSha256": "529ce57919a34b9a1f91f54c04c63264c10a3ac5eca3aa9f192decdf6195b674",
170
+ "baselineRpaths": [
171
+ "@loader_path/../../../",
172
+ "/Users/qt/work/install/lib",
173
+ "@loader_path/../../../",
174
+ "/Users/qt/work/install/lib"
175
+ ],
176
+ "reason": "原包既有的开发机构建备用路径;文件未修改,不依赖该路径解析包内组件"
177
+ },
178
+ {
179
+ "path": "helper/screenhelper.app/Contents/PlugIns/iconengines/libqsvgicon.dylib",
180
+ "rpath": "/Users/qt/work/install/lib",
181
+ "baselineSha256": "f2e2ad3701f92842e1d029941e6b6112ad92cb44ff1d0a744fc9c8cb5fd21814",
182
+ "currentSha256": "f2e2ad3701f92842e1d029941e6b6112ad92cb44ff1d0a744fc9c8cb5fd21814",
183
+ "baselineRpaths": [
184
+ "@loader_path/../../lib",
185
+ "/Users/qt/work/install/lib",
186
+ "@loader_path/../../lib",
187
+ "/Users/qt/work/install/lib"
188
+ ],
189
+ "reason": "原包既有的开发机构建备用路径;文件未修改,不依赖该路径解析包内组件"
190
+ },
191
+ {
192
+ "path": "helper/screenhelper.app/Contents/PlugIns/imageformats/libqsvg.dylib",
193
+ "rpath": "/Users/qt/work/install/lib",
194
+ "baselineSha256": "cb66a68cd630defc3aec927749ef8700326d50d15770433e70bf7a3a9b9112b6",
195
+ "currentSha256": "cb66a68cd630defc3aec927749ef8700326d50d15770433e70bf7a3a9b9112b6",
196
+ "baselineRpaths": [
197
+ "@loader_path/../../lib",
198
+ "/Users/qt/work/install/lib",
199
+ "@loader_path/../../lib",
200
+ "/Users/qt/work/install/lib"
201
+ ],
202
+ "reason": "原包既有的开发机构建备用路径;文件未修改,不依赖该路径解析包内组件"
203
+ }
204
+ ],
205
+ "baseArchiveSha256": "72c9d253e0e5789e86ded113d00d07d7247cb234151dccf9baf7577a42d6ea16",
206
+ "appliedPatches": [
207
+ {
208
+ "path": "patches/hide-cloud-actions.patch",
209
+ "sha256": "886fd6810b7c467d747d66876fa043eaafc486bf6d0fa5ed0cbfce081b9e0bf5"
210
+ },
211
+ {
212
+ "path": "patches/mac-permissions.patch",
213
+ "sha256": "fe78d3d86680b0cc7d273c454f895e6dd98d6750a727621eddee90b1ad2b82a9"
214
+ }
215
+ ],
216
+ "permissionPreflight": true
217
+ }
218
+ }
@@ -0,0 +1,202 @@
1
+ --- a/core/screen_tool_bar.cpp
2
+ +++ b/core/screen_tool_bar.cpp
3
+ @@ -111,9 +111,9 @@
4
+ layout->addWidget(m_pExit);
5
+ layout->addWidget(m_pOk);
6
+
7
+ - // [HELPER-IPC] OCR 按钮显隐由 set_config 下发(原渠道宏语义)
8
+ - if (!HelperConfig::instance().ocrVisible())
9
+ - m_pOCR->hide();
10
+ + // 未接入的云功能同时隐藏入口;滚动截图保持可用。
11
+ + m_pOCR->setVisible(HelperConfig::instance().ocrVisible());
12
+ + m_pTrans->setVisible(HelperConfig::instance().transEnabled());
13
+
14
+ // [M4] 底板样式出自主题模板(颜色/圆角 token 化;原内联 qss 已收敛)
15
+ this->setStyleSheet(ThemeManager::instance().dialogCardQss());
16
+ @@ -459,11 +459,13 @@
17
+ m_pCancel->setVisible(!m_pinEditMode);
18
+ m_scrollCapture->setVisible(!m_pinEditMode);
19
+ // [R6-UI] 编辑会话先隐藏 翻译/OCR(功能保留,仅不可见;后续按用户指示恢复)
20
+ - m_pTrans->setVisible(!m_pinEditMode);
21
+ + m_pTrans->setVisible(!m_pinEditMode && HelperConfig::instance().transEnabled());
22
+ m_pOCR->setVisible(!m_pinEditMode && HelperConfig::instance().ocrVisible());
23
+ // [R5-ZOOM] 缩放控件仅编辑会话可见;宽度按可见按钮数自适应
24
+ m_btnZoom->setVisible(m_pinEditMode);
25
+ - const int buttons = m_pinEditMode ? 14 : 18;
26
+ + const int buttons = m_pinEditMode ? 14 : 16
27
+ + + int(HelperConfig::instance().transEnabled())
28
+ + + int(HelperConfig::instance().ocrVisible());
29
+ setFixedSize((FixedWidth + 16) * buttons, FixedHeight + 20);
30
+ // [R3-#4] 编辑模式语义换装:✔=完成编辑(盖章)、✗=取消编辑——沿用截图会话的
31
+ // "完成截图/退出截图"文案会让用户以为按钮无效(功能本身已分别接 confirmPinEdit/
32
+ --- a/core/screen_label.h
33
+ +++ b/core/screen_label.h
34
+ @@ -47,6 +47,7 @@
35
+ // class ScreenLabel : public QLabel
36
+ class ScreenLabel : public QLabel
37
+ {
38
+ + friend class TestCloudActions;
39
+ Q_OBJECT
40
+ class AddItemCommand : public QUndoCommand
41
+ {
42
+ @@ -169,6 +170,7 @@
43
+ bool eventFilter(QObject *obj, QEvent *event) override;
44
+ private:
45
+ void initScrollCapture();
46
+ + void refreshScrollActions();
47
+ void initConnectTool();
48
+ void showToolBar();
49
+ // [R3-#3] 贴图编辑模式:工具条切换为独立置顶小窗(贴窗边+跟随)/还原为子部件
50
+ --- a/core/screen_label.cpp
51
+ +++ b/core/screen_label.cpp
52
+ @@ -906,19 +906,32 @@
53
+ void ScreenLabel::initScrollCapture()
54
+ {
55
+ #ifdef ENABLE_PIXPIN_SCROLL_CAPTURE
56
+ - PixPinScrollCapture::Action ocrAction;
57
+ - ocrAction.name = "OCR";
58
+ - ocrAction.iconPath = ":/scroll_ocr.png";
59
+ - QString ocrTipKey = "OCR";
60
+ - ocrAction.tip = ocrTipKey.isEmpty() ? ocrAction.name : ocrTipKey;
61
+ - ocrAction.closeAfterTrigger = true;
62
+ - m_scrollCaptureParams.actions.append(ocrAction);
63
+ + refreshScrollActions();
64
+ m_scrollCaptureParams.hideMoveButton = true;
65
+ // [MAC-RESET-20260920] 回归官方 demo 集成:hideCaptureBorder 不再强制
66
+ // true(demo 默认 false),滚动驱动/窗口干预等全部摘除,行为与官方
67
+ // demo 对齐——先在基线上确认"拼接/成图能用",渲染类问题(黑窗)作为
68
+ // 独立问题单独处理(MACOS_PORT.md 第十七节)
69
+ connect(m_pScreenToolBar, &ScreenToolBar::signalScrollCapture, this, &ScreenLabel::onScrollCaptureTriggered);
70
+ +#endif
71
+ +}
72
+ +
73
+ +void ScreenLabel::refreshScrollActions()
74
+ +{
75
+ +#ifdef ENABLE_PIXPIN_SCROLL_CAPTURE
76
+ + // 读取本次配置,避免复用 helper 后遗留上一次的云端 OCR/Word 入口。
77
+ + for (int i = m_scrollCaptureParams.actions.size() - 1; i >= 0; --i)
78
+ + if (m_scrollCaptureParams.actions[i].name == QLatin1String("OCR"))
79
+ + m_scrollCaptureParams.actions.removeAt(i);
80
+ + if (HelperConfig::instance().ocrVisible())
81
+ + {
82
+ + PixPinScrollCapture::Action action;
83
+ + action.name = "OCR";
84
+ + action.iconPath = ":/scroll_ocr.png";
85
+ + action.tip = "OCR";
86
+ + action.closeAfterTrigger = true;
87
+ + m_scrollCaptureParams.actions.append(action);
88
+ + }
89
+ #endif
90
+ }
91
+
92
+ @@ -1583,6 +1596,7 @@
93
+ restoreScrollWindows();
94
+ for (QWidget* w : QApplication::topLevelWidgets()) m_scrollExistingWindows.append(w);
95
+ #endif
96
+ + refreshScrollActions();
97
+ PixPinScrollCapture* inst = PixPinScrollCapture::createInstance(m_scrollCaptureParams, this);
98
+ if (inst)
99
+ {
100
+ --- a/ipc/helper_gateway.cpp
101
+ +++ b/ipc/helper_gateway.cpp
102
+ @@ -446,6 +446,9 @@
103
+
104
+ void HelperGateway::onConvertImage(const QImage& img)
105
+ {
106
+ + // 配置关闭 OCR 时也禁止陈旧滚动动作启动云端 Word 转换。
107
+ + if (!HelperConfig::instance().ocrVisible())
108
+ + return;
109
+ // 既有事件:图像交宿主(留档/宿主自行处理),协议不变
110
+ sendEvent(QJsonObject{{"type", "ocr_requested"},
111
+ {"source", QStringLiteral("scroll")}},
112
+ --- a/CMakeLists.txt
113
+ +++ b/CMakeLists.txt
114
+ @@ -257,6 +257,12 @@
115
+ add_executable(test_helper_config tests/test_helper_config.cpp)
116
+ target_link_libraries(test_helper_config PRIVATE ${QT_LINK}::Test screentool_core)
117
+ add_test(NAME helper_config COMMAND test_helper_config)
118
+ + if(TARGET PixPinScrollCapture)
119
+ + add_executable(test_cloud_actions tests/test_cloud_actions.cpp)
120
+ + target_link_libraries(test_cloud_actions PRIVATE ${QT_LINK}::Test ${QT_LINK}::Widgets screentool_core)
121
+ + target_sources(test_cloud_actions PRIVATE res/themes/themes.qrc res/qrc/icons.qrc)
122
+ + add_test(NAME cloud_actions COMMAND test_cloud_actions)
123
+ + endif()
124
+ add_executable(test_word_convert tests/test_word_convert.cpp)
125
+ target_link_libraries(test_word_convert PRIVATE ${QT_LINK}::Test screentool_core)
126
+ add_test(NAME word_convert COMMAND test_word_convert)
127
+ --- /dev/null
128
+ +++ b/tests/test_cloud_actions.cpp
129
+ @@ -0,0 +1,73 @@
130
+ +#include <QtTest/QtTest>
131
+ +#include <QtWidgets>
132
+ +#include <PixPinScrollCapture.h>
133
+ +#include "../core/screen_label.h"
134
+ +#include "../core/helper_config.h"
135
+ +
136
+ +class TestCloudActions : public QObject
137
+ +{
138
+ + Q_OBJECT
139
+ +private slots:
140
+ + void hideUnsupportedActionsAndKeepScroll();
141
+ + void refreshWordActionFromCurrentConfig();
142
+ +};
143
+ +
144
+ +static QPushButton* button(ScreenToolBar& bar, const QString& tip)
145
+ +{
146
+ + for (auto* candidate : bar.findChildren<QPushButton*>())
147
+ + if (candidate->toolTip() == tip) return candidate;
148
+ + return nullptr;
149
+ +}
150
+ +
151
+ +void TestCloudActions::hideUnsupportedActionsAndKeepScroll()
152
+ +{
153
+ + HelperConfig::instance().apply(QJsonObject{{"ocr_visible", false}, {"trans_enabled", false}});
154
+ + ScreenToolBar bar;
155
+ + bar.initBar();
156
+ + auto* ocr = button(bar, QStringLiteral("OCR"));
157
+ + auto* translate = button(bar, QStringLiteral("Translate"));
158
+ + auto* scroll = button(bar, QStringLiteral("Scroll screenshot"));
159
+ + QVERIFY(ocr && translate && scroll);
160
+ + QVERIFY(ocr->isHidden());
161
+ + QVERIFY(translate->isHidden());
162
+ + QVERIFY(!scroll->isHidden());
163
+ + const int hiddenWidth = bar.width();
164
+ + bar.setPinEditMode(true);
165
+ + bar.setPinEditMode(false);
166
+ + QVERIFY(translate->isHidden());
167
+ + QVERIFY(ocr->isHidden());
168
+ + QVERIFY(!scroll->isHidden());
169
+ + HelperConfig::instance().apply(QJsonObject{{"ocr_visible", true}, {"trans_enabled", true}});
170
+ + bar.initBar();
171
+ + QVERIFY(!ocr->isHidden());
172
+ + QVERIFY(!translate->isHidden());
173
+ + QCOMPARE(bar.width() - hiddenWidth, 96);
174
+ +}
175
+ +
176
+ +void TestCloudActions::refreshWordActionFromCurrentConfig()
177
+ +{
178
+ + HelperConfig::instance().apply(QJsonObject{{"ocr_visible", true}});
179
+ + ScreenLabel label;
180
+ + auto count = [&label](const QString& name) {
181
+ + int count = 0;
182
+ + for (const auto& action : label.m_scrollCaptureParams.actions)
183
+ + if (action.name == name) ++count;
184
+ + return count;
185
+ + };
186
+ + QCOMPARE(count(QStringLiteral("OCR")), 1);
187
+ + PixPinScrollCapture::Action copy;
188
+ + copy.name = "copy";
189
+ + label.m_scrollCaptureParams.actions.append(copy);
190
+ + HelperConfig::instance().apply(QJsonObject{{"ocr_visible", false}});
191
+ + label.refreshScrollActions();
192
+ + QCOMPARE(count(QStringLiteral("OCR")), 0);
193
+ + QCOMPARE(count(QStringLiteral("copy")), 1);
194
+ + HelperConfig::instance().apply(QJsonObject{{"ocr_visible", true}});
195
+ + label.refreshScrollActions();
196
+ + label.refreshScrollActions();
197
+ + QCOMPARE(count(QStringLiteral("OCR")), 1);
198
+ + QCOMPARE(count(QStringLiteral("copy")), 1);
199
+ +}
200
+ +
201
+ +QTEST_MAIN(TestCloudActions)
202
+ +#include "test_cloud_actions.moc"