diff --git a/CMakeLists.txt b/CMakeLists.txt index 5404532..831ffca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,7 +86,3 @@ FetchContent_Declare(cpr GIT_REPOSITORY https://github.com/libcpr/cpr.git GIT_TAG 3b15fa82ea74739b574d705fea44959b58142eb8) FetchContent_MakeAvailable(cpr) target_link_libraries(checks-parser PRIVATE cpr::cpr) - - -find_package(KF${QT_VERSION_MAJOR}WidgetsAddons) -target_link_libraries(checks-parser PRIVATE KF${QT_VERSION_MAJOR}::WidgetsAddons) diff --git a/TODO b/TODO new file mode 100644 index 0000000..fdd1ee2 --- /dev/null +++ b/TODO @@ -0,0 +1,9 @@ +Complete module "export": + make UI; [done] + make export to .csv [done] +Complete module "image-to-text": + make UI; + make use of tesseract/opencv (https://learnopencv.com/deep-learning-based-text-recognition-ocr-using-tesseract-and-opencv/); +Add features: + autodetect store type + diff --git a/TOOD b/TOOD deleted file mode 100644 index 4e7e5e2..0000000 --- a/TOOD +++ /dev/null @@ -1,11 +0,0 @@ -Complete module "export": - make UI; - make export to .ods - make export to .csv - (Optional) make export to .xlsx (if I find some FLOSS library for that Micro$hit format) -Complete module "image-to-text": - make UI; - make use of opencv (https://learnopencv.com/deep-learning-based-text-detection-using-opencv-c-python); -Add features: - autodetect store type - diff --git a/main.cpp b/main.cpp index 907b6ea..799388d 100644 --- a/main.cpp +++ b/main.cpp @@ -2,7 +2,6 @@ #include "ofd/ofd.h" #include "utils/utils.h" #include - #include int main(int argc, char *argv[]) { @@ -10,12 +9,6 @@ int main(int argc, char *argv[]) { MainWindow w; w.show(); - OFD ofd; - std::vector ofds = ofd.search_ofds(); - - for (OFDModule o : ofds) { - std::cout << to_utf8(o.get_name()) << ": " << to_utf8(o.get_url()) << std::endl; - } return a.exec(); } diff --git a/mainwindow.cpp b/mainwindow.cpp index 821abe6..523fb2f 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -15,8 +15,6 @@ MainWindow::MainWindow(QWidget *parent) MainWindow::~MainWindow() { delete ui; } void MainWindow::setupStoresList() { - // Make file format that is a regeeex which parse check, load these files - // here parser = *(new Parser()); std::vector modules_names = parser.search_modules(); @@ -61,7 +59,7 @@ void MainWindow::on_parseButton_clicked() { Check check; - for (auto g : c) { + for (auto& g : c) { check.add_goods(g); } diff --git a/ofd/ofd.cpp b/ofd/ofd.cpp index d349e96..fdd0fdf 100644 --- a/ofd/ofd.cpp +++ b/ofd/ofd.cpp @@ -52,11 +52,28 @@ std::string OFD::get_check_data(std::string fn, std::string fd, -H 'sec-ch-ua-mobile: ?0' \ -H 'sec-ch-ua-platform: "Linux"' - cpr::Response r = - cpr::Get(cpr::Url{to_utf8(module.get_url())}, - cpr::Parameters{{"fn", fn}, {"fd", fd}, {"fp", fp}}); + // curl 'https://ofd.beeline.ru/api/ofdcheck/checkf?fn=7281440701327430&fp=2807139546&fd=25051&format=4' \ + -H 'Accept: application/json, text/plain, */*' \ + -H 'Accept-Language: en-US,en;q=0.9,eo;q=0.8,ru;q=0.7' \ + -H 'Authorization: bearer null' \ + -H 'Connection: keep-alive' \ + -H 'Content-Type: application/json' \ + -H 'DNT: 1' \ + -H 'Referer: https://ofd.beeline.ru/check-order?fn=7281440701327430&fp=2807139546&fd=25051' \ + -H 'Sec-Fetch-Dest: empty' \ + -H 'Sec-Fetch-Mode: cors' \ + -H 'Sec-Fetch-Site: same-origin' \ + -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36' \ + -H 'sec-ch-ua: "Chromium";v="127", "Not)A;Brand";v="99"' \ + -H 'sec-ch-ua-mobile: ?0' \ + -H 'sec-ch-ua-platform: "Linux"' - std::cout << r.text << std::endl; + // cpr::Response r = cpr::Get(cpr::Url{"https://httpbin.org/get"}); + std::cout << fn << " " << fd << " " << fp << std::endl; + cpr::Response r = + //to_utf8(module.get_url()) + cpr::Get(cpr::Url{"https://ofd.beeline.ru/api/ofdcheck/checkf"}, + cpr::Parameters{{"fn", fn}, {"fd", fd}, {"fp", fp}, {"format", "4"}}); return r.text; } diff --git a/ofd/ofd.h b/ofd/ofd.h index 3516d4f..418d4b3 100644 --- a/ofd/ofd.h +++ b/ofd/ofd.h @@ -17,6 +17,6 @@ public: void set_module(std::string); - std::string get_check_data(std::string, std::string, std::string); + std::string get_check_data(std::string fn, std::string fd, std::string fp); }; #endif // OFD_H diff --git a/outputdialog.cpp b/outputdialog.cpp index 3265088..46e3abd 100644 --- a/outputdialog.cpp +++ b/outputdialog.cpp @@ -1,5 +1,3 @@ -// TODO: refactor that shit with custom qt widget(line edit + combo box) - #include "outputdialog.h" #include "check/check.h" #include "output/output_options.h" @@ -24,7 +22,7 @@ bool compare_position(Column &c1, Column &c2) { void OutputDialog::on_buttonBox_accepted() { std::ofstream output_file(this->options.get_path()); - for (int i = 0; i < ui->tableWidget->rowCount(); i ++) { + for (int i = 0; i < ui->tableWidget->rowCount(); i++) { int position = ui->tableWidget->item(i, 0)->text().toInt(); std::string name = ui->tableWidget->item(i, 1)->text().toStdString(); @@ -40,7 +38,7 @@ void OutputDialog::on_buttonBox_accepted() { this->options.get_columns().end(), compare_position); if (options.get_print_header()) { - for (auto& column : this->options.get_columns()) { + for (auto &column : this->options.get_columns()) { output_file << column.name << (column.position == this->options.get_columns().size() ? "" @@ -50,7 +48,7 @@ void OutputDialog::on_buttonBox_accepted() { } for (auto goods : this->check.get_goods()) { - for (auto& column : this->options.get_columns()) { + for (auto &column : this->options.get_columns()) { std::string output_str; switch (column.type) { @@ -116,4 +114,3 @@ void OutputDialog::on_printHeaderCheckBox_stateChanged(int value) { void OutputDialog::on_printTotalCheckBox_stateChanged(int value) { this->options.set_print_total(value); } -