Compare commits
40 Commits
Author | SHA1 | Date |
---|---|---|
|
5f4a86cee8 | |
|
a73bf1fc53 | |
|
7275892b04 | |
|
e749c21a61 | |
|
f483c97935 | |
|
dda40e11b8 | |
|
7822984ff0 | |
|
c17af59358 | |
|
6b815dbe0a | |
|
5600e03ce1 | |
|
7d71cb016a | |
|
7a52905cff | |
|
3b26dbc29d | |
|
754700edfb | |
|
9094d3c997 | |
|
1b32774e55 | |
|
d17695a7fa | |
|
e58d6068e0 | |
|
80e9397e01 | |
|
ba8fc1079a | |
|
e49a078c80 | |
|
64f081b522 | |
|
b19c92079d | |
|
a342d78df7 | |
|
59315f9445 | |
|
d83f106a91 | |
|
1fa69c3a69 | |
|
89afe836be | |
|
51d8600be0 | |
|
229a6bcc9e | |
|
17fd9da3e6 | |
|
33f819a09d | |
|
a87869ca7f | |
|
b57a542161 | |
|
b966d7fcf5 | |
|
cb8041c928 | |
|
5209b7bf22 | |
|
b86514b030 | |
|
31f4ca26fb | |
|
993cf4d69c |
|
@ -124,3 +124,5 @@ checks-parser
|
||||||
deploy/appimage/AppDir/usr/share/doc/
|
deploy/appimage/AppDir/usr/share/doc/
|
||||||
deploy/appimage/AppDir/usr/share/
|
deploy/appimage/AppDir/usr/share/
|
||||||
*.deb
|
*.deb
|
||||||
|
|
||||||
|
binaries
|
||||||
|
|
180
CMakeLists.txt
180
CMakeLists.txt
|
@ -1,12 +1,57 @@
|
||||||
cmake_minimum_required(VERSION 3.10)
|
cmake_minimum_required(VERSION 3.10)
|
||||||
|
|
||||||
project(checks-parser VERSION 0.1 LANGUAGES CXX)
|
project(checks-parser VERSION 0.0.4 LANGUAGES CXX)
|
||||||
|
|
||||||
option(BUILD_TRANSLATIONS "Build translations?" ON)
|
option(BUILD_TRANSLATIONS "Build translations?" ON)
|
||||||
|
option(BUILD_EMAIL_MODE "Build email mode?" ON)
|
||||||
|
option(BUILD_OFD_LOCAL_QR_SCAN "Build OFDs' local qr scanner?" ON)
|
||||||
|
option(BUILD_OFD_BINARYEYE_SCAN "Build OFDs' binaryeye scanner?" ON)
|
||||||
|
|
||||||
include(FetchContent)
|
if (NOT (BUILD_EMAIL_MODE OR BUILD_OFD_LOCAL_QR_SCAN OR BUILD_OFD_BINARYEYE_SCAN))
|
||||||
|
message(FATAL_ERROR "You must specify at least one of the modes of data input!")
|
||||||
|
return()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (BUILD_TRANSLATIONS)
|
||||||
|
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||||
|
add_definitions(-DBUILD_TRANSLATIONS)
|
||||||
|
else()
|
||||||
|
add_compile_definitions(BUILD_TRANSLATIONS)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (BUILD_OFD_LOCAL_QR_SCAN OR BUILD_OFD_BINARYEYE_SCAN)
|
||||||
|
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||||
|
add_definitions(-DBUILD_OFD_MODE)
|
||||||
|
else()
|
||||||
|
add_compile_definitions(BUILD_OFD_MODE)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (BUILD_EMAIL_MODE)
|
||||||
|
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||||
|
add_definitions(-DBUILD_EMAIL_MODE)
|
||||||
|
else()
|
||||||
|
add_compile_definitions(BUILD_EMAIL_MODE)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
if (BUILD_OFD_LOCAL_QR_SCAN)
|
||||||
|
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||||
|
add_definitions(-DBUILD_OFD_LOCAL_QR_SCAN)
|
||||||
|
else()
|
||||||
|
add_compile_definitions(BUILD_OFD_LOCAL_QR_SCAN)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
if (BUILD_OFD_BINARYEYE_SCAN)
|
||||||
|
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||||
|
add_definitions(-DBUILD_OFD_BINARYEYE_SCAN)
|
||||||
|
else()
|
||||||
|
add_compile_definitions(BUILD_OFD_BINARYEYE_SCAN)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
SET(CMAKE_BUILD_TYPE Debug)
|
SET(CMAKE_BUILD_TYPE Debug)
|
||||||
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread")
|
||||||
|
|
||||||
set(CMAKE_AUTOUIC ON)
|
set(CMAKE_AUTOUIC ON)
|
||||||
set(CMAKE_AUTOMOC ON)
|
set(CMAKE_AUTOMOC ON)
|
||||||
|
@ -18,54 +63,60 @@ set(CMAKE_CXX_STANDARD 17)
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||||
|
|
||||||
find_package(Qt5Core REQUIRED)
|
find_package(Qt5Core REQUIRED)
|
||||||
find_package(Qt5 REQUIRED COMPONENTS LinguistTools)
|
if (BUILD_TRANSLATIONS)
|
||||||
|
find_package(Qt5 REQUIRED COMPONENTS LinguistTools)
|
||||||
|
endif()
|
||||||
find_package(Qt5Gui REQUIRED)
|
find_package(Qt5Gui REQUIRED)
|
||||||
find_package(Qt5Widgets REQUIRED)
|
find_package(Qt5Widgets REQUIRED)
|
||||||
find_package(Qt5UiTools REQUIRED)
|
|
||||||
|
|
||||||
set(PROJECT_SOURCES
|
|
||||||
main.cpp
|
|
||||||
mainwindow.h mainwindow.cpp scenes/mainwindow.ui
|
|
||||||
|
|
||||||
goods/goods.h goods/goods.cpp
|
|
||||||
check/check.h check/check.cpp
|
|
||||||
parser/parser.h parser/parser.cpp
|
|
||||||
parser/module.h parser/module.cpp
|
|
||||||
|
|
||||||
output/output_options.h output/output_options.cpp
|
|
||||||
|
|
||||||
utils/utils.h utils/utils.cpp
|
|
||||||
image/checkimage.h image/checkimage.cpp
|
|
||||||
net/net.h net/net.cpp
|
|
||||||
settings/settings.h settings/settings.cpp
|
|
||||||
exceptions/ofdrequestexception.h exceptions/ofdrequestexception.cpp
|
|
||||||
|
|
||||||
emailtextscene.h emailtextscene.cpp scenes/emailtextscene.ui
|
|
||||||
ocrscene.h ocrscene.cpp scenes/ocrscene.ui
|
|
||||||
ofdscene.h ofdscene.cpp scenes/ofdscene.ui
|
|
||||||
outputdialog.h outputdialog.cpp scenes/outputdialog.ui
|
|
||||||
adjustpicturedialog.h adjustpicturedialog.cpp scenes/adjustpicturedialog.ui
|
|
||||||
image_redactor/imageredactor.h image_redactor/imageredactor.cpp
|
|
||||||
solvecaptchadialog.h solvecaptchadialog.cpp scenes/solvecaptchadialog.ui
|
|
||||||
)
|
|
||||||
|
|
||||||
set(TRANSLATION_SOURCES
|
set(TRANSLATION_SOURCES
|
||||||
main.cpp
|
main.cpp
|
||||||
mainwindow.cpp mainwindow.h scenes/mainwindow.ui
|
mainwindow.cpp mainwindow.h scenes/mainwindow.ui
|
||||||
emailtextscene.cpp emailtextscene.h scenes/emailtextscene.ui
|
|
||||||
ocrscene.cpp ocrscene.h scenes/ocrscene.ui
|
|
||||||
ofdscene.cpp ofdscene.h scenes/ofdscene.ui
|
|
||||||
outputdialog.h outputdialog.cpp scenes/outputdialog.ui
|
outputdialog.h outputdialog.cpp scenes/outputdialog.ui
|
||||||
adjustpicturedialog.h adjustpicturedialog.cpp scenes/adjustpicturedialog.ui
|
settingsdialog.h settingsdialog.cpp scenes/settingsdialog.ui
|
||||||
solvecaptchadialog.h solvecaptchadialog.cpp scenes/solvecaptchadialog.ui
|
|
||||||
)
|
)
|
||||||
|
|
||||||
set(TS_FILES
|
if (BUILD_OFD_LOCAL_QR_SCAN)
|
||||||
translations/en_US.ts
|
list(APPEND TRANSLATION_SOURCES adjustpicturedialog.h adjustpicturedialog.cpp scenes/adjustpicturedialog.ui)
|
||||||
translations/ru_RU.ts
|
endif()
|
||||||
|
|
||||||
|
if (BUILD_OFD_LOCAL_QR_SCAN OR BUILD_OFD_BINARYEYE_SCAN)
|
||||||
|
list(APPEND TRANSLATION_SOURCES solvecaptchadialog.h solvecaptchadialog.cpp scenes/solvecaptchadialog.ui)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(PROJECT_SOURCES
|
||||||
|
goods/goods.h goods/goods.cpp
|
||||||
|
check/check.h check/check.cpp
|
||||||
|
|
||||||
|
output/output_options.h output/output_options.cpp
|
||||||
|
|
||||||
|
utils/utils.h utils/utils.cpp
|
||||||
|
|
||||||
|
net/net.h net/net.cpp
|
||||||
|
settings/settings.h settings/settings.cpp
|
||||||
|
|
||||||
|
${TRANSLATION_SOURCES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
if (BUILD_OFD_LOCAL_QR_SCAN)
|
||||||
|
list(APPEND PROJECT_SOURCES image_redactor/imageredactor.h image_redactor/imageredactor.cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (BUILD_OFD_BINARYEYE_SCAN OR BUILD_OFD_LOCAL_QR_SCAN)
|
||||||
|
list(APPEND PROJECT_SOURCES exceptions/ofdrequestexception.h exceptions/ofdrequestexception.cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (BUILD_OFD_BINARYEYE_SCAN)
|
||||||
|
list(APPEND PROJECT_SOURCES http_server/http_server.h http_server/http_server.cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (BUILD_TRANSLATIONS)
|
if (BUILD_TRANSLATIONS)
|
||||||
|
|
||||||
|
set(TS_FILES
|
||||||
|
translations/en_US.ts
|
||||||
|
translations/ru_RU.ts
|
||||||
|
)
|
||||||
|
|
||||||
qt5_create_translation(QM_FILES "${TRANSLATION_SOURCES}" ${TS_FILES})
|
qt5_create_translation(QM_FILES "${TRANSLATION_SOURCES}" ${TS_FILES})
|
||||||
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/translations.qrc ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc COPYONLY)
|
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/translations.qrc ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc COPYONLY)
|
||||||
qt5_add_resources(TRANSLATIONQRC ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc)
|
qt5_add_resources(TRANSLATIONQRC ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc)
|
||||||
|
@ -107,9 +158,11 @@ else()
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(checks-parser PRIVATE Qt5::Widgets Qt5::UiTools)
|
target_link_libraries(checks-parser PRIVATE Qt5::Widgets)
|
||||||
|
|
||||||
target_include_directories(checks-parser PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/image_redactor)
|
if (BUILD_OFD_LOCAL_QR_SCAN)
|
||||||
|
target_include_directories(checks-parser PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/image_redactor)
|
||||||
|
endif()
|
||||||
|
|
||||||
set(BUNDLE_ID_OPTION MACOSX_BUNDLE_GUI_IDENTIFIER org.foxarmy.checks-parser)
|
set(BUNDLE_ID_OPTION MACOSX_BUNDLE_GUI_IDENTIFIER org.foxarmy.checks-parser)
|
||||||
|
|
||||||
|
@ -133,29 +186,34 @@ if(WIN32)
|
||||||
set(OpenCV_DIR /usr/local/lib/cmake/opencv4)
|
set(OpenCV_DIR /usr/local/lib/cmake/opencv4)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
FetchContent_Declare(httplib SYSTEM
|
if (BUILD_OFD_BINARYEYE_SCAN)
|
||||||
GIT_REPOSITORY https://github.com/yhirose/cpp-httplib
|
find_package(PkgConfig)
|
||||||
GIT_TAG c765584e6b1055fe0dfe3e9e6d1b4b09aa305070
|
pkg_check_modules(QRENCODE REQUIRED libqrencode)
|
||||||
GIT_SHALLOW TRUE)
|
include_directories(${QRENCODE_INCLUDE_DIRS})
|
||||||
FetchContent_MakeAvailable(httplib)
|
link_directories(${QRENCODE_LIBRARY_DIRS})
|
||||||
|
target_link_libraries(checks-parser PRIVATE ${QRENCODE_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
if (BUILD_OFD_LOCAL_QR_SCAN)
|
||||||
|
target_link_libraries(checks-parser PRIVATE -lzbar)
|
||||||
|
endif()
|
||||||
|
|
||||||
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} )
|
|
||||||
target_include_directories(checks-parser PUBLIC ${OpenCV_INCLUDE_DIRS})
|
|
||||||
|
|
||||||
target_link_libraries(checks-parser PRIVATE -lzbar)
|
|
||||||
target_link_libraries(checks-parser PRIVATE -ltesseract)
|
|
||||||
target_link_libraries(checks-parser PRIVATE -lcurl)
|
target_link_libraries(checks-parser PRIVATE -lcurl)
|
||||||
target_link_libraries(checks-parser PRIVATE ${OpenCV_LIBS})
|
|
||||||
target_link_libraries(checks-parser PRIVATE httplib)
|
|
||||||
|
|
||||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8)
|
if (CMAKE_VERSION VERSION_LESS 3.30)
|
||||||
|
find_package(Boost 1.45.0 REQUIRED COMPONENTS regex)
|
||||||
|
else()
|
||||||
|
find_package(Boost 1.45.0 CONFIG REQUIRED COMPONENTS regex)
|
||||||
|
endif()
|
||||||
|
include_directories(${Boost_INCLUDE_DIRS})
|
||||||
|
target_link_libraries(checks-parser PUBLIC ${Boost_LIBRARIES})
|
||||||
|
|
||||||
|
if (BUILD_OFD_LOCAL_QR_SCAN OR BUILD_OFD_BINARYEYE_SCAN)
|
||||||
|
find_package(OpenCV REQUIRED COMPONENTS core imgproc imgcodecs)
|
||||||
|
target_link_libraries(checks-parser PRIVATE ${OpenCV_LIBS})
|
||||||
|
target_include_directories(checks-parser PUBLIC ${OpenCV_INCLUDE_DIRS})
|
||||||
|
include_directories( ${OpenCV_INCLUDE_DIRS} )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9)
|
||||||
target_link_libraries(checks-parser PRIVATE -lstdc++fs)
|
target_link_libraries(checks-parser PRIVATE -lstdc++fs)
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -23,6 +23,7 @@ To export, you need to specify an output file path and, if you wish, you can cha
|
||||||
# Installing
|
# Installing
|
||||||
## Building
|
## Building
|
||||||
In general, you need to install following dependencies in order to build that app(I suppose you have installed all the build necessaries such as cmake, make, gcc, git, etc...):
|
In general, you need to install following dependencies in order to build that app(I suppose you have installed all the build necessaries such as cmake, make, gcc, git, etc...):
|
||||||
|
* boost
|
||||||
* tesseract (you also have to install appropriate for your needs language data)
|
* tesseract (you also have to install appropriate for your needs language data)
|
||||||
* opencv
|
* opencv
|
||||||
* zbar
|
* zbar
|
||||||
|
@ -37,7 +38,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 qrencode
|
yay -S base-devel qt5-base opencv zbar nlohmann-json tesseract qrencode boost
|
||||||
#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
|
||||||
|
@ -53,9 +54,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 libqrencode-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 libboost-regex-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 libqrencode-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 libboost-regex-dev```
|
||||||
|
|
||||||
Next steps are identical for every debian-based distro
|
Next steps are identical for every debian-based distro
|
||||||
```
|
```
|
||||||
|
|
|
@ -23,12 +23,14 @@
|
||||||
# Установка
|
# Установка
|
||||||
## Сборка из исходников
|
## Сборка из исходников
|
||||||
В целом, вам нужно установить следующие зависимости, чтобы собрать приложение (я предполагаю, что вы уже имеете на системе базовые пакеты вроде cmake, make, gcc, git и так далее):
|
В целом, вам нужно установить следующие зависимости, чтобы собрать приложение (я предполагаю, что вы уже имеете на системе базовые пакеты вроде cmake, make, gcc, git и так далее):
|
||||||
|
* boost
|
||||||
* tesseract (также вам нужно будет установить языковой пакет для него, например tesseract-data-rus на Arch Linux или tesseract-ocr-rus на Debian Linux.)
|
* tesseract (также вам нужно будет установить языковой пакет для него, например tesseract-data-rus на Arch Linux или tesseract-ocr-rus на Debian Linux.)
|
||||||
* opencv
|
* opencv
|
||||||
* zbar
|
* zbar
|
||||||
* curl
|
* curl
|
||||||
* nlohmann-json
|
* nlohmann-json
|
||||||
* qt5
|
* qt5
|
||||||
|
* qrencode
|
||||||
|
|
||||||
Пожалуйста, не стесняйтесь и открывайте issue, если вы не можете собрать приложение. Я помогу вам, и если вы собираете приложение на дистрибутиве, который здесь не перечислен, как только мы решим вашу проблему, я добавлю новый дистрибутив в этот список!
|
Пожалуйста, не стесняйтесь и открывайте issue, если вы не можете собрать приложение. Я помогу вам, и если вы собираете приложение на дистрибутиве, который здесь не перечислен, как только мы решим вашу проблему, я добавлю новый дистрибутив в этот список!
|
||||||
|
|
||||||
|
@ -37,7 +39,7 @@
|
||||||
Я рекомендую использовать помощник для АУРа (я использую yay) чтобы установить зависимости. Или, если вы мазохист, можете собрать все зависимости ручками ¯\\\_(ツ)\_/¯
|
Я рекомендую использовать помощник для АУРа (я использую yay) чтобы установить зависимости. Или, если вы мазохист, можете собрать все зависимости ручками ¯\\\_(ツ)\_/¯
|
||||||
```
|
```
|
||||||
#Установка зависимостей
|
#Установка зависимостей
|
||||||
yay -S base-devel qt5-base opencv zbar nlohmann-json tesseract qrencode
|
yay -S base-devel qt5-base opencv zbar nlohmann-json tesseract qrencode boost
|
||||||
#Установка языкового пакета для OCR. Замените ``LANG` на желаемый язык. Например, ``tesseract-data-rus`` для русского языка
|
#Установка языкового пакета для OCR. Замените ``LANG` на желаемый язык. Например, ``tesseract-data-rus`` для русского языка
|
||||||
yay -S tesseract-data-LANG
|
yay -S tesseract-data-LANG
|
||||||
#Загрузка исходгого кода и сборка приложения
|
#Загрузка исходгого кода и сборка приложения
|
||||||
|
@ -53,9 +55,9 @@ sudo make install
|
||||||
|
|
||||||
Установка зависимостей для различных debian дистрибутивов:
|
Установка зависимостей для различных debian дистрибутивов:
|
||||||
###### 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 libboost-regex-dev```
|
||||||
###### Ubuntu 20.04, LMDE (проверил только 6), Debian (проверил только 12)
|
###### Ubuntu 20.04, LMDE (проверил только 6), Debian (проверил только 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 libboost-regex-dev```
|
||||||
|
|
||||||
Следующие шаги идеинтичны для всех дистрибутивов, основанных на debian:
|
Следующие шаги идеинтичны для всех дистрибутивов, основанных на debian:
|
||||||
```
|
```
|
||||||
|
|
30
TODO
30
TODO
|
@ -1,30 +0,0 @@
|
||||||
Complete module "export": [done]
|
|
||||||
make UI; [done]
|
|
||||||
make export to .csv [done]
|
|
||||||
|
|
||||||
Complete module "image-to-text": [done]
|
|
||||||
make UI; [done]
|
|
||||||
make use of tesseract/opencv (https://learnopencv.com/deep-learning-based-text-recognition-ocr-using-tesseract-and-opencv/); [done]
|
|
||||||
|
|
||||||
Add features:
|
|
||||||
autodetect store type
|
|
||||||
auto download of stores modules [done]
|
|
||||||
auto download of ofd modules [done]
|
|
||||||
settings, a window for editing settings. [done]
|
|
||||||
add ability to control contrast and rotation of a check image before passing it to OCR [done]
|
|
||||||
add ability to scan a qr code and request data from ofd.ru [done]
|
|
||||||
add ability to change language from preferences
|
|
||||||
|
|
||||||
Refactor:
|
|
||||||
Get rid of CPR, use libcurl instead [done]
|
|
||||||
|
|
||||||
Build:
|
|
||||||
Write script for AppImage deployment [done]
|
|
||||||
Find out dependencies packet names on different distros [done for arch, ubuntu]
|
|
||||||
Ensure success of building on most popular distros [done for arch, ubuntu]
|
|
||||||
Try to compile it on Windows
|
|
||||||
|
|
||||||
Issues:
|
|
||||||
Captcha is not showing when running in appimage [solved]
|
|
||||||
Stores modules are not being downloaded
|
|
||||||
I need to pack tesseract data for ru, en [solved]
|
|
Before Width: | Height: | Size: 138 KiB After Width: | Height: | Size: 138 KiB |
Before Width: | Height: | Size: 649 KiB After Width: | Height: | Size: 649 KiB |
|
@ -0,0 +1,78 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||||
|
|
||||||
|
<svg
|
||||||
|
width="115.83108mm"
|
||||||
|
height="115.8316mm"
|
||||||
|
viewBox="0 0 115.83108 115.8316"
|
||||||
|
version="1.1"
|
||||||
|
id="svg1"
|
||||||
|
inkscape:version="1.4 (e7c3feb100, 2024-10-09)"
|
||||||
|
sodipodi:docname="settings.svg"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg">
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="namedview1"
|
||||||
|
pagecolor="#ffffff"
|
||||||
|
bordercolor="#000000"
|
||||||
|
borderopacity="0.25"
|
||||||
|
inkscape:showpageshadow="2"
|
||||||
|
inkscape:pageopacity="0.0"
|
||||||
|
inkscape:pagecheckerboard="0"
|
||||||
|
inkscape:deskcolor="#d1d1d1"
|
||||||
|
inkscape:document-units="mm"
|
||||||
|
showgrid="true"
|
||||||
|
inkscape:zoom="0.67565763"
|
||||||
|
inkscape:cx="-76.962055"
|
||||||
|
inkscape:cy="230.88617"
|
||||||
|
inkscape:window-width="1920"
|
||||||
|
inkscape:window-height="1029"
|
||||||
|
inkscape:window-x="0"
|
||||||
|
inkscape:window-y="27"
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:current-layer="layer1">
|
||||||
|
<inkscape:grid
|
||||||
|
id="grid4"
|
||||||
|
units="mm"
|
||||||
|
originx="-47.084513"
|
||||||
|
originy="-90.584188"
|
||||||
|
spacingx="0.99999998"
|
||||||
|
spacingy="1"
|
||||||
|
empcolor="#0099e5"
|
||||||
|
empopacity="0.30196078"
|
||||||
|
color="#0099e5"
|
||||||
|
opacity="0.14901961"
|
||||||
|
empspacing="5"
|
||||||
|
enabled="true"
|
||||||
|
visible="true" />
|
||||||
|
</sodipodi:namedview>
|
||||||
|
<defs
|
||||||
|
id="defs1" />
|
||||||
|
<g
|
||||||
|
inkscape:label="Layer 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1"
|
||||||
|
transform="translate(-47.084512,-90.584183)">
|
||||||
|
<rect
|
||||||
|
style="display:none;fill:#37f500;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-opacity:0.075573"
|
||||||
|
id="rect11"
|
||||||
|
width="169.95171"
|
||||||
|
height="169.95171"
|
||||||
|
x="20.362879"
|
||||||
|
y="61.871819"
|
||||||
|
ry="8.590621" />
|
||||||
|
<path
|
||||||
|
id="path10"
|
||||||
|
style="display:inline;fill:#000000;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-opacity:0.075573"
|
||||||
|
inkscape:label="gear"
|
||||||
|
d="m 75.96901,0.80545601 c -11.155773,5e-7 -3.381873,12.02630099 -10.5755,17.65980599 2.26264,2.865218 2.781879,6.635337 1.536071,9.912568 l 0.842199,0.8422 a 23.648779,23.648779 0 0 1 8.720476,-1.56428 23.648779,23.648779 0 0 1 21.188309,14.268711 23.648779,23.648779 0 0 1 0.433613,17.637966 l 8.483422,8.483422 c 0.001,-1.137526 0.23505,-2.370832 0.79807,-3.730066 4.67012,-11.27469 19.06665,-0.813378 19.06665,-13.017015 0,-12.203637 -14.39653,-1.742323 -19.06665,-13.017014 -4.67013,-11.27469 12.9067,-14.057796 4.27742,-22.68707 -8.62927,-8.6292737 -11.41192,8.948014 -22.686611,4.277884 C 77.711789,15.202439 88.172646,0.80545546 75.96901,0.80545601 Z M 106.5976,68.045849 c -0.009,8.298119 12.66446,11.368041 5.07549,18.957003 -7.59196,7.591964 -10.66109,-5.094535 -18.966554,-5.075493 l 16.355784,16.355783 c 2.70707,2.707048 7.06538,2.707048 9.77243,0 l 4.11408,-4.114084 c 2.70705,-2.707068 2.70705,-7.065327 0,-9.77243 z M 92.706536,81.927359 84.164419,73.385241 A 23.648779,23.648779 0 0 1 54.292034,60.751335 l -0.0678,-0.156519 A 23.648779,23.648779 0 0 1 53.850687,43.071964 l -0.808075,-0.808075 c -3.276856,1.245655 -7.046115,0.726779 -9.911204,-1.53516 -5.635193,7.18452 -17.655256,-0.582996 -17.655256,10.570039 1e-6,12.203638 14.396527,1.742324 19.066657,13.017015 4.67013,11.274689 -12.907157,14.057795 -4.277883,22.687069 8.629275,8.629275 11.412378,-8.948013 22.687069,-4.277883 11.27469,4.670129 0.813378,19.067111 13.017015,19.067111 12.203637,0 1.742778,-14.396981 13.017469,-19.067111 1.355311,-0.561389 2.58526,-0.795009 3.720057,-0.79761 z M 43.131408,40.728729 c 0.530828,-0.676772 1.009354,-1.476346 1.411401,-2.446975 1.382806,-3.338388 0.796238,-5.922366 -0.464097,-8.143995 -5.610754,-0.603322 -9.948354,-8.65044 -17.091514,-10.361651 -0.190642,2.831294 0.790952,5.725383 2.964307,7.898752 l 12.263539,12.263539 c 0.290197,0.290195 0.602358,0.542427 0.916364,0.79033 z m 0.947304,-10.59097 c 2.166221,0.232933 4.522048,-0.640922 7.302705,-3.421578 2.784135,-2.78414 3.656675,-5.142371 3.420669,-7.310895 -5.277946,-2.997957 -8.46522,-9.8825424 -14.53716,-3.810602 -6.074184,6.074185 0.81761,9.261629 3.813786,14.543075 z M 54.802086,19.405286 c 2.222924,1.262656 4.808593,1.851301 8.149909,0.467282 0.968102,-0.401001 1.765816,-0.878149 2.441515,-1.407306 -0.247687,-0.313651 -0.499528,-0.625564 -0.78942,-0.915455 L 52.340551,5.2862683 C 50.34246,3.2881697 47.734568,2.2888648 45.127026,2.2887468 v 4.55e-4 c -0.228937,-1.05e-5 -0.457614,0.017002 -0.686136,0.032305 1.710334,7.1397402 9.75097,11.4767772 10.361196,17.0837792 z M 53.850687,43.071964 84.164419,73.385241 A 23.648779,23.648779 0 0 0 85.382901,72.993034 23.648779,23.648779 0 0 0 98.114178,59.562427 L 67.77178,29.22003 a 23.648779,23.648779 0 0 0 -1.137947,0.350348 23.648779,23.648779 0 0 0 -12.783146,13.501586 z"
|
||||||
|
transform="matrix(1.1357528,0,0,1.1357528,18.717777,90.23726)" />
|
||||||
|
<path
|
||||||
|
id="path11"
|
||||||
|
style="display:none;fill:#f50000;fill-opacity:1;stroke:#000000;stroke-width:1.51285;stroke-opacity:0.075573"
|
||||||
|
d="m 63.089959,81.902523 c -0.311091,-1.7e-5 -0.621755,0.02326 -0.932283,0.04412 3.222959,13.454148 22.996087,19.583657 9.430752,33.149007 -13.565319,13.56532 -19.694039,-6.20771 -33.148136,-9.43075 -0.259055,3.84733 1.074576,7.78001 4.02786,10.73331 l 16.664641,16.66466 c 3.992393,3.99236 9.772658,5.03826 14.71346,3.16006 l 76.122907,76.12203 c 3.67851,3.67851 9.60071,3.67851 13.27922,0 l 5.59023,-5.59023 c 3.6785,-3.67853 3.6785,-9.60066 0,-13.27923 L 92.71658,117.35349 c 1.878195,-4.9408 0.832348,-10.72105 -3.16008,-14.71346 L 72.891859,85.975392 c -2.715126,-2.715126 -6.258615,-4.072783 -9.8019,-4.072937 z"
|
||||||
|
inkscape:label="wrench" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 5.7 KiB |
|
@ -1,34 +0,0 @@
|
||||||
FROM archlinux
|
|
||||||
|
|
||||||
#Update
|
|
||||||
RUN pacman --noconfirm -Sy
|
|
||||||
|
|
||||||
#Build dependencies
|
|
||||||
RUN pacman --noconfirm -S sudo cmake git coreutils base-devel qt5-base
|
|
||||||
|
|
||||||
RUN echo "MAKEFLAGS=\"-j${nproc}\"" >> /etc/makepkg.conf
|
|
||||||
|
|
||||||
RUN useradd -ms /bin/bash checks-parser
|
|
||||||
RUN usermod -a -G wheel checks-parser
|
|
||||||
|
|
||||||
RUN echo "checks-parser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers
|
|
||||||
USER checks-parser
|
|
||||||
WORKDIR /home/checks-parser
|
|
||||||
|
|
||||||
#Dependencies from sources
|
|
||||||
RUN git clone https://aur.archlinux.org/yay.git && \
|
|
||||||
cd yay && \
|
|
||||||
makepkg -si --noconfirm && \
|
|
||||||
cd .. && sudo rm -rf yay
|
|
||||||
|
|
||||||
RUN yay -S opencv zbar nlohmann-json tesseract tesseract-data-rus
|
|
||||||
|
|
||||||
#building
|
|
||||||
WORKDIR /home/checks-parser
|
|
||||||
RUN git clone https://git.foxarmy.org/leca/checks-parser && \
|
|
||||||
cd checks-parser && \
|
|
||||||
cmake . && \
|
|
||||||
make -j ${nproc} && \
|
|
||||||
sudo make install
|
|
||||||
|
|
||||||
ENTRYPOINT ["checks-parser"]
|
|
|
@ -1,34 +0,0 @@
|
||||||
FROM debian:bullseye
|
|
||||||
|
|
||||||
#Update
|
|
||||||
RUN apt update -y && apt upgrade -y
|
|
||||||
|
|
||||||
#Build dependencies
|
|
||||||
RUN apt install -y git build-essential cmake
|
|
||||||
|
|
||||||
#Dependencies from repos (qt5, openssl, tesseract and lang package)
|
|
||||||
RUN apt install -y qtbase5-dev openssl libmbedtls-dev tesseract-ocr tesseract-ocr-rus libopencv-dev
|
|
||||||
|
|
||||||
#Dependencies from sources
|
|
||||||
#cpr
|
|
||||||
WORKDIR /root
|
|
||||||
RUN git clone https://github.com/whoshuu/cpr.git && \
|
|
||||||
cd cpr && \
|
|
||||||
mkdir build && cd build && \
|
|
||||||
cmake .. && \
|
|
||||||
make -j ${nproc} && \
|
|
||||||
make install && \
|
|
||||||
cd /root && rm -rf cpr
|
|
||||||
|
|
||||||
|
|
||||||
#building
|
|
||||||
|
|
||||||
WORKDIR /root
|
|
||||||
RUN git clone https://git.foxarmy.org/leca/checks-parser && \
|
|
||||||
cd checks-parser && \
|
|
||||||
mkdir build && cd build &&\
|
|
||||||
cmake .. && \
|
|
||||||
make -j ${nproc} && \
|
|
||||||
make install && \
|
|
||||||
|
|
||||||
ENTRYPOINT ["checks-parser"]
|
|
|
@ -1,4 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
export TESSDATA_PREFIX=\$APPDIR/usr/share/tesseract-ocr/4.00/tessdata
|
export TESSDATA_PREFIX=$APPDIR/usr/share/tesseract-ocr/4.00/tessdata
|
||||||
|
export LD_LIBRARY_PATH=$APPDIR/usr/lib
|
||||||
|
|
||||||
\$APPDIR/usr/bin/checks-parser
|
$APPDIR/usr/bin/checks-parser
|
||||||
|
|
|
@ -1,71 +1,31 @@
|
||||||
FROM ubuntu:20.04
|
FROM checks_parser_base_ubuntu
|
||||||
|
|
||||||
# Installing dependencies
|
RUN DEBIAN_FRONTEND=noninteractive apt update
|
||||||
RUN apt update
|
RUN DEBIAN_FRONTEND=noninteractive apt install -y wget git cmake make gcc g++ fuse libboost-regex-dev
|
||||||
|
|
||||||
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
|
ARG pkgname=$name
|
||||||
RUN DEBIAN_FRONTEND=noninteractive apt install -y wget git cmake make gcc g++ fuse
|
ARG pkgver=$version
|
||||||
|
ARG revision
|
||||||
# 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 /
|
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
|
# Download linuxdeployqt
|
||||||
RUN wget https://github.com/probonopd/linuxdeployqt/releases/download/continuous/linuxdeployqt-continuous-x86_64.AppImage -O /usr/bin/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
|
chmod +x /usr/bin/linuxdeployqt
|
||||||
|
|
||||||
# Prepare AppDir and its files
|
# Prepare AppDir and its files
|
||||||
WORKDIR /appimage
|
WORKDIR /app
|
||||||
RUN mkdir -p AppDir
|
|
||||||
|
RUN mkdir -p AppDir/usr/bin
|
||||||
|
|
||||||
COPY deploy/appimage/checks-parser.desktop AppDir
|
COPY deploy/appimage/checks-parser.desktop AppDir
|
||||||
COPY icon.png AppDir/checks-parser.png
|
COPY assets/icons/icon.png AppDir/checks-parser.png
|
||||||
COPY deploy/appimage/AppRun AppDir
|
COPY deploy/appimage/AppRun AppDir
|
||||||
RUN chmod +x AppDir/AppRun
|
RUN chmod +x AppDir/AppRun
|
||||||
|
RUN cp build/checks-parser /app/AppDir/usr/bin
|
||||||
|
|
||||||
#Copy only necessities
|
RUN PATH=/usr/lib/qt5/bin/:$PATH linuxdeployqt --appimage-extract-and-run AppDir/usr/bin/checks-parser -no-copy-copyright-files -appimage
|
||||||
COPY assets ./assets
|
RUN mkdir -p /output
|
||||||
COPY check ./check
|
RUN echo "cp Checks_parser-x86_64.AppImage /output/Checks_parser-x86_64_${pkgver}-${revision}.AppImage" > /deploy.sh
|
||||||
COPY exceptions ./exceptions
|
RUN chmod +x /deploy.sh
|
||||||
COPY goods ./goods
|
ENTRYPOINT ["bash", "/deploy.sh"]
|
||||||
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
|
|
||||||
|
|
|
@ -1,31 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
rm -rf AppDir
|
|
||||||
|
|
||||||
mkdir -p AppDir
|
|
||||||
mkdir -p AppDir/usr/bin
|
|
||||||
mkdir -p AppDir/usr/lib
|
|
||||||
mkdir -p AppDir/usr/share/tesseract-ocr/4.00/tessdata
|
|
||||||
cp -r /usr/share/tesseract-ocr/4.00/tessdata/* AppDir/usr/share/tesseract-ocr/4.00/tessdata
|
|
||||||
cp ../../checks-parser AppDir/usr/bin
|
|
||||||
|
|
||||||
echo \
|
|
||||||
"[Desktop Entry]
|
|
||||||
Name=Checks parser
|
|
||||||
Exec=usr/bin/checks-parser
|
|
||||||
Icon=checks-parser
|
|
||||||
Type=Application
|
|
||||||
Categories=Utility;" \
|
|
||||||
> AppDir/checks-parser.desktop
|
|
||||||
|
|
||||||
echo \
|
|
||||||
"#!/bin/bash
|
|
||||||
export TESSDATA_PREFIX=\$APPDIR/usr/share/tesseract-ocr/4.00/tessdata
|
|
||||||
|
|
||||||
\$APPDIR/usr/bin/checks-parser" \
|
|
||||||
> AppDir/AppRun
|
|
||||||
|
|
||||||
cp ../../icon.png AppDir/checks-parser.png
|
|
||||||
|
|
||||||
chmod +x AppDir/AppRun
|
|
||||||
cp ../../checks-parser AppDir/usr/bin
|
|
||||||
linuxdeployqt AppDir/usr/bin/checks-parser -no-copy-copyright-files -appimage
|
|
|
@ -0,0 +1,28 @@
|
||||||
|
FROM archlinux:latest
|
||||||
|
|
||||||
|
ARG pkgname=$name
|
||||||
|
ARG pkgver=$version
|
||||||
|
ARG revision
|
||||||
|
|
||||||
|
RUN mkdir -p /output
|
||||||
|
|
||||||
|
RUN pacman --noconfirm -Syu base base-devel sudo
|
||||||
|
RUN echo "sudo cp ${pkgname}-bin-${pkgver}-$revision-x86_64.pkg.tar.zst /output" > /deploy.sh
|
||||||
|
RUN chmod +x /deploy.sh
|
||||||
|
|
||||||
|
RUN useradd -m builder
|
||||||
|
RUN usermod -a -G wheel builder
|
||||||
|
RUN chown -R builder:builder /output
|
||||||
|
RUN echo "%wheel ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers
|
||||||
|
USER builder
|
||||||
|
|
||||||
|
WORKDIR /home/builder/checks-parser
|
||||||
|
|
||||||
|
COPY deploy/archlinux/bin/PKGBUILD PKGBUILD
|
||||||
|
RUN sed -i "s|\$pkgname|${pkgname}-bin|g" PKGBUILD
|
||||||
|
RUN sed -i "s|\$pkgver|${pkgver}|g" PKGBUILD
|
||||||
|
RUN sed -i "s|\$pkgrel|$revision|g" PKGBUILD
|
||||||
|
|
||||||
|
RUN makepkg -s --noconfirm
|
||||||
|
#ENTRYPOINT ["bash"]
|
||||||
|
ENTRYPOINT ["bash", "/deploy.sh"]
|
|
@ -0,0 +1,40 @@
|
||||||
|
# Maintainer: Leca <leca@foxarmy.org>
|
||||||
|
pkgname=$pkgname
|
||||||
|
pkgver=$pkgver
|
||||||
|
pkgrel=$pkgrel
|
||||||
|
epoch=
|
||||||
|
pkgdesc="Utility for parsing checks(receipts) to csv"
|
||||||
|
arch=('x86_64')
|
||||||
|
url="https://git.foxarmy.org/leca/checks-parser"
|
||||||
|
license=('GPL-3.0-or-later')
|
||||||
|
groups=()
|
||||||
|
depends=('qt5-base' 'opencv' 'zbar' 'nlohmann-json' 'tesseract' 'qrencode' 'boost')
|
||||||
|
makedepends=('cmake' 'make' 'gcc' 'git' 'qt5-tools')
|
||||||
|
checkdepends=()
|
||||||
|
optdepends=('tesseract-data-rus: scan russian checks with OCR')
|
||||||
|
provides=()
|
||||||
|
conflicts=("checks-parser-git")
|
||||||
|
replaces=()
|
||||||
|
backup=()
|
||||||
|
options=()
|
||||||
|
install=
|
||||||
|
changelog=
|
||||||
|
_releasesurl=https://git.foxarmy.org/leca/checks-parser/releases/download/$pkgver
|
||||||
|
source=("checks-parser-bin::https+$releaseurl/checks-parser-git-${pkgver}_nightly-$pkgrel-x86_64.pkg.tar.zst")
|
||||||
|
noextract=()
|
||||||
|
sha256sums=('SKIP')
|
||||||
|
|
||||||
|
build() {
|
||||||
|
cd "$pkgname"
|
||||||
|
mkdir build && cd build
|
||||||
|
cmake -DBUILD_TRANSLATIONS=on ..
|
||||||
|
make -j ${nproc}
|
||||||
|
}
|
||||||
|
|
||||||
|
package() {
|
||||||
|
cd "$pkgname"
|
||||||
|
cd build
|
||||||
|
install -Dm644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
|
||||||
|
##install -Dm755
|
||||||
|
make DESTDIR="$pkgdir/" PREFIX="/usr" install
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
FROM archlinux:latest
|
||||||
|
|
||||||
|
ARG pkgname=$name
|
||||||
|
ARG pkgver=$version
|
||||||
|
ARG revision
|
||||||
|
|
||||||
|
RUN mkdir -p /output
|
||||||
|
|
||||||
|
RUN pacman --noconfirm -Syu base base-devel sudo
|
||||||
|
RUN echo "sudo cp ${pkgname}-git-${pkgver}_nightly-$revision-x86_64.pkg.tar.zst /output" > /deploy.sh
|
||||||
|
RUN chmod +x /deploy.sh
|
||||||
|
|
||||||
|
RUN useradd -m builder
|
||||||
|
RUN usermod -a -G wheel builder
|
||||||
|
RUN chown -R builder:builder /output
|
||||||
|
RUN echo "%wheel ALL=(ALL:ALL) NOPASSWD: ALL" > /etc/sudoers
|
||||||
|
USER builder
|
||||||
|
|
||||||
|
WORKDIR /home/builder/checks-parser
|
||||||
|
|
||||||
|
COPY deploy/archlinux/git/PKGBUILD PKGBUILD
|
||||||
|
RUN sed -i "s|\$pkgname|${pkgname}-git|g" PKGBUILD
|
||||||
|
RUN sed -i "s|\$pkgver|${pkgver}_nightly|g" PKGBUILD
|
||||||
|
RUN sed -i "s|\$pkgrel|$revision|g" PKGBUILD
|
||||||
|
|
||||||
|
RUN makepkg -s --noconfirm
|
||||||
|
#ENTRYPOINT ["bash"]
|
||||||
|
ENTRYPOINT ["bash", "/deploy.sh"]
|
|
@ -1,19 +1,19 @@
|
||||||
# Maintainer: Leca <leca@foxarmy.org>
|
# Maintainer: Leca <leca@foxarmy.org>
|
||||||
pkgname=checks-parser-git
|
pkgname=$pkgname
|
||||||
pkgver=alpha_0.0.2
|
pkgver=$pkgver
|
||||||
pkgrel=1
|
pkgrel=$pkgrel
|
||||||
epoch=
|
epoch=
|
||||||
pkgdesc="Utility for parsing checks(receipts) to csv"
|
pkgdesc="Utility for parsing checks(receipts) to csv"
|
||||||
arch=('x86_64')
|
arch=('x86_64')
|
||||||
url="https://git.foxarmy.org/leca/checks-parser"
|
url="https://git.foxarmy.org/leca/checks-parser"
|
||||||
license=('GPL-3.0-or-later')
|
license=('GPL-3.0-or-later')
|
||||||
groups=()
|
groups=()
|
||||||
depends=('qt5-base' 'opencv' 'zbar' 'nlohmann-json' 'tesseract')
|
depends=('qt5-base' 'opencv' 'zbar' 'nlohmann-json' 'tesseract' 'qrencode' 'boost')
|
||||||
makedepends=('cmake' 'make' 'gcc' 'git' 'qt5-tools')
|
makedepends=('cmake' 'make' 'gcc' 'git' 'qt5-tools')
|
||||||
checkdepends=()
|
checkdepends=()
|
||||||
optdepends=('tesseract-data-rus: scan russian checks with OCR')
|
optdepends=('tesseract-data-rus: scan russian checks with OCR')
|
||||||
provides=()
|
provides=()
|
||||||
conflicts=()
|
conflicts=("checks-parser-bin")
|
||||||
replaces=()
|
replaces=()
|
||||||
backup=()
|
backup=()
|
||||||
options=()
|
options=()
|
||||||
|
@ -25,7 +25,7 @@ sha256sums=('SKIP')
|
||||||
|
|
||||||
build() {
|
build() {
|
||||||
cd "$pkgname"
|
cd "$pkgname"
|
||||||
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr .
|
cmake -DBUILD_TRANSLATIONS=on .
|
||||||
make -j ${nproc}
|
make -j ${nproc}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
FROM ubuntu:18.04
|
||||||
|
|
||||||
|
# Installing dependencies
|
||||||
|
RUN apt update
|
||||||
|
|
||||||
|
RUN DEBIAN_FRONTEND=noninteractive apt install -y qtbase5-dev openssl libmbedtls-dev libopencv-dev libzbar-dev qttools5-dev nlohmann-json-dev libcurl4-openssl-dev libqrencode-dev
|
||||||
|
RUN DEBIAN_FRONTEND=noninteractive apt install -y wget git cmake make gcc g++ fuse libboost-regex-dev
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
#Copy only necessities
|
||||||
|
COPY assets ./assets
|
||||||
|
COPY check ./check
|
||||||
|
COPY exceptions ./exceptions
|
||||||
|
COPY goods ./goods
|
||||||
|
COPY image_redactor ./image_redactor
|
||||||
|
COPY output ./output
|
||||||
|
COPY settings ./settings
|
||||||
|
COPY scenes ./scenes
|
||||||
|
COPY net ./net
|
||||||
|
COPY translations ./translations
|
||||||
|
COPY http_server ./http_server
|
||||||
|
COPY utils ./utils
|
||||||
|
|
||||||
|
COPY ./*.h ./*cpp ./*.ui ./*.qrc CMakeLists.txt .
|
||||||
|
|
||||||
|
WORKDIR /app/build
|
||||||
|
|
||||||
|
RUN cmake -DBUILD_TRANSLATIONS=on .. && make -j 8
|
||||||
|
|
||||||
|
ENTRYPOINT ["bash"]
|
|
@ -0,0 +1,29 @@
|
||||||
|
FROM checks_parser_base_ubuntu
|
||||||
|
|
||||||
|
#for envsubst
|
||||||
|
RUN DEBIAN_FRONTEND=noninteractive apt install -y gettext
|
||||||
|
|
||||||
|
ARG pkgname=$name
|
||||||
|
ARG pkgver=$version
|
||||||
|
ARG revision
|
||||||
|
|
||||||
|
ARG pkg=${pkgname}_$pkgver-$revision
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
RUN mkdir -p $pkg/DEBIAN
|
||||||
|
RUN mkdir -p $pkg/usr/bin
|
||||||
|
RUN mkdir -p /output
|
||||||
|
COPY deploy/debian/control $pkg/DEBIAN/control
|
||||||
|
COPY deploy/debian/copy.sh .
|
||||||
|
|
||||||
|
RUN envsubst < $pkg/DEBIAN/control | tee $pkg/DEBIAN/control.output && mv $pkg/DEBIAN/control.output $pkg/DEBIAN/control
|
||||||
|
RUN envsubst < copy.sh | tee copy.sh.output && mv copy.sh.output copy.sh
|
||||||
|
|
||||||
|
RUN chmod +x copy.sh
|
||||||
|
|
||||||
|
RUN cp /app/build/checks-parser $pkg/usr/bin
|
||||||
|
|
||||||
|
RUN dpkg-deb --build $pkg
|
||||||
|
|
||||||
|
ENTRYPOINT ["./copy.sh"]
|
|
@ -0,0 +1,10 @@
|
||||||
|
Package: checks-parser
|
||||||
|
Version: 3.0-1
|
||||||
|
Section: utils
|
||||||
|
Priority: optional
|
||||||
|
Architecture: amd64
|
||||||
|
Homepage: https://git.foxarmy.org/checks-parser
|
||||||
|
Depends: libc, 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
|
||||||
|
Maintainer: Leca <leca@foxarmy.org>
|
||||||
|
Description: Utility for parsing checks(receipts) to csv
|
||||||
|
Utility for extraction of content of a check(receipt) using plaintext, OCR or request to FTS (Federal Taxation Service)
|
|
@ -0,0 +1,2 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
cp $pkg.deb /output
|
|
@ -1,30 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
pkgname="checks-parser"
|
|
||||||
pkgver="3.0"
|
|
||||||
revision="1"
|
|
||||||
|
|
||||||
pkg=${pkgname}_$pkgver-$revision
|
|
||||||
mkdir $pkg
|
|
||||||
|
|
||||||
mkdir -p $pkg/usr/bin
|
|
||||||
|
|
||||||
cp ../../checks-parser $pkg/usr/bin
|
|
||||||
|
|
||||||
mkdir $pkg/DEBIAN
|
|
||||||
|
|
||||||
echo \
|
|
||||||
"Package: $pkgname
|
|
||||||
Version: $pkgver-$revision
|
|
||||||
Section: utils
|
|
||||||
Priority: optional
|
|
||||||
Architecture: amd64
|
|
||||||
Homepage: https://git.foxarmy.org/checks-parser
|
|
||||||
Depends: libc, qtbase5-dev, openssl, libmbedtls-dev, tesseract-ocr, tesseract-ocr-rus, libopencv-dev, libzbar-dev, qttools5-dev, nlohmann-json3-dev, libcurl4-openssl-dev, libtesseract-dev
|
|
||||||
Maintainer: Leca <leca@foxarmy.org>
|
|
||||||
Description: Utility for parsing checks(receipts) to csv
|
|
||||||
Utility for extraction of content of a check(receipt) using plaintext, OCR or request to FTS (Federal Taxation Service)"\
|
|
||||||
> $pkg/DEBIAN/control
|
|
||||||
|
|
||||||
dpkg-deb --build $pkg
|
|
||||||
rm -rf $pkg
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
FROM checks_parser_base_ubuntu
|
||||||
|
|
||||||
|
RUN DEBIAN_FRONTEND=noninteractive apt install -y autoconf automake autopoint bash bison bzip2 flex g++ g++-multilib gettext git gperf intltool libc6-dev-i386 libgdk-pixbuf2.0-dev libltdl-dev libgl-dev libpcre3-dev libssl-dev libtool-bin libxml-parser-perl lzip make openssl p7zip-full patch perl python3 python3-distutils python3-mako python3-packaging python3-pkg-resources python3-setuptools python-is-python3 ruby sed sqlite3 unzip wget xz-utils
|
||||||
|
|
||||||
|
WORKDIR /
|
||||||
|
|
||||||
|
RUN git clone https://github.com/mxe/mxe.git
|
||||||
|
|
||||||
|
RUN cd mxe && make qt
|
|
@ -0,0 +1,46 @@
|
||||||
|
services:
|
||||||
|
base_ubuntu:
|
||||||
|
image: checks_parser_base_ubuntu:latest
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: deploy/base-docker/ubuntu/Dockerfile
|
||||||
|
appimage:
|
||||||
|
image: checks_parser_appimage:latest
|
||||||
|
env_file: .env
|
||||||
|
build:
|
||||||
|
dockerfile: deploy/appimage/Dockerfile
|
||||||
|
context: .
|
||||||
|
args:
|
||||||
|
- pkgname=$name
|
||||||
|
- pkgver=$version
|
||||||
|
- revision=$revision
|
||||||
|
volumes:
|
||||||
|
- ./binaries:/output
|
||||||
|
depends_on:
|
||||||
|
- base_ubuntu
|
||||||
|
debian:
|
||||||
|
image: checks_parser_debian:latest
|
||||||
|
env_file: .env
|
||||||
|
build:
|
||||||
|
dockerfile: deploy/debian/Dockerfile
|
||||||
|
context: .
|
||||||
|
args:
|
||||||
|
- pkgname=$name
|
||||||
|
- pkgver=$version
|
||||||
|
- revision=$revision
|
||||||
|
volumes:
|
||||||
|
- ./binaries:/output
|
||||||
|
depends_on:
|
||||||
|
- base_ubuntu
|
||||||
|
archlinux:
|
||||||
|
image: checks_parser_base_arch:latest
|
||||||
|
env_file: .env
|
||||||
|
build:
|
||||||
|
dockerfile: deploy/archlinux/git/Dockerfile
|
||||||
|
context: .
|
||||||
|
args:
|
||||||
|
- pkgname=$name
|
||||||
|
- pkgver=$version
|
||||||
|
- revision=$revision
|
||||||
|
volumes:
|
||||||
|
- ./binaries:/output
|
|
@ -1,45 +0,0 @@
|
||||||
#include "emailtextscene.h"
|
|
||||||
#include "ui_emailtextscene.h"
|
|
||||||
#include <QMessageBox>
|
|
||||||
#include <iostream>
|
|
||||||
#include <outputdialog.h>
|
|
||||||
#include <check/check.h>
|
|
||||||
|
|
||||||
EmailTextScene::EmailTextScene(QWidget *parent)
|
|
||||||
: QWidget(parent)
|
|
||||||
, ui(new Ui::EmailTextScene) {
|
|
||||||
ui->setupUi(this);
|
|
||||||
|
|
||||||
auto modules = parser.get_modules_names();
|
|
||||||
|
|
||||||
for (auto &module : modules) {
|
|
||||||
ui->store_combo_box->addItem(QString::fromStdString(module));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
EmailTextScene::~EmailTextScene() {
|
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EmailTextScene::on_parse_button_clicked() {
|
|
||||||
std::wstring checkContent = ui->check_content->toPlainText().toStdWString();
|
|
||||||
parser.set_module(parser.search_modules()[ui->store_combo_box->currentIndex()]);
|
|
||||||
|
|
||||||
std::vector<Goods> goods = parser.parse(checkContent);
|
|
||||||
if (goods.size() == 0) {
|
|
||||||
QMessageBox infoDialog;
|
|
||||||
infoDialog.setText(tr("An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer."));
|
|
||||||
infoDialog.setIcon(QMessageBox::Critical);
|
|
||||||
infoDialog.setWindowTitle(tr("Error in parsing"));
|
|
||||||
infoDialog.exec();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Check check;
|
|
||||||
check.add_goods(goods);
|
|
||||||
|
|
||||||
OutputDialog d(this, check);
|
|
||||||
d.show();
|
|
||||||
d.exec();
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
#ifndef EMAILTEXTSCENE_H
|
|
||||||
#define EMAILTEXTSCENE_H
|
|
||||||
|
|
||||||
#include "parser/parser.h"
|
|
||||||
#include <QWidget>
|
|
||||||
|
|
||||||
namespace Ui {
|
|
||||||
class EmailTextScene;
|
|
||||||
}
|
|
||||||
|
|
||||||
class EmailTextScene : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit EmailTextScene(QWidget *parent = nullptr);
|
|
||||||
~EmailTextScene();
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void on_parse_button_clicked();
|
|
||||||
|
|
||||||
private:
|
|
||||||
Ui::EmailTextScene *ui;
|
|
||||||
Parser parser;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // EMAILTEXTSCENE_H
|
|
|
@ -1,11 +1,9 @@
|
||||||
#include "goods.h"
|
#include "goods.h"
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
Goods::Goods(std::string name, double price_per_unit, double quantity) {
|
Goods::Goods(std::string name, double price_per_unit, std::string net_weight, double quantity) :
|
||||||
this->name = name;
|
name(name), price_per_unit(price_per_unit),
|
||||||
this->price_per_unit = price_per_unit;
|
net_weight(net_weight), quantity(quantity) {}
|
||||||
this->quantity = quantity;
|
|
||||||
}
|
|
||||||
|
|
||||||
double Goods::calculate_total_price() {
|
double Goods::calculate_total_price() {
|
||||||
return this->price_per_unit * this->quantity;
|
return this->price_per_unit * this->quantity;
|
||||||
|
@ -15,12 +13,16 @@ std::string Goods::get_name() { return this->name; }
|
||||||
|
|
||||||
double Goods::get_quantity() { return this->quantity; }
|
double Goods::get_quantity() { return this->quantity; }
|
||||||
|
|
||||||
|
std::string Goods::get_net_weight() { return this->net_weight; }
|
||||||
|
|
||||||
double Goods::get_price_per_unit() { return this->price_per_unit; }
|
double Goods::get_price_per_unit() { return this->price_per_unit; }
|
||||||
|
|
||||||
void Goods::set_name(std::string name) { this->name = name; }
|
void Goods::set_name(std::string name) { this->name = name; }
|
||||||
|
|
||||||
void Goods::set_quantity(double quantity) { this->quantity = quantity; }
|
void Goods::set_quantity(double quantity) { this->quantity = quantity; }
|
||||||
|
|
||||||
|
void Goods::set_net_weight(std::string net_weight) { this->net_weight = net_weight; }
|
||||||
|
|
||||||
void Goods::set_price_per_unit(double price_per_unit) {
|
void Goods::set_price_per_unit(double price_per_unit) {
|
||||||
this->price_per_unit = price_per_unit;
|
this->price_per_unit = price_per_unit;
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,17 +7,20 @@ class Goods
|
||||||
{
|
{
|
||||||
std::string name;
|
std::string name;
|
||||||
double quantity; // by weight or by the piece
|
double quantity; // by weight or by the piece
|
||||||
|
std::string net_weight; // will contain values like "5мл" or "10г"
|
||||||
double price_per_unit;
|
double price_per_unit;
|
||||||
public:
|
public:
|
||||||
Goods(std::string, double, double);
|
Goods(std::string name, double quantity, std::string net_weight, double price_per_unit);
|
||||||
double calculate_total_price();
|
double calculate_total_price();
|
||||||
|
|
||||||
std::string get_name();
|
std::string get_name();
|
||||||
double get_quantity();
|
double get_quantity();
|
||||||
|
std::string get_net_weight();
|
||||||
double get_price_per_unit();
|
double get_price_per_unit();
|
||||||
|
|
||||||
void set_name(std::string);
|
void set_name(std::string);
|
||||||
void set_quantity(double);
|
void set_quantity(double);
|
||||||
|
void set_net_weight(std::string);
|
||||||
void set_price_per_unit(double);
|
void set_price_per_unit(double);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,113 @@
|
||||||
|
#include "http_server.h"
|
||||||
|
|
||||||
|
#include <qobjectdefs.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <utils/utils.h>
|
||||||
|
#include <iostream>
|
||||||
|
#include <mainwindow.h>
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
|
void HttpServer::generateRandomPort() {
|
||||||
|
port = rand() % (65535 - 1024) + 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpServer::HttpServer(QWidget *caller) : caller(caller) {
|
||||||
|
started = false;
|
||||||
|
port = 8080;
|
||||||
|
}
|
||||||
|
|
||||||
|
HttpServer::~HttpServer() {
|
||||||
|
started = false;
|
||||||
|
shutdown(serverSocket, SHUT_RDWR);
|
||||||
|
close(serverSocket);
|
||||||
|
|
||||||
|
for (auto &thread : clientHandlersThreads) {
|
||||||
|
thread.join();
|
||||||
|
}
|
||||||
|
|
||||||
|
listenClientsThread.join();
|
||||||
|
}
|
||||||
|
|
||||||
|
int HttpServer::start() {
|
||||||
|
unsigned short number_of_retries = 0;
|
||||||
|
|
||||||
|
while (number_of_retries < 10) {
|
||||||
|
|
||||||
|
serverSocket = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
|
if (serverSocket < 0) {
|
||||||
|
std::cerr << QObject::tr("Could not obtain socket.").toStdString() << std::endl;
|
||||||
|
number_of_retries ++;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
serverAddress.sin_family = AF_INET;
|
||||||
|
serverAddress.sin_port = htons(port);
|
||||||
|
serverAddress.sin_addr.s_addr = INADDR_ANY;
|
||||||
|
|
||||||
|
if (bind(serverSocket, (sockaddr *)&serverAddress, sizeof(serverAddress)) < 0) {
|
||||||
|
std::cerr << QObject::tr("Port ").toStdString() << port << QObject::tr(" seems to be occupied. Trying to generate another one").toStdString() << std::endl;
|
||||||
|
number_of_retries ++;
|
||||||
|
generateRandomPort();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (listen(serverSocket, 1) < 0) {
|
||||||
|
std::cerr << QObject::tr("Could not listen port.").toStdString() << std::endl;
|
||||||
|
number_of_retries ++;
|
||||||
|
generateRandomPort();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
started = true;
|
||||||
|
std::cout << QObject::tr("Listening on port: ").toStdString() << port << std::endl;
|
||||||
|
listenClientsThread = std::thread(&HttpServer::acceptClients, this);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
void HttpServer::handleClient(int clientSocket) {
|
||||||
|
std::string localIp;
|
||||||
|
try {
|
||||||
|
localIp = get_local_ip_address();
|
||||||
|
} catch(std::exception e) {
|
||||||
|
std::cerr << e.what() << std::endl;
|
||||||
|
close(clientSocket);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
char buffer[256] = {0};
|
||||||
|
|
||||||
|
recv(clientSocket, buffer, 256, 0);
|
||||||
|
|
||||||
|
std::string response = "HTTP/1.1 301 Moved Permanently\r\n"
|
||||||
|
"Content-Length: 0\r\n"
|
||||||
|
"Keep-Alive: timeout=5, max=100\r\n"
|
||||||
|
"Location: binaryeye://scan/?ret=http://" + get_local_ip_address() + ":" + std::to_string(port) + "/?result={RESULT}\r\n"
|
||||||
|
"\r\n";
|
||||||
|
|
||||||
|
if (send(clientSocket, response.c_str(), response.length(), 0) < 0) {
|
||||||
|
std::cerr << response.c_str() << std::endl;
|
||||||
|
std::cerr << response.length() << std::endl;
|
||||||
|
std::cerr << QObject::tr("Could not send message").toStdString() << std::endl;
|
||||||
|
}
|
||||||
|
emit ((MainWindow *)caller)->httpNewMessage(QString::fromStdString(std::string(buffer)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void HttpServer::acceptClients() {
|
||||||
|
while (true) {
|
||||||
|
if (!started) return;
|
||||||
|
int clientSocket = accept(serverSocket, nullptr, nullptr);
|
||||||
|
if (!started) return;
|
||||||
|
|
||||||
|
clientHandlersThreads.push_back (
|
||||||
|
std::thread(&HttpServer::handleClient, this, clientSocket)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned short HttpServer::getPort() {
|
||||||
|
return port;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool HttpServer::isStarted() {
|
||||||
|
return started;
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
#ifndef CHECKS_PARSER_HTTP_SERVER
|
||||||
|
#define CHECKS_PARSER_HTTP_SERVER
|
||||||
|
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <QWidget>
|
||||||
|
#include <thread>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
|
||||||
|
class HttpServer {
|
||||||
|
private:
|
||||||
|
unsigned short port;
|
||||||
|
int serverSocket;
|
||||||
|
sockaddr_in serverAddress;
|
||||||
|
|
||||||
|
QWidget* caller;
|
||||||
|
|
||||||
|
std::thread listenClientsThread;
|
||||||
|
std::vector<std::thread> clientHandlersThreads;
|
||||||
|
|
||||||
|
bool started;
|
||||||
|
|
||||||
|
void generateRandomPort();
|
||||||
|
public:
|
||||||
|
HttpServer(QWidget *caller);
|
||||||
|
~HttpServer();
|
||||||
|
int start();
|
||||||
|
void stop();
|
||||||
|
void handleClient(int clientSocket);
|
||||||
|
void acceptClients();
|
||||||
|
|
||||||
|
unsigned short getPort();
|
||||||
|
|
||||||
|
bool isStarted();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //CHECKS_PARSER_HTTP_SERVER
|
|
@ -1,22 +0,0 @@
|
||||||
#include <opencv2/imgcodecs.hpp>
|
|
||||||
#include <string>
|
|
||||||
#include <tesseract/baseapi.h>
|
|
||||||
#include "checkimage.h"
|
|
||||||
|
|
||||||
CheckImage::CheckImage(std::string path) {
|
|
||||||
this->path = path;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string CheckImage::parse_text() {
|
|
||||||
std::string result;
|
|
||||||
|
|
||||||
tesseract::TessBaseAPI *ocr = new tesseract::TessBaseAPI();
|
|
||||||
ocr->Init(NULL, "rus", tesseract::OEM_LSTM_ONLY);
|
|
||||||
ocr->SetPageSegMode(tesseract::PSM_AUTO);
|
|
||||||
|
|
||||||
cv::Mat im = cv::imread(this->path, cv::IMREAD_COLOR);
|
|
||||||
ocr->SetImage(im.data, im.cols, im.rows, 3, im.step);
|
|
||||||
result = std::string(ocr->GetUTF8Text());
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
|
@ -1,15 +0,0 @@
|
||||||
#ifndef CHECKIMAGE_H
|
|
||||||
#define CHECKIMAGE_H
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
class CheckImage {
|
|
||||||
std::string path;
|
|
||||||
public:
|
|
||||||
CheckImage(std::string path);
|
|
||||||
|
|
||||||
std::string parse_text();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // CHECKIMAGE_H
|
|
|
@ -32,8 +32,7 @@ void ImageRedactor::wheelEvent(QWheelEvent *event) {
|
||||||
void ImageRedactor::mousePressEvent(QMouseEvent *event)
|
void ImageRedactor::mousePressEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
// Pan the image
|
// Pan the image
|
||||||
if (event->button() == Qt::LeftButton)
|
if (event->button() == Qt::LeftButton) {
|
||||||
{
|
|
||||||
setDragMode(QGraphicsView::ScrollHandDrag);
|
setDragMode(QGraphicsView::ScrollHandDrag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,8 +40,7 @@ void ImageRedactor::mousePressEvent(QMouseEvent *event)
|
||||||
void ImageRedactor::mouseReleaseEvent(QMouseEvent *event)
|
void ImageRedactor::mouseReleaseEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
// Reset the drag mode
|
// Reset the drag mode
|
||||||
if (event->button() == Qt::LeftButton)
|
if (event->button() == Qt::LeftButton) {
|
||||||
{
|
|
||||||
setDragMode(QGraphicsView::NoDrag);
|
setDragMode(QGraphicsView::NoDrag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
204
main.cpp
204
main.cpp
|
@ -1,9 +1,11 @@
|
||||||
#include "mainwindow.h"
|
#include <mainwindow.h>
|
||||||
#include "net/net.h"
|
#include <net/net.h>
|
||||||
#include "settings/settings.h"
|
#include <settings/settings.h>
|
||||||
#include "utils/utils.h"
|
#include <utils/utils.h>
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <curl/curl.h>
|
#ifdef BUILD_OFD_MODE
|
||||||
|
# include <curl/curl.h>
|
||||||
|
#endif
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#if __GNUC__ < 8 && __clang_major__ < 17
|
#if __GNUC__ < 8 && __clang_major__ < 17
|
||||||
# include <experimental/filesystem>
|
# include <experimental/filesystem>
|
||||||
|
@ -16,23 +18,21 @@
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include <QStackedLayout>
|
#include <QStackedLayout>
|
||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QTranslator>
|
#ifdef BUILD_TRANSLATIONS
|
||||||
#include <emailtextscene.h>
|
# include <QTranslator>
|
||||||
#include <ocrscene.h>
|
#endif
|
||||||
#include <ofdscene.h>
|
#include <settingsdialog.h>
|
||||||
#include <qpushbutton.h>
|
#ifdef BUILD_EMAIL_MODE
|
||||||
#include <parser/parser.h>
|
//placeholder
|
||||||
|
#endif
|
||||||
static QWidget *loadUI(QWidget *parent, std::string filename) {
|
#include <QPushButton>
|
||||||
QUiLoader loader;
|
|
||||||
|
|
||||||
QFile file(QString::fromStdString(filename));
|
|
||||||
file.open(QIODevice::ReadOnly);
|
|
||||||
|
|
||||||
return loader.load(&file, parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char *argv[]) {
|
int main(int argc, char *argv[]) {
|
||||||
|
curl_global_init(CURL_GLOBAL_ALL);
|
||||||
|
|
||||||
|
std::string program_data_path = get_path_relative_to_home(".local/share/checks_parser");
|
||||||
|
create_directories(program_data_path);
|
||||||
|
|
||||||
srand(time(0));
|
srand(time(0));
|
||||||
|
|
||||||
QApplication app(argc, argv);
|
QApplication app(argc, argv);
|
||||||
|
@ -42,10 +42,14 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
Settings s(settings_file_path);
|
Settings s(settings_file_path);
|
||||||
|
|
||||||
|
#ifdef BUILD_TRANSLATIONS
|
||||||
QTranslator translator;
|
QTranslator translator;
|
||||||
QString lang = "en_US";
|
QString lang = "en_US";
|
||||||
|
|
||||||
if (s.get_all_settings().contains("language")) {
|
bool languageSettingPresent = false;
|
||||||
|
languageSettingPresent = s.get_all_settings().find("language") != s.get_all_settings().end();
|
||||||
|
|
||||||
|
if (languageSettingPresent) {
|
||||||
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();
|
||||||
|
@ -53,155 +57,23 @@ int main(int argc, char *argv[]) {
|
||||||
lang = QString::fromStdString("en_US");
|
lang = QString::fromStdString("en_US");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::cout << "Using locale: " << lang.toStdString() << std::endl;
|
std::cout << QObject::tr("Using locale: ").toStdString() << lang.toStdString() << std::endl;
|
||||||
|
|
||||||
translator.load(":/translation/" + lang + ".qm");
|
translator.load(":/translation/" + lang + ".qm");
|
||||||
app.installTranslator(&translator);
|
app.installTranslator(&translator);
|
||||||
|
#endif
|
||||||
QUiLoader loader;
|
|
||||||
|
|
||||||
QWidget *window = new QWidget();
|
|
||||||
QStackedLayout *sceneLayout = new QStackedLayout;
|
|
||||||
|
|
||||||
// Main Window setup
|
|
||||||
QWidget *mainwindowscene = loadUI(window, ":/scenes/scenes/mainwindow.ui");
|
|
||||||
|
|
||||||
// Main Window buttons setup
|
|
||||||
QPushButton *text_from_email_button = ((MainWindow *)mainwindowscene)->findChild<QPushButton *>("text_from_email_button");
|
|
||||||
QPushButton *ocr_button = ((MainWindow *)mainwindowscene)->findChild<QPushButton *>("ocr_button");
|
|
||||||
QPushButton *ofd_button = ((MainWindow *)mainwindowscene)->findChild<QPushButton *>("ofd_button");
|
|
||||||
|
|
||||||
QObject::connect(text_from_email_button, &QPushButton::clicked, [&]() {
|
|
||||||
// Text from email scene
|
|
||||||
sceneLayout->setCurrentIndex(1);
|
|
||||||
sceneLayout->widget(1)->show();
|
|
||||||
});
|
|
||||||
|
|
||||||
QObject::connect(ocr_button, &QPushButton::clicked, [&]() {
|
|
||||||
// OCR scene
|
|
||||||
sceneLayout->setCurrentIndex(2);
|
|
||||||
sceneLayout->widget(2)->show();
|
|
||||||
});
|
|
||||||
|
|
||||||
QObject::connect(ofd_button, &QPushButton::clicked, [&]() {
|
|
||||||
// OFD scene
|
|
||||||
sceneLayout->setCurrentIndex(3);
|
|
||||||
sceneLayout->widget(3)->show();
|
|
||||||
});
|
|
||||||
|
|
||||||
EmailTextScene *emailTextScene = new EmailTextScene();
|
|
||||||
OCRScene *ocrscene = new OCRScene();
|
|
||||||
OFDScene *ofdscene = new OFDScene();
|
|
||||||
|
|
||||||
sceneLayout->addWidget(mainwindowscene);
|
|
||||||
sceneLayout->addWidget(emailTextScene);
|
|
||||||
sceneLayout->addWidget(ocrscene);
|
|
||||||
sceneLayout->addWidget(ofdscene);
|
|
||||||
|
|
||||||
//Setting all back buttons
|
|
||||||
for (uint32_t sceneIndex = 0; sceneIndex < sceneLayout->count(); sceneIndex ++) {
|
|
||||||
auto scene = sceneLayout->widget(sceneIndex);
|
|
||||||
|
|
||||||
QPushButton *back_button = scene->findChild<QPushButton *>("back_button");
|
|
||||||
if (back_button == nullptr) continue;
|
|
||||||
|
|
||||||
QObject::connect(back_button, &QPushButton::clicked, [&]() {
|
|
||||||
sceneLayout->setCurrentIndex(0);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
window->setLayout(sceneLayout);
|
|
||||||
window->show();
|
|
||||||
|
|
||||||
app.exec();
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
// QApplication app(argc, argv);
|
|
||||||
|
|
||||||
// QWidget *window = new QWidget;
|
|
||||||
// QStackedLayout *stackedLayout = new QStackedLayout;
|
|
||||||
|
|
||||||
// QWidget *scene1 = new QWidget;
|
|
||||||
// QWidget *scene2 = new QWidget;
|
|
||||||
|
|
||||||
// // Add some widgets to each scene
|
|
||||||
// QPushButton *button1 = new QPushButton("Switch to Scene 2");
|
|
||||||
// scene1->setLayout(new QVBoxLayout);
|
|
||||||
// scene1->layout()->addWidget(button1);
|
|
||||||
|
|
||||||
// QPushButton *button2 = new QPushButton("Switch to Scene 1");
|
|
||||||
// scene2->setLayout(new QVBoxLayout);
|
|
||||||
// scene2->layout()->addWidget(button2);
|
|
||||||
|
|
||||||
// // Add the scenes to the stacked layout
|
|
||||||
// stackedLayout->addWidget(scene1);
|
|
||||||
// stackedLayout->addWidget(scene2);
|
|
||||||
|
|
||||||
// // Set the layout of the window
|
|
||||||
// window->setLayout(stackedLayout);
|
|
||||||
|
|
||||||
// // Connect the buttons to switch scenes
|
|
||||||
// QObject::connect(button1, &QPushButton::clicked, [&]() {
|
|
||||||
// stackedLayout->setCurrentIndex(1);
|
|
||||||
// });
|
|
||||||
|
|
||||||
// QObject::connect(button2, &QPushButton::clicked, [&]() {
|
|
||||||
// stackedLayout->setCurrentIndex(0);
|
|
||||||
// });
|
|
||||||
|
|
||||||
// window->show();
|
|
||||||
// app.exec();
|
|
||||||
|
|
||||||
// return 0;
|
|
||||||
curl_global_init(CURL_GLOBAL_ALL);
|
|
||||||
|
|
||||||
std::string program_data_path = get_path_relative_to_home(".local/share/checks_parser");
|
|
||||||
create_directories(program_data_path);
|
|
||||||
|
|
||||||
// std::string settings_file_path =
|
|
||||||
// get_path_relative_to_home(".local/share/checks_parser/settings.json");
|
|
||||||
|
|
||||||
// Settings s(settings_file_path);
|
|
||||||
Net n;
|
|
||||||
|
|
||||||
Parser p;
|
|
||||||
std::vector<std::string> stores_updates = p.check_updates();
|
|
||||||
for (const std::string &update : stores_updates) {
|
|
||||||
std::cout << "Downloading "
|
|
||||||
<< s.get_setting("stores_modules_url") + update << " to "
|
|
||||||
<< get_path_relative_to_home(s.get_setting("stores_modules_dir") +
|
|
||||||
"/" + update)
|
|
||||||
<< std::endl;
|
|
||||||
|
|
||||||
n.get_file(s.get_setting("stores_modules_url") + "/" + update,
|
|
||||||
get_path_relative_to_home(s.get_setting("stores_modules_dir") +
|
|
||||||
"/" + update));
|
|
||||||
}
|
|
||||||
|
|
||||||
QApplication a(argc, argv);
|
|
||||||
|
|
||||||
// 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");
|
|
||||||
|
|
||||||
// a.installTranslator(&translator);
|
|
||||||
MainWindow w;
|
MainWindow w;
|
||||||
w.update();
|
|
||||||
w.show();
|
w.show();
|
||||||
|
|
||||||
return a.exec();
|
// TODO: move to the window
|
||||||
|
//Settings button setup
|
||||||
|
// QPushButton *settingsButton = w.findChild<QPushButton *>("settings_button");
|
||||||
|
// QObject::connect(settingsButton, &QPushButton::clicked, [&]() {
|
||||||
|
// SettingsDialog d;
|
||||||
|
// d.show();
|
||||||
|
// d.exec();
|
||||||
|
// });
|
||||||
|
|
||||||
|
return app.exec();
|
||||||
}
|
}
|
||||||
|
|
229
mainwindow.cpp
229
mainwindow.cpp
|
@ -1,15 +1,238 @@
|
||||||
#include "mainwindow.h"
|
#include <mainwindow.h>
|
||||||
#include "ui_mainwindow.h"
|
#include "ui_mainwindow.h"
|
||||||
#include <iostream>
|
|
||||||
|
#include <QFileDialog>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QPixmap>
|
||||||
|
#include <settingsdialog.h>
|
||||||
|
|
||||||
|
#ifdef BUILD_OFD_LOCAL_QR_SCAN
|
||||||
|
# include <adjustpicturedialog.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <outputdialog.h>
|
||||||
|
#include <solvecaptchadialog.h>
|
||||||
|
#include <net/net.h>
|
||||||
|
#include <utils/utils.h>
|
||||||
|
#include <exceptions/ofdrequestexception.h>
|
||||||
|
|
||||||
|
#ifdef BUILD_OFD_BINARYEYE_SCAN
|
||||||
|
# include <qrencode.h>
|
||||||
|
# include <stdlib.h>
|
||||||
|
# include <unistd.h>
|
||||||
|
# include <sys/types.h>
|
||||||
|
# include <sys/socket.h>
|
||||||
|
# include <netinet/in.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
, ui(new Ui::MainWindow) {
|
, ui(new Ui::MainWindow) {
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
ui->stop_server_button->hide();
|
||||||
|
|
||||||
std::cout << "test" << std::endl;
|
#ifdef BUILD_OFD_BINARYEYE_SCAN
|
||||||
|
QObject::connect(this, &MainWindow::httpErrorOccured, this, &MainWindow::notifyHttpServerFailure);
|
||||||
|
connect(this, SIGNAL(httpNewMessage(QString)), this, SLOT(httpNewMessageHandler(QString)));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef BUILD_EMAIL_MODE
|
||||||
|
ui->parse_email_button->hide();
|
||||||
|
ui->or_label_2->hide();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef BUILD_OFD_BINARYEYE_SCAN
|
||||||
|
ui->or_label_2->hide();
|
||||||
|
ui->binary_eye_button->hide();
|
||||||
|
#endif
|
||||||
|
#ifndef BUILD_OFD_LOCAL_QR_SCAN
|
||||||
|
ui->or_label_1->hide();
|
||||||
|
ui->choose_image_button->hide();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
QObject::connect(ui->settings_button, &QPushButton::clicked, [&]() {
|
||||||
|
SettingsDialog d;
|
||||||
|
d.show();
|
||||||
|
d.exec();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef BUILD_OFD_BINARYEYE_SCAN
|
||||||
|
void MainWindow::startHttpServer() {
|
||||||
|
server = new HttpServer(this);
|
||||||
|
|
||||||
|
if (server->start() < 0) {
|
||||||
|
emit httpErrorOccured();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_binary_eye_button_clicked() {
|
||||||
|
httpServerThread = new std::thread(&MainWindow::startHttpServer, this);
|
||||||
|
ui->binary_eye_button->setEnabled(false);
|
||||||
|
ui->stop_server_button->show();
|
||||||
|
|
||||||
|
while (!server->isStarted()) {}
|
||||||
|
|
||||||
|
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(server->getPort()) + "/?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 MainWindow::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();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_stop_server_button_clicked() {
|
||||||
|
delete server;
|
||||||
|
ui->stop_server_button->hide();
|
||||||
|
ui->binary_eye_button->setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::httpNewMessageHandler(QString message) {
|
||||||
|
std::string parametersString = split(message.toStdString(), " ")[1];
|
||||||
|
|
||||||
|
//erase /?result= from the string
|
||||||
|
parametersString.erase(0, parametersString.find("=") + 1);
|
||||||
|
|
||||||
|
std::vector<std::string> parameters = split(parametersString, "&");
|
||||||
|
|
||||||
|
std::map<std::string, std::string> paramsMap;
|
||||||
|
|
||||||
|
for (auto ¶meter : parameters) {
|
||||||
|
std::vector<std::string> values = split(parameter, "=");
|
||||||
|
paramsMap.insert(std::pair<std::string, std::string> (values[0], values[1]));
|
||||||
|
}
|
||||||
|
|
||||||
|
emit onDataDecode(paramsMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#endif //ifdef BUILD_OFD_BINARYEYE_SCAN
|
||||||
|
|
||||||
|
#ifdef BUILD_OFD_LOCAL_QR_SCAN
|
||||||
|
void MainWindow::on_choose_image_button_clicked() {
|
||||||
|
QString filename = QFileDialog::getOpenFileName();
|
||||||
|
|
||||||
|
if (filename == "") {
|
||||||
|
QMessageBox infoDialog;
|
||||||
|
infoDialog.setText(tr("Please, select a picture where QR code that contains info about check is present"));
|
||||||
|
infoDialog.setIcon(QMessageBox::Critical);
|
||||||
|
infoDialog.setWindowTitle(tr("Picture was not selected"));
|
||||||
|
infoDialog.exec();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->info_label->setText(tr("Selected image: ") + filename);
|
||||||
|
|
||||||
|
AdjustPictureDialog dialog = AdjustPictureDialog(this, filename.toStdString());
|
||||||
|
connect(&dialog, &AdjustPictureDialog::decodedData, this, &MainWindow::onDataDecode);
|
||||||
|
dialog.exec();
|
||||||
|
}
|
||||||
|
#endif //ifdef BUILD_OFD_LOCAL_QR_SCAN
|
||||||
|
|
||||||
|
void MainWindow::onDataDecode(std::map<std::string, std::string> 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"]));
|
||||||
|
|
||||||
|
QString extractedDateTime = QString::fromStdString(data["t"]);
|
||||||
|
//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");
|
||||||
|
if (datetime == QDateTime::fromString(extractedDateTime, "20000101T1200")) {
|
||||||
|
datetime = QDateTime::fromString(extractedDateTime, "yyyyMMddThhmmss");
|
||||||
|
}
|
||||||
|
ui->purchase_datetime_edit->setDateTime(datetime);
|
||||||
|
|
||||||
|
int type = std::stoi(data["n"]);
|
||||||
|
ui->operation_type_combo_box->setCurrentIndex(type - 1);
|
||||||
|
|
||||||
|
std::string total = data["s"];
|
||||||
|
|
||||||
|
ui->total_spin_box->setValue(std::stod(total));
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::on_parse_button_clicked() {
|
||||||
|
Net net;
|
||||||
|
net.get_captcha_from_ofdru();
|
||||||
|
|
||||||
|
std::string solved_captcha = "";
|
||||||
|
bool success = true;
|
||||||
|
bool is_captcha_solved = true;
|
||||||
|
Check check;
|
||||||
|
|
||||||
|
do {
|
||||||
|
SolveCaptchaDialog dialog = SolveCaptchaDialog(this, &solved_captcha);
|
||||||
|
dialog.exec();
|
||||||
|
is_captcha_solved = true;
|
||||||
|
|
||||||
|
try {
|
||||||
|
std::string check_content = net.fetch_check_data_from_ofdru(
|
||||||
|
ui->fn_line_edit->text().toStdString(),
|
||||||
|
ui->fd_line_edit->text().toStdString(),
|
||||||
|
ui->fi_line_edit->text().toStdString(),
|
||||||
|
ui->purchase_datetime_edit->dateTime().toString(Qt::ISODate).toStdString(),
|
||||||
|
ui->operation_type_combo_box->currentIndex() + 1,
|
||||||
|
// In the request to ofd.ru, total is in a format with 2 last digits represent decimal part of a number.
|
||||||
|
ui->total_spin_box->text().toDouble() * 100,
|
||||||
|
solved_captcha);
|
||||||
|
|
||||||
|
check = parseOfdRuAnswer(check_content);
|
||||||
|
} catch(OfdRequestException e) {
|
||||||
|
success = false;
|
||||||
|
if (!strcmp(e.what(), "Incorrect captcha")) {
|
||||||
|
is_captcha_solved = false;
|
||||||
|
QMessageBox infoDialog;
|
||||||
|
infoDialog.setText(tr("Captcha was not solved correctly!"));
|
||||||
|
infoDialog.setIcon(QMessageBox::Critical);
|
||||||
|
infoDialog.setWindowTitle(tr("Captcha is incorrect"));
|
||||||
|
infoDialog.exec();
|
||||||
|
break;
|
||||||
|
} else if (!strcmp(e.what(), "Internal server error")) {
|
||||||
|
QMessageBox infoDialog;
|
||||||
|
infoDialog.setText(tr("Internal server error. Please, try again later."));
|
||||||
|
infoDialog.setIcon(QMessageBox::Critical);
|
||||||
|
infoDialog.setWindowTitle(tr("Internal server error"));
|
||||||
|
infoDialog.exec();
|
||||||
|
return;
|
||||||
|
} else if (!strcmp(e.what(), "Does not exist")) {
|
||||||
|
QMessageBox infoDialog;
|
||||||
|
infoDialog.setText(tr("Check not found. Please, ensure correctness of entered data."));
|
||||||
|
infoDialog.setIcon(QMessageBox::Critical);
|
||||||
|
infoDialog.setWindowTitle(tr("Check was not found"));
|
||||||
|
infoDialog.exec();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} while (!is_captcha_solved);
|
||||||
|
|
||||||
|
if (success) {
|
||||||
|
OutputDialog *d = new OutputDialog(this, check);
|
||||||
|
d->exec();
|
||||||
|
|
||||||
|
delete d;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
MainWindow::~MainWindow() {
|
MainWindow::~MainWindow() {
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,219 +0,0 @@
|
||||||
#include "mainwindow.h"
|
|
||||||
#include "./ui_mainwindow.h"
|
|
||||||
#include "check/check.h"
|
|
||||||
#include "exceptions/ofdrequestexception.h"
|
|
||||||
#include "goods/goods.h"
|
|
||||||
#include "outputdialog.h"
|
|
||||||
#include "adjustpicturedialog.h"
|
|
||||||
#include "settingsdialog.h"
|
|
||||||
#include "solvecaptchadialog.h"
|
|
||||||
#include <QFileDialog>
|
|
||||||
#include <QMessageBox>
|
|
||||||
#include "image/checkimage.h"
|
|
||||||
#include "utils/utils.h"
|
|
||||||
#include <opencv2/objdetect.hpp>
|
|
||||||
#include <opencv2/imgcodecs.hpp>
|
|
||||||
#include <opencv2/highgui/highgui.hpp>
|
|
||||||
#include <opencv2/imgproc/imgproc.hpp>
|
|
||||||
#include <zbar.h>
|
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
|
||||||
: QMainWindow(parent), ui(new Ui::MainWindow) {
|
|
||||||
ui->setupUi(this);
|
|
||||||
// this->setupStoresList();
|
|
||||||
}
|
|
||||||
|
|
||||||
MainWindow::~MainWindow() { delete ui; }
|
|
||||||
|
|
||||||
// void MainWindow::setupStoresList() {
|
|
||||||
// parser = *(new Parser());
|
|
||||||
|
|
||||||
// std::vector<std::string> modules_names = parser.search_modules();
|
|
||||||
|
|
||||||
// for (std::string name : modules_names) {
|
|
||||||
// StoreModule m(name);
|
|
||||||
// std::wstring module_name = m.get_name();
|
|
||||||
|
|
||||||
// QString s = QString::fromStdWString(module_name);
|
|
||||||
// ui->storeType->addItem(s);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// std::string MainWindow::makeRequestToOfd(std::string captcha) {
|
|
||||||
// std::string checkContent = Net().fetch_check_data_from_ofdru(
|
|
||||||
// ui->fn_edit->text().toStdString(),
|
|
||||||
// ui->fd_edit->text().toStdString(),
|
|
||||||
// ui->fi_edit->text().toStdString(),
|
|
||||||
// ui->dateTimeEdit->dateTime().toString(Qt::ISODate).toStdString(),
|
|
||||||
// ui->fundIncomeCombo->currentIndex() + 1,
|
|
||||||
// // In the request to ofd.ru, total is in a strange format, like a string of a format where 2 last digits represent decimal part of a number.
|
|
||||||
// ui->total_edit->text().toDouble() * 100,
|
|
||||||
// captcha);
|
|
||||||
|
|
||||||
// return checkContent;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// void MainWindow::on_parseButton_clicked() {
|
|
||||||
// QString s;
|
|
||||||
// switch (ui->tabWidget->currentIndex()) {
|
|
||||||
// case 0:
|
|
||||||
// s = ui->checkContent->toPlainText();
|
|
||||||
// break;
|
|
||||||
// case 1:
|
|
||||||
// s = ui->checkContentFromImage->toPlainText();
|
|
||||||
// break;
|
|
||||||
// case 2:
|
|
||||||
// Net().get_captcha_from_ofdru();
|
|
||||||
|
|
||||||
// std::string solved_captcha = "";
|
|
||||||
// bool success = true;
|
|
||||||
// bool is_captcha_solved = true;
|
|
||||||
|
|
||||||
// do {
|
|
||||||
// SolveCaptchaDialog dialog = SolveCaptchaDialog(this, &solved_captcha);
|
|
||||||
// dialog.exec();
|
|
||||||
// is_captcha_solved = true;
|
|
||||||
|
|
||||||
// try {
|
|
||||||
// std::string check_content = makeRequestToOfd(solved_captcha);
|
|
||||||
// check = parseOfdRuAnswer(check_content);
|
|
||||||
// } catch(OfdRequestException e) {
|
|
||||||
// success = false;
|
|
||||||
// if (!strcmp(e.what(), "Incorrect captcha")) {
|
|
||||||
// is_captcha_solved = false;
|
|
||||||
// QMessageBox infoDialog;
|
|
||||||
// infoDialog.setText(tr("Captcha was not solved correctly!"));
|
|
||||||
// infoDialog.setIcon(QMessageBox::Critical);
|
|
||||||
// infoDialog.setWindowTitle(tr("Captcha is incorrect"));
|
|
||||||
// infoDialog.exec();
|
|
||||||
// break;
|
|
||||||
// } else if (!strcmp(e.what(), "Internal server error")) {
|
|
||||||
// QMessageBox infoDialog;
|
|
||||||
// infoDialog.setText(tr("Internal server error. Please, try again later."));
|
|
||||||
// infoDialog.setIcon(QMessageBox::Critical);
|
|
||||||
// infoDialog.setWindowTitle(tr("Internal server error"));
|
|
||||||
// infoDialog.exec();
|
|
||||||
// return;
|
|
||||||
// } else if (!strcmp(e.what(), "Does not exist")) {
|
|
||||||
// QMessageBox infoDialog;
|
|
||||||
// infoDialog.setText(tr("Check not found. Please, ensure correctness of entered data."));
|
|
||||||
// infoDialog.setIcon(QMessageBox::Critical);
|
|
||||||
// infoDialog.setWindowTitle(tr("Check was not found"));
|
|
||||||
// infoDialog.exec();
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// } while (!is_captcha_solved);
|
|
||||||
|
|
||||||
// if (success) {
|
|
||||||
// OutputDialog d = OutputDialog(this, check);
|
|
||||||
// d.exec();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// std::wstring check_plaintext = s.toStdWString();
|
|
||||||
// parser.set_module(parser.search_modules()[0]);
|
|
||||||
|
|
||||||
// std::vector<Goods> c = parser.parse(check_plaintext);
|
|
||||||
|
|
||||||
// if (c.size() == 0) {
|
|
||||||
// QMessageBox infoDialog;
|
|
||||||
// infoDialog.setText(tr("An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer."));
|
|
||||||
// infoDialog.setIcon(QMessageBox::Critical);
|
|
||||||
// infoDialog.setWindowTitle(tr("Error in parsing"));
|
|
||||||
// infoDialog.exec();
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// for (auto& g : c) {
|
|
||||||
// check.add_goods(g);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// OutputDialog d = OutputDialog(this, check);
|
|
||||||
// d.show();
|
|
||||||
// d.exec();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// void MainWindow::on_storeType_currentIndexChanged(int index) {
|
|
||||||
// std::string module = parser.search_modules()[index];
|
|
||||||
// parser.set_module(module);
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// void MainWindow::on_preferencesButton_clicked() {
|
|
||||||
// SettingsDialog s = SettingsDialog();
|
|
||||||
// s.show();
|
|
||||||
// s.exec();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// void MainWindow::on_chooseImageButton_ofd_clicked() {
|
|
||||||
// QString filename = QFileDialog::getOpenFileName();
|
|
||||||
|
|
||||||
// if (filename == "") {
|
|
||||||
// QMessageBox infoDialog;
|
|
||||||
// infoDialog.setText(tr("Please, select a picture where QR code that contains info about check is present"));
|
|
||||||
// infoDialog.setIcon(QMessageBox::Critical);
|
|
||||||
// infoDialog.setWindowTitle(tr("Picture was not selected"));
|
|
||||||
// infoDialog.exec();
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// std::string new_text = "Selected: " + filename.toStdString();
|
|
||||||
// ui->pathLabel_ofd->setText(QString::fromStdString(new_text));
|
|
||||||
|
|
||||||
// AdjustPictureDialog dialog = AdjustPictureDialog(this, filename.toStdString());
|
|
||||||
// connect(&dialog, &AdjustPictureDialog::decodedData, this, &MainWindow::onDecodedData);
|
|
||||||
// dialog.exec();
|
|
||||||
|
|
||||||
// ui->picture_ofd->setPixmap(QPixmap(filename));
|
|
||||||
// ui->picture_ofd->setScaledContents(true);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// void MainWindow::onDecodedData(std::string data) {
|
|
||||||
// std::string delimiter = "&";
|
|
||||||
// std::vector<std::string> dataSplit = split(data, delimiter);
|
|
||||||
|
|
||||||
// std::cout << data << std::endl;
|
|
||||||
|
|
||||||
// ui->fn_edit->setText(QString::fromStdString(dataSplit[2]));
|
|
||||||
// ui->fd_edit->setText(QString::fromStdString(dataSplit[3]));
|
|
||||||
// ui->fi_edit->setText(QString::fromStdString(dataSplit[4]));
|
|
||||||
|
|
||||||
// QString extractedDateTime = QString::fromStdString(split(dataSplit[0], "=")[1]);
|
|
||||||
// QDateTime datetime = QDateTime::fromString(extractedDateTime, "yyyyMMddThhmm");
|
|
||||||
// ui->dateTimeEdit->setDateTime(datetime);
|
|
||||||
|
|
||||||
// int type = std::stoi(split(dataSplit[5], "=")[1]);
|
|
||||||
// ui->fundIncomeCombo->setCurrentIndex(type - 1);
|
|
||||||
|
|
||||||
// std::string total = split(dataSplit[1], "=")[1];
|
|
||||||
|
|
||||||
// ui->total_edit->setText(QString::fromStdString(total));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// void MainWindow::on_chooseImageButton_ocr_clicked()
|
|
||||||
// {
|
|
||||||
// QString filename = QFileDialog::getOpenFileName();
|
|
||||||
|
|
||||||
// if (filename == "") {
|
|
||||||
// QMessageBox infoDialog;
|
|
||||||
// infoDialog.setText(tr("Please, select a picture to scan"));
|
|
||||||
// infoDialog.setIcon(QMessageBox::Critical);
|
|
||||||
// infoDialog.setWindowTitle(tr("Picture was not selected"));
|
|
||||||
// infoDialog.exec();
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// std::string new_text = "Selected: " + filename.toStdString();
|
|
||||||
// ui->pathLabel_ocr->setText(QString::fromStdString(new_text));
|
|
||||||
|
|
||||||
// CheckImage i(filename.toStdString());
|
|
||||||
// std::string parsed = i.parse_text();
|
|
||||||
|
|
||||||
// ui->picture_ocr->setPixmap(QPixmap(filename));
|
|
||||||
// ui->picture_ocr->setScaledContents(true);
|
|
||||||
// ui->checkContentFromImage->setPlainText(QString::fromStdString(parsed));
|
|
||||||
// }
|
|
||||||
|
|
38
mainwindow.h
38
mainwindow.h
|
@ -2,8 +2,10 @@
|
||||||
#define MAINWINDOW_H
|
#define MAINWINDOW_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <qevent.h>
|
#include <QEvent>
|
||||||
#include <QtUiTools/quiloader.h>
|
#include <thread>
|
||||||
|
|
||||||
|
#include <http_server/http_server.h>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
|
@ -16,10 +18,36 @@ class MainWindow : public QWidget
|
||||||
public:
|
public:
|
||||||
explicit MainWindow(QWidget *parent = nullptr);
|
explicit MainWindow(QWidget *parent = nullptr);
|
||||||
~MainWindow();
|
~MainWindow();
|
||||||
Ui::MainWindow *ui;
|
#ifdef BUILD_OFD_BINARYEYE_SCAN
|
||||||
private slots:
|
void startHttpServer();
|
||||||
private:
|
#endif
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void httpNewMessage(QString message);
|
||||||
|
void httpErrorOccured();
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
#ifdef BUILD_OFD_LOCAL_QR_SCAN
|
||||||
|
void on_choose_image_button_clicked();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void onDataDecode(std::map<std::string, std::string>);
|
||||||
|
void on_parse_button_clicked();
|
||||||
|
|
||||||
|
#ifdef BUILD_OFD_BINARYEYE_SCAN
|
||||||
|
|
||||||
|
void on_binary_eye_button_clicked();
|
||||||
|
void notifyHttpServerFailure();
|
||||||
|
void on_stop_server_button_clicked();
|
||||||
|
|
||||||
|
void httpNewMessageHandler(QString message);
|
||||||
|
#endif
|
||||||
|
private:
|
||||||
|
Ui::MainWindow *ui;
|
||||||
|
#ifdef BUILD_OFD_BINARYEYE_SCAN
|
||||||
|
std::thread *httpServerThread;
|
||||||
|
HttpServer *server = NULL;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // MAINWINDOW_H
|
#endif // MAINWINDOW_H
|
||||||
|
|
|
@ -1,44 +0,0 @@
|
||||||
#ifndef MAINWINDOW_H
|
|
||||||
#define MAINWINDOW_H
|
|
||||||
|
|
||||||
#include <QMainWindow>
|
|
||||||
|
|
||||||
#include "check/check.h"
|
|
||||||
#include "parser/parser.h"
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
namespace Ui {
|
|
||||||
class MainWindow;
|
|
||||||
}
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
class MainWindow : public QMainWindow {
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
Check check;
|
|
||||||
Parser parser;
|
|
||||||
|
|
||||||
public:
|
|
||||||
MainWindow(QWidget *parent = nullptr);
|
|
||||||
~MainWindow();
|
|
||||||
// void setupStoresList();
|
|
||||||
|
|
||||||
// Check get_check();
|
|
||||||
// void onDecodedData(std::string);
|
|
||||||
|
|
||||||
// std::string makeRequestToOfd(std::string captcha);
|
|
||||||
private slots:
|
|
||||||
// void on_parseButton_clicked();
|
|
||||||
|
|
||||||
// void on_storeType_currentIndexChanged(int index);
|
|
||||||
|
|
||||||
// void on_preferencesButton_clicked();
|
|
||||||
|
|
||||||
// void on_chooseImageButton_ofd_clicked();
|
|
||||||
|
|
||||||
// void on_chooseImageButton_ocr_clicked();
|
|
||||||
|
|
||||||
private:
|
|
||||||
Ui::MainWindow *ui;
|
|
||||||
};
|
|
||||||
#endif // MAINWINDOW_H
|
|
|
@ -3,5 +3,8 @@
|
||||||
<file>assets/icons/email-text.svg</file>
|
<file>assets/icons/email-text.svg</file>
|
||||||
<file>assets/icons/OCR.svg</file>
|
<file>assets/icons/OCR.svg</file>
|
||||||
<file>assets/icons/OFD.svg</file>
|
<file>assets/icons/OFD.svg</file>
|
||||||
|
<file>assets/icons/icon.png</file>
|
||||||
|
<file>assets/icons/icon.svg</file>
|
||||||
|
<file>assets/icons/settings.svg</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
{
|
|
||||||
"name":"Магнит",
|
|
||||||
"goods_name_regex": "([\\(\\)\\%\\*a-zA-Z0-9\u0401\u0451\u0410-\u044f \\.\\-\/]{17,100})",
|
|
||||||
"goods_price_regex": "[0-9]{0,4}[^%]\\.[0-9]{2} ",
|
|
||||||
"goods_quantity_regex": "([0-9]{0,4}[^%]\\.[0-9]{3} )|(\t\\d )",
|
|
||||||
"check_start_regex": "",
|
|
||||||
"check_end_regex":""
|
|
||||||
}
|
|
|
@ -1,8 +0,0 @@
|
||||||
{
|
|
||||||
"name":"Пятёрочка",
|
|
||||||
"goods_name_regex": "([\\(\\)\\%\\*a-zA-Z0-9\u0401\u0451\u0410-\u044f \\.\\-\/]{17,100})",
|
|
||||||
"goods_price_regex": "[0-9]{0,4}[^%]\\.[0-9]{2} ",
|
|
||||||
"goods_quantity_regex": "([0-9]{0,4}[^%]\\.[0-9]{3} )|(\t\\d )",
|
|
||||||
"check_start_regex": "КАССОВЫЙ ЧЕК\nприход",
|
|
||||||
"check_end_regex": "Итог\\:.{0,3}[0-9]{0,6}\\.[0-9]{2}"
|
|
||||||
}
|
|
52
net/net.cpp
52
net/net.cpp
|
@ -1,11 +1,15 @@
|
||||||
#include "net.h"
|
#include <net/net.h>
|
||||||
#include <curl/curl.h>
|
#include <curl/curl.h>
|
||||||
#include "../utils/utils.h"
|
#include <utils/utils.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <vector>
|
|
||||||
#include <regex>
|
|
||||||
|
|
||||||
struct data {};
|
Net::Net() {}
|
||||||
|
|
||||||
|
size_t writeCallback(void* contents, size_t size, size_t nmemb, void* userp) {
|
||||||
|
size_t totalSize = size * nmemb;
|
||||||
|
((std::string*)userp)->append(std::string((char*)contents));
|
||||||
|
return totalSize;
|
||||||
|
}
|
||||||
|
|
||||||
size_t write_data(void *buffer, size_t size, size_t nmemb, void *filename) {
|
size_t write_data(void *buffer, size_t size, size_t nmemb, void *filename) {
|
||||||
FILE *f = fopen(((std::string *)filename)->c_str(), "w");
|
FILE *f = fopen(((std::string *)filename)->c_str(), "w");
|
||||||
|
@ -16,44 +20,6 @@ size_t write_data(void *buffer, size_t size, size_t nmemb, void *filename) {
|
||||||
return written;
|
return written;
|
||||||
}
|
}
|
||||||
|
|
||||||
Net::Net() {}
|
|
||||||
|
|
||||||
void write_modules(void *buffer, size_t size, size_t nmemb, void *modules) {
|
|
||||||
std::vector<std::string> *modules_vector =
|
|
||||||
(std::vector<std::string> *)modules;
|
|
||||||
std::string to_parse = std::string((char*)buffer);
|
|
||||||
|
|
||||||
std::regex r("(?!\\\")\\w+\\.json(?!\\\")", std::regex::collate);
|
|
||||||
std::smatch res;
|
|
||||||
|
|
||||||
std::string::const_iterator search(to_parse.cbegin());
|
|
||||||
while (std::regex_search(search, to_parse.cend(), res, r)) {
|
|
||||||
modules_vector->push_back(res[0]);
|
|
||||||
search = res.suffix().first;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t writeCallback(void* contents, size_t size, size_t nmemb, void* userp) {
|
|
||||||
size_t totalSize = size * nmemb;
|
|
||||||
((std::string*)userp)->append(std::string((char*)contents));
|
|
||||||
return totalSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string> Net::get_all_modules(std::string url) {
|
|
||||||
CURL *handle = curl_easy_init();
|
|
||||||
|
|
||||||
curl_easy_setopt(handle, CURLOPT_URL, url.c_str());
|
|
||||||
curl_easy_setopt(handle, CURLOPT_WRITEFUNCTION, write_modules);
|
|
||||||
|
|
||||||
std::vector<std::string> modules {};
|
|
||||||
|
|
||||||
curl_easy_setopt(handle, CURLOPT_WRITEDATA, &modules);
|
|
||||||
|
|
||||||
curl_easy_perform(handle);
|
|
||||||
|
|
||||||
return modules;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Net::get_file(std::string url, std::string filename) {
|
void Net::get_file(std::string url, std::string filename) {
|
||||||
CURL *handle = curl_easy_init();
|
CURL *handle = curl_easy_init();
|
||||||
|
|
||||||
|
|
|
@ -5,12 +5,12 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
size_t write_data(void *buffer, size_t size, size_t nmemb, void *userp);
|
size_t write_data(void *buffer, size_t size, size_t nmemb, void *userp);
|
||||||
|
size_t writeCallback(void* contents, size_t size, size_t nmemb, void* userp);
|
||||||
|
|
||||||
class Net
|
class Net
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Net();
|
Net();
|
||||||
std::vector<std::string> get_all_modules(std::string url);
|
|
||||||
void get_file(std::string url, std::string filename);
|
void get_file(std::string url, std::string filename);
|
||||||
std::string fetch_check_data_from_ofdru(std::string fn, std::string fd, std::string fi, std::string datetime, int operation, int total, std::string captcha);
|
std::string fetch_check_data_from_ofdru(std::string fn, std::string fd, std::string fi, std::string datetime, int operation, int total, std::string captcha);
|
||||||
void get_captcha_from_ofdru();
|
void get_captcha_from_ofdru();
|
||||||
|
|
73
ocrscene.cpp
73
ocrscene.cpp
|
@ -1,73 +0,0 @@
|
||||||
#include "ocrscene.h"
|
|
||||||
#include "ui_ocrscene.h"
|
|
||||||
|
|
||||||
#include <QFileDialog>
|
|
||||||
#include <QMessageBox>
|
|
||||||
#include <outputdialog.h>
|
|
||||||
|
|
||||||
#include <image/checkimage.h>
|
|
||||||
|
|
||||||
#include <check/check.h>
|
|
||||||
|
|
||||||
OCRScene::OCRScene(QWidget *parent)
|
|
||||||
: QWidget(parent)
|
|
||||||
, ui(new Ui::OCRScene) {
|
|
||||||
ui->setupUi(this);
|
|
||||||
|
|
||||||
auto modules = parser.get_modules_names();
|
|
||||||
|
|
||||||
for (auto &module : modules) {
|
|
||||||
ui->store_combo_box->addItem(QString::fromStdString(module));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
OCRScene::~OCRScene() {
|
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OCRScene::on_parse_button_clicked() {
|
|
||||||
std::wstring checkContent = ui->check_text_edit->toPlainText().toStdWString();
|
|
||||||
|
|
||||||
parser.set_module(parser.search_modules()[ui->store_combo_box->currentIndex()]);
|
|
||||||
|
|
||||||
std::vector<Goods> goods = parser.parse(checkContent);
|
|
||||||
if (goods.size() == 0) {
|
|
||||||
QMessageBox infoDialog;
|
|
||||||
infoDialog.setText(tr("An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer."));
|
|
||||||
infoDialog.setIcon(QMessageBox::Critical);
|
|
||||||
infoDialog.setWindowTitle(tr("Error in parsing"));
|
|
||||||
infoDialog.exec();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
Check check;
|
|
||||||
check.add_goods(goods);
|
|
||||||
|
|
||||||
OutputDialog d(this, check);
|
|
||||||
d.show();
|
|
||||||
d.exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OCRScene::on_choose_image_button_clicked() {
|
|
||||||
QString filename = QFileDialog::getOpenFileName();
|
|
||||||
|
|
||||||
if (filename == "") {
|
|
||||||
QMessageBox infoDialog;
|
|
||||||
infoDialog.setText(tr("Please, select a picture to scan"));
|
|
||||||
infoDialog.setIcon(QMessageBox::Critical);
|
|
||||||
infoDialog.setWindowTitle(tr("Picture was not selected"));
|
|
||||||
infoDialog.exec();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string new_text = "Selected: " + filename.toStdString();
|
|
||||||
ui->path_to_image_label->setText(tr("Path to image: ")+ filename);
|
|
||||||
|
|
||||||
CheckImage i(filename.toStdString());
|
|
||||||
std::string parsed = i.parse_text();
|
|
||||||
|
|
||||||
ui->check_text_edit->setPlainText(QString::fromStdString(parsed));
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
29
ocrscene.h
29
ocrscene.h
|
@ -1,29 +0,0 @@
|
||||||
#ifndef OCRSCENE_H
|
|
||||||
#define OCRSCENE_H
|
|
||||||
|
|
||||||
#include "parser/parser.h"
|
|
||||||
#include <QWidget>
|
|
||||||
|
|
||||||
namespace Ui {
|
|
||||||
class OCRScene;
|
|
||||||
}
|
|
||||||
|
|
||||||
class OCRScene : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit OCRScene(QWidget *parent = nullptr);
|
|
||||||
~OCRScene();
|
|
||||||
|
|
||||||
private slots:
|
|
||||||
void on_parse_button_clicked();
|
|
||||||
|
|
||||||
void on_choose_image_button_clicked();
|
|
||||||
|
|
||||||
private:
|
|
||||||
Ui::OCRScene *ui;
|
|
||||||
Parser parser;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // OCRSCENE_H
|
|
216
ofdscene.cpp
216
ofdscene.cpp
|
@ -1,216 +0,0 @@
|
||||||
#include "ofdscene.h"
|
|
||||||
#include "ui_ofdscene.h"
|
|
||||||
#include "utils/utils.h"
|
|
||||||
|
|
||||||
#include <QFileDialog>
|
|
||||||
#include <QMessageBox>
|
|
||||||
#include <adjustpicturedialog.h>
|
|
||||||
#include <httplib.h>
|
|
||||||
#include <outputdialog.h>
|
|
||||||
#include <qpixmap.h>
|
|
||||||
#include <solvecaptchadialog.h>
|
|
||||||
|
|
||||||
#include <net/net.h>
|
|
||||||
#include <exceptions/ofdrequestexception.h>
|
|
||||||
#include <bits/basic_string.h>
|
|
||||||
#include <qrencode.h>
|
|
||||||
|
|
||||||
#include <bits/basic_string.h>
|
|
||||||
|
|
||||||
OFDScene::OFDScene(QWidget *parent)
|
|
||||||
: QWidget(parent)
|
|
||||||
, ui(new Ui::OFDScene) {
|
|
||||||
ui->setupUi(this);
|
|
||||||
|
|
||||||
QObject::connect(this, &OFDScene::httpErrorOccured, this, &OFDScene::notifyHttpServerFailure);
|
|
||||||
}
|
|
||||||
|
|
||||||
OFDScene::~OFDScene() {
|
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
void OFDScene::startHttpServer() {
|
|
||||||
std::string localIp = "";
|
|
||||||
|
|
||||||
try {
|
|
||||||
localIp = get_local_ip_address();
|
|
||||||
} catch(std::exception e) {
|
|
||||||
std::cerr << e.what() << std::endl;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned short number_of_retries = 0;
|
|
||||||
|
|
||||||
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() {
|
|
||||||
QString filename = QFileDialog::getOpenFileName();
|
|
||||||
|
|
||||||
if (filename == "") {
|
|
||||||
QMessageBox infoDialog;
|
|
||||||
infoDialog.setText(tr("Please, select a picture where QR code that contains info about check is present"));
|
|
||||||
infoDialog.setIcon(QMessageBox::Critical);
|
|
||||||
infoDialog.setWindowTitle(tr("Picture was not selected"));
|
|
||||||
infoDialog.exec();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
ui->info_label->setText(tr("Selected image: ") + filename);
|
|
||||||
|
|
||||||
AdjustPictureDialog dialog = AdjustPictureDialog(this, filename.toStdString());
|
|
||||||
connect(&dialog, &AdjustPictureDialog::decodedData, this, &OFDScene::onDataDecode);
|
|
||||||
dialog.exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
void OFDScene::onDataDecode(std::map<std::string, std::string> 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"]));
|
|
||||||
|
|
||||||
QString extractedDateTime = QString::fromStdString(data["t"]);
|
|
||||||
//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");
|
|
||||||
if (datetime == QDateTime::fromString(extractedDateTime, "20000101T1200")) {
|
|
||||||
datetime = QDateTime::fromString(extractedDateTime, "yyyyMMddThhmmss");
|
|
||||||
}
|
|
||||||
ui->purchase_datetime_edit->setDateTime(datetime);
|
|
||||||
|
|
||||||
int type = std::stoi(data["n"]);
|
|
||||||
ui->operation_type_combo_box->setCurrentIndex(type - 1);
|
|
||||||
|
|
||||||
std::string total = data["s"];
|
|
||||||
|
|
||||||
ui->total_spin_box->setValue(std::stod(total));
|
|
||||||
}
|
|
||||||
|
|
||||||
void OFDScene::on_parse_button_clicked() {
|
|
||||||
Net net;
|
|
||||||
net.get_captcha_from_ofdru();
|
|
||||||
|
|
||||||
std::string solved_captcha = "";
|
|
||||||
bool success = true;
|
|
||||||
bool is_captcha_solved = true;
|
|
||||||
Check check;
|
|
||||||
|
|
||||||
do {
|
|
||||||
SolveCaptchaDialog dialog = SolveCaptchaDialog(this, &solved_captcha);
|
|
||||||
dialog.exec();
|
|
||||||
is_captcha_solved = true;
|
|
||||||
|
|
||||||
try {
|
|
||||||
std::string check_content = net.fetch_check_data_from_ofdru(
|
|
||||||
ui->fn_line_edit->text().toStdString(),
|
|
||||||
ui->fd_line_edit->text().toStdString(),
|
|
||||||
ui->fi_line_edit->text().toStdString(),
|
|
||||||
ui->purchase_datetime_edit->dateTime().toString(Qt::ISODate).toStdString(),
|
|
||||||
ui->operation_type_combo_box->currentIndex() + 1,
|
|
||||||
// In the request to ofd.ru, total is in a format with 2 last digits represent decimal part of a number.
|
|
||||||
ui->total_spin_box->text().toDouble() * 100,
|
|
||||||
solved_captcha);
|
|
||||||
|
|
||||||
check = parseOfdRuAnswer(check_content);
|
|
||||||
} catch(OfdRequestException e) {
|
|
||||||
success = false;
|
|
||||||
if (!strcmp(e.what(), "Incorrect captcha")) {
|
|
||||||
is_captcha_solved = false;
|
|
||||||
QMessageBox infoDialog;
|
|
||||||
infoDialog.setText(tr("Captcha was not solved correctly!"));
|
|
||||||
infoDialog.setIcon(QMessageBox::Critical);
|
|
||||||
infoDialog.setWindowTitle(tr("Captcha is incorrect"));
|
|
||||||
infoDialog.exec();
|
|
||||||
break;
|
|
||||||
} else if (!strcmp(e.what(), "Internal server error")) {
|
|
||||||
QMessageBox infoDialog;
|
|
||||||
infoDialog.setText(tr("Internal server error. Please, try again later."));
|
|
||||||
infoDialog.setIcon(QMessageBox::Critical);
|
|
||||||
infoDialog.setWindowTitle(tr("Internal server error"));
|
|
||||||
infoDialog.exec();
|
|
||||||
return;
|
|
||||||
} else if (!strcmp(e.what(), "Does not exist")) {
|
|
||||||
QMessageBox infoDialog;
|
|
||||||
infoDialog.setText(tr("Check not found. Please, ensure correctness of entered data."));
|
|
||||||
infoDialog.setIcon(QMessageBox::Critical);
|
|
||||||
infoDialog.setWindowTitle(tr("Check was not found"));
|
|
||||||
infoDialog.exec();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} while (!is_captcha_solved);
|
|
||||||
|
|
||||||
if (success) {
|
|
||||||
OutputDialog d = OutputDialog(this, check);
|
|
||||||
d.exec();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
43
ofdscene.h
43
ofdscene.h
|
@ -1,43 +0,0 @@
|
||||||
#ifndef OFDSCENE_H
|
|
||||||
#define OFDSCENE_H
|
|
||||||
|
|
||||||
#include <QWidget>
|
|
||||||
#include <httplib.h>
|
|
||||||
#include <thread>
|
|
||||||
|
|
||||||
namespace Ui {
|
|
||||||
class OFDScene;
|
|
||||||
}
|
|
||||||
|
|
||||||
class OFDScene : public QWidget
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit OFDScene(QWidget *parent = nullptr);
|
|
||||||
~OFDScene();
|
|
||||||
void startHttpServer();
|
|
||||||
|
|
||||||
unsigned int getPort();
|
|
||||||
private slots:
|
|
||||||
void on_choose_image_button_clicked();
|
|
||||||
void onDataDecode(std::map<std::string, std::string>);
|
|
||||||
|
|
||||||
void on_parse_button_clicked();
|
|
||||||
|
|
||||||
void on_binary_eye_button_clicked();
|
|
||||||
void notifyHttpServerFailure();
|
|
||||||
|
|
||||||
signals:
|
|
||||||
|
|
||||||
void httpErrorOccured();
|
|
||||||
|
|
||||||
private:
|
|
||||||
Ui::OFDScene *ui;
|
|
||||||
std::thread *http_thread;
|
|
||||||
|
|
||||||
unsigned int port;
|
|
||||||
httplib::Server server;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // OFDSCENE_H
|
|
|
@ -1,401 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>MainWindow</class>
|
|
||||||
<widget class="QMainWindow" name="MainWindow">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>817</width>
|
|
||||||
<height>659</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>MainWindow</string>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="centralwidget">
|
|
||||||
<widget class="QComboBox" name="storeType">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>90</x>
|
|
||||||
<y>10</y>
|
|
||||||
<width>211</width>
|
|
||||||
<height>31</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QLabel" name="storeTypeLabel">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>10</x>
|
|
||||||
<y>10</y>
|
|
||||||
<width>81</width>
|
|
||||||
<height>31</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Store type</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QPushButton" name="parseButton">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>30</x>
|
|
||||||
<y>560</y>
|
|
||||||
<width>80</width>
|
|
||||||
<height>26</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Parse</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QPushButton" name="preferencesButton">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>730</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>81</width>
|
|
||||||
<height>31</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Preferences</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>10</x>
|
|
||||||
<y>50</y>
|
|
||||||
<width>801</width>
|
|
||||||
<height>511</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="currentIndex">
|
|
||||||
<number>1</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>611</width>
|
|
||||||
<height>441</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="OCR">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>OCR</string>
|
|
||||||
</attribute>
|
|
||||||
<widget class="QPushButton" name="chooseImageButton_ocr">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>10</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>511</width>
|
|
||||||
<height>401</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QLabel" name="pathLabel_ocr">
|
|
||||||
<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 class="QLabel" name="picture_ocr">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>490</x>
|
|
||||||
<y>10</y>
|
|
||||||
<width>291</width>
|
|
||||||
<height>421</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="OFD">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>OFD</string>
|
|
||||||
</attribute>
|
|
||||||
<widget class="QLabel" name="picture_ofd">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>490</x>
|
|
||||||
<y>10</y>
|
|
||||||
<width>291</width>
|
|
||||||
<height>421</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QLabel" name="pathLabel_ofd">
|
|
||||||
<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="QPushButton" name="chooseImageButton_ofd">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>10</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>80</width>
|
|
||||||
<height>26</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Choose</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QLineEdit" name="fn_edit">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>180</x>
|
|
||||||
<y>50</y>
|
|
||||||
<width>261</width>
|
|
||||||
<height>26</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="inputMask">
|
|
||||||
<string>0000000000000000</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QLabel" name="fn_label">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>10</x>
|
|
||||||
<y>50</y>
|
|
||||||
<width>161</width>
|
|
||||||
<height>21</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>FN (Fiscal Number)</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QLabel" name="fd_label">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>10</x>
|
|
||||||
<y>90</y>
|
|
||||||
<width>161</width>
|
|
||||||
<height>21</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>FD (Fiscal Document)</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QLineEdit" name="fd_edit">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>180</x>
|
|
||||||
<y>90</y>
|
|
||||||
<width>261</width>
|
|
||||||
<height>26</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="inputMask">
|
|
||||||
<string>0000000000</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QLabel" name="fi_label">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>10</x>
|
|
||||||
<y>130</y>
|
|
||||||
<width>161</width>
|
|
||||||
<height>21</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>FI (Fiscal Identifier)</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QLineEdit" name="fi_edit">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>180</x>
|
|
||||||
<y>130</y>
|
|
||||||
<width>261</width>
|
|
||||||
<height>26</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="inputMask">
|
|
||||||
<string>0000000000</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QDateTimeEdit" name="dateTimeEdit">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>10</x>
|
|
||||||
<y>170</y>
|
|
||||||
<width>194</width>
|
|
||||||
<height>27</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QComboBox" name="fundIncomeCombo">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>10</x>
|
|
||||||
<y>210</y>
|
|
||||||
<width>191</width>
|
|
||||||
<height>26</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Funds income</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Funds return</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Funds spend</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Spends return</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
<widget class="QLineEdit" name="total_edit">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>90</x>
|
|
||||||
<y>250</y>
|
|
||||||
<width>113</width>
|
|
||||||
<height>26</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="inputMask">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QLabel" name="total_label">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>10</x>
|
|
||||||
<y>250</y>
|
|
||||||
<width>66</width>
|
|
||||||
<height>18</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Total</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
<widget class="QMenuBar" name="menubar">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>817</width>
|
|
||||||
<height>33</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<widget class="QMenu" name="menuchecks_parser">
|
|
||||||
<property name="title">
|
|
||||||
<string>checks parser</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<addaction name="menuchecks_parser"/>
|
|
||||||
</widget>
|
|
||||||
<widget class="QStatusBar" name="statusbar"/>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
|
@ -83,8 +83,7 @@ void OutputDialog::on_buttonBox_accepted() {
|
||||||
output_file << std::fixed << std::setprecision(2) << goods.get_quantity();
|
output_file << std::fixed << std::setprecision(2) << goods.get_quantity();
|
||||||
break;
|
break;
|
||||||
case ColumnType::goods_net_weight:
|
case ColumnType::goods_net_weight:
|
||||||
output_file << "TODO";
|
output_file << goods.get_net_weight();
|
||||||
// TODO
|
|
||||||
break;
|
break;
|
||||||
case ColumnType::goods_total:
|
case ColumnType::goods_total:
|
||||||
output_file << std::fixed << std::setprecision(2) << goods.calculate_total_price();
|
output_file << std::fixed << std::setprecision(2) << goods.calculate_total_price();
|
||||||
|
|
|
@ -1,93 +0,0 @@
|
||||||
#include "module.h"
|
|
||||||
#include <fstream>
|
|
||||||
#include <nlohmann/json.hpp>
|
|
||||||
#include <regex>
|
|
||||||
#include <string>
|
|
||||||
#include "../utils/utils.h"
|
|
||||||
|
|
||||||
StoreModule::StoreModule() {}
|
|
||||||
|
|
||||||
StoreModule::StoreModule(std::string path) {
|
|
||||||
std::ifstream settings_file(path);
|
|
||||||
nlohmann::json settings = nlohmann::json::parse(settings_file);
|
|
||||||
|
|
||||||
this->name = from_utf8(settings["name"]);
|
|
||||||
this->goods_name_regex = from_utf8(settings["goods_name_regex"]);
|
|
||||||
this->goods_price_regex = from_utf8(settings["goods_price_regex"]);
|
|
||||||
this->goods_quantity_regex = from_utf8(settings["goods_quantity_regex"]);
|
|
||||||
this->check_start_regex = from_utf8(settings["check_start_regex"]);
|
|
||||||
this->check_end_regex = from_utf8(settings["check_end_regex"]);
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
|
||||||
std::wcout << "Name: " << this->name << std::endl;
|
|
||||||
std::wcout << "Goods name regex: " << this->goods_name_regex << std::endl;
|
|
||||||
std::wcout << "Goods price regex: " << this->goods_price_regex << std::endl;
|
|
||||||
std::wcout << "Goods quantity regex: " << this->goods_quantity_regex
|
|
||||||
<< std::endl;
|
|
||||||
std::wcout << "Check start regex: " << this->check_start_regex << std::endl;
|
|
||||||
std::wcout << "Check end regex: " << this->check_end_regex << std::endl;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string> StoreModule::parse_name(std::wstring str) {
|
|
||||||
std::vector<std::string> result;
|
|
||||||
std::wregex r(this->goods_name_regex, std::regex_constants::multiline);
|
|
||||||
|
|
||||||
for (std::wsregex_iterator it{str.begin(), str.end(), r}, end{}; it != end;
|
|
||||||
it++) {
|
|
||||||
result.push_back(to_utf8(it->str()));
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string> StoreModule::parse_price(std::wstring str) {
|
|
||||||
std::vector<std::string> result;
|
|
||||||
std::wregex r(this->goods_price_regex, std::regex::collate);
|
|
||||||
|
|
||||||
for (std::wsregex_iterator it{str.begin(), str.end(), r}, end{}; it != end;
|
|
||||||
it++) {
|
|
||||||
result.push_back(to_utf8(it->str()));
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string> StoreModule::parse_quantity(std::wstring str) {
|
|
||||||
std::vector<std::string> result;
|
|
||||||
std::wregex r(this->goods_quantity_regex, std::regex::collate);
|
|
||||||
|
|
||||||
for (std::wsregex_iterator it{str.begin(), str.end(), r}, end{}; it != end;
|
|
||||||
it++) {
|
|
||||||
result.push_back(to_utf8(it->str()));
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::wstring StoreModule::trim_check(std::wstring& check) {
|
|
||||||
unsigned int start_pos;
|
|
||||||
unsigned int end_pos;
|
|
||||||
|
|
||||||
std::wregex start_regex(this->check_start_regex, std::regex::collate);
|
|
||||||
std::wregex end_regex(this->check_end_regex, std::regex::collate);
|
|
||||||
|
|
||||||
for (std::wsregex_iterator it{check.begin(), check.end(), start_regex}, end{};
|
|
||||||
it != end; it++) {
|
|
||||||
start_pos = it->position() + it->str().size();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
check = check.substr(start_pos, check.size());
|
|
||||||
|
|
||||||
for (std::wsregex_iterator it{check.begin(), check.end(), end_regex}, end{};
|
|
||||||
it != end; it++) {
|
|
||||||
end_pos = it->position() - 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
check = check.substr(0, end_pos);
|
|
||||||
|
|
||||||
return check;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::wstring StoreModule::get_name() { return this->name; }
|
|
|
@ -1,28 +0,0 @@
|
||||||
#ifndef STORE_MODULE_H
|
|
||||||
#define STORE_MODULE_H
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
class StoreModule {
|
|
||||||
std::string path;
|
|
||||||
std::wstring name;
|
|
||||||
std::wstring goods_name_regex;
|
|
||||||
std::wstring goods_price_regex;
|
|
||||||
std::wstring goods_quantity_regex;
|
|
||||||
std::wstring check_start_regex;
|
|
||||||
std::wstring check_end_regex;
|
|
||||||
public:
|
|
||||||
StoreModule(std::string);
|
|
||||||
StoreModule();
|
|
||||||
|
|
||||||
std::vector<std::string> parse_name(std::wstring);
|
|
||||||
std::vector<std::string> parse_price(std::wstring);
|
|
||||||
std::vector<std::string> parse_quantity(std::wstring);
|
|
||||||
std::wstring trim_check(std::wstring&);
|
|
||||||
|
|
||||||
|
|
||||||
std::wstring get_name();
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // STORE_MODULE_H
|
|
|
@ -1,143 +0,0 @@
|
||||||
#include "parser.h"
|
|
||||||
#include "../goods/goods.h"
|
|
||||||
#include "../net/net.h"
|
|
||||||
#include "../settings/settings.h"
|
|
||||||
#include "../utils/utils.h"
|
|
||||||
#include <iostream>
|
|
||||||
#include <fstream>
|
|
||||||
|
|
||||||
#if __GNUC__ < 8 && __clang_major__ < 17
|
|
||||||
# include <experimental/filesystem>
|
|
||||||
using namespace std::experimental;
|
|
||||||
using namespace std::experimental::filesystem;
|
|
||||||
#else
|
|
||||||
# include <filesystem>
|
|
||||||
using namespace std::filesystem;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void dumpVectorsToStdErr(std::vector<std::string> &goods_names, std::vector<std::string> &goods_prices, std::vector<std::string>& goods_quantities) {
|
|
||||||
std::cerr << goods_names.size() << " " << goods_prices.size() << " " << goods_quantities.size() << std::endl;
|
|
||||||
std::cerr << "Found goods names: ";
|
|
||||||
for (auto &goods_name : goods_names) {
|
|
||||||
std::cerr << goods_name << " ";
|
|
||||||
}
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
std::cerr << "Found goods prices: ";
|
|
||||||
for (auto &goods_price : goods_prices) {
|
|
||||||
std::cerr << goods_price << " ";
|
|
||||||
}
|
|
||||||
std::cerr << std::endl;
|
|
||||||
|
|
||||||
std::cerr << "Found goods names: ";
|
|
||||||
for (auto &goods_quantity : goods_quantities) {
|
|
||||||
std::cerr << goods_quantity << " ";
|
|
||||||
}
|
|
||||||
std::cerr << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
Parser::Parser() {}
|
|
||||||
|
|
||||||
std::vector<std::string> Parser::search_modules() {
|
|
||||||
Settings s(get_path_relative_to_home(".local/share/checks_parser/settings.json"));
|
|
||||||
std::string path = get_path_relative_to_home(s.get_setting("stores_modules_dir"));//std::string(std::getenv("HOME")) + "/" + STORES_MODULES_DIR;
|
|
||||||
directory_entry modules_dir(path);
|
|
||||||
|
|
||||||
if (!exists(modules_dir)) {
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string> modules_files;
|
|
||||||
|
|
||||||
for (auto &file : directory_iterator(path)) {
|
|
||||||
modules_files.push_back(file.path());
|
|
||||||
}
|
|
||||||
|
|
||||||
return modules_files;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string> Parser::get_modules_names() {
|
|
||||||
std::vector<std::string> modules = this->search_modules();
|
|
||||||
std::vector<std::string> names = {};
|
|
||||||
|
|
||||||
for (std::string &modulePath : modules) {
|
|
||||||
std::ifstream inputFile(modulePath);
|
|
||||||
|
|
||||||
nlohmann::json module = nlohmann::json::parse(inputFile);
|
|
||||||
std::string name = module["name"];
|
|
||||||
names.push_back(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
return names;
|
|
||||||
}
|
|
||||||
|
|
||||||
void Parser::set_module(std::string path) { module = StoreModule(path); }
|
|
||||||
|
|
||||||
std::vector<Goods> Parser::parse(std::wstring check_plaintext) {
|
|
||||||
std::vector<Goods> result;
|
|
||||||
|
|
||||||
module.trim_check(check_plaintext);
|
|
||||||
|
|
||||||
std::vector<std::string> goods_names = module.parse_name(check_plaintext);
|
|
||||||
std::vector<std::string> goods_prices = module.parse_price(check_plaintext);
|
|
||||||
std::vector<std::string> goods_quantities =
|
|
||||||
module.parse_quantity(check_plaintext);
|
|
||||||
|
|
||||||
if (goods_names.size() != goods_prices.size() ||
|
|
||||||
goods_names.size() != goods_quantities.size() ||
|
|
||||||
goods_prices.size() != goods_quantities.size()) {
|
|
||||||
|
|
||||||
dumpVectorsToStdErr(goods_names, goods_prices, goods_quantities);
|
|
||||||
|
|
||||||
//Error. Amount of names, prices or quantities are not equal. That means, that some regex(es) has mismatched.
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
short goods_amount = goods_names.size();
|
|
||||||
|
|
||||||
for (short i = 0; i < goods_amount; i++) {
|
|
||||||
Goods goods(goods_names[i], std::stof(goods_prices[i]), std::stof(goods_quantities[i]));
|
|
||||||
|
|
||||||
result.push_back(goods);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string> Parser::check_updates() {
|
|
||||||
std::cout << "Checking updates for stores modules" << std::endl;
|
|
||||||
Settings s(get_path_relative_to_home(".local/share/checks_parser/settings.json"));
|
|
||||||
std::string path = get_path_relative_to_home(s.get_setting("stores_modules_dir"));
|
|
||||||
|
|
||||||
std::vector<std::string> to_download;
|
|
||||||
std::vector<std::string> stored_modules;
|
|
||||||
|
|
||||||
directory_entry modules_dir(path);
|
|
||||||
if (!exists(modules_dir)) {
|
|
||||||
create_directories(path);
|
|
||||||
}
|
|
||||||
for (const auto& file : directory_iterator(path)) {
|
|
||||||
if (!is_regular_file(file)) continue;
|
|
||||||
stored_modules.push_back(file.path().filename());
|
|
||||||
std::cout << file.path().filename() << " detected store module" << std::endl;
|
|
||||||
}
|
|
||||||
Net n;
|
|
||||||
std::cerr << "Downloading modules list from: " << s.get_setting("stores_modules_url") << std::endl;
|
|
||||||
std::vector<std::string> remote_modules = n.get_all_modules(s.get_setting("stores_modules_url"));
|
|
||||||
if (stored_modules.empty()) {
|
|
||||||
std::cout << "I need to download everything" << std::endl;
|
|
||||||
to_download = remote_modules;
|
|
||||||
} else {
|
|
||||||
for (const std::string& module : remote_modules) {
|
|
||||||
if (!vector_contains_element(stored_modules, module)) {
|
|
||||||
std::cout << "I need to download store module " << module << std::endl;
|
|
||||||
to_download.push_back(module);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return to_download;
|
|
||||||
}
|
|
|
@ -1,27 +0,0 @@
|
||||||
#ifndef PARSER_H
|
|
||||||
#define PARSER_H
|
|
||||||
|
|
||||||
#include "../goods/goods.h"
|
|
||||||
#include "module.h"
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
class Parser {
|
|
||||||
|
|
||||||
StoreModule module;
|
|
||||||
|
|
||||||
public:
|
|
||||||
Parser();
|
|
||||||
|
|
||||||
std::vector<std::string> search_modules();
|
|
||||||
|
|
||||||
std::vector<std::string> get_modules_names();
|
|
||||||
|
|
||||||
std::vector<std::string> check_updates();
|
|
||||||
|
|
||||||
void set_module(std::string);
|
|
||||||
|
|
||||||
std::vector<Goods> parse(std::wstring);
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // PARSER_H
|
|
|
@ -1,10 +1,8 @@
|
||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="/scenes">
|
<qresource prefix="/scenes">
|
||||||
<file>scenes/outputdialog.ui</file>
|
<file>scenes/outputdialog.ui</file>
|
||||||
<file>scenes/emailtextscene.ui</file>
|
|
||||||
<file>scenes/ocrscene.ui</file>
|
|
||||||
<file>scenes/mainwindow.ui</file>
|
<file>scenes/mainwindow.ui</file>
|
||||||
<file>scenes/ofdscene.ui</file>
|
<file>scenes/settingsdialog.ui</file>
|
||||||
<file>scenes/solvecaptchadialog.ui</file>
|
<file>scenes/solvecaptchadialog.ui</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
|
|
@ -13,65 +13,42 @@
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Dialog</string>
|
<string>Dialog</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<property name="geometry">
|
<item row="1" column="0" colspan="2">
|
||||||
<rect>
|
<widget class="ImageRedactor" name="graphicsView"/>
|
||||||
<x>450</x>
|
</item>
|
||||||
<y>450</y>
|
<item row="2" column="0">
|
||||||
<width>341</width>
|
<widget class="QSlider" name="contrastSlider">
|
||||||
<height>32</height>
|
<property name="value">
|
||||||
</rect>
|
<number>50</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="standardButtons">
|
</widget>
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
</item>
|
||||||
</property>
|
<item row="0" column="0" colspan="2">
|
||||||
</widget>
|
<widget class="QLabel" name="label">
|
||||||
<widget class="QSlider" name="contrastSlider">
|
<property name="text">
|
||||||
<property name="geometry">
|
<string>Please, zoom to qr code and adjust contrast so that qr code looks sharp</string>
|
||||||
<rect>
|
</property>
|
||||||
<x>10</x>
|
</widget>
|
||||||
<y>460</y>
|
</item>
|
||||||
<width>591</width>
|
<item row="3" column="0">
|
||||||
<height>16</height>
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
</rect>
|
<property name="orientation">
|
||||||
</property>
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
<property name="value">
|
</property>
|
||||||
<number>50</number>
|
<property name="standardButtons">
|
||||||
</property>
|
<set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok</set>
|
||||||
<property name="orientation">
|
</property>
|
||||||
<enum>Qt::Horizontal</enum>
|
</widget>
|
||||||
</property>
|
</item>
|
||||||
</widget>
|
</layout>
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>10</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>511</width>
|
|
||||||
<height>18</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Please, zoom to qr code and adjust contrast so that qr code looks sharp</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="ImageRedactor" name="graphicsView">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>5</x>
|
|
||||||
<y>21</y>
|
|
||||||
<width>801</width>
|
|
||||||
<height>421</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<zorder>buttonBox</zorder>
|
|
||||||
<zorder>label</zorder>
|
<zorder>label</zorder>
|
||||||
<zorder>contrastSlider</zorder>
|
<zorder>contrastSlider</zorder>
|
||||||
<zorder>graphicsView</zorder>
|
<zorder>graphicsView</zorder>
|
||||||
|
<zorder>buttonBox</zorder>
|
||||||
</widget>
|
</widget>
|
||||||
<customwidgets>
|
<customwidgets>
|
||||||
<customwidget>
|
<customwidget>
|
||||||
|
|
|
@ -1,80 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>EmailTextScene</class>
|
|
||||||
<widget class="QWidget" name="EmailTextScene">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>1077</width>
|
|
||||||
<height>608</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Form</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<item row="2" column="0" colspan="3">
|
|
||||||
<widget class="QLabel" name="check_content_label">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Check content</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0" colspan="3">
|
|
||||||
<widget class="QPushButton" name="parse_button">
|
|
||||||
<property name="text">
|
|
||||||
<string>Parse</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="store_label">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Store:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0" colspan="3">
|
|
||||||
<widget class="QTextEdit" name="check_content"/>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QPushButton" name="back_button">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Back</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QComboBox" name="store_combo_box">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
|
@ -7,7 +7,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1039</width>
|
<width>1039</width>
|
||||||
<height>693</height>
|
<height>426</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -26,93 +26,226 @@
|
||||||
<string>Form</string>
|
<string>Form</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="2" column="0">
|
<item row="1" column="3">
|
||||||
<layout class="QGridLayout" name="root_layout">
|
<widget class="QLabel" name="or_label_2">
|
||||||
<property name="verticalSpacing">
|
<property name="sizePolicy">
|
||||||
<number>6</number>
|
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="1">
|
<property name="text">
|
||||||
<widget class="QPushButton" name="ocr_button">
|
<string>or</string>
|
||||||
<property name="toolTip">
|
</property>
|
||||||
<string>Optical Character Recognition</string>
|
</widget>
|
||||||
</property>
|
</item>
|
||||||
<property name="text">
|
<item row="9" column="0" colspan="5">
|
||||||
<string/>
|
<widget class="QPushButton" name="parse_button">
|
||||||
</property>
|
<property name="sizePolicy">
|
||||||
<property name="icon">
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
<iconset>
|
<horstretch>0</horstretch>
|
||||||
<normaloff>:/icons/assets/icons/OCR.svg</normaloff>:/icons/assets/icons/OCR.svg</iconset>
|
<verstretch>0</verstretch>
|
||||||
</property>
|
</sizepolicy>
|
||||||
<property name="iconSize">
|
</property>
|
||||||
<size>
|
<property name="text">
|
||||||
<width>128</width>
|
<string>Parse</string>
|
||||||
<height>128</height>
|
</property>
|
||||||
</size>
|
</widget>
|
||||||
</property>
|
</item>
|
||||||
</widget>
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="fd_label">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>FD (Fiscal Document)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="fn_label">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>FN (Fiscal Number)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="0">
|
||||||
|
<widget class="QLabel" name="operation_type_label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Operation type</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="4">
|
||||||
|
<widget class="QPushButton" name="binary_eye_button">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Use your phone as a QR code scanner</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0" colspan="5">
|
||||||
|
<widget class="QLabel" name="info_label">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="0">
|
||||||
|
<widget class="QLabel" name="datetime_label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Date and time of purchase</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="4">
|
||||||
|
<widget class="QPushButton" name="stop_server_button">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Stop server</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QPushButton" name="choose_image_button">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Choose image on your PC</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="0">
|
||||||
|
<widget class="QLabel" name="total_label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Total</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<widget class="QLabel" name="fi_label">
|
||||||
|
<property name="text">
|
||||||
|
<string>FI (Fiscal Identifier)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QPushButton" name="parse_email_button">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Parse an E-Mail</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLabel" name="or_label_1">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>or</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="2" colspan="3">
|
||||||
|
<widget class="QLineEdit" name="fn_line_edit">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="2" colspan="3">
|
||||||
|
<widget class="QLineEdit" name="fd_line_edit"/>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="2" colspan="3">
|
||||||
|
<widget class="QLineEdit" name="fi_line_edit"/>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="2" colspan="3">
|
||||||
|
<widget class="QDateTimeEdit" name="purchase_datetime_edit"/>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="2" colspan="3">
|
||||||
|
<widget class="QComboBox" name="operation_type_combo_box">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Funds income</string>
|
||||||
|
</property>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="0">
|
<item>
|
||||||
<widget class="QPushButton" name="text_from_email_button">
|
<property name="text">
|
||||||
<property name="sizePolicy">
|
<string>Funds return</string>
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
</property>
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Text from E-Mail</string>
|
|
||||||
</property>
|
|
||||||
<property name="autoFillBackground">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset>
|
|
||||||
<normaloff>:/icons/assets/icons/email-text.svg</normaloff>:/icons/assets/icons/email-text.svg</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>128</width>
|
|
||||||
<height>128</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="autoRepeat">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="autoExclusive">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="autoDefault">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="default">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
<property name="flat">
|
|
||||||
<bool>false</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" colspan="2">
|
<item>
|
||||||
<widget class="QPushButton" name="ofd_button">
|
<property name="text">
|
||||||
<property name="text">
|
<string>Funds spend</string>
|
||||||
<string/>
|
</property>
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset>
|
|
||||||
<normaloff>:/icons/assets/icons/OFD.svg</normaloff>:/icons/assets/icons/OFD.svg</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="iconSize">
|
|
||||||
<size>
|
|
||||||
<width>128</width>
|
|
||||||
<height>128</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Spends return</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="2" colspan="3">
|
||||||
|
<widget class="QDoubleSpinBox" name="total_spin_box">
|
||||||
|
<property name="maximum">
|
||||||
|
<double>4294967296.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QPushButton" name="settings_button">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Settings</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
|
@ -1,127 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>OCRScene</class>
|
|
||||||
<widget class="QWidget" name="OCRScene">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>992</width>
|
|
||||||
<height>634</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Form</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<property name="topMargin">
|
|
||||||
<number>8</number>
|
|
||||||
</property>
|
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="QComboBox" name="store_combo_box">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="0" colspan="3">
|
|
||||||
<widget class="QPushButton" name="parse_button">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Parse</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0" colspan="2">
|
|
||||||
<widget class="QPushButton" name="choose_image_button">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="baseSize">
|
|
||||||
<size>
|
|
||||||
<width>0</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Choose</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0" colspan="3">
|
|
||||||
<widget class="QPushButton" name="back_button">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Back</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0" colspan="3">
|
|
||||||
<widget class="QLabel" name="instructions_label">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Recognized text will be shown below as soon as image will be processed. Please, edit it</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="2">
|
|
||||||
<widget class="QLabel" name="path_to_image_label">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Path to image:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0" colspan="3">
|
|
||||||
<widget class="QTextEdit" name="check_text_edit"/>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0" colspan="2">
|
|
||||||
<widget class="QLabel" name="store_label">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Store:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
|
@ -1,194 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>OFDScene</class>
|
|
||||||
<widget class="QWidget" name="OFDScene">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>894</width>
|
|
||||||
<height>625</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Form</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<property name="sizeConstraint">
|
|
||||||
<enum>QLayout::SizeConstraint::SetDefaultConstraint</enum>
|
|
||||||
</property>
|
|
||||||
<item row="8" column="0">
|
|
||||||
<widget class="QLabel" name="total_label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Total</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QPushButton" name="back_button">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Fixed" vsizetype="Maximum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Back</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QLabel" name="or_label">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>or</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="8" column="2">
|
|
||||||
<widget class="QDoubleSpinBox" name="total_spin_box">
|
|
||||||
<property name="maximum">
|
|
||||||
<double>4294967296.000000000000000</double>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0">
|
|
||||||
<widget class="QLabel" name="fd_label">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>FD (Fiscal Document)</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="0">
|
|
||||||
<widget class="QLabel" name="datetime_label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Date and time of purchase</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="7" column="2">
|
|
||||||
<widget class="QComboBox" name="operation_type_combo_box">
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Funds income</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Funds return</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Funds spend</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>Spends return</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="2">
|
|
||||||
<widget class="QLineEdit" name="fd_line_edit"/>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0" colspan="3">
|
|
||||||
<widget class="QLabel" name="info_label">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Minimum" vsizetype="Maximum">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="2">
|
|
||||||
<widget class="QLineEdit" name="fn_line_edit">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="2">
|
|
||||||
<widget class="QLineEdit" name="fi_line_edit"/>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="QPushButton" name="binary_eye_button">
|
|
||||||
<property name="text">
|
|
||||||
<string>Use your phone as a QR code scanner</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0">
|
|
||||||
<widget class="QLabel" name="fn_label">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>FN (Fiscal Number)</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="0">
|
|
||||||
<widget class="QLabel" name="fi_label">
|
|
||||||
<property name="text">
|
|
||||||
<string>FI (Fiscal Identifier)</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="2">
|
|
||||||
<widget class="QDateTimeEdit" name="purchase_datetime_edit"/>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QPushButton" name="choose_image_button">
|
|
||||||
<property name="text">
|
|
||||||
<string>Choose image on your PC</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="7" column="0">
|
|
||||||
<widget class="QLabel" name="operation_type_label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Operation type</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="9" column="0" colspan="3">
|
|
||||||
<widget class="QPushButton" name="parse_button">
|
|
||||||
<property name="sizePolicy">
|
|
||||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
|
|
||||||
<horstretch>0</horstretch>
|
|
||||||
<verstretch>0</verstretch>
|
|
||||||
</sizepolicy>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Parse</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections/>
|
|
||||||
</ui>
|
|
|
@ -0,0 +1,236 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>settingsdialog</class>
|
||||||
|
<widget class="QDialog" name="settingsdialog">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>693</width>
|
||||||
|
<height>616</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Dialog</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QScrollArea" name="scrollArea">
|
||||||
|
<property name="widgetResizable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>673</width>
|
||||||
|
<height>554</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="5" column="0">
|
||||||
|
<widget class="QLabel" name="label_14">
|
||||||
|
<property name="text">
|
||||||
|
<string>Goods quantity alias</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="1">
|
||||||
|
<widget class="QSpinBox" name="goodsTotalPositionSpin"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLineEdit" name="goodsNameAliasEdit"/>
|
||||||
|
</item>
|
||||||
|
<item row="12" column="0">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>Language</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="0">
|
||||||
|
<widget class="QLabel" name="label_16">
|
||||||
|
<property name="text">
|
||||||
|
<string>Goods net weight alias</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label_12">
|
||||||
|
<property name="text">
|
||||||
|
<string>Goods price per unit alias</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="1">
|
||||||
|
<widget class="QLineEdit" name="goodsQuantityAliasEdit"/>
|
||||||
|
</item>
|
||||||
|
<item row="11" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Print total</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_10">
|
||||||
|
<property name="text">
|
||||||
|
<string>Goods name alias</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QLineEdit" name="goodsPricePerUnitAliasEdit"/>
|
||||||
|
</item>
|
||||||
|
<item row="9" column="1">
|
||||||
|
<widget class="QLineEdit" name="goodsTotalAliasEdit"/>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QSpinBox" name="goodsQuantityPositionSpin"/>
|
||||||
|
</item>
|
||||||
|
<item row="9" column="0">
|
||||||
|
<widget class="QLabel" name="label_18">
|
||||||
|
<property name="text">
|
||||||
|
<string>Goods total alias</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="10" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Print header</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="1">
|
||||||
|
<widget class="QLineEdit" name="goodsNetWeightAliasEdit"/>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="0">
|
||||||
|
<widget class="QLabel" name="label_17">
|
||||||
|
<property name="text">
|
||||||
|
<string>Goods total position</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="1">
|
||||||
|
<widget class="QSpinBox" name="goodsNetWeightPositionSpin"/>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="0">
|
||||||
|
<widget class="QLabel" name="label_15">
|
||||||
|
<property name="text">
|
||||||
|
<string>Goods net weight position</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="12" column="1">
|
||||||
|
<widget class="QComboBox" name="languageComboBox">
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>en_US</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>ru_RU</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="label_13">
|
||||||
|
<property name="text">
|
||||||
|
<string>Goods quantity position</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QSpinBox" name="goodsNamePositionSpin"/>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_9">
|
||||||
|
<property name="text">
|
||||||
|
<string>Goods name position</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="10" column="1">
|
||||||
|
<widget class="QCheckBox" name="printHeaderCheckBox">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_11">
|
||||||
|
<property name="text">
|
||||||
|
<string>Goods price per unit position</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="11" column="1">
|
||||||
|
<widget class="QCheckBox" name="printTotalCheckBox">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QSpinBox" name="goodsPricePerUnitPositionSpin"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Save</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>settingsdialog</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>248</x>
|
||||||
|
<y>254</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>settingsdialog</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>316</x>
|
||||||
|
<y>260</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
|
@ -4,7 +4,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "../utils/utils.h"
|
#include "../utils/utils.h"
|
||||||
|
|
||||||
#if __GNUC__ < 8 && __clang_major__ < 17
|
#if __GNUC__ <= 8 && __clang_major__ < 17
|
||||||
# include <experimental/filesystem>
|
# include <experimental/filesystem>
|
||||||
using namespace std::experimental;
|
using namespace std::experimental;
|
||||||
using namespace std::experimental::filesystem;
|
using namespace std::experimental::filesystem;
|
||||||
|
@ -20,10 +20,6 @@ Settings::Settings(std::string path) {
|
||||||
std::ofstream output(path);
|
std::ofstream output(path);
|
||||||
|
|
||||||
nlohmann::json settings = R"({
|
nlohmann::json settings = R"({
|
||||||
"ofds_modules_dir":".local/share/checks_parser/modules/ofd",
|
|
||||||
"stores_modules_dir":".local/share/checks_parser/modules/stores",
|
|
||||||
"ofds_modules_url":"https://foxarmy.org/checks-parser/modules/ofd/",
|
|
||||||
"stores_modules_url":"https://foxarmy.org/checks-parser/modules/stores/",
|
|
||||||
"print_header": true,
|
"print_header": true,
|
||||||
"print_total": true,
|
"print_total": true,
|
||||||
"output_order": {
|
"output_order": {
|
||||||
|
|
|
@ -1,7 +1,10 @@
|
||||||
#include "settingsdialog.h"
|
#include "settingsdialog.h"
|
||||||
#include "settings/settings.h"
|
|
||||||
#include "ui_settingsdialog.h"
|
#include "ui_settingsdialog.h"
|
||||||
#include "utils/utils.h"
|
|
||||||
|
#include <settings/settings.h>
|
||||||
|
#include <utils/utils.h>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
@ -12,11 +15,6 @@ SettingsDialog::SettingsDialog(QWidget *parent)
|
||||||
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
ui->OFDModulesDirEdit->setText(QString::fromStdString(settings.get_all_settings()["ofds_modules_dir"]));
|
|
||||||
ui->OFDModulesURLEdit->setText(QString::fromStdString(settings.get_all_settings()["ofds_modules_url"]));
|
|
||||||
ui->storesModulesDirEdit->setText(QString::fromStdString(settings.get_all_settings()["stores_modules_dir"]));
|
|
||||||
ui->storesModulesURLEdit->setText(QString::fromStdString(settings.get_all_settings()["stores_modules_url"]));
|
|
||||||
|
|
||||||
ui->goodsNamePositionSpin->setValue(this->settings.get_all_settings()["output_order"]["goods_name"]["position"]);
|
ui->goodsNamePositionSpin->setValue(this->settings.get_all_settings()["output_order"]["goods_name"]["position"]);
|
||||||
ui->goodsNameAliasEdit->setText(QString::fromStdString(this->settings.get_all_settings()["output_order"]["goods_name"]["name"]));
|
ui->goodsNameAliasEdit->setText(QString::fromStdString(this->settings.get_all_settings()["output_order"]["goods_name"]["name"]));
|
||||||
|
|
||||||
|
@ -35,42 +33,24 @@ SettingsDialog::SettingsDialog(QWidget *parent)
|
||||||
ui->printHeaderCheckBox->setChecked(this->settings.get_all_settings()["print_header"]);
|
ui->printHeaderCheckBox->setChecked(this->settings.get_all_settings()["print_header"]);
|
||||||
ui->printTotalCheckBox->setChecked(this->settings.get_all_settings()["print_total"]);
|
ui->printTotalCheckBox->setChecked(this->settings.get_all_settings()["print_total"]);
|
||||||
|
|
||||||
|
|
||||||
int currentLanguageIndex = 0;
|
int currentLanguageIndex = 0;
|
||||||
if (!this->settings.get_all_settings().contains("language")) {
|
bool languageSettingPresent = false;
|
||||||
|
|
||||||
|
languageSettingPresent = settings.get_all_settings().find("language") != settings.get_all_settings().end();
|
||||||
|
|
||||||
|
if (languageSettingPresent) {
|
||||||
|
currentLanguageIndex = ui->languageComboBox->findText(QString::fromStdString(this->settings.get_all_settings()["language"]));
|
||||||
|
|
||||||
|
} else {
|
||||||
currentLanguageIndex = ui->languageComboBox->findText(QLocale::system().name());
|
currentLanguageIndex = ui->languageComboBox->findText(QLocale::system().name());
|
||||||
if (currentLanguageIndex < 0) {
|
if (currentLanguageIndex < 0) {
|
||||||
currentLanguageIndex = ui->languageComboBox->findText("en_US");
|
currentLanguageIndex = ui->languageComboBox->findText("en_US");
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
currentLanguageIndex = ui->languageComboBox->findText(QString::fromStdString(this->settings.get_all_settings()["language"]));
|
|
||||||
}
|
}
|
||||||
ui->languageComboBox->setCurrentIndex(currentLanguageIndex);
|
ui->languageComboBox->setCurrentIndex(currentLanguageIndex);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SettingsDialog::~SettingsDialog() { delete ui; }
|
|
||||||
|
|
||||||
void SettingsDialog::on_OFDModulesDirEdit_editingFinished() {
|
|
||||||
this->settings.alter_setting("ofds_modules_dir",
|
|
||||||
ui->OFDModulesDirEdit->text().toStdString());
|
|
||||||
}
|
|
||||||
|
|
||||||
void SettingsDialog::on_storesModulesDirEdit_editingFinished() {
|
|
||||||
this->settings.alter_setting("stores_modules_dir",
|
|
||||||
ui->storesModulesDirEdit->text().toStdString());
|
|
||||||
}
|
|
||||||
|
|
||||||
void SettingsDialog::on_OFDModulesURLEdit_editingFinished() {
|
|
||||||
this->settings.alter_setting("ofds_modules_url",
|
|
||||||
ui->OFDModulesURLEdit->text().toStdString());
|
|
||||||
}
|
|
||||||
|
|
||||||
void SettingsDialog::on_storesModulesURLEdit_editingFinished() {
|
|
||||||
this->settings.alter_setting("stores_modules_url",
|
|
||||||
ui->storesModulesURLEdit->text().toStdString());
|
|
||||||
}
|
|
||||||
|
|
||||||
void SettingsDialog::on_goodsNamePositionSpin_valueChanged(int value) {
|
void SettingsDialog::on_goodsNamePositionSpin_valueChanged(int value) {
|
||||||
this->settings.get_all_settings()["output_order"]["goods_name"]["position"] =
|
this->settings.get_all_settings()["output_order"]["goods_name"]["position"] =
|
||||||
value;
|
value;
|
||||||
|
@ -137,7 +117,11 @@ void SettingsDialog::on_buttonBox_accepted() { this->settings.flush(); }
|
||||||
void SettingsDialog::on_buttonBox_rejected() { this->close(); }
|
void SettingsDialog::on_buttonBox_rejected() { this->close(); }
|
||||||
|
|
||||||
void SettingsDialog::on_languageComboBox_currentTextChanged(const QString &changed) {
|
void SettingsDialog::on_languageComboBox_currentTextChanged(const QString &changed) {
|
||||||
if (this->settings.get_all_settings().contains("language")) {
|
bool languageSettingPresent = false;
|
||||||
|
|
||||||
|
languageSettingPresent = settings.get_all_settings().find("language") != settings.get_all_settings().end();
|
||||||
|
|
||||||
|
if (languageSettingPresent) {
|
||||||
if (changed == QString::fromStdString(this->settings.get_all_settings()["language"])) return;
|
if (changed == QString::fromStdString(this->settings.get_all_settings()["language"])) return;
|
||||||
} else {
|
} else {
|
||||||
if (changed == QLocale::system().name()) return;
|
if (changed == QLocale::system().name()) return;
|
||||||
|
@ -152,3 +136,5 @@ void SettingsDialog::on_languageComboBox_currentTextChanged(const QString &chang
|
||||||
infoDialog.exec();
|
infoDialog.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SettingsDialog::~SettingsDialog() { delete ui; }
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#define SETTINGSDIALOG_H
|
#define SETTINGSDIALOG_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
#include "settings/settings.h"
|
#include <settings/settings.h>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class settingsdialog;
|
class settingsdialog;
|
||||||
|
@ -16,46 +16,35 @@ public:
|
||||||
~SettingsDialog();
|
~SettingsDialog();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_OFDModulesDirEdit_editingFinished();
|
|
||||||
|
|
||||||
void on_buttonBox_accepted();
|
|
||||||
|
|
||||||
void on_storesModulesDirEdit_editingFinished();
|
|
||||||
|
|
||||||
void on_OFDModulesURLEdit_editingFinished();
|
|
||||||
|
|
||||||
void on_storesModulesURLEdit_editingFinished();
|
|
||||||
|
|
||||||
void on_goodsNamePositionSpin_valueChanged(int arg1);
|
void on_goodsNamePositionSpin_valueChanged(int arg1);
|
||||||
|
|
||||||
void on_goodsNameAliasEdit_editingFinished();
|
void on_goodsNameAliasEdit_editingFinished();
|
||||||
|
|
||||||
void on_goodsPricePerUnitPositionSpin_valueChanged(int arg1);
|
void on_goodsPricePerUnitPositionSpin_valueChanged(int arg1);
|
||||||
|
|
||||||
void on_goodsPricePerUnitAliasEdit_editingFinished();
|
void on_goodsPricePerUnitAliasEdit_editingFinished();
|
||||||
|
|
||||||
void on_goodsQuantityPositionSpin_valueChanged(int arg1);
|
void on_goodsQuantityPositionSpin_valueChanged(int arg1);
|
||||||
|
|
||||||
void on_goodsQuantityAliasEdit_editingFinished();
|
void on_goodsQuantityAliasEdit_editingFinished();
|
||||||
|
|
||||||
void on_goodsNetWeightPositionSpin_valueChanged(int arg1);
|
void on_goodsNetWeightPositionSpin_valueChanged(int arg1);
|
||||||
|
|
||||||
void on_goodsNetWeightAliasEdit_editingFinished();
|
void on_goodsNetWeightAliasEdit_editingFinished();
|
||||||
|
|
||||||
void on_goodsTotalPositionSpin_valueChanged(int arg1);
|
|
||||||
|
|
||||||
|
|
||||||
|
void on_goodsTotalPositionSpin_valueChanged(int arg1);
|
||||||
void on_goodsTotalAliasEdit_editingFinished();
|
void on_goodsTotalAliasEdit_editingFinished();
|
||||||
|
|
||||||
|
void on_printTotalCheckBox_stateChanged(int arg1);
|
||||||
void on_printHeaderCheckBox_stateChanged(int arg1);
|
void on_printHeaderCheckBox_stateChanged(int arg1);
|
||||||
|
|
||||||
void on_printTotalCheckBox_stateChanged(int arg1);
|
void on_buttonBox_accepted();
|
||||||
|
|
||||||
void on_buttonBox_rejected();
|
void on_buttonBox_rejected();
|
||||||
|
|
||||||
void on_languageComboBox_currentTextChanged(const QString &arg1);
|
void on_languageComboBox_currentTextChanged(const QString &arg1);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::settingsdialog *ui;
|
Ui::settingsdialog *ui;
|
||||||
|
public:
|
||||||
|
bool settingsExist();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // SETTINGSDIALOG_H
|
#endif // SETTINGSDIALOG_H
|
||||||
|
|
|
@ -1,306 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>settingsdialog</class>
|
|
||||||
<widget class="QDialog" name="settingsdialog">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>599</width>
|
|
||||||
<height>799</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Dialog</string>
|
|
||||||
</property>
|
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>310</x>
|
|
||||||
<y>740</y>
|
|
||||||
<width>251</width>
|
|
||||||
<height>32</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="standardButtons">
|
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Save</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QScrollArea" name="scrollArea">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>10</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>541</width>
|
|
||||||
<height>741</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="widgetResizable">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>539</width>
|
|
||||||
<height>739</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="gridLayoutWidget">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>531</width>
|
|
||||||
<height>731</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<item row="15" column="1">
|
|
||||||
<widget class="QCheckBox" name="printTotalCheckBox">
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="10" column="0">
|
|
||||||
<widget class="QLabel" name="label_15">
|
|
||||||
<property name="text">
|
|
||||||
<string>Goods net weight position</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="1">
|
|
||||||
<widget class="QSpinBox" name="goodsNamePositionSpin"/>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0">
|
|
||||||
<widget class="QLabel" name="label_8">
|
|
||||||
<property name="text">
|
|
||||||
<string>Stores modules url</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="8" column="0">
|
|
||||||
<widget class="QLabel" name="label_13">
|
|
||||||
<property name="text">
|
|
||||||
<string>Goods quantity position</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QLineEdit" name="OFDModulesDirEdit"/>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string>OFD modules url</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="14" column="0">
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>Print header</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="1">
|
|
||||||
<widget class="QSpinBox" name="goodsPricePerUnitPositionSpin"/>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
|
||||||
<widget class="QLineEdit" name="storesModulesURLEdit"/>
|
|
||||||
</item>
|
|
||||||
<item row="9" column="0">
|
|
||||||
<widget class="QLabel" name="label_14">
|
|
||||||
<property name="text">
|
|
||||||
<string>Goods quantity alias</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label_6">
|
|
||||||
<property name="text">
|
|
||||||
<string>OFD modules directory</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="1">
|
|
||||||
<widget class="QLineEdit" name="goodsNameAliasEdit"/>
|
|
||||||
</item>
|
|
||||||
<item row="15" column="0">
|
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="text">
|
|
||||||
<string>Print total</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="13" column="1">
|
|
||||||
<widget class="QLineEdit" name="goodsTotalAliasEdit"/>
|
|
||||||
</item>
|
|
||||||
<item row="8" column="1">
|
|
||||||
<widget class="QSpinBox" name="goodsQuantityPositionSpin"/>
|
|
||||||
</item>
|
|
||||||
<item row="11" column="0">
|
|
||||||
<widget class="QLabel" name="label_16">
|
|
||||||
<property name="text">
|
|
||||||
<string>Goods net weight alias</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="10" column="1">
|
|
||||||
<widget class="QSpinBox" name="goodsNetWeightPositionSpin"/>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QLineEdit" name="OFDModulesURLEdit"/>
|
|
||||||
</item>
|
|
||||||
<item row="13" column="0">
|
|
||||||
<widget class="QLabel" name="label_18">
|
|
||||||
<property name="text">
|
|
||||||
<string>Goods total alias</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QLineEdit" name="storesModulesDirEdit"/>
|
|
||||||
</item>
|
|
||||||
<item row="7" column="1">
|
|
||||||
<widget class="QLineEdit" name="goodsPricePerUnitAliasEdit"/>
|
|
||||||
</item>
|
|
||||||
<item row="9" column="1">
|
|
||||||
<widget class="QLineEdit" name="goodsQuantityAliasEdit"/>
|
|
||||||
</item>
|
|
||||||
<item row="11" column="1">
|
|
||||||
<widget class="QLineEdit" name="goodsNetWeightAliasEdit"/>
|
|
||||||
</item>
|
|
||||||
<item row="4" column="0">
|
|
||||||
<widget class="QLabel" name="label_9">
|
|
||||||
<property name="text">
|
|
||||||
<string>Goods name position</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="14" column="1">
|
|
||||||
<widget class="QCheckBox" name="printHeaderCheckBox">
|
|
||||||
<property name="text">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="5" column="0">
|
|
||||||
<widget class="QLabel" name="label_10">
|
|
||||||
<property name="text">
|
|
||||||
<string>Goods name alias</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="6" column="0">
|
|
||||||
<widget class="QLabel" name="label_11">
|
|
||||||
<property name="text">
|
|
||||||
<string>Goods price per unit position</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label_7">
|
|
||||||
<property name="text">
|
|
||||||
<string>Stores modules directory</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="12" column="0">
|
|
||||||
<widget class="QLabel" name="label_17">
|
|
||||||
<property name="text">
|
|
||||||
<string>Goods total position</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
|
||||||
<widget class="QPushButton" name="OFDModulesDirChooseButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>Choose</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="12" column="1">
|
|
||||||
<widget class="QSpinBox" name="goodsTotalPositionSpin"/>
|
|
||||||
</item>
|
|
||||||
<item row="7" column="0">
|
|
||||||
<widget class="QLabel" name="label_12">
|
|
||||||
<property name="text">
|
|
||||||
<string>Goods price per unit alias</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="QPushButton" name="storedModulesDirChooseButton">
|
|
||||||
<property name="text">
|
|
||||||
<string>Choose</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="16" column="0">
|
|
||||||
<widget class="QLabel" name="label_4">
|
|
||||||
<property name="text">
|
|
||||||
<string>TextLabel</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="16" column="1">
|
|
||||||
<widget class="QComboBox" name="languageComboBox">
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>en_US</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<property name="text">
|
|
||||||
<string>ru_RU</string>
|
|
||||||
</property>
|
|
||||||
</item>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
<resources/>
|
|
||||||
<connections>
|
|
||||||
<connection>
|
|
||||||
<sender>buttonBox</sender>
|
|
||||||
<signal>accepted()</signal>
|
|
||||||
<receiver>settingsdialog</receiver>
|
|
||||||
<slot>accept()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>248</x>
|
|
||||||
<y>254</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>157</x>
|
|
||||||
<y>274</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
<connection>
|
|
||||||
<sender>buttonBox</sender>
|
|
||||||
<signal>rejected()</signal>
|
|
||||||
<receiver>settingsdialog</receiver>
|
|
||||||
<slot>reject()</slot>
|
|
||||||
<hints>
|
|
||||||
<hint type="sourcelabel">
|
|
||||||
<x>316</x>
|
|
||||||
<y>260</y>
|
|
||||||
</hint>
|
|
||||||
<hint type="destinationlabel">
|
|
||||||
<x>286</x>
|
|
||||||
<y>274</y>
|
|
||||||
</hint>
|
|
||||||
</hints>
|
|
||||||
</connection>
|
|
||||||
</connections>
|
|
||||||
</ui>
|
|
|
@ -11,7 +11,6 @@ SolveCaptchaDialog::SolveCaptchaDialog(QWidget *parent, std::string* solved_capt
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
QString captcha_path = QString::fromStdString(get_path_relative_to_home(".local/share/checks_parser/captcha.jpg"));
|
QString captcha_path = QString::fromStdString(get_path_relative_to_home(".local/share/checks_parser/captcha.jpg"));
|
||||||
std::cout << captcha_path.toStdString() << std::endl;
|
|
||||||
ui->captcha_picture->setPixmap(captcha_path);
|
ui->captcha_picture->setPixmap(captcha_path);
|
||||||
ui->captcha_picture->setScaledContents(true);
|
ui->captcha_picture->setScaledContents(true);
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<translation>Dialog</translation>
|
<translation>Dialog</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../scenes/adjustpicturedialog.ui" line="58"/>
|
<location filename="../scenes/adjustpicturedialog.ui" line="33"/>
|
||||||
<source>Please, zoom to qr code and adjust contrast so that qr code looks sharp</source>
|
<source>Please, zoom to qr code and adjust contrast so that qr code looks sharp</source>
|
||||||
<translation>Please, zoom to qr code and adjust contrast so that qr code looks sharp</translation>
|
<translation>Please, zoom to qr code and adjust contrast so that qr code looks sharp</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -27,43 +27,36 @@
|
||||||
<context>
|
<context>
|
||||||
<name>EmailTextScene</name>
|
<name>EmailTextScene</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../scenes/emailtextscene.ui" line="14"/>
|
|
||||||
<source>Form</source>
|
<source>Form</source>
|
||||||
<translation>Form</translation>
|
<translation type="vanished">Form</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Store type</source>
|
<source>Store type</source>
|
||||||
<translation type="obsolete">Store type</translation>
|
<translation type="obsolete">Store type</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../scenes/emailtextscene.ui" line="26"/>
|
|
||||||
<source>Check content</source>
|
<source>Check content</source>
|
||||||
<translation>Check content</translation>
|
<translation type="vanished">Check content</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../scenes/emailtextscene.ui" line="33"/>
|
|
||||||
<source>Parse</source>
|
<source>Parse</source>
|
||||||
<translation>Parse</translation>
|
<translation type="vanished">Parse</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../scenes/emailtextscene.ui" line="46"/>
|
|
||||||
<source>Store:</source>
|
<source>Store:</source>
|
||||||
<translation>Store:</translation>
|
<translation type="vanished">Store:</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../scenes/emailtextscene.ui" line="62"/>
|
|
||||||
<source>Back</source>
|
<source>Back</source>
|
||||||
<translation>Back</translation>
|
<translation type="vanished">Back</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<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>An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer.</translation>
|
<translation type="vanished">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"/>
|
|
||||||
<source>Error in parsing</source>
|
<source>Error in parsing</source>
|
||||||
<translation>Error in parsing</translation>
|
<translation type="vanished">Error in parsing</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
|
@ -77,8 +70,9 @@
|
||||||
<translation type="vanished">Store type</translation>
|
<translation type="vanished">Store type</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="51"/>
|
||||||
<source>Parse</source>
|
<source>Parse</source>
|
||||||
<translation type="vanished">Parse</translation>
|
<translation>Parse</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Preferences</source>
|
<source>Preferences</source>
|
||||||
|
@ -119,51 +113,336 @@
|
||||||
<translation type="vanished">0000000000000000</translation>
|
<translation type="vanished">0000000000000000</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="77"/>
|
||||||
<source>FN (Fiscal Number)</source>
|
<source>FN (Fiscal Number)</source>
|
||||||
<translatorcomment>FN = Фискальный Номер</translatorcomment>
|
<translatorcomment>FN = Фискальный Номер</translatorcomment>
|
||||||
<translation type="vanished">FN (Fiscal Number)</translation>
|
<translation>FN (Fiscal Number)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="64"/>
|
||||||
<source>FD (Fiscal Document)</source>
|
<source>FD (Fiscal Document)</source>
|
||||||
<translatorcomment>FD = Фискальный Документ</translatorcomment>
|
<translatorcomment>FD = Фискальный Документ</translatorcomment>
|
||||||
<translation type="vanished">FD (Fiscal Document)</translation>
|
<translation>FD (Fiscal Document)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>0000000000</source>
|
<source>0000000000</source>
|
||||||
<translation type="vanished">000000000</translation>
|
<translation type="vanished">000000000</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<source>Back</source>
|
||||||
|
<translation type="obsolete">Back</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="130"/>
|
||||||
|
<source>Stop server</source>
|
||||||
|
<translation>Stop server</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="143"/>
|
||||||
|
<source>Choose image on your PC</source>
|
||||||
|
<translation>Choose image on your PC</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="38"/>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="183"/>
|
||||||
|
<source>or</source>
|
||||||
|
<translation>or</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="97"/>
|
||||||
|
<source>Use your phone as a QR code scanner</source>
|
||||||
|
<translation>Use your phone as a QR code scanner</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="157"/>
|
||||||
<source>FI (Fiscal Identifier)</source>
|
<source>FI (Fiscal Identifier)</source>
|
||||||
<translatorcomment>FI = Фискальный Признак</translatorcomment>
|
<translatorcomment>FI = Фискальный Признак</translatorcomment>
|
||||||
<translation type="vanished">FI (Fiscal Identifier)</translation>
|
<translation>FI (Fiscal Identifier)</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="117"/>
|
||||||
|
<source>Date and time of purchase</source>
|
||||||
|
<translation>Date and time of purchase</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="84"/>
|
||||||
|
<source>Operation type</source>
|
||||||
|
<translation>Operation type</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="170"/>
|
||||||
|
<source>Parse an E-Mail</source>
|
||||||
|
<translation>Parse an E-Mail</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="210"/>
|
||||||
<source>Funds income</source>
|
<source>Funds income</source>
|
||||||
<translatorcomment>Приход средств</translatorcomment>
|
<translatorcomment>Приход средств</translatorcomment>
|
||||||
<translation type="vanished">Funds income</translation>
|
<translation>Funds income</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="215"/>
|
||||||
<source>Funds return</source>
|
<source>Funds return</source>
|
||||||
<translatorcomment>Возврат средств</translatorcomment>
|
<translatorcomment>Возврат средств</translatorcomment>
|
||||||
<translation type="vanished">Funds return</translation>
|
<translation>Funds return</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="220"/>
|
||||||
<source>Funds spend</source>
|
<source>Funds spend</source>
|
||||||
<translatorcomment>Расход средств</translatorcomment>
|
<translatorcomment>Расход средств</translatorcomment>
|
||||||
<translation type="vanished">Funds spend</translation>
|
<translation>Funds spend</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="225"/>
|
||||||
<source>Spends return</source>
|
<source>Spends return</source>
|
||||||
<translatorcomment>Возврат расхода</translatorcomment>
|
<translatorcomment>Возврат расхода</translatorcomment>
|
||||||
<translation type="vanished">Spends return</translation>
|
<translation>Spends return</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="246"/>
|
||||||
|
<source>Settings</source>
|
||||||
|
<translation>Settings</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="150"/>
|
||||||
|
<source>Total</source>
|
||||||
|
<translation>Total</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>checks parser</source>
|
||||||
|
<translation type="vanished">checks parser</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="91"/>
|
||||||
|
<source>QR code for binaryeye to connect</source>
|
||||||
|
<translation>QR code for binaryeye to connect</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="92"/>
|
||||||
|
<source>I've scanned</source>
|
||||||
|
<translation>I've scanned</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="98"/>
|
||||||
|
<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't lucky, please, contact the developer.</source>
|
||||||
|
<translation>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.</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="100"/>
|
||||||
|
<source>Could not start http server.</source>
|
||||||
|
<translation>Could not start http server.</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="144"/>
|
||||||
|
<source>Selected image: </source>
|
||||||
|
<translation>Selected image: </translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="204"/>
|
||||||
|
<source>Captcha was not solved correctly!</source>
|
||||||
|
<translation>Captcha was not solved correctly!</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="206"/>
|
||||||
|
<source>Captcha is incorrect</source>
|
||||||
|
<translation>Captcha is incorrect</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="211"/>
|
||||||
|
<source>Internal server error. Please, try again later.</source>
|
||||||
|
<translation>Internal server error. Please, try again later.</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="213"/>
|
||||||
|
<source>Internal server error</source>
|
||||||
|
<translation>Internal server error</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="218"/>
|
||||||
|
<source>Check not found. Please, ensure correctness of entered data.</source>
|
||||||
|
<translation>Check not found. Please, ensure correctness of entered data.</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="220"/>
|
||||||
|
<source>Check was not found</source>
|
||||||
|
<translation>Check was not found</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer.</source>
|
||||||
|
<translation type="vanished">An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer.</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Error in parsing</source>
|
||||||
|
<translation type="vanished">Error in parsing</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="137"/>
|
||||||
|
<source>Please, select a picture where QR code that contains info about check is present</source>
|
||||||
|
<translation>Please, select a picture where QR code that contains info about check is present</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="139"/>
|
||||||
|
<source>Picture was not selected</source>
|
||||||
|
<translation>Picture was not selected</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Please, select a picture to scan</source>
|
||||||
|
<translation type="vanished">Please, select a picture to scan</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="26"/>
|
||||||
|
<source>Form</source>
|
||||||
|
<translation>Form</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Optical Character Recognition</source>
|
||||||
|
<translation type="vanished">Optical Character Recognition</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Text from E-Mail</source>
|
||||||
|
<translation type="vanished">Text from E-Mail</translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>OCRScene</name>
|
||||||
|
<message>
|
||||||
|
<source>Form</source>
|
||||||
|
<translation type="vanished">Form</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Choose</source>
|
||||||
|
<translation type="vanished">Choose</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Path to image:</source>
|
||||||
|
<translation type="vanished">Path to image:</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Store:</source>
|
||||||
|
<translation type="vanished">Store:</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Recognized text will be shown below as soon as image will be processed. Please, edit it</source>
|
||||||
|
<translation type="vanished">Recognized text will be shown below as soon as image will be processed. Please, edit it</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Back</source>
|
||||||
|
<translation type="vanished">Back</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Parse</source>
|
||||||
|
<translation type="vanished">Parse</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer.</source>
|
||||||
|
<translation type="vanished">An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer.</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Error in parsing</source>
|
||||||
|
<translation type="vanished">Error in parsing</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Please, select a picture to scan</source>
|
||||||
|
<translation type="vanished">Please, select a picture to scan</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Picture was not selected</source>
|
||||||
|
<translation type="vanished">Picture was not selected</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Path to image: </source>
|
||||||
|
<translation type="vanished">Path to image: </translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>OFDScene</name>
|
||||||
|
<message>
|
||||||
|
<source>Form</source>
|
||||||
|
<translation type="vanished">Form</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Total</source>
|
<source>Total</source>
|
||||||
<translation type="vanished">Total</translation>
|
<translation type="vanished">Total</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>checks parser</source>
|
<source>Back</source>
|
||||||
<translation type="vanished">checks parser</translation>
|
<translation type="vanished">Back</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>or</source>
|
||||||
|
<translation type="vanished">or</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>FD (Fiscal Document)</source>
|
||||||
|
<translation type="vanished">FD (Fiscal Document)</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Date and time of purchase</source>
|
||||||
|
<translation type="vanished">Date and time of purchase</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Stop server</source>
|
||||||
|
<translation type="vanished">Stop server</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Funds income</source>
|
||||||
|
<translation type="vanished">Funds income</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Funds return</source>
|
||||||
|
<translation type="vanished">Funds return</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Funds spend</source>
|
||||||
|
<translation type="vanished">Funds spend</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Spends return</source>
|
||||||
|
<translation type="vanished">Spends return</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Use your phone as a QR code scanner</source>
|
||||||
|
<translation type="vanished">Use your phone as a QR code scanner</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>FN (Fiscal Number)</source>
|
||||||
|
<translation type="vanished">FN (Fiscal Number)</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>FI (Fiscal Identifier)</source>
|
||||||
|
<translation type="vanished">FI (Fiscal Identifier)</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Choose image on your PC</source>
|
||||||
|
<translation type="vanished">Choose image on your PC</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Operation type</source>
|
||||||
|
<translation type="vanished">Operation type</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Parse</source>
|
||||||
|
<translation type="vanished">Parse</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<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't lucky, please, contact the developer.</source>
|
||||||
|
<translation type="vanished">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.</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Could not start http server.</source>
|
||||||
|
<translation type="vanished">Could not start http server.</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Please, select a picture where QR code that contains info about check is present</source>
|
||||||
|
<translation type="vanished">Please, select a picture where QR code that contains info about check is present</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Picture was not selected</source>
|
||||||
|
<translation type="vanished">Picture was not selected</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Selected image: </source>
|
||||||
|
<translation type="vanished">Selected image: </translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Captcha was not solved correctly!</source>
|
<source>Captcha was not solved correctly!</source>
|
||||||
|
@ -186,250 +465,16 @@
|
||||||
<translation type="vanished">Check not found. Please, ensure correctness of entered data.</translation>
|
<translation type="vanished">Check not found. Please, ensure correctness of entered data.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer.</source>
|
|
||||||
<translation type="vanished">An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer.</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Error in parsing</source>
|
|
||||||
<translation type="vanished">Error in parsing</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Please, select a picture where QR code that contains info about check is present</source>
|
|
||||||
<translation type="vanished">Please, select a picture where QR code that contains info about check is present</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Picture was not selected</source>
|
|
||||||
<translation type="vanished">Picture was not selected</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Please, select a picture to scan</source>
|
|
||||||
<translation type="vanished">Please, select a picture to scan</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/mainwindow.ui" line="26"/>
|
|
||||||
<source>Form</source>
|
|
||||||
<translation>Form</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/mainwindow.ui" line="37"/>
|
|
||||||
<source>Optical Character Recognition</source>
|
|
||||||
<translation>Optical Character Recognition</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/mainwindow.ui" line="63"/>
|
|
||||||
<source>Text from E-Mail</source>
|
|
||||||
<translation>Text from E-Mail</translation>
|
|
||||||
</message>
|
|
||||||
</context>
|
|
||||||
<context>
|
|
||||||
<name>OCRScene</name>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ocrscene.ui" line="20"/>
|
|
||||||
<source>Form</source>
|
|
||||||
<translation>Form</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ocrscene.ui" line="64"/>
|
|
||||||
<source>Choose</source>
|
|
||||||
<translation>Choose</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ocrscene.ui" line="103"/>
|
|
||||||
<source>Path to image:</source>
|
|
||||||
<translation>Path to image:</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ocrscene.ui" line="119"/>
|
|
||||||
<source>Store:</source>
|
|
||||||
<translation>Store:</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<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>
|
|
||||||
<translation>Recognized text will be shown below as soon as image will be processed. Please, edit it</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ocrscene.ui" line="77"/>
|
|
||||||
<source>Back</source>
|
|
||||||
<translation>Back</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ocrscene.ui" line="45"/>
|
|
||||||
<source>Parse</source>
|
|
||||||
<translation>Parse</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../ocrscene.cpp" line="36"/>
|
|
||||||
<source>An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer.</source>
|
|
||||||
<translation>An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer.</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../ocrscene.cpp" line="38"/>
|
|
||||||
<source>Error in parsing</source>
|
|
||||||
<translation>Error in parsing</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../ocrscene.cpp" line="56"/>
|
|
||||||
<source>Please, select a picture to scan</source>
|
|
||||||
<translation>Please, select a picture to scan</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../ocrscene.cpp" line="58"/>
|
|
||||||
<source>Picture was not selected</source>
|
|
||||||
<translation>Picture was not selected</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../ocrscene.cpp" line="64"/>
|
|
||||||
<source>Path to image: </source>
|
|
||||||
<translation>Path to image: </translation>
|
|
||||||
</message>
|
|
||||||
</context>
|
|
||||||
<context>
|
|
||||||
<name>OFDScene</name>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ofdscene.ui" line="14"/>
|
|
||||||
<source>Form</source>
|
|
||||||
<translation>Form</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ofdscene.ui" line="23"/>
|
|
||||||
<source>Total</source>
|
|
||||||
<translation>Total</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ofdscene.ui" line="36"/>
|
|
||||||
<source>Back</source>
|
|
||||||
<translation>Back</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ofdscene.ui" line="49"/>
|
|
||||||
<source>or</source>
|
|
||||||
<translation>or</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ofdscene.ui" line="69"/>
|
|
||||||
<source>FD (Fiscal Document)</source>
|
|
||||||
<translation>FD (Fiscal Document)</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ofdscene.ui" line="76"/>
|
|
||||||
<source>Date and time of purchase</source>
|
|
||||||
<translation>Date and time of purchase</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ofdscene.ui" line="84"/>
|
|
||||||
<source>Funds income</source>
|
|
||||||
<translation>Funds income</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ofdscene.ui" line="89"/>
|
|
||||||
<source>Funds return</source>
|
|
||||||
<translation>Funds return</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ofdscene.ui" line="94"/>
|
|
||||||
<source>Funds spend</source>
|
|
||||||
<translation>Funds spend</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ofdscene.ui" line="99"/>
|
|
||||||
<source>Spends return</source>
|
|
||||||
<translation>Spends return</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ofdscene.ui" line="136"/>
|
|
||||||
<source>Use your phone as a QR code scanner</source>
|
|
||||||
<translation>Use your phone as a QR code scanner</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ofdscene.ui" line="149"/>
|
|
||||||
<source>FN (Fiscal Number)</source>
|
|
||||||
<translation>FN (Fiscal Number)</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ofdscene.ui" line="156"/>
|
|
||||||
<source>FI (Fiscal Identifier)</source>
|
|
||||||
<translation>FI (Fiscal Identifier)</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ofdscene.ui" line="166"/>
|
|
||||||
<source>Choose image on your PC</source>
|
|
||||||
<translation>Choose image on your PC</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ofdscene.ui" line="173"/>
|
|
||||||
<source>Operation type</source>
|
|
||||||
<translation>Operation type</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ofdscene.ui" line="186"/>
|
|
||||||
<source>Parse</source>
|
|
||||||
<translation>Parse</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<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'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>
|
|
||||||
<translation>Please, select a picture where QR code that contains info about check is present</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../ofdscene.cpp" line="86"/>
|
|
||||||
<source>Picture was not selected</source>
|
|
||||||
<translation>Picture was not selected</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../ofdscene.cpp" line="91"/>
|
|
||||||
<source>Selected image: </source>
|
|
||||||
<translation>Selected image: </translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../ofdscene.cpp" line="150"/>
|
|
||||||
<source>Captcha was not solved correctly!</source>
|
|
||||||
<translation>Captcha was not solved correctly!</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../ofdscene.cpp" line="152"/>
|
|
||||||
<source>Captcha is incorrect</source>
|
|
||||||
<translation>Captcha is incorrect</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../ofdscene.cpp" line="157"/>
|
|
||||||
<source>Internal server error. Please, try again later.</source>
|
|
||||||
<translation>Internal server error. Please, try again later.</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../ofdscene.cpp" line="159"/>
|
|
||||||
<source>Internal server error</source>
|
|
||||||
<translation>Internal server error</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../ofdscene.cpp" line="164"/>
|
|
||||||
<source>Check not found. Please, ensure correctness of entered data.</source>
|
|
||||||
<translation>Check not found. Please, ensure correctness of entered data.</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../ofdscene.cpp" line="166"/>
|
|
||||||
<source>Check was not found</source>
|
<source>Check was not found</source>
|
||||||
<translation>Check was not found</translation>
|
<translation type="vanished">Check was not found</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ofdscene.cpp" line="198"/>
|
|
||||||
<source>QR code for binaryeye to connect</source>
|
<source>QR code for binaryeye to connect</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="vanished">QR code for binaryeye to connect</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ofdscene.cpp" line="199"/>
|
|
||||||
<source>I've scanned</source>
|
<source>I've scanned</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="vanished">I've scanned</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>123 123</source>
|
<source>123 123</source>
|
||||||
|
@ -549,15 +594,25 @@
|
||||||
<translation>Print total</translation>
|
<translation>Print total</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>QObject</name>
|
||||||
|
<message>
|
||||||
|
<location filename="../main.cpp" line="60"/>
|
||||||
|
<source>Using locale: </source>
|
||||||
|
<translation>Using locale: </translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>SettingsDialog</name>
|
<name>SettingsDialog</name>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../settingsdialog.cpp" line="133"/>
|
||||||
<source>You need to restart program to apply language changes</source>
|
<source>You need to restart program to apply language changes</source>
|
||||||
<translation type="vanished">You need to restart program to apply language changes</translation>
|
<translation>You need to restart program to apply language changes</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../settingsdialog.cpp" line="135"/>
|
||||||
<source>Restart required</source>
|
<source>Restart required</source>
|
||||||
<translation type="vanished">Restart required</translation>
|
<translation>Restart required</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
|
@ -568,12 +623,12 @@
|
||||||
<translation>Dialog</translation>
|
<translation>Dialog</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../solvecaptchadialog.cpp" line="23"/>
|
<location filename="../solvecaptchadialog.cpp" line="22"/>
|
||||||
<source>Please, enter a valid captcha</source>
|
<source>Please, enter a valid captcha</source>
|
||||||
<translation>Please, enter a valid captcha</translation>
|
<translation>Please, enter a valid captcha</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../solvecaptchadialog.cpp" line="25"/>
|
<location filename="../solvecaptchadialog.cpp" line="24"/>
|
||||||
<source>No captcha</source>
|
<source>No captcha</source>
|
||||||
<translation>No captcha</translation>
|
<translation>No captcha</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -581,56 +636,71 @@
|
||||||
<context>
|
<context>
|
||||||
<name>settingsdialog</name>
|
<name>settingsdialog</name>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/settingsdialog.ui" line="14"/>
|
||||||
<source>Dialog</source>
|
<source>Dialog</source>
|
||||||
<translation type="vanished">Dialog</translation>
|
<translation>Dialog</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/settingsdialog.ui" line="155"/>
|
||||||
<source>Goods name position</source>
|
<source>Goods name position</source>
|
||||||
<translation type="vanished">Goods name position</translation>
|
<translation>Goods name position</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/settingsdialog.ui" line="64"/>
|
||||||
<source>Goods price per unit alias</source>
|
<source>Goods price per unit alias</source>
|
||||||
<translation type="vanished">Goods price per unit alias</translation>
|
<translation>Goods price per unit alias</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../scenes/settingsdialog.ui" line="50"/>
|
||||||
|
<source>Language</source>
|
||||||
|
<translation>Language</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>TextLabel</source>
|
<source>TextLabel</source>
|
||||||
<translation type="vanished">Language</translation>
|
<translation type="vanished">Language</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/settingsdialog.ui" line="132"/>
|
||||||
<source>en_US</source>
|
<source>en_US</source>
|
||||||
<translation type="vanished">en_US</translation>
|
<translation>en_US</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/settingsdialog.ui" line="137"/>
|
||||||
<source>ru_RU</source>
|
<source>ru_RU</source>
|
||||||
<translation type="vanished">ru_RU</translation>
|
<translation>ru_RU</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Choose</source>
|
<source>Choose</source>
|
||||||
<translation type="vanished">Choose</translation>
|
<translation type="vanished">Choose</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/settingsdialog.ui" line="104"/>
|
||||||
<source>Print header</source>
|
<source>Print header</source>
|
||||||
<translation type="vanished">Print header</translation>
|
<translation>Print header</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/settingsdialog.ui" line="57"/>
|
||||||
<source>Goods net weight alias</source>
|
<source>Goods net weight alias</source>
|
||||||
<translation type="vanished">Goods net weight alias</translation>
|
<translation>Goods net weight alias</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Stores modules url</source>
|
<source>Stores modules url</source>
|
||||||
<translation type="vanished">Stores modules url</translation>
|
<translation type="vanished">Stores modules url</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/settingsdialog.ui" line="97"/>
|
||||||
<source>Goods total alias</source>
|
<source>Goods total alias</source>
|
||||||
<translation type="vanished">Goods total alias</translation>
|
<translation>Goods total alias</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/settingsdialog.ui" line="81"/>
|
||||||
<source>Goods name alias</source>
|
<source>Goods name alias</source>
|
||||||
<translation type="vanished">Goods name alias</translation>
|
<translation>Goods name alias</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/settingsdialog.ui" line="37"/>
|
||||||
<source>Goods quantity alias</source>
|
<source>Goods quantity alias</source>
|
||||||
<translation type="vanished">Goods quantity alias</translation>
|
<translation>Goods quantity alias</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Stores modules directory</source>
|
<source>Stores modules directory</source>
|
||||||
|
@ -641,28 +711,33 @@
|
||||||
<translation type="vanished">OFD modules directory</translation>
|
<translation type="vanished">OFD modules directory</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/settingsdialog.ui" line="169"/>
|
||||||
<source>Goods price per unit position</source>
|
<source>Goods price per unit position</source>
|
||||||
<translation type="vanished">Goods price per unit position</translation>
|
<translation>Goods price per unit position</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/settingsdialog.ui" line="124"/>
|
||||||
<source>Goods net weight position</source>
|
<source>Goods net weight position</source>
|
||||||
<translation type="vanished">Goods net weight position</translation>
|
<translation>Goods net weight position</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>OFD modules url</source>
|
<source>OFD modules url</source>
|
||||||
<translation type="vanished">OFD modules url</translation>
|
<translation type="vanished">OFD modules url</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/settingsdialog.ui" line="114"/>
|
||||||
<source>Goods total position</source>
|
<source>Goods total position</source>
|
||||||
<translation type="vanished">Goods total position</translation>
|
<translation>Goods total position</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/settingsdialog.ui" line="145"/>
|
||||||
<source>Goods quantity position</source>
|
<source>Goods quantity position</source>
|
||||||
<translation type="vanished">Goods quantity position</translation>
|
<translation>Goods quantity position</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/settingsdialog.ui" line="74"/>
|
||||||
<source>Print total</source>
|
<source>Print total</source>
|
||||||
<translation type="vanished">Print total</translation>
|
<translation>Print total</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<translation>Диалог</translation>
|
<translation>Диалог</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../scenes/adjustpicturedialog.ui" line="58"/>
|
<location filename="../scenes/adjustpicturedialog.ui" line="33"/>
|
||||||
<source>Please, zoom to qr code and adjust contrast so that qr code looks sharp</source>
|
<source>Please, zoom to qr code and adjust contrast so that qr code looks sharp</source>
|
||||||
<translation>Пожалуйста, приблизьте QR код и настройте контраст, чтобы он читался</translation>
|
<translation>Пожалуйста, приблизьте QR код и настройте контраст, чтобы он читался</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -27,43 +27,36 @@
|
||||||
<context>
|
<context>
|
||||||
<name>EmailTextScene</name>
|
<name>EmailTextScene</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../scenes/emailtextscene.ui" line="14"/>
|
|
||||||
<source>Form</source>
|
<source>Form</source>
|
||||||
<translation>Форма</translation>
|
<translation type="vanished">Форма</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Store type</source>
|
<source>Store type</source>
|
||||||
<translation type="obsolete">Магазин</translation>
|
<translation type="obsolete">Магазин</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../scenes/emailtextscene.ui" line="26"/>
|
|
||||||
<source>Check content</source>
|
<source>Check content</source>
|
||||||
<translation>Контент чека</translation>
|
<translation type="vanished">Контент чека</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../scenes/emailtextscene.ui" line="33"/>
|
|
||||||
<source>Parse</source>
|
<source>Parse</source>
|
||||||
<translation>Парсить</translation>
|
<translation type="vanished">Парсить</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../scenes/emailtextscene.ui" line="46"/>
|
|
||||||
<source>Store:</source>
|
<source>Store:</source>
|
||||||
<translation>Магазин:</translation>
|
<translation type="vanished">Магазин:</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../scenes/emailtextscene.ui" line="62"/>
|
|
||||||
<source>Back</source>
|
<source>Back</source>
|
||||||
<translation>Назад</translation>
|
<translation type="vanished">Назад</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<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>Произошла ошибка. Чек был прочитан неверно. Размеры векторов различаются. Пожалуйста, сообщите об этом разработчику.</translation>
|
<translation type="vanished">Произошла ошибка. Чек был прочитан неверно. Размеры векторов различаются. Пожалуйста, сообщите об этом разработчику.</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../emailtextscene.cpp" line="33"/>
|
|
||||||
<source>Error in parsing</source>
|
<source>Error in parsing</source>
|
||||||
<translation>Ошибка в парсинге</translation>
|
<translation type="vanished">Ошибка в парсинге</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
|
@ -77,8 +70,9 @@
|
||||||
<translation type="vanished">Магазин</translation>
|
<translation type="vanished">Магазин</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="51"/>
|
||||||
<source>Parse</source>
|
<source>Parse</source>
|
||||||
<translation type="vanished">Парсить</translation>
|
<translation>Парсить</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Preferences</source>
|
<source>Preferences</source>
|
||||||
|
@ -119,23 +113,272 @@
|
||||||
<translation type="vanished">0000000000000000</translation>
|
<translation type="vanished">0000000000000000</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="77"/>
|
||||||
<source>FN (Fiscal Number)</source>
|
<source>FN (Fiscal Number)</source>
|
||||||
<translatorcomment>Фискальный Норма</translatorcomment>
|
<translatorcomment>Фискальный Норма</translatorcomment>
|
||||||
<translation type="vanished">ФН</translation>
|
<translation>ФН</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="64"/>
|
||||||
<source>FD (Fiscal Document)</source>
|
<source>FD (Fiscal Document)</source>
|
||||||
<translatorcomment>Фискальный Документ</translatorcomment>
|
<translatorcomment>Фискальный Документ</translatorcomment>
|
||||||
<translation type="vanished">ФД</translation>
|
<translation>ФД</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>0000000000</source>
|
<source>0000000000</source>
|
||||||
<translation type="vanished">000000000</translation>
|
<translation type="vanished">000000000</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<source>Back</source>
|
||||||
|
<translation type="obsolete">Назад</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="130"/>
|
||||||
|
<source>Stop server</source>
|
||||||
|
<translation>Остановить сервер</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="143"/>
|
||||||
|
<source>Choose image on your PC</source>
|
||||||
|
<translation>Выбрать изображение на компьютере</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="38"/>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="183"/>
|
||||||
|
<source>or</source>
|
||||||
|
<translation>или</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="97"/>
|
||||||
|
<source>Use your phone as a QR code scanner</source>
|
||||||
|
<translation>Использовать телефон как сканнер QR</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="157"/>
|
||||||
<source>FI (Fiscal Identifier)</source>
|
<source>FI (Fiscal Identifier)</source>
|
||||||
<translatorcomment>Фискальный Признак</translatorcomment>
|
<translatorcomment>Фискальный Признак</translatorcomment>
|
||||||
<translation type="vanished">ФП</translation>
|
<translation>ФП</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="117"/>
|
||||||
|
<source>Date and time of purchase</source>
|
||||||
|
<translation>Дата и время покупки</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="84"/>
|
||||||
|
<source>Operation type</source>
|
||||||
|
<translation>Тип операции</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="170"/>
|
||||||
|
<source>Parse an E-Mail</source>
|
||||||
|
<translation>Парсить E-Mail</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="210"/>
|
||||||
|
<source>Funds income</source>
|
||||||
|
<translation>Приход средств</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="215"/>
|
||||||
|
<source>Funds return</source>
|
||||||
|
<translation>Возврат средств</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="220"/>
|
||||||
|
<source>Funds spend</source>
|
||||||
|
<translation>Расход средств</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="225"/>
|
||||||
|
<source>Spends return</source>
|
||||||
|
<translation>Возврат расхода</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="246"/>
|
||||||
|
<source>Settings</source>
|
||||||
|
<translation>Настройки</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="150"/>
|
||||||
|
<source>Total</source>
|
||||||
|
<translation>Итого</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>checks parser</source>
|
||||||
|
<translation type="vanished">Парсер чеков</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="91"/>
|
||||||
|
<source>QR code for binaryeye to connect</source>
|
||||||
|
<translation>QR код для подключения BinaryEye</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="92"/>
|
||||||
|
<source>I've scanned</source>
|
||||||
|
<translation>Просканировал</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="98"/>
|
||||||
|
<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't lucky, please, contact the developer.</source>
|
||||||
|
<translation>Не смог поднять HTTP сервер. 10 раз подряд случайно выбранный порт был занят. Либо Вам следует бежать за лоттерейным билетом, или в программе баг. Если лотерейный билет не был выигрышным, пожалуйста, сообщите разработчику.</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="100"/>
|
||||||
|
<source>Could not start http server.</source>
|
||||||
|
<translation>Не получилось запустить HTTP сервер.</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="144"/>
|
||||||
|
<source>Selected image: </source>
|
||||||
|
<translation>Выбранное изображение: </translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="204"/>
|
||||||
|
<source>Captcha was not solved correctly!</source>
|
||||||
|
<translation>Капча была решена неверно!</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="206"/>
|
||||||
|
<source>Captcha is incorrect</source>
|
||||||
|
<translation>Капча введена неверно</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="211"/>
|
||||||
|
<source>Internal server error. Please, try again later.</source>
|
||||||
|
<translation>Внутренняя ошибка сервера. Пожалуйста, попробуйте снова позже.</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="213"/>
|
||||||
|
<source>Internal server error</source>
|
||||||
|
<translation>Внутренняя ошибка сервера</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="218"/>
|
||||||
|
<source>Check not found. Please, ensure correctness of entered data.</source>
|
||||||
|
<translation>Чек не найден. Пожалуйста, убедитесь в правильности введённых данных.</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="220"/>
|
||||||
|
<source>Check was not found</source>
|
||||||
|
<translation>Чек не найден</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer.</source>
|
||||||
|
<translation type="vanished">Произошла ошибка. Чек был прочитан неверно. Размеры векторов различаются. Пожалуйста, сообщите об этом разработчику.</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Error in parsing</source>
|
||||||
|
<translation type="vanished">Ошибка в парсинге</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="137"/>
|
||||||
|
<source>Please, select a picture where QR code that contains info about check is present</source>
|
||||||
|
<translation>Пожалуйста, выберете изображение, содержащее QR код с информацией о чеке</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="139"/>
|
||||||
|
<source>Picture was not selected</source>
|
||||||
|
<translation>Изображение не было выбрано</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Please, select a picture to scan</source>
|
||||||
|
<translation type="vanished">Пожалуйста, выберете изображение для сканирования</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../scenes/mainwindow.ui" line="26"/>
|
||||||
|
<source>Form</source>
|
||||||
|
<translation>Форма</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Optical Character Recognition</source>
|
||||||
|
<translation type="vanished">Оптическое распознавание символов</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Text from E-Mail</source>
|
||||||
|
<translation type="vanished">Текст из электронного письма</translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>OCRScene</name>
|
||||||
|
<message>
|
||||||
|
<source>Form</source>
|
||||||
|
<translation type="vanished">Форма</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Choose</source>
|
||||||
|
<translation type="vanished">Выбрать</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Path to image:</source>
|
||||||
|
<translation type="vanished">Путь к изображению:</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Store:</source>
|
||||||
|
<translation type="vanished">Магазин:</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Recognized text will be shown below as soon as image will be processed. Please, edit it</source>
|
||||||
|
<translation type="vanished">Распознанный текст будет показан ниже как только изображение обработается. Пожалуйста, отредактируйте</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Back</source>
|
||||||
|
<translation type="vanished">Назад</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Parse</source>
|
||||||
|
<translation type="vanished">Парсить</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer.</source>
|
||||||
|
<translation type="vanished">Произошла ошибка. Чек был прочитан неверно. Размеры векторов различаются. Пожалуйста, сообщите об этом разработчику.</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Error in parsing</source>
|
||||||
|
<translation type="vanished">Ошибка в парсинге</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Please, select a picture to scan</source>
|
||||||
|
<translation type="vanished">Пожалуйста, выберете изображение для сканирования</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Picture was not selected</source>
|
||||||
|
<translation type="vanished">Изображение не было выбрано</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Path to image: </source>
|
||||||
|
<translation type="vanished">Путь к изображению: </translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>OFDScene</name>
|
||||||
|
<message>
|
||||||
|
<source>Form</source>
|
||||||
|
<translation type="vanished">Форма</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Total</source>
|
||||||
|
<translation type="vanished">Итого</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Back</source>
|
||||||
|
<translation type="vanished">Назад</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>or</source>
|
||||||
|
<translation type="vanished">или</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>FD (Fiscal Document)</source>
|
||||||
|
<translation type="vanished">ФД</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Date and time of purchase</source>
|
||||||
|
<translation type="vanished">Дата и время покупки</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Stop server</source>
|
||||||
|
<translation type="vanished">Остановить сервер</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Funds income</source>
|
<source>Funds income</source>
|
||||||
|
@ -154,12 +397,48 @@
|
||||||
<translation type="vanished">Возврат расхода</translation>
|
<translation type="vanished">Возврат расхода</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Total</source>
|
<source>Use your phone as a QR code scanner</source>
|
||||||
<translation type="vanished">Итого</translation>
|
<translation type="vanished">Использовать телефон как сканнер QR</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>checks parser</source>
|
<source>FN (Fiscal Number)</source>
|
||||||
<translation type="vanished">Парсер чеков</translation>
|
<translation type="vanished">ФН</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>FI (Fiscal Identifier)</source>
|
||||||
|
<translation type="vanished">ФП</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Choose image on your PC</source>
|
||||||
|
<translation type="vanished">Выбрать изображение на компьютере</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Operation type</source>
|
||||||
|
<translation type="vanished">Тип операции</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Parse</source>
|
||||||
|
<translation type="vanished">Парсить</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<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't lucky, please, contact the developer.</source>
|
||||||
|
<translation type="vanished">Не смог поднять HTTP сервер. 10 раз подряд случайно выбранный порт был занят. Либо Вам следует бежать за лоттерейным билетом, или в программе баг. Если лотерейный билет не был выигрышным, пожалуйста, сообщите разработчику.</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Could not start http server.</source>
|
||||||
|
<translation type="vanished">Не получилось запустить HTTP сервер.</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Please, select a picture where QR code that contains info about check is present</source>
|
||||||
|
<translation type="vanished">Пожалуйста, выберете изображение, содержащее QR код с информацией о чеке</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Picture was not selected</source>
|
||||||
|
<translation type="vanished">Изображение не было выбрано</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Selected image: </source>
|
||||||
|
<translation type="vanished">Выбранное изображение: </translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Captcha was not solved correctly!</source>
|
<source>Captcha was not solved correctly!</source>
|
||||||
|
@ -186,250 +465,12 @@
|
||||||
<translation type="vanished">Чек не найден</translation>
|
<translation type="vanished">Чек не найден</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer.</source>
|
|
||||||
<translation type="vanished">Произошла ошибка. Чек был прочитан неверно. Размеры векторов различаются. Пожалуйста, сообщите об этом разработчику.</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Error in parsing</source>
|
|
||||||
<translation type="vanished">Ошибка в парсинге</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Please, select a picture where QR code that contains info about check is present</source>
|
|
||||||
<translation type="vanished">Пожалуйста, выберете изображение, содержащее QR код с информацией о чеке</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Picture was not selected</source>
|
|
||||||
<translation type="vanished">Изображение не было выбрано</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>Please, select a picture to scan</source>
|
|
||||||
<translation type="vanished">Пожалуйста, выберете изображение для сканирования</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/mainwindow.ui" line="26"/>
|
|
||||||
<source>Form</source>
|
|
||||||
<translation>Форма</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/mainwindow.ui" line="37"/>
|
|
||||||
<source>Optical Character Recognition</source>
|
|
||||||
<translation>Оптическое распознавание символов</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/mainwindow.ui" line="63"/>
|
|
||||||
<source>Text from E-Mail</source>
|
|
||||||
<translation>Текст из электронного письма</translation>
|
|
||||||
</message>
|
|
||||||
</context>
|
|
||||||
<context>
|
|
||||||
<name>OCRScene</name>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ocrscene.ui" line="20"/>
|
|
||||||
<source>Form</source>
|
|
||||||
<translation>Форма</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ocrscene.ui" line="64"/>
|
|
||||||
<source>Choose</source>
|
|
||||||
<translation>Выбрать</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ocrscene.ui" line="103"/>
|
|
||||||
<source>Path to image:</source>
|
|
||||||
<translation>Путь к изображению:</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ocrscene.ui" line="119"/>
|
|
||||||
<source>Store:</source>
|
|
||||||
<translation>Магазин:</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<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>
|
|
||||||
<translation>Распознанный текст будет показан ниже как только изображение обработается. Пожалуйста, отредактируйте</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ocrscene.ui" line="77"/>
|
|
||||||
<source>Back</source>
|
|
||||||
<translation>Назад</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ocrscene.ui" line="45"/>
|
|
||||||
<source>Parse</source>
|
|
||||||
<translation>Парсить</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../ocrscene.cpp" line="36"/>
|
|
||||||
<source>An error has occured. Check was matched incorrectly. Vector sizes are different. Please, contact the developer.</source>
|
|
||||||
<translation>Произошла ошибка. Чек был прочитан неверно. Размеры векторов различаются. Пожалуйста, сообщите об этом разработчику.</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../ocrscene.cpp" line="38"/>
|
|
||||||
<source>Error in parsing</source>
|
|
||||||
<translation>Ошибка в парсинге</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../ocrscene.cpp" line="56"/>
|
|
||||||
<source>Please, select a picture to scan</source>
|
|
||||||
<translation>Пожалуйста, выберете изображение для сканирования</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../ocrscene.cpp" line="58"/>
|
|
||||||
<source>Picture was not selected</source>
|
|
||||||
<translation>Изображение не было выбрано</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../ocrscene.cpp" line="64"/>
|
|
||||||
<source>Path to image: </source>
|
|
||||||
<translation>Путь к изображению: </translation>
|
|
||||||
</message>
|
|
||||||
</context>
|
|
||||||
<context>
|
|
||||||
<name>OFDScene</name>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ofdscene.ui" line="14"/>
|
|
||||||
<source>Form</source>
|
|
||||||
<translation>Форма</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ofdscene.ui" line="23"/>
|
|
||||||
<source>Total</source>
|
|
||||||
<translation>Итого</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ofdscene.ui" line="36"/>
|
|
||||||
<source>Back</source>
|
|
||||||
<translation>Назад</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ofdscene.ui" line="49"/>
|
|
||||||
<source>or</source>
|
|
||||||
<translation>или</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ofdscene.ui" line="69"/>
|
|
||||||
<source>FD (Fiscal Document)</source>
|
|
||||||
<translation>ФД</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ofdscene.ui" line="76"/>
|
|
||||||
<source>Date and time of purchase</source>
|
|
||||||
<translation>Дата и время покупки</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ofdscene.ui" line="84"/>
|
|
||||||
<source>Funds income</source>
|
|
||||||
<translation>Приход средств</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ofdscene.ui" line="89"/>
|
|
||||||
<source>Funds return</source>
|
|
||||||
<translation>Возврат средств</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ofdscene.ui" line="94"/>
|
|
||||||
<source>Funds spend</source>
|
|
||||||
<translation>Расход средств</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ofdscene.ui" line="99"/>
|
|
||||||
<source>Spends return</source>
|
|
||||||
<translation>Возврат расхода</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ofdscene.ui" line="136"/>
|
|
||||||
<source>Use your phone as a QR code scanner</source>
|
|
||||||
<translation>Использовать телефон как сканнер QR</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ofdscene.ui" line="149"/>
|
|
||||||
<source>FN (Fiscal Number)</source>
|
|
||||||
<translation>ФН</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ofdscene.ui" line="156"/>
|
|
||||||
<source>FI (Fiscal Identifier)</source>
|
|
||||||
<translation>ФП</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ofdscene.ui" line="166"/>
|
|
||||||
<source>Choose image on your PC</source>
|
|
||||||
<translation>Выбрать изображение на компьютере</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ofdscene.ui" line="173"/>
|
|
||||||
<source>Operation type</source>
|
|
||||||
<translation>Тип операции</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../scenes/ofdscene.ui" line="186"/>
|
|
||||||
<source>Parse</source>
|
|
||||||
<translation>Парсить</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<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'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>
|
|
||||||
<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>
|
|
||||||
<translation>Капча была решена неверно!</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../ofdscene.cpp" line="152"/>
|
|
||||||
<source>Captcha is incorrect</source>
|
|
||||||
<translation>Капча введена неверно</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../ofdscene.cpp" line="157"/>
|
|
||||||
<source>Internal server error. Please, try again later.</source>
|
|
||||||
<translation>Внутренняя ошибка сервера. Пожалуйста, попробуйте снова позже.</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../ofdscene.cpp" line="159"/>
|
|
||||||
<source>Internal server error</source>
|
|
||||||
<translation>Внутренняя ошибка сервера</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../ofdscene.cpp" line="164"/>
|
|
||||||
<source>Check not found. Please, ensure correctness of entered data.</source>
|
|
||||||
<translation>Чек не найден. Пожалуйста, убедитесь в правильности введённых данных.</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../ofdscene.cpp" line="166"/>
|
|
||||||
<source>Check was not found</source>
|
|
||||||
<translation>Чек не найден</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<location filename="../ofdscene.cpp" line="198"/>
|
|
||||||
<source>QR code for binaryeye to connect</source>
|
<source>QR code for binaryeye to connect</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="vanished">QR код для подключения BinaryEye</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../ofdscene.cpp" line="199"/>
|
|
||||||
<source>I've scanned</source>
|
<source>I've scanned</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="vanished">Просканировал</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>123 123</source>
|
<source>123 123</source>
|
||||||
|
@ -549,15 +590,25 @@
|
||||||
<translation>Печатать Итого</translation>
|
<translation>Печатать Итого</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
|
<context>
|
||||||
|
<name>QObject</name>
|
||||||
|
<message>
|
||||||
|
<location filename="../main.cpp" line="60"/>
|
||||||
|
<source>Using locale: </source>
|
||||||
|
<translation>Использую локаль: </translation>
|
||||||
|
</message>
|
||||||
|
</context>
|
||||||
<context>
|
<context>
|
||||||
<name>SettingsDialog</name>
|
<name>SettingsDialog</name>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../settingsdialog.cpp" line="133"/>
|
||||||
<source>You need to restart program to apply language changes</source>
|
<source>You need to restart program to apply language changes</source>
|
||||||
<translation type="vanished">Требуется перезагрузить программу, чтобы применить изменения языка</translation>
|
<translation>Требуется перезагрузить программу, чтобы применить изменения языка</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../settingsdialog.cpp" line="135"/>
|
||||||
<source>Restart required</source>
|
<source>Restart required</source>
|
||||||
<translation type="vanished">Требуется перезагрузка</translation>
|
<translation>Требуется перезагрузка</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
<context>
|
<context>
|
||||||
|
@ -568,12 +619,12 @@
|
||||||
<translation>Диалог</translation>
|
<translation>Диалог</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../solvecaptchadialog.cpp" line="23"/>
|
<location filename="../solvecaptchadialog.cpp" line="22"/>
|
||||||
<source>Please, enter a valid captcha</source>
|
<source>Please, enter a valid captcha</source>
|
||||||
<translation>Пожалуйста, введите верную капчу</translation>
|
<translation>Пожалуйста, введите верную капчу</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../solvecaptchadialog.cpp" line="25"/>
|
<location filename="../solvecaptchadialog.cpp" line="24"/>
|
||||||
<source>No captcha</source>
|
<source>No captcha</source>
|
||||||
<translation>Нет капчи</translation>
|
<translation>Нет капчи</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -581,56 +632,71 @@
|
||||||
<context>
|
<context>
|
||||||
<name>settingsdialog</name>
|
<name>settingsdialog</name>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/settingsdialog.ui" line="14"/>
|
||||||
<source>Dialog</source>
|
<source>Dialog</source>
|
||||||
<translation type="vanished">Диалог</translation>
|
<translation>Диалог</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/settingsdialog.ui" line="155"/>
|
||||||
<source>Goods name position</source>
|
<source>Goods name position</source>
|
||||||
<translation type="vanished">Позиция имени товара</translation>
|
<translation>Позиция имени товара</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/settingsdialog.ui" line="64"/>
|
||||||
<source>Goods price per unit alias</source>
|
<source>Goods price per unit alias</source>
|
||||||
<translation type="vanished">Алиас цены товара</translation>
|
<translation>Алиас цены товара</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../scenes/settingsdialog.ui" line="50"/>
|
||||||
|
<source>Language</source>
|
||||||
|
<translation>Язык</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>TextLabel</source>
|
<source>TextLabel</source>
|
||||||
<translation type="vanished">Язык</translation>
|
<translation type="vanished">Язык</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/settingsdialog.ui" line="132"/>
|
||||||
<source>en_US</source>
|
<source>en_US</source>
|
||||||
<translation type="vanished">en_US</translation>
|
<translation>en_US</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/settingsdialog.ui" line="137"/>
|
||||||
<source>ru_RU</source>
|
<source>ru_RU</source>
|
||||||
<translation type="vanished">ru_RU</translation>
|
<translation>ru_RU</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Choose</source>
|
<source>Choose</source>
|
||||||
<translation type="vanished">Выбрать</translation>
|
<translation type="vanished">Выбрать</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/settingsdialog.ui" line="104"/>
|
||||||
<source>Print header</source>
|
<source>Print header</source>
|
||||||
<translation type="vanished">Печатать заголовок</translation>
|
<translation>Печатать заголовок</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/settingsdialog.ui" line="57"/>
|
||||||
<source>Goods net weight alias</source>
|
<source>Goods net weight alias</source>
|
||||||
<translation type="vanished">Алиас массы нетто товара</translation>
|
<translation>Алиас массы нетто товара</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Stores modules url</source>
|
<source>Stores modules url</source>
|
||||||
<translation type="vanished">URL модулей магазина</translation>
|
<translation type="vanished">URL модулей магазина</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/settingsdialog.ui" line="97"/>
|
||||||
<source>Goods total alias</source>
|
<source>Goods total alias</source>
|
||||||
<translation type="vanished">Алиас всего за продукт</translation>
|
<translation>Алиас всего за продукт</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/settingsdialog.ui" line="81"/>
|
||||||
<source>Goods name alias</source>
|
<source>Goods name alias</source>
|
||||||
<translation type="vanished">Алиас имени товара</translation>
|
<translation>Алиас имени товара</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/settingsdialog.ui" line="37"/>
|
||||||
<source>Goods quantity alias</source>
|
<source>Goods quantity alias</source>
|
||||||
<translation type="vanished">Алиас количества товара</translation>
|
<translation>Алиас количества товара</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Stores modules directory</source>
|
<source>Stores modules directory</source>
|
||||||
|
@ -641,28 +707,33 @@
|
||||||
<translation type="vanished">Директория модулей ОФД</translation>
|
<translation type="vanished">Директория модулей ОФД</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/settingsdialog.ui" line="169"/>
|
||||||
<source>Goods price per unit position</source>
|
<source>Goods price per unit position</source>
|
||||||
<translation type="vanished">Позиция центы товара</translation>
|
<translation>Позиция центы товара</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/settingsdialog.ui" line="124"/>
|
||||||
<source>Goods net weight position</source>
|
<source>Goods net weight position</source>
|
||||||
<translation type="vanished">Позиция массы нетто товара</translation>
|
<translation>Позиция массы нетто товара</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>OFD modules url</source>
|
<source>OFD modules url</source>
|
||||||
<translation type="vanished">URL модулей ОФД</translation>
|
<translation type="vanished">URL модулей ОФД</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/settingsdialog.ui" line="114"/>
|
||||||
<source>Goods total position</source>
|
<source>Goods total position</source>
|
||||||
<translation type="vanished">Позиция всего за товар</translation>
|
<translation>Позиция всего за товар</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/settingsdialog.ui" line="145"/>
|
||||||
<source>Goods quantity position</source>
|
<source>Goods quantity position</source>
|
||||||
<translation type="vanished">Позиция количества товара</translation>
|
<translation>Позиция количества товара</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
|
<location filename="../scenes/settingsdialog.ui" line="74"/>
|
||||||
<source>Print total</source>
|
<source>Print total</source>
|
||||||
<translation type="vanished">Печатать Итого</translation>
|
<translation>Печатать Итого</translation>
|
||||||
</message>
|
</message>
|
||||||
</context>
|
</context>
|
||||||
</TS>
|
</TS>
|
||||||
|
|
121
utils/utils.cpp
121
utils/utils.cpp
|
@ -1,24 +1,31 @@
|
||||||
#include "utils.h"
|
#include <utils/utils.h>
|
||||||
|
#ifdef BUILD_OFD_BINARYEYE_SCAN
|
||||||
#include <arpa/inet.h>
|
# include <arpa/inet.h>
|
||||||
|
# include <qrencode.h>
|
||||||
|
# include <ifaddrs.h>
|
||||||
|
# include <netinet/in.h>
|
||||||
|
#endif
|
||||||
|
#ifdef BUILD_OFD_MODE
|
||||||
|
# include <exceptions/ofdrequestexception.h>
|
||||||
|
# include <fstream>
|
||||||
|
#endif
|
||||||
#include <codecvt>
|
#include <codecvt>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <locale>
|
#include <locale>
|
||||||
#include <opencv2/core/mat.hpp>
|
#if defined(BUILD_OCR_MODE) || defined(BUILD_OFD_MODE)
|
||||||
#include <opencv2/imgcodecs.hpp>
|
# include <opencv2/core/mat.hpp>
|
||||||
#include <opencv2/imgproc.hpp>
|
# include <opencv2/imgcodecs.hpp>
|
||||||
#include <qrencode.h>
|
# include <opencv2/imgproc.hpp>
|
||||||
#include <regex>
|
#endif
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "../exceptions/ofdrequestexception.h"
|
|
||||||
#include "settings/settings.h"
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <fstream>
|
|
||||||
#include <ifaddrs.h>
|
|
||||||
#include <netinet/in.h>
|
|
||||||
#include <opencv2/opencv.hpp>
|
|
||||||
|
|
||||||
|
#include <boost/regex.hpp>
|
||||||
|
#include <net/net.h>
|
||||||
|
#include <settings/settings.h>
|
||||||
|
|
||||||
|
#ifdef BUILD_OFD_BINARYEYE_SCAN
|
||||||
std::string get_local_ip_address() {
|
std::string get_local_ip_address() {
|
||||||
struct ifaddrs * ifAddrStruct=NULL;
|
struct ifaddrs * ifAddrStruct=NULL;
|
||||||
struct ifaddrs * ifa=NULL;
|
struct ifaddrs * ifa=NULL;
|
||||||
|
@ -44,6 +51,7 @@ std::string get_local_ip_address() {
|
||||||
|
|
||||||
throw std::runtime_error(QWidget::tr("Could not find any usable local IP address. If you beleive that this is problem with the program, please, contact the developer.").toStdString());
|
throw std::runtime_error(QWidget::tr("Could not find any usable local IP address. If you beleive that this is problem with the program, please, contact the developer.").toStdString());
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
std::string to_utf8(std::wstring wide_string) {
|
std::string to_utf8(std::wstring wide_string) {
|
||||||
static std::wstring_convert<std::codecvt_utf8<wchar_t>> utf8_conv;
|
static std::wstring_convert<std::codecvt_utf8<wchar_t>> utf8_conv;
|
||||||
|
@ -66,10 +74,17 @@ bool vector_contains_element(const std::vector<T>& vector, const T& to_find) {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
template<class T>
|
||||||
|
bool areAllSizesEqual(const std::vector<T>& v1, const std::vector<T>& v2,
|
||||||
|
const std::vector<T>& v3, const std::vector<T>& v4) {
|
||||||
|
return (v1.size() == v2.size() && v2.size() == v3.size() && v3.size() == v4.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//ужас
|
//ужас
|
||||||
template bool vector_contains_element<std::string>(const std::vector<std::string>& vector, const std::string& to_find);
|
template bool vector_contains_element<std::string>(const std::vector<std::string>& vector, const std::string& to_find);
|
||||||
|
template bool areAllSizesEqual(const std::vector<std::string>& v1, const std::vector<std::string>& v2,
|
||||||
|
const std::vector<std::string>& v3, const std::vector<std::string>& v4);
|
||||||
std::vector<std::string> split(std::string s, std::string delimiter) {
|
std::vector<std::string> split(std::string s, std::string delimiter) {
|
||||||
std::vector<std::string> result;
|
std::vector<std::string> result;
|
||||||
size_t pos = 0;
|
size_t pos = 0;
|
||||||
|
@ -84,16 +99,30 @@ std::vector<std::string> split(std::string s, std::string delimiter) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<std::wstring> split(std::wstring s, std::wstring delimiter) {
|
||||||
|
std::vector<std::wstring> result;
|
||||||
|
size_t pos = 0;
|
||||||
|
std::wstring token;
|
||||||
|
while ((pos = s.find(delimiter)) != std::string::npos) {
|
||||||
|
token = s.substr(0, pos);
|
||||||
|
result.push_back(token);
|
||||||
|
s.erase(0, pos + delimiter.length());
|
||||||
|
}
|
||||||
|
result.push_back(s);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
std::wstring substring_from_to(std::wstring& text, std::wstring from, std::wstring to) {
|
std::wstring substring_from_to(std::wstring& text, std::wstring from, std::wstring to) {
|
||||||
unsigned int start_pos = 0;
|
unsigned int start_pos = 0;
|
||||||
unsigned int end_pos = 0;
|
unsigned int end_pos = 0;
|
||||||
|
|
||||||
std::wstring substring;
|
std::wstring substring;
|
||||||
|
|
||||||
std::wregex start_regex(from);
|
boost::wregex start_regex(from);
|
||||||
std::wregex end_regex(to);
|
boost::wregex end_regex(to);
|
||||||
|
|
||||||
for (std::wsregex_iterator it{text.begin(), text.end(), start_regex}, end{};
|
for (boost::wsregex_iterator it{text.begin(), text.end(), start_regex}, end{};
|
||||||
it != end; it++) {
|
it != end; it++) {
|
||||||
start_pos = it->position() + it->str().size();
|
start_pos = it->position() + it->str().size();
|
||||||
break;
|
break;
|
||||||
|
@ -102,7 +131,7 @@ std::wstring substring_from_to(std::wstring& text, std::wstring from, std::wstri
|
||||||
if(text == from_utf8("")) return text;
|
if(text == from_utf8("")) return text;
|
||||||
substring = text.substr(start_pos, text.size());
|
substring = text.substr(start_pos, text.size());
|
||||||
|
|
||||||
for (std::wsregex_iterator it{substring.begin(), substring.end(), end_regex}, end{};
|
for (boost::wsregex_iterator it{substring.begin(), substring.end(), end_regex}, end{};
|
||||||
it != end; it++) {
|
it != end; it++) {
|
||||||
end_pos = it->position();
|
end_pos = it->position();
|
||||||
break;
|
break;
|
||||||
|
@ -114,7 +143,7 @@ std::wstring substring_from_to(std::wstring& text, std::wstring from, std::wstri
|
||||||
|
|
||||||
return substring;
|
return substring;
|
||||||
}
|
}
|
||||||
|
#ifdef BUILD_OFD_MODE
|
||||||
std::wstring trim_html_response(std::wstring& check) {
|
std::wstring trim_html_response(std::wstring& check) {
|
||||||
std::wstring begin_check_marker = from_utf8("<!-- Products -->");
|
std::wstring begin_check_marker = from_utf8("<!-- Products -->");
|
||||||
std::wstring end_check_marker = from_utf8("<!-- \\/Products -->");
|
std::wstring end_check_marker = from_utf8("<!-- \\/Products -->");
|
||||||
|
@ -124,23 +153,23 @@ std::wstring trim_html_response(std::wstring& check) {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::wstring> find_in_html(std::string& html, std::string regex, std::string html_start, std::string html_end) {
|
std::vector<std::wstring> find_in_html(std::string& html, std::string regex, std::string html_start, std::string html_end) {
|
||||||
std::regex searching_regex(regex);
|
boost::regex searching_regex(regex);
|
||||||
|
|
||||||
std::vector<std::wstring> parsed;
|
std::vector<std::wstring> parsed;
|
||||||
for (std::sregex_iterator it{html.begin(), html.end(), searching_regex}, end{};
|
for (boost::sregex_iterator it{html.begin(), html.end(), searching_regex}, end{};
|
||||||
it != end; it++) {
|
it != end; it++) {
|
||||||
|
|
||||||
std::wstring found_entry = from_utf8(it->str());
|
std::wstring found_entry = from_utf8(it->str());
|
||||||
std::wcout << "Found: " << found_entry << std::endl;
|
std::cout << "Found: " << to_utf8(found_entry) << std::endl;
|
||||||
std::wstring extracted = substring_from_to(found_entry, from_utf8(html_start), from_utf8(html_end));
|
std::wstring extracted = substring_from_to(found_entry, from_utf8(html_start), from_utf8(html_end));
|
||||||
std::wcout << "Extracted: " << extracted << std::endl;
|
std::cout << "Extracted: " << to_utf8(extracted) << std::endl;
|
||||||
parsed.push_back(extracted);
|
parsed.push_back(extracted);
|
||||||
}
|
}
|
||||||
return parsed;
|
return parsed;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::wstring> find_products_in_html(std::string html) {
|
std::vector<std::wstring> find_products_in_html(std::string html) {
|
||||||
return find_in_html(html, "<div class=\"ifw-col ifw-col-1 text-left\"><b>.*<\\/b><\\/div>", "<div class=\"ifw-col ifw-col-1 text-left\"><b>", "<\\/b><\\/div>");
|
return find_in_html(html, "<div class=\"ifw-col ifw-col-1 text-left\"><b>.{2,100}<\\/b><\\/div>", "<div class=\"ifw-col ifw-col-1 text-left\"><b>", "<\\/b><\\/div>");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::wstring> find_amounts_in_html(std::string html) {
|
std::vector<std::wstring> find_amounts_in_html(std::string html) {
|
||||||
|
@ -152,6 +181,29 @@ std::vector<std::wstring> find_amounts_in_html(std::string html) {
|
||||||
return founds;
|
return founds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<std::wstring> find_net_weights_in_names(std::vector<std::wstring> &names) {
|
||||||
|
std::vector<std::wstring> result;
|
||||||
|
for (std::wstring &name : names ) {
|
||||||
|
boost::wregex regexp(from_utf8("((\\d+(\\.|,)?\\d{0,}((м|)л|(к|м|)г|т|ц|шт|(pc|)s|(m|k|)g|(m|)l|t))(\\s|\\t){0,})+"), boost::regex_constants::collate);
|
||||||
|
bool found = false;
|
||||||
|
for (boost::wsregex_iterator it{name.begin(), name.end(), regexp}, end{}; it != end;
|
||||||
|
it++) {
|
||||||
|
result.push_back(it->str());
|
||||||
|
found = true;
|
||||||
|
name.erase(it->position(), it->str().length());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!found) {
|
||||||
|
result.push_back(from_utf8("?"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto &entry : result) {
|
||||||
|
std::replace(entry.begin(), entry.end(), ',', '.');
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<std::wstring> find_prices_in_html(std::string html) {
|
std::vector<std::wstring> find_prices_in_html(std::string html) {
|
||||||
std::vector<std::wstring> founds = find_in_html(html, "X <\\/span><span>\\d+(\\.|,)\\d{2}<\\/span>", "X <\\/span><span>", "<\\/span>");
|
std::vector<std::wstring> founds = find_in_html(html, "X <\\/span><span>\\d+(\\.|,)\\d{2}<\\/span>", "X <\\/span><span>", "<\\/span>");
|
||||||
for (auto &found : founds) {
|
for (auto &found : founds) {
|
||||||
|
@ -161,7 +213,7 @@ std::vector<std::wstring> find_prices_in_html(std::string html) {
|
||||||
return founds;
|
return founds;
|
||||||
}
|
}
|
||||||
|
|
||||||
void dumpVectorsToStderr(std::vector<std::wstring> &products, std::vector<std::wstring> &amounts, std::vector<std::wstring> &prices) {
|
void dumpVectorsToStderr(std::vector<std::wstring> &products, std::vector<std::wstring> &amounts, std::vector<std::wstring> &net_weights, std::vector<std::wstring> &prices) {
|
||||||
std::cerr << "Products: ";
|
std::cerr << "Products: ";
|
||||||
for (auto &product : products) {
|
for (auto &product : products) {
|
||||||
std::cerr << to_utf8(product) << "|[]|";
|
std::cerr << to_utf8(product) << "|[]|";
|
||||||
|
@ -174,6 +226,12 @@ void dumpVectorsToStderr(std::vector<std::wstring> &products, std::vector<std::w
|
||||||
}
|
}
|
||||||
std::cerr << std::endl;
|
std::cerr << std::endl;
|
||||||
|
|
||||||
|
std::cerr << "Net weights: ";
|
||||||
|
for (auto &net_weight : net_weights) {
|
||||||
|
std::wcerr << net_weight << " ";
|
||||||
|
}
|
||||||
|
std::cerr << std::endl;
|
||||||
|
|
||||||
std::cerr << "Prices: ";
|
std::cerr << "Prices: ";
|
||||||
for (auto &price : prices) {
|
for (auto &price : prices) {
|
||||||
std::wcerr << price << " ";
|
std::wcerr << price << " ";
|
||||||
|
@ -188,6 +246,7 @@ Check parseOfdRuAnswer(std::string html) {
|
||||||
|
|
||||||
std::vector<std::wstring> products = find_products_in_html(trimmed);
|
std::vector<std::wstring> products = find_products_in_html(trimmed);
|
||||||
std::vector<std::wstring> amounts = find_amounts_in_html(trimmed);
|
std::vector<std::wstring> amounts = find_amounts_in_html(trimmed);
|
||||||
|
std::vector<std::wstring> net_weights = find_net_weights_in_names(products);
|
||||||
std::vector<std::wstring> prices = find_prices_in_html(trimmed);
|
std::vector<std::wstring> prices = find_prices_in_html(trimmed);
|
||||||
|
|
||||||
if ((products.size() + amounts.size() + prices.size()) == 0) {
|
if ((products.size() + amounts.size() + prices.size()) == 0) {
|
||||||
|
@ -202,7 +261,7 @@ Check parseOfdRuAnswer(std::string html) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((products.size() + amounts.size() + prices.size())/products.size() != 3) {
|
if ((products.size() + amounts.size() + prices.size())/products.size() != 3) {
|
||||||
dumpVectorsToStderr(products, amounts, prices);
|
dumpVectorsToStderr(products, amounts, net_weights, prices);
|
||||||
//TOOD: make new setting "app_home" and get all path using it.
|
//TOOD: make new setting "app_home" and get all path using it.
|
||||||
std::ofstream error_log(get_path_relative_to_home(".local/share/checks_parser/error_log.txt"), std::ios_base::app);
|
std::ofstream error_log(get_path_relative_to_home(".local/share/checks_parser/error_log.txt"), std::ios_base::app);
|
||||||
error_log << trimmed << std::endl;
|
error_log << trimmed << std::endl;
|
||||||
|
@ -213,13 +272,17 @@ Check parseOfdRuAnswer(std::string html) {
|
||||||
Check c;
|
Check c;
|
||||||
|
|
||||||
for (int i = 0; i < products.size(); i ++) {
|
for (int i = 0; i < products.size(); i ++) {
|
||||||
Goods goods(to_utf8(products[i]), std::stod(prices[i]), std::stod(amounts[i]));
|
std::cout << "Adding to check: ";
|
||||||
|
std::cout << to_utf8(products[i]) << " " << to_utf8(prices[i]) << " " << to_utf8(net_weights[i]) << " " << to_utf8(amounts[i]) << std::endl;
|
||||||
|
Goods goods(to_utf8(products[i]), std::stod(prices[i]), to_utf8(net_weights[i]), std::stod(amounts[i]));
|
||||||
c.add_goods(goods);
|
c.add_goods(goods);
|
||||||
}
|
}
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
#endif // ifdef BUILD_OFD_MODE
|
||||||
|
|
||||||
|
#ifdef BUILD_OFD_BINARYEYE_SCAN
|
||||||
void generate_qr_code(std::string data) {
|
void generate_qr_code(std::string data) {
|
||||||
QRcode *qrCode = QRcode_encodeString(data.c_str(), 2, QR_ECLEVEL_L, QR_MODE_8, 1);
|
QRcode *qrCode = QRcode_encodeString(data.c_str(), 2, QR_ECLEVEL_L, QR_MODE_8, 1);
|
||||||
if (qrCode == NULL) {
|
if (qrCode == NULL) {
|
||||||
|
@ -244,3 +307,5 @@ void generate_qr_code(std::string data) {
|
||||||
cv::imwrite(get_path_relative_to_home(".local/share/checks_parser/binaryeye_connection.png"), qrCodeImage);
|
cv::imwrite(get_path_relative_to_home(".local/share/checks_parser/binaryeye_connection.png"), qrCodeImage);
|
||||||
QRcode_free(qrCode);
|
QRcode_free(qrCode);
|
||||||
}
|
}
|
||||||
|
#endif // ifdef BUILD_OFD_BINARYEYE_SCAN
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,6 @@
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "../check/check.h"
|
#include "../check/check.h"
|
||||||
|
|
||||||
std::string get_local_ip_address();
|
|
||||||
std::string to_utf8(std::wstring wide_string);
|
std::string to_utf8(std::wstring wide_string);
|
||||||
std::wstring from_utf8(std::string string);
|
std::wstring from_utf8(std::string string);
|
||||||
|
|
||||||
|
@ -13,13 +12,24 @@ std::string get_path_relative_to_home(std::string path);
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
bool vector_contains_element(const std::vector<T> &vector, const T &to_find);
|
bool vector_contains_element(const std::vector<T> &vector, const T &to_find);
|
||||||
|
template <class T>
|
||||||
|
bool areAllSizesEqual(const std::vector<T>& v1, const std::vector<T>& v2,
|
||||||
|
const std::vector<T>& v3, const std::vector<T>& v4);
|
||||||
|
|
||||||
std::vector<std::string> split(std::string, std::string);
|
std::vector<std::string> split(std::string, std::string);
|
||||||
|
std::vector<std::wstring> split(std::wstring s, std::wstring delimiter);
|
||||||
|
|
||||||
|
#ifdef BUILD_OFD_MODE
|
||||||
Check parseOfdRuAnswer(std::string);
|
Check parseOfdRuAnswer(std::string);
|
||||||
|
|
||||||
std::wstring trim_html_response(std::wstring& check);
|
std::wstring trim_html_response(std::wstring& check);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef BUILD_OFD_BINARYEYE_SCAN
|
||||||
void generate_qr_code(std::string data);
|
void generate_qr_code(std::string data);
|
||||||
|
std::string get_local_ip_address();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void fetch_and_download_modules();
|
||||||
|
|
||||||
#endif // UTILS_H
|
#endif // UTILS_H
|
||||||
|
|
Loading…
Reference in New Issue