Disable Viber chat OCR while preserving saved profiles

This commit is contained in:
agrynco committed 2026-11-06 00:18:04 +02:00
1 parent 178573233b
commit 66e24b5efc
5 files changed
+11 -26

No files matched your search

+5 -6
View File
@@ -1013,7 +1013,7 @@ LRESULT CALLBACK chatLanguagesProc(HWND w, UINT msg, WPARAM wp, LPARAM lp)
{
int selected = (int)SendDlgItemMessageW(w, 710, LB_GETCURSEL, 0, 0);
if (selected < 0 || selected >= (int)v->keys.size())
throw std::runtime_error("Open a Telegram, Teams or Viber chat, then reopen this dialog. Viber requires Tesseract.");
throw std::runtime_error("Open a Telegram or Teams chat, then reopen this dialog. Viber OCR is disabled.");
auto next = v->settings->draft;
if (id == 713) next.chatCycles.erase(v->keys[selected]);
else
@@ -1055,8 +1055,7 @@ void showChatLanguages(HWND parent, SettingsView *settings)
{
if (!IsWindowVisible(candidate)) return TRUE;
auto &data = *(Context *)context;
auto key = lower(processName(candidate)) == L"viber"
? recognizeViberChat(candidate, data.settings) : windowChatKey(candidate);
auto key = windowChatKey(candidate);
if (!key.empty()) data.keys.insert(std::move(key));
return TRUE;
}, (LPARAM)&context);
@@ -1064,13 +1063,13 @@ void showChatLanguages(HWND parent, SettingsView *settings)
auto *v = new ChatLanguagesView{parent, settings, {keys.begin(), keys.end()}};
SetWindowLongPtrW(w, GWLP_HWNDPARENT, (LONG_PTR)parent);
SetWindowLongPtrW(w, GWLP_USERDATA, (LONG_PTR)v);
label(w, L"Telegram / Teams / Viber (experimental OCR) chat profiles", 18, 16, 604);
label(w, L"Telegram / Teams profiles; saved Viber profiles are inactive", 18, 16, 604);
control(w, L"LISTBOX", L"", WS_TABSTOP | WS_VSCROLL | LBS_NOTIFY | LBS_NOINTEGRALHEIGHT | WS_BORDER,
710, 18, 44, 604, 140);
for (const auto &key : v->keys)
{
auto split = key.find(L'\n');
auto name = std::wstring(key.starts_with(L"telegram\n") ? L"Telegram: " : key.starts_with(L"viber\n") ? L"Viber: " : L"Teams: ") + key.substr(split + 1);
auto name = std::wstring(key.starts_with(L"telegram\n") ? L"Telegram: " : key.starts_with(L"viber\n") ? L"Viber (inactive): " : L"Teams: ") + key.substr(split + 1);
SendDlgItemMessageW(w, 710, LB_ADDSTRING, 0, (LPARAM)name.c_str());
}
control(w, L"STATIC", L"Open a chat, then reopen this dialog to add it.", 0, 712, 18, 194, 604, 26);
@@ -1989,7 +1988,7 @@ void showSettings(App &app, bool visible)
label(w, L"Backspace / Delete clears it", 454, 270, 230);
button(w, L"Re&fresh layouts", 253, 454, 322, 230);
button(w, L"Languages for a &chat...", 259, 24, 378, 230);
label(w, L"Chat languages: Telegram, Teams, Viber (OCR).", 272, 382, 412);
label(w, L"Chat languages: Telegram / Teams. Viber OCR disabled.", 272, 382, 412);
page();
label(w, L"Click a shortcut field and press the desired keys", 24, 76, 660);