6 Commits

17 changed files with 434 additions and 169 deletions

View File

@@ -135,12 +135,18 @@ endif()
FetchContent_Declare(httplib SYSTEM FetchContent_Declare(httplib SYSTEM
GIT_REPOSITORY https://github.com/yhirose/cpp-httplib GIT_REPOSITORY https://github.com/yhirose/cpp-httplib
GIT_TAG 2eaa2ea64f9fb12773306534d461d9ed63cb76b6 # v0.14.1 GIT_TAG c765584e6b1055fe0dfe3e9e6d1b4b09aa305070
GIT_SHALLOW TRUE) GIT_SHALLOW TRUE)
FetchContent_MakeAvailable(httplib) FetchContent_MakeAvailable(httplib)
find_package(OpenCV REQUIRED COMPONENTS core imgproc imgcodecs) find_package(OpenCV REQUIRED COMPONENTS core imgproc imgcodecs)
find_package(PkgConfig)
pkg_check_modules(QRENCODE REQUIRED libqrencode)
include_directories(${QRENCODE_INCLUDE_DIRS})
link_directories(${QRENCODE_LIBRARY_DIRS})
target_link_libraries(checks-parser PRIVATE ${QRENCODE_LIBRARIES})
include_directories( ${OpenCV_INCLUDE_DIRS} ) include_directories( ${OpenCV_INCLUDE_DIRS} )
target_include_directories(checks-parser PUBLIC ${OpenCV_INCLUDE_DIRS}) target_include_directories(checks-parser PUBLIC ${OpenCV_INCLUDE_DIRS})

View File

@@ -29,6 +29,7 @@ In general, you need to install following dependencies in order to build that ap
* curl * curl
* nlohmann-json * nlohmann-json
* qt5 * qt5
* qrencode
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
@@ -36,7 +37,7 @@ Please, do not hesitate to open an issue if you cannot build that. I will help a
I recommend using aur helper (I use yay) to install dependencies. Or, if you're masochist, you can build all by yourself ¯\\\_()\_ I recommend using aur helper (I use yay) to install dependencies. Or, if you're masochist, you can build all by yourself ¯\\\_()\_
``` ```
#Install dependencies #Install dependencies
yay -S base-devel qt5-base opencv zbar nlohmann-json tesseract yay -S base-devel qt5-base opencv zbar nlohmann-json tesseract qrencode
#Install a language package for OCR. Replace ``LANG` to your language. For example, ``tesseract-data-rus`` for russian language #Install a language package for OCR. Replace ``LANG` to your language. For example, ``tesseract-data-rus`` for russian language
yay -S tesseract-data-LANG yay -S tesseract-data-LANG
#Clone and compile an app #Clone and compile an app
@@ -52,9 +53,9 @@ In debian-based distributions most, but not every, package names are the same.
Installation of dependencies for different debian-based distros: Installation of dependencies for different debian-based distros:
###### Ubuntu 18.04 ###### 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``` ```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 libqrencode-dev```
###### Ubuntu 20.04, LMDE (tested only 6), Debian (tested only 12) ###### 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``` ```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 libqrencode-dev```
Next steps are identical for every debian-based distro Next steps are identical for every debian-based distro
``` ```

View File

@@ -37,7 +37,7 @@
Я рекомендую использовать помощник для АУРа (я использую yay) чтобы установить зависимости. Или, если вы мазохист, можете собрать все зависимости ручками ¯\\\_()\_ Я рекомендую использовать помощник для АУРа (я использую yay) чтобы установить зависимости. Или, если вы мазохист, можете собрать все зависимости ручками ¯\\\_()\_
``` ```
#Установка зависимостей #Установка зависимостей
yay -S base-devel qt5-base opencv zbar nlohmann-json tesseract yay -S base-devel qt5-base opencv zbar nlohmann-json tesseract qrencode
#Установка языкового пакета для OCR. Замените ``LANG` на желаемый язык. Например, ``tesseract-data-rus`` для русского языка #Установка языкового пакета для OCR. Замените ``LANG` на желаемый язык. Например, ``tesseract-data-rus`` для русского языка
yay -S tesseract-data-LANG yay -S tesseract-data-LANG
#Загрузка исходгого кода и сборка приложения #Загрузка исходгого кода и сборка приложения

View File

@@ -41,7 +41,13 @@ void AdjustPictureDialog::accept() {
infoDialog.setWindowTitle(tr("No QR code")); infoDialog.setWindowTitle(tr("No QR code"));
infoDialog.exec(); infoDialog.exec();
} else { } else {
emit decodedData(result); std::map<std::string, std::string> paramsMap;
std::vector<std::string> dataSplit = split(result, "&");
for (std::string &pair : dataSplit) {
std::vector<std::string> values = split(pair, "=");
paramsMap.insert(std::pair<std::string, std::string>(values[0], values[1]));
}
emit decodedData(paramsMap);
QDialog::accept(); QDialog::accept();
} }

View File

@@ -22,7 +22,7 @@ public:
void computeContrastLookupTable(); void computeContrastLookupTable();
std::vector<unsigned short> contrastLUT[100]; std::vector<unsigned short> contrastLUT[100];
signals: signals:
void decodedData(std::string data); void decodedData(std::map<std::string, std::string> data);
private slots: private slots:

View File

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

Binary file not shown.

Before

Width:  |  Height:  |  Size: 138 KiB

4
deploy/appimage/AppRun Normal 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

