TODO changes

This commit is contained in:
leca 2024-08-30 22:12:14 +03:00
parent d9fca88af3
commit 2a726a96b7
8 changed files with 35 additions and 36 deletions

View File

@ -86,7 +86,3 @@ FetchContent_Declare(cpr GIT_REPOSITORY https://github.com/libcpr/cpr.git
GIT_TAG 3b15fa82ea74739b574d705fea44959b58142eb8) GIT_TAG 3b15fa82ea74739b574d705fea44959b58142eb8)
FetchContent_MakeAvailable(cpr) FetchContent_MakeAvailable(cpr)
target_link_libraries(checks-parser PRIVATE cpr::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)

9
TODO Normal file
View File

@ -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

11
TOOD
View File

@ -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

View File

@ -2,7 +2,6 @@
#include "ofd/ofd.h" #include "ofd/ofd.h"
#include "utils/utils.h" #include "utils/utils.h"
#include <iostream> #include <iostream>
#include <QApplication> #include <QApplication>
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
@ -10,12 +9,6 @@ int main(int argc, char *argv[]) {
MainWindow w; MainWindow w;
w.show(); w.show();
OFD ofd;
std::vector<std::string> 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(); return a.exec();
} }

View File

@ -15,8 +15,6 @@ MainWindow::MainWindow(QWidget *parent)
MainWindow::~MainWindow() { delete ui; } MainWindow::~MainWindow() { delete ui; }
void MainWindow::setupStoresList() { void MainWindow::setupStoresList() {
// Make file format that is a regeeex which parse check, load these files
// here
parser = *(new Parser()); parser = *(new Parser());
std::vector<std::string> modules_names = parser.search_modules(); std::vector<std::string> modules_names = parser.search_modules();
@ -61,7 +59,7 @@ void MainWindow::on_parseButton_clicked() {
Check check; Check check;
for (auto g : c) { for (auto& g : c) {
check.add_goods(g); check.add_goods(g);
} }

View File

@ -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-mobile: ?0' \
-H 'sec-ch-ua-platform: "Linux"' -H 'sec-ch-ua-platform: "Linux"'
cpr::Response r = // curl 'https://ofd.beeline.ru/api/ofdcheck/checkf?fn=7281440701327430&fp=2807139546&fd=25051&format=4' \
cpr::Get(cpr::Url{to_utf8(module.get_url())}, -H 'Accept: application/json, text/plain, */*' \
cpr::Parameters{{"fn", fn}, {"fd", fd}, {"fp", fp}}); -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; return r.text;
} }

View File

@ -17,6 +17,6 @@ public:
void set_module(std::string); 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 #endif // OFD_H

View File

@ -1,5 +1,3 @@
// TODO: refactor that shit with custom qt widget(line edit + combo box)
#include "outputdialog.h" #include "outputdialog.h"
#include "check/check.h" #include "check/check.h"
#include "output/output_options.h" #include "output/output_options.h"
@ -116,4 +114,3 @@ void OutputDialog::on_printHeaderCheckBox_stateChanged(int value) {
void OutputDialog::on_printTotalCheckBox_stateChanged(int value) { void OutputDialog::on_printTotalCheckBox_stateChanged(int value) {
this->options.set_print_total(value); this->options.set_print_total(value);
} }