Skip to content

Commit

Permalink
Merge pull request #13 from wanhuz/main
Browse files Browse the repository at this point in the history
Merge 0.6.2
  • Loading branch information
wanhuz authored May 11, 2023
2 parents 02619c9 + 946242e commit eb81443
Show file tree
Hide file tree
Showing 19 changed files with 159 additions and 45 deletions.
18 changes: 7 additions & 11 deletions BUILD.md
Original file line number Diff line number Diff line change
@@ -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
x. If the program crash because of Mecab::createTagger, make sure the mecabrc path is correct in mecabKey.cpp
4 changes: 2 additions & 2 deletions RELEASE.md
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
18 changes: 9 additions & 9 deletions ROADMAP.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
1 change: 1 addition & 0 deletions src/capturekey/maincontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/dict/dict.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <algorithm>

#ifdef DEBUG_MODE
#define ABSPATHTODICT dictPath = "C://xxx//melonpan//res//dict//JMdict_e"
#define ABSPATHTODICT dictPath = "..//res//dict//JMdict_e"
#else
#define ABSPATHTODICT
#endif
Expand Down
1 change: 1 addition & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ int main(int argc, char *argv[])
{
QApplication a(argc, argv);
MainWindow m;
a.setQuitOnLastWindowClosed(false);
m.show();
return a.exec();
}
2 changes: 1 addition & 1 deletion src/ocr/ocr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <qdebug.h>

#ifdef DEBUG_MODE
#define ABSTESSDATAPATH tessDataPath = "C:\\xxx\\melonpan\\res\\tessdata\\"
#define ABSTESSDATAPATH tessDataPath = "..\\res\\tessdata\\"
#else
#define ABSTESSDATAPATH
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/settings/mecabKey.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include <qstring.h>

#ifdef DEBUG_MODE
#define ABSPATHTOMECABRC pathToMecabrc = "C:\\xxx\\melonpan\\res\\mecab\\etc\\mecabrc"
#define ABSPATHTOMECABRC pathToMecabrc = "..\\res\\mecab\\etc\\mecabrc"
#else
#define ABSPATHTOMECABRC
#endif
Expand Down
6 changes: 2 additions & 4 deletions src/ui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/ui/popup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions vs2019/Debug/KanjiProgram.log

This file was deleted.

2 changes: 0 additions & 2 deletions vs2019/Debug/Shanachan.tlog/Shanachan.lastbuildstate

This file was deleted.

Empty file.
12 changes: 11 additions & 1 deletion vs2019/KanjiProgram.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@
<ExecutablePath>$(ExecutablePath)</ExecutablePath>
<IncludePath>C:\Program Files %28x86%29\MeCab\sdk;$(IncludePath)</IncludePath>
<LibraryPath>C:\Program Files %28x86%29\MeCab\sdk;$(LibraryPath)</LibraryPath>
<OutDir>..\build\Release</OutDir>
<IntDir>..\build\Release</IntDir>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='x86|x64'" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
Expand Down Expand Up @@ -126,7 +128,7 @@
<ClCompile>
<AdditionalOptions>/utf-8 %(AdditionalOptions)</AdditionalOptions>
<LanguageStandard>stdcpp17</LanguageStandard>
<PreprocessorDefinitions>DEBUG_MODE</PreprocessorDefinitions>
<PreprocessorDefinitions>DEBUG_MODE;</PreprocessorDefinitions>
</ClCompile>
<Bscmake>
<AdditionalOptions>./configure --with-charset=utf8 --enable-utf8-only %(AdditionalOptions)</AdditionalOptions>
Expand Down Expand Up @@ -222,6 +224,7 @@
<ClCompile Include="..\src\util\util.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="resource.h" />
<QtMoc Include="..\src\capturekey\capturekey.h" />
<QtMoc Include="..\src\capturekey\maincontroller.h" />
<ClInclude Include="..\src\data\entry.h" />
Expand All @@ -244,6 +247,13 @@
<QtRcc Include="..\res\ui\buttonicon.qrc" />
<QtRcc Include="..\src\ui\MainWindow.qrc" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="melonpan.rc" />
</ItemGroup>
<ItemGroup>
<Image Include="..\res\ui\melonpan.ico" />
<Image Include="icon1.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Condition="Exists('$(QtMsBuild)\qt.targets')">
<Import Project="$(QtMsBuild)\qt.targets" />
Expand Down
16 changes: 16 additions & 0 deletions vs2019/KanjiProgram.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@
<ClInclude Include="..\src\settings\mecabKey.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="resource.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\src\ocr\ocr.cpp">
Expand Down Expand Up @@ -125,4 +128,17 @@
<Filter>Resource Files</Filter>
</QtRcc>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="melonpan.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<Image Include="..\res\ui\melonpan.ico">
<Filter>Resource Files</Filter>
</Image>
<Image Include="icon1.ico">
<Filter>Resource Files</Filter>
</Image>
</ItemGroup>
</Project>
18 changes: 8 additions & 10 deletions vs2019/KanjiProgram.vcxproj.user
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerEnvironment>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</LocalDebuggerEnvironment>
<LocalDebuggerEnvironment>PATH=%PATH%;$(QtDllPath)
$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
<LocalDebuggerCommand>$(TargetPath)</LocalDebuggerCommand>
<LocalDebuggerCommandArguments>$(QmlDebug) </LocalDebuggerCommandArguments>
</PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='x86|x64'">
<QtLastBackgroundBuild>2023-05-01T10:22:43.0950918Z</QtLastBackgroundBuild>
<QtLastBackgroundBuild>2023-05-02T00:28:56.7707115Z</QtLastBackgroundBuild>
</PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<QtLastBackgroundBuild>2023-05-01T10:22:43.3310925Z</QtLastBackgroundBuild>
<QtLastBackgroundBuild>2023-05-02T00:28:57.5382552Z</QtLastBackgroundBuild>
</PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<QtLastBackgroundBuild>2023-05-01T10:22:43.5470918Z</QtLastBackgroundBuild>
<QtLastBackgroundBuild>2023-05-02T00:28:57.7812585Z</QtLastBackgroundBuild>
</PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<QtLastBackgroundBuild>2023-05-01T10:22:43.1720946Z</QtLastBackgroundBuild>
<QtLastBackgroundBuild>2023-05-02T00:28:56.9702554Z</QtLastBackgroundBuild>
</PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='x86|Win32'">
<QtLastBackgroundBuild>2023-05-01T10:22:43.2521243Z</QtLastBackgroundBuild>
<QtLastBackgroundBuild>2023-05-02T00:28:57.2052557Z</QtLastBackgroundBuild>
</PropertyGroup>
<PropertyGroup Label="QtSettings" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<QtLastBackgroundBuild>2023-05-01T10:22:43.4580916Z</QtLastBackgroundBuild>
<QtLastBackgroundBuild>2023-05-02T00:28:57.6802558Z</QtLastBackgroundBuild>
</PropertyGroup>
</Project>
Binary file added vs2019/melonpan.aps
Binary file not shown.
81 changes: 81 additions & 0 deletions vs2019/melonpan.rc
Original file line number Diff line number Diff line change
@@ -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

17 changes: 17 additions & 0 deletions vs2019/resource.h
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit eb81443

Please sign in to comment.