@@ -0,0 +1,71 @@
FROM ubuntu:20.04
# Installing dependencies
RUN apt update
RUN DEBIAN_FRONTEND=noninteractive 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 libqrencode-dev
RUN DEBIAN_FRONTEND=noninteractive apt install -y wget git cmake make gcc g++ fuse
# For gcc 12
RUN DEBIAN_FRONTEND=noninteractive apt install -y libmpc-dev libmpfr-dev libgmp-dev
# The program uses std::regex_constants::multiline and some other C++17 things that are not found in gcc for Ubuntu Focal. Thus, we should compile it.
WORKDIR /
RUN wget https://mirror.linux-ia64.org/gnu/gcc/releases/gcc-12.3.0/gcc-12.3.0.tar.gz
RUN tar xf gcc-12.3.0.tar.gz
WORKDIR /gcc-12.3.0
RUN ./configure --disable-multilib
RUN make -j $(nproc) && make install
WORKDIR /
RUN rm -rf gcc-12.3.0
ENTRYPOINT bash
# Download linuxdeployqt
RUN wget https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage -O /usr/bin/linuxdeployqt && \
chmod +x /usr/bin/linuxdeployqt
# Prepare AppDir and its files
WORKDIR /appimage
RUN mkdir -p AppDir
COPY deploy/appimage/checks-parser.desktop AppDir
COPY icon.png AppDir/checks-parser.png
COPY deploy/appimage/AppRun AppDir
RUN chmod +x AppDir/AppRun
#Copy only necessities
COPY assets ./assets
COPY check ./check
COPY exceptions ./exceptions
COPY goods ./goods
COPY image ./image
COPY image_redactor ./image_redactor
COPY output ./output
COPY parser ./parser
COPY settings ./settings
COPY scenes ./scenes
COPY net ./net
COPY translations ./translations
COPY utils ./utils
COPY ./*cpp ./*.h ./*.ui ./*.qrc CMakeLists.txt .
RUN mkdir build
WORKDIR /appimage/build
RUN cmake -DBUILD_TRANSLATIONS=on .. && make -j 8
WORKDIR /appimage/AppDir/usr/bin
RUN cp /appimage/build/checks-parser .
WORKDIR /appimage
RUN LD_LIBRARY_PATH=LD_LIBRARY_PATH=/usr/local/lib64 linuxdeployqt AppDir/usr/bin/checks-parser -no-copy-copyright-files -appimage
ENTRYPOINT bash

View File

@@ -33,9 +33,33 @@ static QWidget *loadUI(QWidget *parent, std::string filename) {
} }
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
QUiLoader loader; srand(time(0));
QApplication app(argc, argv); QApplication app(argc, argv);
std::string settings_file_path =
get_path_relative_to_home(".local/share/checks_parser/settings.json");
Settings s(settings_file_path);
QTranslator translator;
QString lang = "en_US";
if (s.get_all_settings().contains("language")) {
lang = QString::fromStdString(s.get_all_settings()["language"]);
} else if (translator.load(":/translation/"+QLocale::system().name()+".qm")) {
lang = QLocale::system().name();
} else {
lang = QString::fromStdString("en_US");
}
std::cout << "Using locale: " << lang.toStdString() << std::endl;
translator.load(":/translation/" + lang + ".qm");
app.installTranslator(&translator);
QUiLoader loader;
QWidget *window = new QWidget(); QWidget *window = new QWidget();
QStackedLayout *sceneLayout = new QStackedLayout; QStackedLayout *sceneLayout = new QStackedLayout;
@@ -69,10 +93,6 @@ int main(int argc, char *argv[]) {
OCRScene *ocrscene = new OCRScene(); OCRScene *ocrscene = new OCRScene();
OFDScene *ofdscene = new OFDScene(); OFDScene *ofdscene = new OFDScene();
ofdscene->startHttpServer();
// get_local_ip_address();
sceneLayout->addWidget(mainwindowscene); sceneLayout->addWidget(mainwindowscene);
sceneLayout->addWidget(emailTextScene); sceneLayout->addWidget(emailTextScene);
sceneLayout->addWidget(ocrscene); sceneLayout->addWidget(ocrscene);
@@ -90,6 +110,8 @@ int main(int argc, char *argv[]) {
}); });
} }
window->setLayout(sceneLayout); window->setLayout(sceneLayout);
window->show(); window->show();
@@ -139,10 +161,10 @@ int main(int argc, char *argv[]) {
std::string program_data_path = get_path_relative_to_home(".local/share/checks_parser"); std::string program_data_path = get_path_relative_to_home(".local/share/checks_parser");
create_directories(program_data_path); create_directories(program_data_path);
std::string settings_file_path = // std::string settings_file_path =
get_path_relative_to_home(".local/share/checks_parser/settings.json"); // get_path_relative_to_home(".local/share/checks_parser/settings.json");
Settings s(settings_file_path); // Settings s(settings_file_path);
Net n; Net n;
Parser p; Parser p;
@@ -161,22 +183,22 @@ int main(int argc, char *argv[]) {
QApplication a(argc, argv); QApplication a(argc, argv);
QTranslator translator; // QTranslator translator;
QString lang = "en_US"; // QString lang = "en_US";
if (s.get_all_settings().contains("language")) { // if (s.get_all_settings().contains("language")) {
lang = QString::fromStdString(s.get_all_settings()["language"]); // lang = QString::fromStdString(s.get_all_settings()["language"]);
} else if (translator.load(":/translation/"+QLocale::system().name()+".qm")) { // } else if (translator.load(":/translation/"+QLocale::system().name()+".qm")) {
lang = QLocale::system().name(); // lang = QLocale::system().name();
} else { // } else {
lang = QString::fromStdString("en_US"); // lang = QString::fromStdString("en_US");
} // }
std::cout << "Using locale: " << lang.toStdString() << std::endl; // std::cout << "Using locale: " << lang.toStdString() << std::endl;
translator.load(":/translation/" + lang + ".qm"); // translator.load(":/translation/" + lang + ".qm");
a.installTranslator(&translator); // a.installTranslator(&translator);
MainWindow w; MainWindow w;
w.update(); w.update();
w.show(); w.show();

View File

@@ -7,16 +7,22 @@
#include <adjustpicturedialog.h> #include <adjustpicturedialog.h>
#include <httplib.h> #include <httplib.h>
#include <outputdialog.h> #include <outputdialog.h>
#include <qpixmap.h>
#include <solvecaptchadialog.h> #include <solvecaptchadialog.h>
#include <net/net.h> #include <net/net.h>
#include <exceptions/ofdrequestexception.h> #include <exceptions/ofdrequestexception.h>
#include <bits/basic_string.h>
#include <qrencode.h>
#include <bits/basic_string.h>
OFDScene::OFDScene(QWidget *parent) OFDScene::OFDScene(QWidget *parent)
: QWidget(parent) : QWidget(parent)
, ui(new Ui::OFDScene) { , ui(new Ui::OFDScene) {
ui->setupUi(this); ui->setupUi(this);
QObject::connect(this, &OFDScene::httpErrorOccured, this, &OFDScene::notifyHttpServerFailure);
} }
OFDScene::~OFDScene() { OFDScene::~OFDScene() {
@@ -25,6 +31,7 @@ OFDScene::~OFDScene() {
void OFDScene::startHttpServer() { void OFDScene::startHttpServer() {
std::string localIp = ""; std::string localIp = "";
try { try {
localIp = get_local_ip_address(); localIp = get_local_ip_address();
} catch(std::exception e) { } catch(std::exception e) {
@@ -32,13 +39,43 @@ void OFDScene::startHttpServer() {
return; return;
} }
httplib::Server svr; unsigned short number_of_retries = 0;
//TODO: generate random port from 1024 to 65535 and check if its used.
svr.Get("/", [&](const httplib::Request &, httplib::Response &res){
res.set_redirect("http://"+ localIp +":8080/", 301);
});
svr.listen("0.0.0.0", 8080); do {
if (number_of_retries == 10) {
emit httpErrorOccured();
return;
}
this->port = rand() % (65535 - 1024) + 1024;
std::string connectionString = "binaryeye://scan/?ret=http://"+ localIp +":"+ std::to_string(port) +"/?result={RESULT}";
server.Get("/", [&](const httplib::Request &req, httplib::Response &res){
std::map<std::string, std::string> paramsMap;
if (req.params.size() < 1) {
res.set_redirect(connectionString, 301);
std::cerr << "Too few params: " << req.params.size() << std::endl;
return;
}
std::string result = req.params.find("result")->second;
std::vector<std::string> dataSplit = split(result, "&");
for (std::string &pair : dataSplit) {
std::vector<std::string> values = split(pair, "=");
paramsMap.insert(std::pair<std::string, std::string>(values[0], values[1]));
}
emit onDataDecode(paramsMap);
res.set_redirect(connectionString, 301);
});
std::cerr << "Listening on port: " << this->port << std::endl;
if (!server.listen("0.0.0.0", this->port)) {
std::cerr << "Random port seems to be occupied. Trying to generate another one" << std::endl;
number_of_retries ++;
continue;
}
} while(true);
} }
void OFDScene::on_choose_image_button_clicked() { void OFDScene::on_choose_image_button_clicked() {
@@ -53,7 +90,6 @@ void OFDScene::on_choose_image_button_clicked() {
return; return;
} }
ui->info_label->setText(tr("Selected image: ") + filename); ui->info_label->setText(tr("Selected image: ") + filename);
AdjustPictureDialog dialog = AdjustPictureDialog(this, filename.toStdString()); AdjustPictureDialog dialog = AdjustPictureDialog(this, filename.toStdString());
@@ -61,27 +97,27 @@ void OFDScene::on_choose_image_button_clicked() {
dialog.exec(); dialog.exec();
} }
void OFDScene::onDataDecode(std::string data) { void OFDScene::onDataDecode(std::map<std::string, std::string> data) {
std::vector<std::string> dataSplit = split(data, "&"); ui->fn_line_edit->setText(QString::fromStdString(data["fn"]));
ui->fd_line_edit->setText(QString::fromStdString(data["i"]));
ui->fi_line_edit->setText(QString::fromStdString(data["fp"]));
ui->fn_line_edit->setText(QString::fromStdString(split(dataSplit[2], "=")[1])); QString extractedDateTime = QString::fromStdString(data["t"]);
ui->fd_line_edit->setText(QString::fromStdString(split(dataSplit[3], "=")[1]));
ui->fi_line_edit->setText(QString::fromStdString(split(dataSplit[4], "=")[1]));
QString extractedDateTime = QString::fromStdString(split(dataSplit[0], "=")[1]);
//TODO: some QRs contain datetime in format yyyyMMddThhmmss. Perhaps there is more different formats, should write function to detect them. //TODO: some QRs contain datetime in format yyyyMMddThhmmss. Perhaps there is more different formats, should write function to detect them.
QDateTime datetime = QDateTime::fromString(extractedDateTime, "yyyyMMddThhmm"); QDateTime datetime = QDateTime::fromString(extractedDateTime, "yyyyMMddThhmm");
if (datetime == QDateTime::fromString(extractedDateTime, "20000101T1200")) {
datetime = QDateTime::fromString(extractedDateTime, "yyyyMMddThhmmss");
}
ui->purchase_datetime_edit->setDateTime(datetime); ui->purchase_datetime_edit->setDateTime(datetime);
int type = std::stoi(split(dataSplit[5], "=")[1]); int type = std::stoi(data["n"]);
ui->operation_type_combo_box->setCurrentIndex(type - 1); ui->operation_type_combo_box->setCurrentIndex(type - 1);
std::string total = split(dataSplit[1], "=")[1]; std::string total = data["s"];
ui->total_spin_box->setValue(std::stod(total)); ui->total_spin_box->setValue(std::stod(total));
} }
void OFDScene::on_parse_button_clicked() { void OFDScene::on_parse_button_clicked() {
Net net; Net net;
net.get_captcha_from_ofdru(); net.get_captcha_from_ofdru();
@@ -140,11 +176,41 @@ void OFDScene::on_parse_button_clicked() {
OutputDialog d = OutputDialog(this, check); OutputDialog d = OutputDialog(this, check);
d.exec(); d.exec();
} }
} }
void OFDScene::on_binary_eye_button_clicked() { void OFDScene::on_binary_eye_button_clicked() {
http_thread = new std::thread(&OFDScene::startHttpServer, this);
ui->binary_eye_button->setEnabled(false);
while (!server.is_running());
std::string localIp;
try {
localIp = get_local_ip_address();
} catch(std::exception e) {
std::cerr << e.what() << std::endl;
return;
}
std::string connectionString = "binaryeye://scan?ret=http://" + localIp + ":" + std::to_string(port) + "/?result={RESULT}";
generate_qr_code(connectionString);
QMessageBox infoDialog = QMessageBox();
infoDialog.setText(QString::fromStdString(connectionString));
infoDialog.setIconPixmap(QPixmap(QString::fromStdString(get_path_relative_to_home(".local/share/checks_parser/binaryeye_connection.png"))).scaled(400, 400, Qt::KeepAspectRatio));
infoDialog.setWindowTitle(tr("QR code for binaryeye to connect"));
infoDialog.setButtonText(1, tr("I've scanned"));
infoDialog.exec();
}
void OFDScene::notifyHttpServerFailure() {
QMessageBox infoDialog = QMessageBox();
infoDialog.setText(tr("Could not start http server. 10 times in a row random port was occupied. Either you should run for a lottery ticket, or the problem is in the program. If the lottery ticket wasn't lucky, please, contact the developer."));
infoDialog.setIcon(QMessageBox::Warning);
infoDialog.setWindowTitle(tr("Could not start http server."));
infoDialog.exec();
}
unsigned int OFDScene::getPort() {
return port;
} }

View File

@@ -2,6 +2,8 @@
#define OFDSCENE_H #define OFDSCENE_H
#include <QWidget> #include <QWidget>
#include <httplib.h>
#include <thread>
namespace Ui { namespace Ui {
class OFDScene; class OFDScene;
@@ -15,16 +17,27 @@ public:
explicit OFDScene(QWidget *parent = nullptr); explicit OFDScene(QWidget *parent = nullptr);
~OFDScene(); ~OFDScene();
void startHttpServer(); void startHttpServer();
unsigned int getPort();
private slots: private slots:
void on_choose_image_button_clicked(); void on_choose_image_button_clicked();
void onDataDecode(std::string data); void onDataDecode(std::map<std::string, std::string>);
void on_parse_button_clicked(); void on_parse_button_clicked();
void on_binary_eye_button_clicked(); void on_binary_eye_button_clicked();
void notifyHttpServerFailure();
signals:
void httpErrorOccured();
private: private:
Ui::OFDScene *ui; Ui::OFDScene *ui;
std::thread *http_thread;
unsigned int port;
httplib::Server server;
}; };
#endif // OFDSCENE_H #endif // OFDSCENE_H

View File

@@ -29,7 +29,7 @@
<message> <message>
<location filename="../scenes/emailtextscene.ui" line="14"/> <location filename="../scenes/emailtextscene.ui" line="14"/>
<source>Form</source> <source>Form</source>
<translation type="unfinished"></translation> <translation>Form</translation>
</message> </message>
<message> <message>
<source>Store type</source> <source>Store type</source>
@@ -38,32 +38,32 @@
<message> <message>
<location filename="../scenes/emailtextscene.ui" line="26"/> <location filename="../scenes/emailtextscene.ui" line="26"/>
<source>Check content</source> <source>Check content</source>
<translation type="unfinished">Check content</translation> <translation>Check content</translation>
</message> </message>
<message> <message>
<location filename="../scenes/emailtextscene.ui" line="33"/> <location filename="../scenes/emailtextscene.ui" line="33"/>
<source>Parse</source> <source>Parse</source>
<translation type="unfinished">Parse</translation> <translation>Parse</translation>
</message> </message>
<message> <message>
<location filename="../scenes/emailtextscene.ui" line="46"/> <location filename="../scenes/emailtextscene.ui" line="46"/>
<source>Store:</source> <source>Store:</source>
<translation type="unfinished"></translation> <translation>Store:</translation>
</message> </message>
<message> <message>
<location filename="../scenes/emailtextscene.ui" line="62"/> <location filename="../scenes/emailtextscene.ui" line="62"/>
<source>Back</source> <source>Back</source>
<translation type="unfinished"></translation> <translation>Back</translation>
</message> </message>
<message> <message>
<location filename="../emailtextscene.cpp" line="31"/> <location filename="../emailtextscene.cpp" line="31"/>
<source>An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer.</source> <source>An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer.</source>
<translation type="unfinished">An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer.</translation> <translation>An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer.</translation>
</message> </message>
<message> <message>
<location filename="../emailtextscene.cpp" line="33"/> <location filename="../emailtextscene.cpp" line="33"/>
<source>Error in parsing</source> <source>Error in parsing</source>
<translation type="unfinished">Error in parsing</translation> <translation>Error in parsing</translation>
</message> </message>
</context> </context>
<context> <context>
@@ -208,17 +208,17 @@
<message> <message>
<location filename="../scenes/mainwindow.ui" line="26"/> <location filename="../scenes/mainwindow.ui" line="26"/>
<source>Form</source> <source>Form</source>
<translation type="unfinished"></translation> <translation>Form</translation>
</message> </message>
<message> <message>
<location filename="../scenes/mainwindow.ui" line="37"/> <location filename="../scenes/mainwindow.ui" line="37"/>
<source>Optical Character Recognition</source> <source>Optical Character Recognition</source>
<translation type="unfinished"></translation> <translation>Optical Character Recognition</translation>
</message> </message>
<message> <message>
<location filename="../scenes/mainwindow.ui" line="63"/> <location filename="../scenes/mainwindow.ui" line="63"/>
<source>Text from E-Mail</source> <source>Text from E-Mail</source>
<translation type="unfinished"></translation> <translation>Text from E-Mail</translation>
</message> </message>
</context> </context>
<context> <context>
@@ -226,62 +226,62 @@
<message> <message>
<location filename="../scenes/ocrscene.ui" line="20"/> <location filename="../scenes/ocrscene.ui" line="20"/>
<source>Form</source> <source>Form</source>
<translation type="unfinished"></translation> <translation>Form</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ocrscene.ui" line="64"/> <location filename="../scenes/ocrscene.ui" line="64"/>
<source>Choose</source> <source>Choose</source>
<translation type="unfinished">Choose</translation> <translation>Choose</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ocrscene.ui" line="103"/> <location filename="../scenes/ocrscene.ui" line="103"/>
<source>Path to image:</source> <source>Path to image:</source>
<translation type="unfinished"></translation> <translation>Path to image:</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ocrscene.ui" line="119"/> <location filename="../scenes/ocrscene.ui" line="119"/>
<source>Store:</source> <source>Store:</source>
<translation type="unfinished"></translation> <translation>Store:</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ocrscene.ui" line="90"/> <location filename="../scenes/ocrscene.ui" line="90"/>
<source>Recognized text will be shown below as soon as image will be processed. Please, edit it</source> <source>Recognized text will be shown below as soon as image will be processed. Please, edit it</source>
<translation type="unfinished"></translation> <translation>Recognized text will be shown below as soon as image will be processed. Please, edit it</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ocrscene.ui" line="77"/> <location filename="../scenes/ocrscene.ui" line="77"/>
<source>Back</source> <source>Back</source>
<translation type="unfinished"></translation> <translation>Back</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ocrscene.ui" line="45"/> <location filename="../scenes/ocrscene.ui" line="45"/>
<source>Parse</source> <source>Parse</source>
<translation type="unfinished">Parse</translation> <translation>Parse</translation>
</message> </message>
<message> <message>
<location filename="../ocrscene.cpp" line="36"/> <location filename="../ocrscene.cpp" line="36"/>
<source>An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer.</source> <source>An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer.</source>
<translation type="unfinished">An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer.</translation> <translation>An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer.</translation>
</message> </message>
<message> <message>
<location filename="../ocrscene.cpp" line="38"/> <location filename="../ocrscene.cpp" line="38"/>
<source>Error in parsing</source> <source>Error in parsing</source>
<translation type="unfinished">Error in parsing</translation> <translation>Error in parsing</translation>
</message> </message>
<message> <message>
<location filename="../ocrscene.cpp" line="56"/> <location filename="../ocrscene.cpp" line="56"/>
<source>Please, select a picture to scan</source> <source>Please, select a picture to scan</source>
<translation type="unfinished">Please, select a picture to scan</translation> <translation>Please, select a picture to scan</translation>
</message> </message>
<message> <message>
<location filename="../ocrscene.cpp" line="58"/> <location filename="../ocrscene.cpp" line="58"/>
<source>Picture was not selected</source> <source>Picture was not selected</source>
<translation type="unfinished">Picture was not selected</translation> <translation>Picture was not selected</translation>
</message> </message>
<message> <message>
<location filename="../ocrscene.cpp" line="64"/> <location filename="../ocrscene.cpp" line="64"/>
<source>Path to image: </source> <source>Path to image: </source>
<translation type="unfinished">Path to image: </translation> <translation>Path to image: </translation>
</message> </message>
</context> </context>
<context> <context>
@@ -289,128 +289,152 @@
<message> <message>
<location filename="../scenes/ofdscene.ui" line="14"/> <location filename="../scenes/ofdscene.ui" line="14"/>
<source>Form</source> <source>Form</source>
<translation type="unfinished"></translation> <translation>Form</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ofdscene.ui" line="23"/> <location filename="../scenes/ofdscene.ui" line="23"/>
<source>Total</source> <source>Total</source>
<translation type="unfinished">Total</translation> <translation>Total</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ofdscene.ui" line="36"/> <location filename="../scenes/ofdscene.ui" line="36"/>
<source>Back</source> <source>Back</source>
<translation type="unfinished"></translation> <translation>Back</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ofdscene.ui" line="49"/> <location filename="../scenes/ofdscene.ui" line="49"/>
<source>or</source> <source>or</source>
<translation type="unfinished"></translation> <translation>or</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ofdscene.ui" line="69"/> <location filename="../scenes/ofdscene.ui" line="69"/>
<source>FD (Fiscal Document)</source> <source>FD (Fiscal Document)</source>
<translation type="unfinished">FD (Fiscal Document)</translation> <translation>FD (Fiscal Document)</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ofdscene.ui" line="76"/> <location filename="../scenes/ofdscene.ui" line="76"/>
<source>Date and time of purchase</source> <source>Date and time of purchase</source>
<translation type="unfinished"></translation> <translation>Date and time of purchase</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ofdscene.ui" line="84"/> <location filename="../scenes/ofdscene.ui" line="84"/>
<source>Funds income</source> <source>Funds income</source>
<translation type="unfinished">Funds income</translation> <translation>Funds income</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ofdscene.ui" line="89"/> <location filename="../scenes/ofdscene.ui" line="89"/>
<source>Funds return</source> <source>Funds return</source>
<translation type="unfinished">Funds return</translation> <translation>Funds return</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ofdscene.ui" line="94"/> <location filename="../scenes/ofdscene.ui" line="94"/>
<source>Funds spend</source> <source>Funds spend</source>
<translation type="unfinished">Funds spend</translation> <translation>Funds spend</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ofdscene.ui" line="99"/> <location filename="../scenes/ofdscene.ui" line="99"/>
<source>Spends return</source> <source>Spends return</source>
<translation type="unfinished">Spends return</translation> <translation>Spends return</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ofdscene.ui" line="136"/> <location filename="../scenes/ofdscene.ui" line="136"/>
<source>Use your phone as a QR code scanner</source> <source>Use your phone as a QR code scanner</source>
<translation type="unfinished"></translation> <translation>Use your phone as a QR code scanner</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ofdscene.ui" line="149"/> <location filename="../scenes/ofdscene.ui" line="149"/>
<source>FN (Fiscal Number)</source> <source>FN (Fiscal Number)</source>
<translation type="unfinished">FN (Fiscal Number)</translation> <translation>FN (Fiscal Number)</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ofdscene.ui" line="156"/> <location filename="../scenes/ofdscene.ui" line="156"/>
<source>FI (Fiscal Identifier)</source> <source>FI (Fiscal Identifier)</source>
<translation type="unfinished">FI (Fiscal Identifier)</translation> <translation>FI (Fiscal Identifier)</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ofdscene.ui" line="166"/> <location filename="../scenes/ofdscene.ui" line="166"/>
<source>Choose image on your PC</source> <source>Choose image on your PC</source>
<translation type="unfinished"></translation> <translation>Choose image on your PC</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ofdscene.ui" line="173"/> <location filename="../scenes/ofdscene.ui" line="173"/>
<source>Operation type</source> <source>Operation type</source>
<translation type="unfinished"></translation> <translation>Operation type</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ofdscene.ui" line="186"/> <location filename="../scenes/ofdscene.ui" line="186"/>
<source>Parse</source> <source>Parse</source>
<translation type="unfinished">Parse</translation> <translation>Parse</translation>
</message> </message>
<message> <message>
<location filename="../ofdscene.cpp" line="48"/> <location filename="../ofdscene.cpp" line="205"/>
<source>Could not start http server. 10 times in a row random port was occupied. Either you should run for a lottery ticket, or the problem is in the program. If the lottery ticket wasn&apos;t lucky, please, contact the developer.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ofdscene.cpp" line="207"/>
<source>Could not start http server.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ofdscene.cpp" line="84"/>
<source>Please, select a picture where QR code that contains info about check is present</source> <source>Please, select a picture where QR code that contains info about check is present</source>
<translation type="unfinished">Please, select a picture where QR code that contains info about check is present</translation> <translation>Please, select a picture where QR code that contains info about check is present</translation>
</message> </message>
<message> <message>
<location filename="../ofdscene.cpp" line="50"/> <location filename="../ofdscene.cpp" line="86"/>
<source>Picture was not selected</source> <source>Picture was not selected</source>
<translation type="unfinished">Picture was not selected</translation> <translation>Picture was not selected</translation>
</message> </message>
<message> <message>
<location filename="../ofdscene.cpp" line="56"/> <location filename="../ofdscene.cpp" line="91"/>
<source>Selected image: </source> <source>Selected image: </source>
<translation type="unfinished"></translation> <translation>Selected image: </translation>
</message> </message>
<message> <message>
<location filename="../ofdscene.cpp" line="115"/> <location filename="../ofdscene.cpp" line="150"/>
<source>Captcha was not solved correctly!</source> <source>Captcha was not solved correctly!</source>
<translation type="unfinished">Captcha was not solved correctly!</translation> <translation>Captcha was not solved correctly!</translation>
</message> </message>
<message> <message>
<location filename="../ofdscene.cpp" line="117"/> <location filename="../ofdscene.cpp" line="152"/>
<source>Captcha is incorrect</source> <source>Captcha is incorrect</source>
<translation type="unfinished">Captcha is incorrect</translation> <translation>Captcha is incorrect</translation>
</message> </message>
<message> <message>
<location filename="../ofdscene.cpp" line="122"/> <location filename="../ofdscene.cpp" line="157"/>
<source>Internal server error. Please, try again later.</source> <source>Internal server error. Please, try again later.</source>
<translation type="unfinished">Internal server error. Please, try again later.</translation> <translation>Internal server error. Please, try again later.</translation>
</message> </message>
<message> <message>
<location filename="../ofdscene.cpp" line="124"/> <location filename="../ofdscene.cpp" line="159"/>
<source>Internal server error</source> <source>Internal server error</source>
<translation type="unfinished">Internal server error</translation> <translation>Internal server error</translation>
</message> </message>
<message> <message>
<location filename="../ofdscene.cpp" line="129"/> <location filename="../ofdscene.cpp" line="164"/>
<source>Check not found. Please, ensure correctness of entered data.</source> <source>Check not found. Please, ensure correctness of entered data.</source>
<translation type="unfinished">Check not found. Please, ensure correctness of entered data.</translation> <translation>Check not found. Please, ensure correctness of entered data.</translation>
</message> </message>
<message> <message>
<location filename="../ofdscene.cpp" line="131"/> <location filename="../ofdscene.cpp" line="166"/>
<source>Check was not found</source> <source>Check was not found</source>
<translation>Check was not found</translation>
</message>
<message>
<location filename="../ofdscene.cpp" line="198"/>
<source>QR code for binaryeye to connect</source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message>
<location filename="../ofdscene.cpp" line="199"/>
<source>I&apos;ve scanned</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>123 123</source>
<translation type="obsolete">123 123</translation>
</message>
</context> </context>
<context> <context>
<name>OutputDialog</name> <name>OutputDialog</name>

View File

@@ -29,7 +29,7 @@
<message> <message>
<location filename="../scenes/emailtextscene.ui" line="14"/> <location filename="../scenes/emailtextscene.ui" line="14"/>
<source>Form</source> <source>Form</source>
<translation type="unfinished"></translation> <translation>Форма</translation>
</message> </message>
<message> <message>
<source>Store type</source> <source>Store type</source>
@@ -38,32 +38,32 @@
<message> <message>
<location filename="../scenes/emailtextscene.ui" line="26"/> <location filename="../scenes/emailtextscene.ui" line="26"/>
<source>Check content</source> <source>Check content</source>
<translation type="unfinished">Контент чека</translation> <translation>Контент чека</translation>
</message> </message>
<message> <message>
<location filename="../scenes/emailtextscene.ui" line="33"/> <location filename="../scenes/emailtextscene.ui" line="33"/>
<source>Parse</source> <source>Parse</source>
<translation type="unfinished">Парсить</translation> <translation>Парсить</translation>
</message> </message>
<message> <message>
<location filename="../scenes/emailtextscene.ui" line="46"/> <location filename="../scenes/emailtextscene.ui" line="46"/>
<source>Store:</source> <source>Store:</source>
<translation type="unfinished"></translation> <translation>Магазин:</translation>
</message> </message>
<message> <message>
<location filename="../scenes/emailtextscene.ui" line="62"/> <location filename="../scenes/emailtextscene.ui" line="62"/>
<source>Back</source> <source>Back</source>
<translation type="unfinished"></translation> <translation>Назад</translation>
</message> </message>
<message> <message>
<location filename="../emailtextscene.cpp" line="31"/> <location filename="../emailtextscene.cpp" line="31"/>
<source>An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer.</source> <source>An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer.</source>
<translation type="unfinished">Произошла ошибка. Чек был прочитан неверно. Размеры векторов различаются. Пожалуйста, сообщите об этом разработчику.</translation> <translation>Произошла ошибка. Чек был прочитан неверно. Размеры векторов различаются. Пожалуйста, сообщите об этом разработчику.</translation>
</message> </message>
<message> <message>
<location filename="../emailtextscene.cpp" line="33"/> <location filename="../emailtextscene.cpp" line="33"/>
<source>Error in parsing</source> <source>Error in parsing</source>
<translation type="unfinished">Ошибка в парсинге</translation> <translation>Ошибка в парсинге</translation>
</message> </message>
</context> </context>
<context> <context>
@@ -208,17 +208,17 @@
<message> <message>
<location filename="../scenes/mainwindow.ui" line="26"/> <location filename="../scenes/mainwindow.ui" line="26"/>
<source>Form</source> <source>Form</source>
<translation type="unfinished"></translation> <translation>Форма</translation>
</message> </message>
<message> <message>
<location filename="../scenes/mainwindow.ui" line="37"/> <location filename="../scenes/mainwindow.ui" line="37"/>
<source>Optical Character Recognition</source> <source>Optical Character Recognition</source>
<translation type="unfinished"></translation> <translation>Оптическое распознавание символов</translation>
</message> </message>
<message> <message>
<location filename="../scenes/mainwindow.ui" line="63"/> <location filename="../scenes/mainwindow.ui" line="63"/>
<source>Text from E-Mail</source> <source>Text from E-Mail</source>
<translation type="unfinished"></translation> <translation>Текст из электронного письма</translation>
</message> </message>
</context> </context>
<context> <context>
@@ -226,62 +226,62 @@
<message> <message>
<location filename="../scenes/ocrscene.ui" line="20"/> <location filename="../scenes/ocrscene.ui" line="20"/>
<source>Form</source> <source>Form</source>
<translation type="unfinished"></translation> <translation>Форма</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ocrscene.ui" line="64"/> <location filename="../scenes/ocrscene.ui" line="64"/>
<source>Choose</source> <source>Choose</source>
<translation type="unfinished">Выбрать</translation> <translation>Выбрать</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ocrscene.ui" line="103"/> <location filename="../scenes/ocrscene.ui" line="103"/>
<source>Path to image:</source> <source>Path to image:</source>
<translation type="unfinished"></translation> <translation>Путь к изображению:</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ocrscene.ui" line="119"/> <location filename="../scenes/ocrscene.ui" line="119"/>
<source>Store:</source> <source>Store:</source>
<translation type="unfinished"></translation> <translation>Магазин:</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ocrscene.ui" line="90"/> <location filename="../scenes/ocrscene.ui" line="90"/>
<source>Recognized text will be shown below as soon as image will be processed. Please, edit it</source> <source>Recognized text will be shown below as soon as image will be processed. Please, edit it</source>
<translation type="unfinished"></translation> <translation>Распознанный текст будет показан ниже как только изображение обработается. Пожалуйста, отредактируйте</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ocrscene.ui" line="77"/> <location filename="../scenes/ocrscene.ui" line="77"/>
<source>Back</source> <source>Back</source>
<translation type="unfinished"></translation> <translation>Назад</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ocrscene.ui" line="45"/> <location filename="../scenes/ocrscene.ui" line="45"/>
<source>Parse</source> <source>Parse</source>
<translation type="unfinished">Парсить</translation> <translation>Парсить</translation>
</message> </message>
<message> <message>
<location filename="../ocrscene.cpp" line="36"/> <location filename="../ocrscene.cpp" line="36"/>
<source>An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer.</source> <source>An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer.</source>
<translation type="unfinished">Произошла ошибка. Чек был прочитан неверно. Размеры векторов различаются. Пожалуйста, сообщите об этом разработчику.</translation> <translation>Произошла ошибка. Чек был прочитан неверно. Размеры векторов различаются. Пожалуйста, сообщите об этом разработчику.</translation>
</message> </message>
<message> <message>
<location filename="../ocrscene.cpp" line="38"/> <location filename="../ocrscene.cpp" line="38"/>
<source>Error in parsing</source> <source>Error in parsing</source>
<translation type="unfinished">Ошибка в парсинге</translation> <translation>Ошибка в парсинге</translation>
</message> </message>
<message> <message>
<location filename="../ocrscene.cpp" line="56"/> <location filename="../ocrscene.cpp" line="56"/>
<source>Please, select a picture to scan</source> <source>Please, select a picture to scan</source>
<translation type="unfinished">Пожалуйста, выберете изображение для сканирования</translation> <translation>Пожалуйста, выберете изображение для сканирования</translation>
</message> </message>
<message> <message>
<location filename="../ocrscene.cpp" line="58"/> <location filename="../ocrscene.cpp" line="58"/>
<source>Picture was not selected</source> <source>Picture was not selected</source>
<translation type="unfinished">Изображение не было выбрано</translation> <translation>Изображение не было выбрано</translation>
</message> </message>
<message> <message>
<location filename="../ocrscene.cpp" line="64"/> <location filename="../ocrscene.cpp" line="64"/>
<source>Path to image: </source> <source>Path to image: </source>
<translation type="unfinished">Путь к изображению: </translation> <translation>Путь к изображению: </translation>
</message> </message>
</context> </context>
<context> <context>
@@ -289,127 +289,151 @@
<message> <message>
<location filename="../scenes/ofdscene.ui" line="14"/> <location filename="../scenes/ofdscene.ui" line="14"/>
<source>Form</source> <source>Form</source>
<translation type="unfinished"></translation> <translation>Форма</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ofdscene.ui" line="23"/> <location filename="../scenes/ofdscene.ui" line="23"/>
<source>Total</source> <source>Total</source>
<translation type="unfinished">Итого</translation> <translation>Итого</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ofdscene.ui" line="36"/> <location filename="../scenes/ofdscene.ui" line="36"/>
<source>Back</source> <source>Back</source>
<translation type="unfinished"></translation> <translation>Назад</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ofdscene.ui" line="49"/> <location filename="../scenes/ofdscene.ui" line="49"/>
<source>or</source> <source>or</source>
<translation type="unfinished"></translation> <translation>или</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ofdscene.ui" line="69"/> <location filename="../scenes/ofdscene.ui" line="69"/>
<source>FD (Fiscal Document)</source> <source>FD (Fiscal Document)</source>
<translation type="unfinished">ФД</translation> <translation>ФД</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ofdscene.ui" line="76"/> <location filename="../scenes/ofdscene.ui" line="76"/>
<source>Date and time of purchase</source> <source>Date and time of purchase</source>
<translation type="unfinished"></translation> <translation>Дата и время покупки</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ofdscene.ui" line="84"/> <location filename="../scenes/ofdscene.ui" line="84"/>
<source>Funds income</source> <source>Funds income</source>
<translation type="unfinished">Приход средств</translation> <translation>Приход средств</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ofdscene.ui" line="89"/> <location filename="../scenes/ofdscene.ui" line="89"/>
<source>Funds return</source> <source>Funds return</source>
<translation type="unfinished">Возврат средств</translation> <translation>Возврат средств</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ofdscene.ui" line="94"/> <location filename="../scenes/ofdscene.ui" line="94"/>
<source>Funds spend</source> <source>Funds spend</source>
<translation type="unfinished">Расход средств</translation> <translation>Расход средств</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ofdscene.ui" line="99"/> <location filename="../scenes/ofdscene.ui" line="99"/>
<source>Spends return</source> <source>Spends return</source>
<translation type="unfinished">Возврат расхода</translation> <translation>Возврат расхода</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ofdscene.ui" line="136"/> <location filename="../scenes/ofdscene.ui" line="136"/>
<source>Use your phone as a QR code scanner</source> <source>Use your phone as a QR code scanner</source>
<translation type="unfinished"></translation> <translation>Использовать телефон как сканнер QR</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ofdscene.ui" line="149"/> <location filename="../scenes/ofdscene.ui" line="149"/>
<source>FN (Fiscal Number)</source> <source>FN (Fiscal Number)</source>
<translation type="unfinished">ФН</translation> <translation>ФН</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ofdscene.ui" line="156"/> <location filename="../scenes/ofdscene.ui" line="156"/>
<source>FI (Fiscal Identifier)</source> <source>FI (Fiscal Identifier)</source>
<translation type="unfinished">ФП</translation> <translation>ФП</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ofdscene.ui" line="166"/> <location filename="../scenes/ofdscene.ui" line="166"/>
<source>Choose image on your PC</source> <source>Choose image on your PC</source>
<translation type="unfinished"></translation> <translation>Выбрать изображение на компьютере</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ofdscene.ui" line="173"/> <location filename="../scenes/ofdscene.ui" line="173"/>
<source>Operation type</source> <source>Operation type</source>
<translation type="unfinished"></translation> <translation>Тип операции</translation>
</message> </message>
<message> <message>
<location filename="../scenes/ofdscene.ui" line="186"/> <location filename="../scenes/ofdscene.ui" line="186"/>
<source>Parse</source> <source>Parse</source>
<translation type="unfinished">Парсить</translation> <translation>Парсить</translation>
</message> </message>
<message> <message>
<location filename="../ofdscene.cpp" line="48"/> <location filename="../ofdscene.cpp" line="205"/>
<source>Please, select a picture where QR code that contains info about check is present</source> <source>Could not start http server. 10 times in a row random port was occupied. Either you should run for a lottery ticket, or the problem is in the program. If the lottery ticket wasn&apos;t lucky, please, contact the developer.</source>
<translation type="unfinished">Пожалуйста, выберете изображение, содержащее QR код с информацией о чеке</translation>
</message>
<message>
<location filename="../ofdscene.cpp" line="50"/>
<source>Picture was not selected</source>
<translation type="unfinished">Изображение не было выбрано</translation>
</message>
<message>
<location filename="../ofdscene.cpp" line="56"/>
<source>Selected image: </source>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>
</message> </message>
<message> <message>
<location filename="../ofdscene.cpp" line="115"/> <location filename="../ofdscene.cpp" line="207"/>
<source>Could not start http server.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ofdscene.cpp" line="84"/>
<source>Please, select a picture where QR code that contains info about check is present</source>
<translation>Пожалуйста, выберете изображение, содержащее QR код с информацией о чеке</translation>
</message>
<message>
<location filename="../ofdscene.cpp" line="86"/>
<source>Picture was not selected</source>
<translation>Изображение не было выбрано</translation>
</message>
<message>
<location filename="../ofdscene.cpp" line="91"/>
<source>Selected image: </source>
<translation>Выбранное изображение: </translation>
</message>
<message>
<location filename="../ofdscene.cpp" line="150"/>
<source>Captcha was not solved correctly!</source> <source>Captcha was not solved correctly!</source>
<translation type="unfinished">Капча была решена неверно!</translation> <translation>Капча была решена неверно!</translation>
</message> </message>
<message> <message>
<location filename="../ofdscene.cpp" line="117"/> <location filename="../ofdscene.cpp" line="152"/>
<source>Captcha is incorrect</source> <source>Captcha is incorrect</source>
<translation type="unfinished">Капча введена неверно</translation> <translation>Капча введена неверно</translation>
</message> </message>
<message> <message>
<location filename="../ofdscene.cpp" line="122"/> <location filename="../ofdscene.cpp" line="157"/>
<source>Internal server error. Please, try again later.</source> <source>Internal server error. Please, try again later.</source>
<translation type="unfinished">Внутренняя ошибка сервера. Пожалуйста, попробуйте снова позже.</translation> <translation>Внутренняя ошибка сервера. Пожалуйста, попробуйте снова позже.</translation>
</message> </message>
<message> <message>
<location filename="../ofdscene.cpp" line="124"/> <location filename="../ofdscene.cpp" line="159"/>
<source>Internal server error</source> <source>Internal server error</source>
<translation type="unfinished">Внутренняя ошибка сервера</translation> <translation>Внутренняя ошибка сервера</translation>
</message> </message>
<message> <message>
<location filename="../ofdscene.cpp" line="129"/> <location filename="../ofdscene.cpp" line="164"/>
<source>Check not found. Please, ensure correctness of entered data.</source> <source>Check not found. Please, ensure correctness of entered data.</source>
<translation type="unfinished">Чек не найден. Пожалуйста, убедитесь в правильности введённых данных.</translation> <translation>Чек не найден. Пожалуйста, убедитесь в правильности введённых данных.</translation>
</message> </message>
<message> <message>
<location filename="../ofdscene.cpp" line="131"/> <location filename="../ofdscene.cpp" line="166"/>
<source>Check was not found</source> <source>Check was not found</source>
<translation type="unfinished">Чек не найден</translation> <translation>Чек не найден</translation>
</message>
<message>
<location filename="../ofdscene.cpp" line="198"/>
<source>QR code for binaryeye to connect</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../ofdscene.cpp" line="199"/>
<source>I&apos;ve scanned</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>123 123</source>
<translation type="obsolete">123 123</translation>
</message> </message>
</context> </context>
<context> <context>

View File

@@ -5,6 +5,10 @@
#include <cstring> #include <cstring>
#include <iostream> #include <iostream>
#include <locale> #include <locale>
#include <opencv2/core/mat.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/imgproc.hpp>
#include <qrencode.h>
#include <regex> #include <regex>
#include <string> #include <string>
#include "../exceptions/ofdrequestexception.h" #include "../exceptions/ofdrequestexception.h"
@@ -13,6 +17,7 @@
#include <fstream> #include <fstream>
#include <ifaddrs.h> #include <ifaddrs.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <opencv2/opencv.hpp>
std::string get_local_ip_address() { std::string get_local_ip_address() {
struct ifaddrs * ifAddrStruct=NULL; struct ifaddrs * ifAddrStruct=NULL;
@@ -214,3 +219,28 @@ Check parseOfdRuAnswer(std::string html) {
return c; return c;
} }
void generate_qr_code(std::string data) {
QRcode *qrCode = QRcode_encodeString(data.c_str(), 2, QR_ECLEVEL_L, QR_MODE_8, 1);
if (qrCode == NULL) {
std::cerr << "Error on generating qr code" << std::endl;
}
cv::Mat qrCodeImage = cv::Mat::zeros(qrCode->width, qrCode->width, CV_8UC3);
for (int y = 0; y < qrCode->width; y++) {
for (int x = 0; x < qrCode->width; x++) {
cv::rectangle(
qrCodeImage,
cv::Point(x, y),
cv::Point(x + 1, y + 1),
((qrCode->data[y * qrCode->width + x] & 1) ?
cv::Scalar(255., 255., 255.) : cv::Scalar(0., 0., 0.)
),
-1
);
}
}
cv::imwrite(get_path_relative_to_home(".local/share/checks_parser/binaryeye_connection.png"), qrCodeImage);
QRcode_free(qrCode);
}

View File

@@ -20,4 +20,6 @@ Check parseOfdRuAnswer(std::string);
std::wstring trim_html_response(std::wstring& check); std::wstring trim_html_response(std::wstring& check);
void generate_qr_code(std::string data);
#endif // UTILS_H #endif // UTILS_H