packing ocr data and handling escape on chose files

This commit is contained in:
leca 2024-12-02 14:12:03 +03:00
parent c941264346
commit 41463c7f87
7 changed files with 64 additions and 2 deletions

1
.gitignore vendored
View File

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

View File

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

View File

@ -1,7 +1,10 @@
#!/usr/bin/env bash
mkdir -p AppDir/usr/bin
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
echo \
"[Desktop Entry]
Name=Checks parser
@ -11,4 +14,12 @@ Type=Application
Categories=Utility;" \
> AppDir/checks-parser.desktop
echo \
"#!/usr/bin/env bash
export TESSDATA_PREFIX=usr/share/tesseract-ocr/4.00/tessdata
./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

View File

@ -1 +1 @@
2024/12/02 13:01:47 Micro started
2024/12/02 13:43:54 Micro started

View File

@ -140,6 +140,15 @@ void MainWindow::on_preferencesButton_clicked() {
void MainWindow::on_chooseImageButton_ofd_clicked() {
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();
ui->pathLabel_ofd->setText(QString::fromStdString(new_text));
@ -177,6 +186,15 @@ void MainWindow::on_chooseImageButton_ocr_clicked()
{
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();
ui->pathLabel_ocr->setText(QString::fromStdString(new_text));

View File

@ -159,6 +159,22 @@
<source>Check was not found</source>
<translation type="unfinished"></translation>
</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>
<name>OutputDialog</name>

View File

@ -159,6 +159,22 @@
<source>Check was not found</source>
<translation type="unfinished"></translation>
</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>
<name>OutputDialog</name>