4 Commits

Author SHA1 Message Date
17a03606c5 fixed wrong setting 2024-12-03 15:24:21 +03:00
83351698d6 readme & todo updated 2024-12-03 15:02:54 +03:00
2c99f422d3 appimage deployment 2024-12-03 03:45:58 +03:00
41463c7f87 packing ocr data and handling escape on chose files 2024-12-02 14:12:03 +03:00
14 changed files with 101 additions and 14 deletions

1
.gitignore vendored
View File

@@ -120,3 +120,4 @@ checks-parser_autogen
checks-parser checks-parser
deploy/appimage/AppDir/usr/share/doc/ deploy/appimage/AppDir/usr/share/doc/
deploy/appimage/AppDir/usr/share/

View File

@@ -30,7 +30,7 @@ In general, you need to install following dependencies in order to build that ap
Please, do not hesitate to open an issue if you cannot build that. I will help and if you are building on a distro that is not listed there, we can append that list as soon as we will solve your problem! Please, do not hesitate to open an issue if you cannot build that. I will help and if you are building on a distro that is not listed there, we can append that list as soon as we will solve your problem!
### Linux ### Linux
##### Arch Linux ##### Arch Linux-based
I recommend using aur helper (I use yay) to install dependencies. Or, if you're masochist, you can build all by yourself /shrug I recommend using aur helper (I use yay) to install dependencies. Or, if you're masochist, you can build all by yourself /shrug
``` ```
#Install dependencies #Install dependencies
@@ -38,16 +38,31 @@ yay -S sudo cmake git coreutils base-devel eigen qt5-base mbedtls gtkglext openc
#Clone and compile an app #Clone and compile an app
git clone https://git.foxarmy.org/leca/checks-parser git clone https://git.foxarmy.org/leca/checks-parser
cd checks-parser cd checks-parser
mkdir build cmake .
cd build
cmake ..
make -j{nproc} make -j{nproc}
#If you wish to install that program system-wide, run #If you wish to install that program system-wide, run
sudo make install sudo make install
``` ```
##### Debian ##### Debian-based
apt install -y qtbase5-dev openssl libmbedtls-dev tesseract-ocr tesseract-ocr-rus libopencv-dev libzbar-dev qttools5-dev nlohmann-json-dev libcurl4-openssl-dev libtesseract-dev In debian-based distributions most, but not every, package names are the same.
TODO
Installation of dependencies for different debian-based distros:
###### Ubuntu 18.04
```apt install -y qtbase5-dev openssl libmbedtls-dev tesseract-ocr tesseract-ocr-rus libopencv-dev libzbar-dev qttools5-dev nlohmann-json-dev libcurl4-openssl-dev libtesseract-dev```
###### Ubuntu 20.04, LMDE (tested only 6), Debian (tested only 12)
```apt install -y qtbase5-dev openssl libmbedtls-dev tesseract-ocr tesseract-ocr-rus libopencv-dev libzbar-dev qttools5-dev nlohmann-json3-dev libcurl4-openssl-dev libtesseract-dev```
Next steps are identical for every debian-based distro
```
#Clone and compile an app
git clone https://git.foxarmy.org/leca/checks-parser
cd checks-parser
cmake .
make -j{nproc}
#If you wish to install that program system-wide, run
sudo make install
```
### Windows ### Windows
Maybe Maybe
### Mac OS ### Mac OS

4
TODO
View File

@@ -26,5 +26,5 @@ Build:
Issues: Issues:
Captcha is not showing when running in appimage [solved] Captcha is not showing when running in appimage [solved]
Stores modules are not being downloaded Stores modules are not being downloaded
I need to pack tesseract data for ru, en I need to pack tesseract data for ru, en [solved]

View File

@@ -1 +0,0 @@
checks-parser.png

Before

Width:  |  Height:  |  Size: 17 B

After

Width:  |  Height:  |  Size: 627 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 B

After

Width:  |  Height:  |  Size: 627 KiB

View File

@@ -1 +0,0 @@
usr/bin/checks-parser

4
deploy/appimage/AppDir/AppRun Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
export TESSDATA_PREFIX=$APPDIR/usr/share/tesseract-ocr/4.00/tessdata
$APPDIR/usr/bin/checks-parser

View File

@@ -4,4 +4,4 @@ Exec=usr/bin/checks-parser
Icon=checks-parser Icon=checks-parser
Type=Application Type=Application
Categories=Utility; Categories=Utility;
X-AppImage-Version=7c021c9 X-AppImage-Version=41463c7

View File

@@ -0,0 +1,7 @@
# Generated by linuxdeployqt
# https://github.com/probonopd/linuxdeployqt/
[Paths]
Prefix = ./
Plugins = plugins
Imports = qml
Qml2Imports = qml

View File

