From f26f30dce77179999337555d295e442b67c67a6c Mon Sep 17 00:00:00 2001 From: Akash Mozumdar Date: Mon, 22 Mar 2021 01:18:56 -0600 Subject: [PATCH] small fixes --- cmake/QtUtils.cmake | 4 ++-- deploy.ps1 | 2 +- extensions/deepltranslate.cpp | 1 - extensions/devtoolsdeepltranslate.cpp | 6 +++--- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/cmake/QtUtils.cmake b/cmake/QtUtils.cmake index 8df7e8b..fc92c6e 100644 --- a/cmake/QtUtils.cmake +++ b/cmake/QtUtils.cmake @@ -1,5 +1,5 @@ macro(msvc_registry_search) - if(NOT DEFINED Qt5_DIR AND MSVC) + if(NOT EXISTS Qt5_DIR AND MSVC) # look for user-registry pointing to qtcreator get_filename_component(QT_BIN [HKEY_CURRENT_USER\\Software\\Classes\\Applications\\QtProject.QtCreator.pro\\shell\\Open\\Command] PATH) @@ -52,7 +52,7 @@ macro(find_qt5) set(CMAKE_INCLUDE_CURRENT_DIR ON) #set(CMAKE_AUTOMOC ON) set(CMAKE_AUTOUIC ON) - add_definitions(-DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x060000) + #add_definitions(-DQT_DEPRECATED_WARNINGS -DQT_DISABLE_DEPRECATED_BEFORE=0x060000) find_package(Qt5 COMPONENTS ${ARGN}) if(Qt5_FOUND) diff --git a/deploy.ps1 b/deploy.ps1 index 0a5a21c..e3daffe 100644 --- a/deploy.ps1 +++ b/deploy.ps1 @@ -85,7 +85,7 @@ foreach ($arch in @("x86", "x64")) { copy -Force -Recurse -Verbose -Destination "Runtime/$arch/$file" -Path "Release_$arch/$file"; } - copy -Force -Recurse -Verbose -Destination "$arch" -Path "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Redist/MSVC/**/$arch/Microsoft.VC142.CRT/*" + copy -Force -Recurse -Verbose -Destination "Runtime/$arch" -Path "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Redist/MSVC/**/$arch/Microsoft.VC142.CRT/*" } rm -Force -Recurse -Verbose "Textractor"; diff --git a/extensions/deepltranslate.cpp b/extensions/deepltranslate.cpp index c875b5e..2832ac4 100644 --- a/extensions/deepltranslate.cpp +++ b/extensions/deepltranslate.cpp @@ -3,7 +3,6 @@ #include extern const wchar_t* TRANSLATION_ERROR; -extern const char* USE_PREV_SENTENCE_CONTEXT; extern Synchronized translateTo, translateFrom, authKey; diff --git a/extensions/devtoolsdeepltranslate.cpp b/extensions/devtoolsdeepltranslate.cpp index 46b7edd..e54ae9c 100644 --- a/extensions/devtoolsdeepltranslate.cpp +++ b/extensions/devtoolsdeepltranslate.cpp @@ -133,12 +133,12 @@ std::pair Translate(const std::wstring& text) // DevTools can't handle concurrent translations yet static std::mutex translationMutex; std::scoped_lock lock(translationMutex); - DevTools::SendRequest("Page.navigate", FormatString(LR"({"url":"https://www.deepl.com/translator#any/%s/%s"})", translateTo.Copy(), Escape(text))); + DevTools::SendRequest("Page.navigate", FormatString(LR"({"url":"https://www.deepl.com/en/translator#any/%s/%s"})", translateTo.Copy(), Escape(text))); if (translateFrom.Copy() != autoDetectLanguage) DevTools::SendRequest("Runtime.evaluate", FormatString(LR"({"expression":" - document.querySelector('.lmt__language_select--source').querySelector('button').click(), - document.evaluate(`//button[contains(text(),'%s')]`,document.querySelector('.lmt__language_select__menu'),null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue.click() + document.querySelector('.lmt__language_select--source').querySelector('button').click(); + document.evaluate(`//button[contains(text(),'%s')]`,document.querySelector('.lmt__language_select__menu'),null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue.click(); "})", S(std::find_if(languages.begin(), languages.end(), [end = S(translateFrom.Copy())](const QString& language) { return language.endsWith(end); })->split(":")[0]))); for (int retry = 0; ++retry < 100; Sleep(100))