diff --git a/BUILD.md b/BUILD.md index 5887d18..2ef745a 100644 --- a/BUILD.md +++ b/BUILD.md @@ -1,13 +1,9 @@ -1. Install MS Studio 2022 -2. Install Qt 5.15.1 -3. Install Vcpkg -4. Build the project from Visual Studio once to download dependencies using Vcpkg +1. Install MS Visual Studio 2022 +2. Install Qt 5.15.1 +3. Integrate Qt into Visual Studio using QT VS Tools Plugin + - Set Qt 5.15.1 to its folder (example: C:\Qt\5.15.1\msvc2019_64) +4. Install Vcpkg 5. Install Mecab from official site, set to UTF-8 during installation -6. To compile and run the program in debug mode, define absolute path to its resource folder in directive in file: -- dict.cpp -- MainWindow.cpp -- mecabKey.cpp -- ocr.cpp -- popup.cpp +6. Build the project from Visual Studio to download dependencies using Vcpkg and run it! -x. If the program crash because of Mecab::createTagger, make sure the mecabrc absolute path is correct in mecabKey.cpp \ No newline at end of file +x. If the program crash because of Mecab::createTagger, make sure the mecabrc path is correct in mecabKey.cpp \ No newline at end of file diff --git a/RELEASE.md b/RELEASE.md index 08206fc..ce73349 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,6 +1,6 @@ 1. Create a release build using Visual Studio 64-bit -2. Copy release folder (should be in vs2019/x64/release) to another location (example: "C:\Users\xxx\Desktop\Release" -3. Remove everything except melonpan.exe +2. Copy release folder (should be in build/release) to another location (example: "C:\Users\xxx\Desktop\Release" +3. Remove everything except melonpan.exe, .dll file and .res file 5. Navigate to Qt 5.15.1 compiler binary folder (e,g, C:\Qt\5.15.1\msvc2019_64\bin) 6. Open Powershell in that folder and run winqtdeploy.exe with argument pointing to location of release folder in 2 - example: .\windeployqt.exe "C:\Users\xxx\Desktop\Release" diff --git a/ROADMAP.md b/ROADMAP.md index 1b528b8..4e982b2 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -11,22 +11,23 @@ Basic OCR Preprocessing? - sharpen image, b/w e,g, 0.8 Configuration Option Extra character in textbox break search -Automatic font size recognition Search romaji +Search speed improvement FIx searching english word sorted by japanese frequency 0.7 -Search speed improvement -Basic settings +Automatic font size recognition 0.6.3 Fix horizontal capture for OCR +Basic settings + - Default capture key + - Default Minimize to tray -minimize all time, minimize only when toggled, no minimize 0.6.2 -Bugfix -- Min UI crash -- Memory leak -Revise debug mode +Bugfix x +Revise debug mode x +Add shortcut with icon x 0.6.1 Update to Tess 5 x @@ -51,6 +52,5 @@ note. ux improvement - copy text from column - double click to select text from column -ux bug -- toggle resize windows + capturekey not safe starting hook. check null val first \ No newline at end of file diff --git a/src/capturekey/maincontroller.cpp b/src/capturekey/maincontroller.cpp index 07e3165..6469e63 100644 --- a/src/capturekey/maincontroller.cpp +++ b/src/capturekey/maincontroller.cpp @@ -90,6 +90,7 @@ void MainController::captureOCR() { It is a hacky solution, but it is the most optimal way to get text from different application types in Microsoft Windows*/ void MainController::captureTextGeneric() { Util::sendKeyInput(); + Util::sendKeyInput(); //Fix for capture text sometimes capture garbage text } //Search word in dictionary diff --git a/src/dict/dict.cpp b/src/dict/dict.cpp index 3d48b07..0d1f3ca 100644 --- a/src/dict/dict.cpp +++ b/src/dict/dict.cpp @@ -8,7 +8,7 @@ #include #ifdef DEBUG_MODE -#define ABSPATHTODICT dictPath = "C://xxx//melonpan//res//dict//JMdict_e" +#define ABSPATHTODICT dictPath = "..//res//dict//JMdict_e" #else #define ABSPATHTODICT #endif diff --git a/src/main.cpp b/src/main.cpp index 77811ee..290127b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5,6 +5,7 @@ int main(int argc, char *argv[]) { QApplication a(argc, argv); MainWindow m; + a.setQuitOnLastWindowClosed(false); m.show(); return a.exec(); } diff --git a/src/ocr/ocr.cpp b/src/ocr/ocr.cpp index 894f65c..f507c1d 100644 --- a/src/ocr/ocr.cpp +++ b/src/ocr/ocr.cpp @@ -9,7 +9,7 @@ #include #ifdef DEBUG_MODE -#define ABSTESSDATAPATH tessDataPath = "C:\\xxx\\melonpan\\res\\tessdata\\" +#define ABSTESSDATAPATH tessDataPath = "..\\res\\tessdata\\" #else #define ABSTESSDATAPATH #endif diff --git a/src/settings/mecabKey.cpp b/src/settings/mecabKey.cpp index 9037aad..c566a34 100644 --- a/src/settings/mecabKey.cpp +++ b/src/settings/mecabKey.cpp @@ -11,7 +11,7 @@ #include #ifdef DEBUG_MODE -#define ABSPATHTOMECABRC pathToMecabrc = "C:\\xxx\\melonpan\\res\\mecab\\etc\\mecabrc" +#define ABSPATHTOMECABRC pathToMecabrc = "..\\res\\mecab\\etc\\mecabrc" #else #define ABSPATHTOMECABRC #endif diff --git a/src/ui/MainWindow.cpp b/src/ui/MainWindow.cpp index 9352335..ff41e04 100644 --- a/src/ui/MainWindow.cpp +++ b/src/ui/MainWindow.cpp @@ -20,8 +20,8 @@ #include "../capturekey/maincontroller.h" #ifdef DEBUG_MODE -#define ABSPATHTOFONT fontPath = "C:\\xxx\\melonpan\\res\\font\\NotoSansMonoCJKjp-Regular.otf" -#define ABSPATHTOTRAYICON TrayIconPath = QIcon("C:\\xxx\\melonpan\\res\\ui\\melonpan.ico") +#define ABSPATHTOFONT fontPath = "..\\res\\font\\NotoSansMonoCJKjp-Regular.otf" +#define ABSPATHTOTRAYICON TrayIconPath = QIcon("..\\res\\ui\\melonpan.ico") #else #define ABSPATHTOFONT #define ABSPATHTOTRAYICON @@ -132,9 +132,7 @@ MainWindow::MainWindow(QWidget* parent) connect(MainControl, SIGNAL(captureResult(QString)), textbox, SLOT(setText(QString))); connect(OCRBtn, SIGNAL(toggled(bool)), this, SLOT(startCaptureOCR(bool))); - connect(OCRBtn, SIGNAL(toggled(bool)), this, SLOT(alwaysOnTop(bool))); connect(textBtn, SIGNAL(toggled(bool)), this, SLOT(startCaptureText(bool))); - connect(textBtn, SIGNAL(toggled(bool)), this, SLOT(alwaysOnTop(bool))); connect(minBtn, &QPushButton::toggled, this, [=](const bool tempbool) {minMode = tempbool;}); connect(textbox, SIGNAL(textChanged(QString)), this, SLOT(search())); connect(trayIcon, &QSystemTrayIcon::activated, this, &MainWindow::iconActivated); diff --git a/src/ui/popup.cpp b/src/ui/popup.cpp index d770fe2..9c75069 100644 --- a/src/ui/popup.cpp +++ b/src/ui/popup.cpp @@ -13,7 +13,7 @@ #define MIN_ENTRY 0 #ifdef DEBUG_MODE -#define ABSPATHTOFONT fontPath = "C:\\xxx\\melonpan\\res\\NotoSansMonoCJKjp-Regular.otf" +#define ABSPATHTOFONT fontPath = "..\\res\\font\\NotoSansMonoCJKjp-Regular.otf" #else #define ABSPATHTOFONT #endif diff --git a/vs2019/Debug/KanjiProgram.log b/vs2019/Debug/KanjiProgram.log deleted file mode 100644 index f7e4679..0000000 --- a/vs2019/Debug/KanjiProgram.log +++ /dev/null @@ -1,2 +0,0 @@ -C:\Users\WanHuz\AppData\Local\QtMsBuild\qt_vars.targets(68,5): error : There's no Qt version assigned to project KanjiProgram.vcxproj for configuration Debug/Win32. -C:\Users\WanHuz\AppData\Local\QtMsBuild\qt_vars.targets(68,5): error : Please set a Qt installation in 'Project|Properties|Configuration Properties|Qt Project Settings|Qt Installation'. diff --git a/vs2019/Debug/Shanachan.tlog/Shanachan.lastbuildstate b/vs2019/Debug/Shanachan.tlog/Shanachan.lastbuildstate deleted file mode 100644 index 803ffd3..0000000 --- a/vs2019/Debug/Shanachan.tlog/Shanachan.lastbuildstate +++ /dev/null @@ -1,2 +0,0 @@ -PlatformToolSet=v143:VCToolArchitecture=Native32Bit:VCToolsVersion=14.32.31326:TargetPlatformVersion=10.0.19041.0:VcpkgTriplet=x86-windows: -Debug|Win32|C:\Users\WanHuz\Documents\GitHub\new\melonpan\vs2019\| diff --git a/vs2019/Debug/Shanachan.tlog/unsuccessfulbuild b/vs2019/Debug/Shanachan.tlog/unsuccessfulbuild deleted file mode 100644 index e69de29..0000000 diff --git a/vs2019/KanjiProgram.vcxproj b/vs2019/KanjiProgram.vcxproj index b83c9c3..3d46cfc 100644 --- a/vs2019/KanjiProgram.vcxproj +++ b/vs2019/KanjiProgram.vcxproj @@ -88,6 +88,8 @@ $(ExecutablePath) C:\Program Files %28x86%29\MeCab\sdk;$(IncludePath) C:\Program Files %28x86%29\MeCab\sdk;$(LibraryPath) + ..\build\Release + ..\build\Release @@ -126,7 +128,7 @@ /utf-8 %(AdditionalOptions) stdcpp17 - DEBUG_MODE + DEBUG_MODE; ./configure --with-charset=utf8 --enable-utf8-only %(AdditionalOptions) @@ -222,6 +224,7 @@ + @@ -244,6 +247,13 @@ + + + + + + + diff --git a/vs2019/KanjiProgram.vcxproj.filters b/vs2019/KanjiProgram.vcxproj.filters index 489442b..c2d7a95 100644 --- a/vs2019/KanjiProgram.vcxproj.filters +++ b/vs2019/KanjiProgram.vcxproj.filters @@ -77,6 +77,9 @@ Header Files + + Header Files + @@ -125,4 +128,17 @@ Resource Files + + + Resource Files + + + + + Resource Files + + + Resource Files + + \ No newline at end of file diff --git a/vs2019/KanjiProgram.vcxproj.user b/vs2019/KanjiProgram.vcxproj.user index aed6f11..0f985df 100644 --- a/vs2019/KanjiProgram.vcxproj.user +++ b/vs2019/KanjiProgram.vcxproj.user @@ -1,30 +1,28 @@  - TESSDATA_PREFIX=C:\Users\WanHuz\source\repos\melonpan\res\tessdata -PATH=%PATH%;$(QtDllPath);C:\Users\WanHuz\AppData\Local\Programs\Python\Python37 -PYTHONPATH="C:\Users\WanHuz\AppData\Local\Programs\Python\Python37\DLLs;C:\Users\WanHuz\AppData\Local\Programs\Python\Python37\Lib" -PYTHONHOME=C:\Users\WanHuz\AppData\Local\Programs\Python\Python37 + PATH=%PATH%;$(QtDllPath) +$(LocalDebuggerEnvironment) WindowsLocalDebugger $(TargetPath) $(QmlDebug) - 2023-05-01T10:22:43.0950918Z + 2023-05-02T00:28:56.7707115Z - 2023-05-01T10:22:43.3310925Z + 2023-05-02T00:28:57.5382552Z - 2023-05-01T10:22:43.5470918Z + 2023-05-02T00:28:57.7812585Z - 2023-05-01T10:22:43.1720946Z + 2023-05-02T00:28:56.9702554Z - 2023-05-01T10:22:43.2521243Z + 2023-05-02T00:28:57.2052557Z - 2023-05-01T10:22:43.4580916Z + 2023-05-02T00:28:57.6802558Z \ No newline at end of file diff --git a/vs2019/melonpan.aps b/vs2019/melonpan.aps new file mode 100644 index 0000000..c47e93c Binary files /dev/null and b/vs2019/melonpan.aps differ diff --git a/vs2019/melonpan.rc b/vs2019/melonpan.rc new file mode 100644 index 0000000..dcd9a9a --- /dev/null +++ b/vs2019/melonpan.rc @@ -0,0 +1,81 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Japanese (Japan) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_JPN) +LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT +#pragma code_page(932) + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +#endif // Japanese (Japan) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// English (United Kingdom) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENG) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK +#pragma code_page(1252) + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_ICON2 ICON "C:\\Users\\WanHuz\\Documents\\GitHub\\melonpan\\res\\ui\\melonpan.ico" + +#endif // English (United Kingdom) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/vs2019/resource.h b/vs2019/resource.h new file mode 100644 index 0000000..3969837 --- /dev/null +++ b/vs2019/resource.h @@ -0,0 +1,17 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by melonpan.rc +// +#define IDI_ICON1 101 +#define IDI_ICON2 102 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 103 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif