packing ocr data and handling escape on chose files
This commit is contained in:
		
							
								
								
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -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/ | ||||||
|   | |||||||
| @@ -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=c941264 | ||||||
|   | |||||||
| @@ -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,12 @@ Type=Application | |||||||
| Categories=Utility;" \ | Categories=Utility;" \ | ||||||
| > AppDir/checks-parser.desktop | > 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 | linuxdeployqt AppDir/usr/bin/checks-parser -no-copy-copyright-files -appimage | ||||||
|   | |||||||
| @@ -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)); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -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> | ||||||
|   | |||||||
| @@ -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> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user