remade text type switch as tabview
This commit is contained in:
parent
4bf7638f6a
commit
02e4465075
|
@ -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)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 14.0.1, 2024-10-05T17:58:40. -->
|
||||
<!-- Written by QtCreator 14.0.2, 2024-10-18T01:45:27. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
|
@ -102,14 +102,14 @@
|
|||
<value type="int" key="CMake.Configure.BaseEnvironment">2</value>
|
||||
<value type="bool" key="CMake.Configure.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="CMake.Configure.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}
|
||||
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
|
||||
<value type="QString" key="CMake.Initial.Parameters">-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}</value>
|
||||
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
|
||||
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}</value>
|
||||
<value type="int" key="EnableQmlDebugging">0</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/leca/projects/qt/checks-parser/build/Desktop-Debug</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
|
@ -159,14 +159,14 @@
|
|||
<value type="int" key="CMake.Configure.BaseEnvironment">2</value>
|
||||
<value type="bool" key="CMake.Configure.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="CMake.Configure.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}
|
||||
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
|
||||
<value type="QString" key="CMake.Initial.Parameters">-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}</value>
|
||||
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
|
||||
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/leca/projects/qt/checks-parser/build/Desktop-Release</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
|
@ -213,14 +213,14 @@
|
|||
<value type="int" key="CMake.Configure.BaseEnvironment">2</value>
|
||||
<value type="bool" key="CMake.Configure.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="CMake.Configure.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}
|
||||
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
|
||||
<value type="QString" key="CMake.Initial.Parameters">-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}</value>
|
||||
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
|
||||
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/leca/projects/qt/checks-parser/build/Desktop-RelWithDebInfo</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
|
@ -267,14 +267,14 @@
|
|||
<value type="int" key="CMake.Configure.BaseEnvironment">2</value>
|
||||
<value type="bool" key="CMake.Configure.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="CMake.Configure.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}
|
||||
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
|
||||
<value type="QString" key="CMake.Initial.Parameters">-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}</value>
|
||||
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
|
||||
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}</value>
|
||||
<value type="int" key="EnableQmlDebugging">0</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/leca/projects/qt/checks-parser/build/Desktop-Profile</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
|
@ -322,14 +322,14 @@
|
|||
<value type="int" key="CMake.Configure.BaseEnvironment">2</value>
|
||||
<value type="bool" key="CMake.Configure.ClearSystemEnvironment">false</value>
|
||||
<valuelist type="QVariantList" key="CMake.Configure.UserEnvironmentChanges"/>
|
||||
<value type="QString" key="CMake.Initial.Parameters">-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}
|
||||
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
|
||||
<value type="QString" key="CMake.Initial.Parameters">-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}</value>
|
||||
-DQT_QMAKE_EXECUTABLE:FILEPATH=%{Qt:qmakeExecutable}
|
||||
-DCMAKE_CXX_FLAGS_INIT:STRING=%{Qt:QML_DEBUG_FLAG}</value>
|
||||
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/leca/projects/qt/checks-parser/build/Desktop-MinSizeRel</value>
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
|
||||
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 7.2 KiB |
22
main.cpp
22
main.cpp
|
@ -21,17 +21,17 @@ int main(int argc, char *argv[]) {
|
|||
OFD ofd;
|
||||
Net n;
|
||||
|
||||
std::vector<std::string> 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<std::string> 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<std::string> stores_updates = p.check_updates();\
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
189
mainwindow.ui
189
mainwindow.ui
|
@ -70,95 +70,6 @@
|
|||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="QStackedWidget" name="inputHolder">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>80</y>
|
||||
<width>501</width>
|
||||
<height>471</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="page_5">
|
||||
<widget class="QLabel" name="checkContentLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>101</width>
|
||||
<height>18</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Check content</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPlainTextEdit" name="checkContent">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>50</y>
|
||||
<width>431</width>
|
||||
<height>401</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="page_6">
|
||||
<widget class="QLabel" name="pathLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>110</x>
|
||||
<y>20</y>
|
||||
<width>381</width>
|
||||
<height>18</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Path to image: </string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="chooseImageButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>20</y>
|
||||
<width>80</width>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Choose</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>50</y>
|
||||
<width>571</width>
|
||||
<height>18</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Here is recognised check text. Please, edit it if something's wrong:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPlainTextEdit" name="checkContentFromImage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>80</y>
|
||||
<width>471</width>
|
||||
<height>371</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="parseButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
|
@ -185,6 +96,106 @@
|
|||
<string>Preferences</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>80</y>
|
||||
<width>601</width>
|
||||
<height>471</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="Text">
|
||||
<attribute name="title">
|
||||
<string>Text</string>
|
||||
</attribute>
|
||||
<widget class="QLabel" name="checkContentLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>101</width>
|
||||
<height>18</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Check content</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPlainTextEdit" name="checkContent">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>30</y>
|
||||
<width>431</width>
|
||||
<height>241</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="OCR">
|
||||
<attribute name="title">
|
||||
<string>OCR</string>
|
||||
</attribute>
|
||||
<widget class="QPushButton" name="chooseImageButton">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>80</width>
|
||||
<height>26</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Choose</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPlainTextEdit" name="checkContentFromImage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>60</y>
|
||||
<width>471</width>
|
||||
<height>231</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="pathLabel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>100</x>
|
||||
<y>0</y>
|
||||
<width>381</width>
|
||||
<height>18</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Path to image: </string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>30</y>
|
||||
<width>571</width>
|
||||
<height>18</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Here is recognised check text. Please, edit it if something's wrong:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="OFD">
|
||||
<attribute name="title">
|
||||
<string>OFD</string>
|
||||
</attribute>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
|
|
|
@ -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"}'
|
18
ofd/module.h
18
ofd/module.h
|
@ -1,18 +0,0 @@
|
|||
#ifndef OFD_MODULE_H
|
||||
#define OFD_MODULE_H
|
||||
|
||||
#include <string>
|
||||
|
||||
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
|
64
ofd/ofd.cpp
64
ofd/ofd.cpp
|
@ -1,67 +1,3 @@
|
|||
#include "ofd.h"
|
||||
#include "../utils/utils.h"
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "../net/net.h"
|
||||
#include "../settings/settings.h"
|
||||
|
||||
OFD::OFD() {}
|
||||
|
||||
OFD::OFD(std::string path) { this->module = OFDModule(path); };
|
||||
|
||||
std::vector<std::string> OFD::search_ofds() {
|
||||
Settings s(get_path_relative_to_home(".local/share/checks_parser/settings.json"));
|
||||
std::vector<std::string> 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<std::string> 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<std::string> to_download;
|
||||
std::vector<std::string> 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<std::string> 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;
|
||||
}
|
||||
|
|
14
ofd/ofd.h
14
ofd/ofd.h
|
@ -2,22 +2,12 @@
|
|||
#define OFD_H
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "module.h"
|
||||
|
||||
class OFD {
|
||||
|
||||
OFDModule module;
|
||||
|
||||
public:
|
||||
OFD();
|
||||
OFD(std::string);
|
||||
|
||||
std::vector<std::string> search_ofds();
|
||||
|
||||
void set_module(std::string);
|
||||
|
||||
std::string get_check_data(std::string fn, std::string fd, std::string fp);
|
||||
std::vector<std::string> 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
|
||||
|
|
|
@ -3,6 +3,12 @@
|
|||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#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 {
|
||||
|
|
Loading…
Reference in New Issue