checks-parser-git done, checks-parser-bin WIP
This commit is contained in:
parent
80e9397e01
commit
e58d6068e0
|
@ -13,6 +13,14 @@ if (NOT (BUILD_EMAIL_TO_TEXT_MODE OR BUILD_OCR_MODE OR BUILD_OFD_LOCAL_QR_SCAN O
|
||||||
return()
|
return()
|
||||||
endif()
|
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 (BUILD_OFD_LOCAL_QR_SCAN OR BUILD_OFD_BINARYEYE_SCAN)
|
||||||
if(CMAKE_VERSION VERSION_LESS 3.12)
|
if(CMAKE_VERSION VERSION_LESS 3.12)
|
||||||
add_definitions(-DBUILD_OFD_MODE)
|
add_definitions(-DBUILD_OFD_MODE)
|
||||||
|
@ -171,7 +179,11 @@ else()
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_link_libraries(checks-parser PRIVATE Qt5::Widgets Qt5::UiTools)
|
target_link_libraries(checks-parser PRIVATE Qt5::Widgets)
|
||||||
|
|
||||||
|
if (BUILD_TRANSLATIONS)
|
||||||
|
target_link_libraries(checks-parser PRIVATE Qt5::UiTools)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (BUILD_OFD_LOCAL_QR_SCAN)
|
if (BUILD_OFD_LOCAL_QR_SCAN)
|
||||||
target_include_directories(checks-parser PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/image_redactor)
|
target_include_directories(checks-parser PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/image_redactor)
|
||||||
|
|
|
@ -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,6 +23,7 @@
|
||||||
# Установка
|
# Установка
|
||||||
## Сборка из исходников
|
## Сборка из исходников
|
||||||
В целом, вам нужно установить следующие зависимости, чтобы собрать приложение (я предполагаю, что вы уже имеете на системе базовые пакеты вроде 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
|
||||||
|
@ -38,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
|
||||||
#Загрузка исходгого кода и сборка приложения
|
#Загрузка исходгого кода и сборка приложения
|
||||||
|
@ -54,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 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 (проверил только 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 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```
|
||||||
|
|
||||||
Следующие шаги идеинтичны для всех дистрибутивов, основанных на debian:
|
Следующие шаги идеинтичны для всех дистрибутивов, основанных на debian:
|
||||||
```
|
```
|
||||||
|
|
|
@ -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.4
|
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' 'qrencode')
|
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}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,3 +22,15 @@ services:
|
||||||
- ./binaries:/output
|
- ./binaries:/output
|
||||||
depends_on:
|
depends_on:
|
||||||
- base_ubuntu
|
- 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
|
||||||
|
|
6
main.cpp
6
main.cpp
|
@ -28,6 +28,9 @@
|
||||||
#endif
|
#endif
|
||||||
#include <qpushbutton.h>
|
#include <qpushbutton.h>
|
||||||
#include <parser/parser.h>
|
#include <parser/parser.h>
|
||||||
|
#ifdef BUILD_TRANSLATIONS
|
||||||
|
# include <QtUiTools/quiloader.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static QWidget *loadUI(QWidget *parent, std::string filename) {
|
static QWidget *loadUI(QWidget *parent, std::string filename) {
|
||||||
QUiLoader loader;
|
QUiLoader loader;
|
||||||
|
@ -50,7 +53,7 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
QTranslator translator;
|
QTranslator translator;
|
||||||
QString lang = "en_US";
|
QString lang = "en_US";
|
||||||
|
#ifdef BUILD_TRANSLATIONS
|
||||||
bool languageSettingPresent = false;
|
bool languageSettingPresent = false;
|
||||||
languageSettingPresent = s.get_all_settings().find("language") != s.get_all_settings().end();
|
languageSettingPresent = s.get_all_settings().find("language") != s.get_all_settings().end();
|
||||||
|
|
||||||
|
@ -68,6 +71,7 @@ int main(int argc, char *argv[]) {
|
||||||
app.installTranslator(&translator);
|
app.installTranslator(&translator);
|
||||||
|
|
||||||
QUiLoader loader;
|
QUiLoader loader;
|
||||||
|
#endif
|
||||||
|
|
||||||
QWidget *window = new QWidget();
|
QWidget *window = new QWidget();
|
||||||
QStackedLayout *sceneLayout = new QStackedLayout;
|
QStackedLayout *sceneLayout = new QStackedLayout;
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <qevent.h>
|
#include <qevent.h>
|
||||||
#include <QtUiTools/quiloader.h>
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
|
|
Loading…
Reference in New Issue