From 02e44650751896525f48911b613be7a0b49d6f63 Mon Sep 17 00:00:00 2001 From: leca Date: Tue, 22 Oct 2024 13:18:19 +0300 Subject: [PATCH] remade text type switch as tabview --- CMakeLists.txt | 7 +- CMakeLists.txt.user | 52 +++++------ captcha.png | Bin 0 -> 7398 bytes main.cpp | 22 ++--- mainwindow.cpp | 8 +- mainwindow.h | 2 +- mainwindow.ui | 189 +++++++++++++++++++++------------------- ofd.desc | 2 + ofd/module.h | 18 ---- ofd/ofd.cpp | 64 -------------- ofd/ofd.h | 14 +-- output/output_options.h | 7 +- 12 files changed, 157 insertions(+), 228 deletions(-) create mode 100644 captcha.png create mode 100644 ofd.desc delete mode 100644 ofd/module.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b90deb..6f861be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,7 +47,7 @@ else() outputdialog.h outputdialog.cpp outputdialog.ui output/output_options.h output/output_options.cpp ofd/ofd.h ofd/ofd.cpp - ofd/module.h ofd/module.cpp + utils/utils.h utils/utils.cpp image/checkimage.h image/checkimage.cpp net/net.h net/net.cpp @@ -92,4 +92,7 @@ include_directories("/usr/include/opencv4") target_link_libraries(checks-parser PRIVATE -ltesseract) target_link_libraries(checks-parser PRIVATE -lcurl) -target_link_libraries(checks-parser PRIVATE ${OpenCV_LIBS}) +pkg_search_module(opencv REQUIRED IMPORTED_TARGET opencv) +target_link_libraries(checks-parser PRIVATE PkgConfig::opencv) +# target_link_libraries(checks-parser PRIVATE ${OpenCV_LIBS}) +# target_link_libraries(checks-parser PRIVATE -lopencv) diff --git a/CMakeLists.txt.user b/CMakeLists.txt.user index bf27976..d8ae996 100644 --- a/CMakeLists.txt.user +++ b/CMakeLists.txt.user @@ -1,6 +1,6 @@ - + EnvironmentId @@ -102,14 +102,14 @@ 2 false - -DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG} --DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable} + -DCMAKE_GENERATOR:STRING=Ninja +-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C} +-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX} -DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx} --DCMAKE_GENERATOR:STRING=Ninja --DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake --DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX} +-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable} +-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG} 0 /home/leca/projects/qt/checks-parser/build/Desktop-Debug @@ -159,14 +159,14 @@ 2 false - -DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG} --DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable} + -DCMAKE_GENERATOR:STRING=Ninja +-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C} +-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX} -DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx} --DCMAKE_GENERATOR:STRING=Ninja --DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake --DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX} +-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable} +-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG} /home/leca/projects/qt/checks-parser/build/Desktop-Release @@ -213,14 +213,14 @@ 2 false - -DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG} --DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable} + -DCMAKE_GENERATOR:STRING=Ninja +-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo -DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C} +-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX} -DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx} --DCMAKE_GENERATOR:STRING=Ninja --DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake --DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX} +-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable} +-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG} /home/leca/projects/qt/checks-parser/build/Desktop-RelWithDebInfo @@ -267,14 +267,14 @@ 2 false - -DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG} --DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable} + -DCMAKE_GENERATOR:STRING=Ninja +-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake -DCMAKE_BUILD_TYPE:STRING=RelWithDebInfo -DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C} +-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX} -DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx} --DCMAKE_GENERATOR:STRING=Ninja --DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake --DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX} +-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable} +-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG} 0 /home/leca/projects/qt/checks-parser/build/Desktop-Profile @@ -322,14 +322,14 @@ 2 false - -DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG} --DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable} + -DCMAKE_GENERATOR:STRING=Ninja +-DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake -DCMAKE_BUILD_TYPE:STRING=MinSizeRel -DCMAKE_C_COMPILER:FILEPATH=%{Compiler:Executable:C} +-DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX} -DCMAKE_CXX_COMPILER:FILEPATH=%{Compiler:Executable:Cxx} --DCMAKE_GENERATOR:STRING=Ninja --DCMAKE_PROJECT_INCLUDE_BEFORE:FILEPATH=%{BuildConfig:BuildDirectory:NativeFilePath}/.qtc/package-manager/auto-setup.cmake --DCMAKE_PREFIX_PATH:PATH=%{Qt:QT_INSTALL_PREFIX} +-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable} +-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG} /home/leca/projects/qt/checks-parser/build/Desktop-MinSizeRel diff --git a/captcha.png b/captcha.png new file mode 100644 index 0000000000000000000000000000000000000000..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_e_uQ3l!XXF8G9Bw^AvHNs{6$&Q@->}14lw?+5zF2F4V6+p=hZxiuUQjKAAF- zZ^ai#b2^Gq*RKR+Z$DW~5>4glN78>3X8poR1;JCUi|m$q@VbhNZ`nI10|z}z@0X>- QQJ$m!--@WF4!NBAH<5WTd;kCd literal 0 HcmV?d00001 diff --git a/main.cpp b/main.cpp index a9e3ac8..081b897 100644 --- a/main.cpp +++ b/main.cpp @@ -21,17 +21,17 @@ int main(int argc, char *argv[]) { OFD ofd; Net n; - std::vector ofd_updates = ofd.check_updates(); - for (const std::string &update : ofd_updates) { - std::cout << "Downloading " - << s.get_setting("ofds_modules_url") + update << " to " - << get_path_relative_to_home(s.get_setting("ofds_modules_dir") + - "/" + update) - << std::endl; - n.get_file(s.get_setting("ofds_modules_url") + "/" + update, - get_path_relative_to_home(s.get_setting("ofds_modules_dir") + - "/" + update)); - } + // std::vector ofd_updates = ofd.check_updates(); + // for (const std::string &update : ofd_updates) { + // std::cout << "Downloading " + // << s.get_setting("ofds_modules_url") + update << " to " + // << get_path_relative_to_home(s.get_setting("ofds_modules_dir") + + // "/" + update) + // << std::endl; + // n.get_file(s.get_setting("ofds_modules_url") + "/" + update, + // get_path_relative_to_home(s.get_setting("ofds_modules_dir") + + // "/" + update)); + // } Parser p; std::vector stores_updates = p.check_updates();\ diff --git a/mainwindow.cpp b/mainwindow.cpp index 7c5f6d4..bbd9ffd 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -36,9 +36,9 @@ void MainWindow::setupStoresList() { #endif } -void MainWindow::on_checkType_currentIndexChanged(int index) { - ui->inputHolder->setCurrentIndex(index); -} +// void MainWindow::on_checkType_currentIndexChanged(int index) { +// ui->inputHolder->setCurrentIndex(index); +// } void MainWindow::on_parseButton_clicked() { QString s; @@ -82,7 +82,7 @@ void MainWindow::on_chooseImageButton_clicked() { std::cout << filename.toStdString() << std::endl; // this->options.set_path(filename.toStdString()); - std::string new_text = "Path to export: " + filename.toStdString(); + std::string new_text = "Selected: " + filename.toStdString(); ui->pathLabel->setText(QString::fromStdString(new_text)); CheckImage i(filename.toStdString()); diff --git a/mainwindow.h b/mainwindow.h index 6995ec2..3fd8086 100644 --- a/mainwindow.h +++ b/mainwindow.h @@ -25,7 +25,7 @@ public: Check get_check(); private slots: - void on_checkType_currentIndexChanged(int index); + // void on_checkType_currentIndexChanged(int index); void on_parseButton_clicked(); diff --git a/mainwindow.ui b/mainwindow.ui index 4b8482f..cdca4ae 100644 --- a/mainwindow.ui +++ b/mainwindow.ui @@ -70,95 +70,6 @@ - - - - 10 - 80 - 501 - 471 - - - - 0 - - - - - - 10 - 10 - 101 - 18 - - - - Check content - - - - - - 10 - 50 - 431 - 401 - - - - - - - - - 110 - 20 - 381 - 18 - - - - Path to image: - - - - - - 10 - 20 - 80 - 26 - - - - Choose - - - - - - 10 - 50 - 571 - 18 - - - - Here is recognised check text. Please, edit it if something's wrong: - - - - - - 10 - 80 - 471 - 371 - - - - - @@ -185,6 +96,106 @@ Preferences + + + + 10 + 80 + 601 + 471 + + + + 0 + + + + Text + + + + + 0 + 0 + 101 + 18 + + + + Check content + + + + + + 0 + 30 + 431 + 241 + + + + + + + OCR + + + + + 0 + 0 + 80 + 26 + + + + Choose + + + + + + 0 + 60 + 471 + 231 + + + + + + + 100 + 0 + 381 + 18 + + + + Path to image: + + + + + + 0 + 30 + 571 + 18 + + + + Here is recognised check text. Please, edit it if something's wrong: + + + + + + OFD + + + diff --git a/ofd.desc b/ofd.desc new file mode 100644 index 0000000..8c903e2 --- /dev/null +++ b/ofd.desc @@ -0,0 +1,2 @@ +1. curl -X GET https://check.ofd.ru/api/captcha/common/img +2. curl 'https://check.ofd.ru/Document/FetchReceiptFromFns' -H 'content-type: application/json;charset=UTF-8' --data-raw '{"TotalSum":52344,"FnNumber":"7281440701327430","ReceiptOperationType":"1","DocNumber":"25955","DocFiscalSign":"2518183888","Captcha":"INSERT SOLVED CAPTCHA","DocDateTime":"2024-08-16T19:36:00.000Z"}' diff --git a/ofd/module.h b/ofd/module.h deleted file mode 100644 index 09bdfcd..0000000 --- a/ofd/module.h +++ /dev/null @@ -1,18 +0,0 @@ -#ifndef OFD_MODULE_H -#define OFD_MODULE_H - -#include - -class OFDModule { - std::string path; - std::wstring name; - std::wstring url; -public: - OFDModule(std::string); - OFDModule(); - - std::wstring get_name(); - std::wstring get_url(); -}; - -#endif // OFDMODULE_H diff --git a/ofd/ofd.cpp b/ofd/ofd.cpp index ee3689d..0333ae9 100644 --- a/ofd/ofd.cpp +++ b/ofd/ofd.cpp @@ -1,67 +1,3 @@ #include "ofd.h" -#include "../utils/utils.h" -#include -#include -#include -#include -#include "../net/net.h" -#include "../settings/settings.h" OFD::OFD() {} - -OFD::OFD(std::string path) { this->module = OFDModule(path); }; - -std::vector OFD::search_ofds() { - Settings s(get_path_relative_to_home(".local/share/checks_parser/settings.json")); - std::vector result{}; - - std::string path = get_path_relative_to_home(s.get_setting("ods_modules_dir")); - std::filesystem::directory_entry modules_dir(path); - - if (!modules_dir.exists()) { - std::filesystem::create_directories(path); - std::cout << "No modules directory found. Created one at " << path - << std::endl; - std::cout << "Please, download modules to that directory from my git." - << std::endl; - } - - for (auto file : std::filesystem::directory_iterator(path)) { - result.push_back(file.path()); - } - - return result; -} - -void OFD::set_module(std::string path) { this->module = OFDModule(path); } - -std::string OFD::get_check_data(std::string fn, std::string fd, - std::string fp) { - //TODO - return ""; -} - -std::vector OFD::check_updates() { - Settings s(get_path_relative_to_home(".local/share/checks_parser/settings.json")); - - std::string path = get_path_relative_to_home(s.get_setting("ofds_modules_dir")); - std::vector to_download; - std::vector stored_modules; - - for (const auto& file : std::filesystem::directory_iterator(path)) { - if (!file.is_regular_file()) continue; - stored_modules.push_back(file.path().filename()); - std::cout << "Detected OFD module" << file.path().filename() << std::endl; - } - Net n; - std::vector remote_modules = n.get_all_modules(s.get_setting("ofds_modules_url")); - - for (const std::string& module : remote_modules) { - if (!vector_contains_element(stored_modules, module)) { - to_download.push_back(module); - std::cout << "I need to download OFD module " << module << std::endl; - } - } - - return to_download; -} diff --git a/ofd/ofd.h b/ofd/ofd.h index 6f98355..22c1325 100644 --- a/ofd/ofd.h +++ b/ofd/ofd.h @@ -2,22 +2,12 @@ #define OFD_H #include -#include -#include "module.h" class OFD { - OFDModule module; - public: OFD(); - OFD(std::string); - - std::vector search_ofds(); - - void set_module(std::string); - - std::string get_check_data(std::string fn, std::string fd, std::string fp); - std::vector check_updates(); + void ask_captcha(); + std::string request_and_parse_check(long fiscal_number, long fiscal_document, long fiscal_sign, std::string datetime, double total, std::string captcha); }; #endif // OFD_H diff --git a/output/output_options.h b/output/output_options.h index 78ee716..1c66b40 100644 --- a/output/output_options.h +++ b/output/output_options.h @@ -3,6 +3,12 @@ #include #include +#include +#include +#include +#include +#include "../net/net.h" +#include "../settings/settings.h" enum class ColumnType { goods_name, @@ -18,7 +24,6 @@ struct Column { // Example: unsigned int position; // "0" <-- 0 = "A", 1 = "B", etc.. column letter in // table processor (i.e. excel or libreoffice) } typedef Column; - enum class OutputFormat { csv, ods, xlsx, plaintext } typedef OutputFormat; class OutputOptions {