@sonicloud/dsh-sonicloud-device 0.1.1 → 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.
- package/CHANGELOG.md +44 -0
- package/CHANGELOG.zh.md +44 -0
- package/README.md +81 -86
- package/README.zh.md +135 -0
- package/dist/build.json +1 -1
- package/dist/client.js +202 -28
- package/docs/contributing/development.md +51 -28
- package/docs/images/plugin-install.png +0 -0
- package/docs/images/sonicloud-device.png +0 -0
- package/docs/specs/ci-cd.md +24 -37
- package/docs/specs/mouse-settings.md +7 -34
- package/docs/specs/smart-mouse-plugin.md +51 -32
- package/native/README.md +4 -0
- package/native/desktop/VOICE_SOURCE.json +16 -0
- package/native/desktop/VoicePanel.cs +191 -59
- package/native/desktop/VoicePanel.swift +27 -0
- package/native/desktop/darwin-arm64/Sonicloud Voice.app/Contents/MacOS/sonicloud-voice +0 -0
- package/native/desktop/darwin-arm64/Sonicloud Voice.app/Contents/_CodeSignature/CodeResources +115 -0
- package/native/desktop/typer.dll +0 -0
- package/native/desktop/windows.ps1 +1 -1
- package/native/screenshot/README.md +34 -0
- package/native/screenshot/SOURCE.json +218 -0
- package/native/screenshot/darwin-arm64/screentool-macos-1.2.2.zip +0 -0
- package/native/screenshot/patches/hide-cloud-actions.patch +202 -0
- package/native/screenshot/patches/mac-permissions.patch +545 -0
- package/native/screenshot/patches/upstream-files.json +22 -0
- package/native/screenshot/win32-x64/PixPinScrollCapture.dll +0 -0
- package/native/screenshot/win32-x64/Qt5Core.dll +0 -0
- package/native/screenshot/win32-x64/Qt5Gui.dll +0 -0
- package/native/screenshot/win32-x64/Qt5Network.dll +0 -0
- package/native/screenshot/win32-x64/Qt5Svg.dll +0 -0
- package/native/screenshot/win32-x64/Qt5Widgets.dll +0 -0
- package/native/screenshot/win32-x64/iconengines/qsvgicon.dll +0 -0
- package/native/screenshot/win32-x64/imageformats/qjpeg.dll +0 -0
- package/native/screenshot/win32-x64/imageformats/qsvg.dll +0 -0
- package/native/screenshot/win32-x64/libcrypto-1_1-x64.dll +0 -0
- package/native/screenshot/win32-x64/libssl-1_1-x64.dll +0 -0
- package/native/screenshot/win32-x64/msvcp140.dll +0 -0
- package/native/screenshot/win32-x64/platforms/qwindows.dll +0 -0
- package/native/screenshot/win32-x64/qwindowsvistastyle.dll +0 -0
- package/native/screenshot/win32-x64/screenhelper.exe +0 -0
- package/native/screenshot/win32-x64/screentool.dll +0 -0
- package/native/screenshot/win32-x64/vcruntime140.dll +0 -0
- package/native/screenshot/win32-x64/vcruntime140_1.dll +0 -0
- package/package.json +2 -1
- package/src/desktop/presentation.mjs +18 -4
- package/src/desktop/screenshot-worker.mjs +225 -0
- package/src/desktop/screenshot.mjs +185 -0
- package/src/devices/actions.mjs +7 -1
- package/src/devices/manager.mjs +145 -81
- package/src/host/index.mjs +5 -1
- package/src/shared/remote.mjs +5 -0
- /package/{src/client/assets → docs/images}/contact-wechat.jpg +0 -0
|
@@ -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
|
+
}
|
|
Binary file
|
|
@@ -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"
|