@@ -1,7 +1,10 @@
#!/usr/bin/env bash #!/usr/bin/env bash
mkdir -p AppDir/usr/bin mkdir -p AppDir/usr/bin
mkdir -p AppDir/usr/lib mkdir -p AppDir/usr/lib
mkdir -p AppDir/usr/share/tesseract-ocr/4.00/tessdata
cp -r /usr/share/tesseract-ocr/4.00/tessdata/* AppDir/usr/share/tesseract-ocr/4.00/tessdata
cp ../../checks-parser AppDir/usr/bin cp ../../checks-parser AppDir/usr/bin
echo \ echo \
"[Desktop Entry] "[Desktop Entry]
Name=Checks parser Name=Checks parser
@@ -11,4 +14,13 @@ Type=Application
Categories=Utility;" \ Categories=Utility;" \
> AppDir/checks-parser.desktop > AppDir/checks-parser.desktop
echo \
"#!/bin/bash
export TESSDATA_PREFIX=\$APPDIR/usr/share/tesseract-ocr/4.00/tessdata
\$APPDIR/usr/bin/checks-parser" \
> AppDir/AppRun
chmod +x AppDir/AppRun
cp ../../checks-parser AppDir/usr/bin
linuxdeployqt AppDir/usr/bin/checks-parser -no-copy-copyright-files -appimage linuxdeployqt AppDir/usr/bin/checks-parser -no-copy-copyright-files -appimage

View File

@@ -1 +0,0 @@
2024/12/02 13:01:47 Micro started

View File

@@ -140,6 +140,15 @@ void MainWindow::on_preferencesButton_clicked() {
void MainWindow::on_chooseImageButton_ofd_clicked() { void MainWindow::on_chooseImageButton_ofd_clicked() {
QString filename = QFileDialog::getOpenFileName(); QString filename = QFileDialog::getOpenFileName();
if (filename == "") {
QMessageBox infoDialog;
infoDialog.setText(tr("Please, select a picture where QR code that contains info about check is present"));
infoDialog.setIcon(QMessageBox::Critical);
infoDialog.setWindowTitle(tr("Picture was not selected"));
infoDialog.exec();
return;
}
std::string new_text = "Selected: " + filename.toStdString(); std::string new_text = "Selected: " + filename.toStdString();
ui->pathLabel_ofd->setText(QString::fromStdString(new_text)); ui->pathLabel_ofd->setText(QString::fromStdString(new_text));
@@ -177,6 +186,15 @@ void MainWindow::on_chooseImageButton_ocr_clicked()
{ {
QString filename = QFileDialog::getOpenFileName(); QString filename = QFileDialog::getOpenFileName();
if (filename == "") {
QMessageBox infoDialog;
infoDialog.setText(tr("Please, select a picture to scan"));
infoDialog.setIcon(QMessageBox::Critical);
infoDialog.setWindowTitle(tr("Picture was not selected"));
infoDialog.exec();
return;
}
std::string new_text = "Selected: " + filename.toStdString(); std::string new_text = "Selected: " + filename.toStdString();
ui->pathLabel_ocr->setText(QString::fromStdString(new_text)); ui->pathLabel_ocr->setText(QString::fromStdString(new_text));

View File

@@ -85,7 +85,7 @@ std::vector<std::string> Parser::check_updates() {
std::cout << file.path().filename() << " detected store module" << std::endl; std::cout << file.path().filename() << " detected store module" << std::endl;
} }
Net n; Net n;
std::cerr << "Downloading modules list from: " << s.get_setting("stores_modules_url"); std::cerr << "Downloading modules list from: " << s.get_setting("stores_modules_url") << std::endl;
std::vector<std::string> remote_modules = n.get_all_modules(s.get_setting("stores_modules_url")); std::vector<std::string> remote_modules = n.get_all_modules(s.get_setting("stores_modules_url"));
if (stored_modules.empty()) { if (stored_modules.empty()) {
std::cout << "I need to download everything" << std::endl; std::cout << "I need to download everything" << std::endl;

View File

@@ -23,7 +23,7 @@ Settings::Settings(std::string path) {
"ofds_modules_dir":".local/share/checks_parser/modules/ofd", "ofds_modules_dir":".local/share/checks_parser/modules/ofd",
"stores_modules_dir":".local/share/checks_parser/modules/stores", "stores_modules_dir":".local/share/checks_parser/modules/stores",
"ofds_modules_url":"https://foxarmy.org/checks-parser/modules/ofd/", "ofds_modules_url":"https://foxarmy.org/checks-parser/modules/ofd/",
"stores_modules_url":"https://foxarmy.org/checks-parser/modules/modules/", "stores_modules_url":"https://foxarmy.org/checks-parser/modules/stores/",
"print_header": true, "print_header": true,
"print_total": true, "print_total": true,
"output_order": { "output_order": {

View File

@@ -159,6 +159,22 @@
<source>Check was not found</source> <source>Check was not found</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<location filename="../mainwindow.cpp" line="145"/>
<source>Please, select a picture where QR code that contains info about check is present</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="147"/>
<location filename="../mainwindow.cpp" line="193"/>
<source>Picture was not selected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="191"/>
<source>Please, select a picture to scan</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>OutputDialog</name> <name>OutputDialog</name>

View File

@@ -159,6 +159,22 @@
<source>Check was not found</source> <source>Check was not found</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<location filename="../mainwindow.cpp" line="145"/>
<source>Please, select a picture where QR code that contains info about check is present</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="147"/>
<location filename="../mainwindow.cpp" line="193"/>
<source>Picture was not selected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="191"/>
<source>Please, select a picture to scan</source>
<translation type="unfinished"></translation>
</message>
</context> </context>
<context> <context>
<name>OutputDialog</name> <name>OutputDialog</name>