diff --git a/CMakeLists.txt b/CMakeLists.txt index 5f7dd56..1303d29 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -207,9 +207,9 @@ if (BUILD_OFD_BINARYEYE_SCAN) 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() +# if (BUILD_OFD_LOCAL_QR_SCAN) + # target_link_libraries(checks-parser PRIVATE -lzbar) +# endif() target_link_libraries(checks-parser PRIVATE -lcurl) @@ -222,7 +222,7 @@ 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) + find_package(OpenCV REQUIRED COMPONENTS core imgproc imgcodecs opencv_objdetect) target_link_libraries(checks-parser PRIVATE ${OpenCV_LIBS}) target_include_directories(checks-parser PUBLIC ${OpenCV_INCLUDE_DIRS}) include_directories( ${OpenCV_INCLUDE_DIRS} ) diff --git a/adjustpicturedialog.cpp b/adjustpicturedialog.cpp index d7d52f8..b8529bd 100644 --- a/adjustpicturedialog.cpp +++ b/adjustpicturedialog.cpp @@ -1,13 +1,16 @@ #include "adjustpicturedialog.h" #include "ui_adjustpicturedialog.h" -#include "utils/utils.h" +#include + +#include #include -#include +#include +#include #include -#include #include #include -#include + +using cv::QRCodeDetector, cv::Mat; AdjustPictureDialog::AdjustPictureDialog(QWidget *parent, std::string imagePath) : QDialog(parent) @@ -54,24 +57,26 @@ void AdjustPictureDialog::accept() { } std::string AdjustPictureDialog::decode() { - cv::Mat im = cv::imread(get_path_relative_to_home(".local/share/checks_parser/temp.png")); + Mat im = cv::imread(get_path_relative_to_home(".local/share/checks_parser/temp.png")); + QRCodeDetector qrDecoder = QRCodeDetector(); + return qrDecoder.detectAndDecode(im); - zbar::ImageScanner scanner; - scanner.set_config(zbar::ZBAR_QRCODE, zbar::ZBAR_CFG_ENABLE, 1); + // zbar::ImageScanner scanner; + // scanner.set_config(zbar::ZBAR_QRCODE, zbar::ZBAR_CFG_ENABLE, 1); - cv::Mat imGray; - cv::cvtColor(im, imGray, cv::COLOR_BGR2GRAY); + // cv::Mat imGray; + // cv::cvtColor(im, imGray, cv::COLOR_BGR2GRAY); - zbar::Image image(im.cols, im.rows, "Y800", (uchar *) imGray.data, im.cols * im.rows); - scanner.scan(image); + // zbar::Image image(im.cols, im.rows, "Y800", (uchar *) imGray.data, im.cols * im.rows); + // scanner.scan(image); - std::string result = ""; + // std::string result = ""; - for (zbar::Image::SymbolIterator symbol = image.symbol_begin(); symbol != image.symbol_end(); ++symbol) { - result = symbol->get_data(); - } + // for (zbar::Image::SymbolIterator symbol = image.symbol_begin(); symbol != image.symbol_end(); ++symbol) { + // result = symbol->get_data(); + // } - return result; + // return result; } void AdjustPictureDialog::computeContrastLookupTable() { diff --git a/scenes/mainwindow.ui b/scenes/mainwindow.ui index f4ca6e1..2e83db5 100644 --- a/scenes/mainwindow.ui +++ b/scenes/mainwindow.ui @@ -268,6 +268,9 @@ QAbstractItemView::SelectionBehavior::SelectRows + + true + diff --git a/translations/en_US.ts b/translations/en_US.ts index 9c8f64b..d2e8f1c 100644 --- a/translations/en_US.ts +++ b/translations/en_US.ts @@ -14,12 +14,12 @@ Please, zoom to qr code and adjust contrast so that qr code looks sharp - + QR code was not detected on that image. Please edit it again or enter data manually QR code was not detected on that image. Please edit it again or enter data manually - + No QR code No QR code @@ -112,7 +112,7 @@ 0000000000000000 - + FN (Fiscal Number) FN = Фискальный Номер FN (Fiscal Number) @@ -151,13 +151,13 @@ Use your phone as a QR code scanner - + FI (Fiscal Identifier) FI = Фискальный Признак FI (Fiscal Identifier) - + Delete selected @@ -175,12 +175,12 @@ Date and time of purchase - + Operation type Operation type - + Parse an E-Mail Parse an E-Mail @@ -244,7 +244,7 @@ - + Total Total diff --git a/translations/ru_RU.ts b/translations/ru_RU.ts index 45ccf44..ee1ae23 100644 --- a/translations/ru_RU.ts +++ b/translations/ru_RU.ts @@ -14,12 +14,12 @@ Пожалуйста, приблизьте QR код и настройте контраст, чтобы он читался - + QR code was not detected on that image. Please edit it again or enter data manually QR код не найден на этом изображении. Пожалуйста, попытайтесь снова или введите данные вручную - + No QR code QR код не найден @@ -112,7 +112,7 @@ 0000000000000000 - + FN (Fiscal Number) Фискальный Норма ФН @@ -151,13 +151,13 @@ Использовать телефон как сканнер QR - + FI (Fiscal Identifier) Фискальный Признак ФП - + Delete selected @@ -167,12 +167,12 @@ Дата и время покупки - + Operation type Тип операции - + Parse an E-Mail Парсить E-Mail @@ -232,7 +232,7 @@ - + Total Итого diff --git a/widgets/checkqueuetablemodel.h b/widgets/checkqueuetablemodel.h index 0c00617..8092ca5 100644 --- a/widgets/checkqueuetablemodel.h +++ b/widgets/checkqueuetablemodel.h @@ -22,7 +22,6 @@ public: Qt::ItemFlags flags(const QModelIndex &index) const override; Qt::DropActions supportedDropActions() const override; - // bool insertRow(int row, int count, const QModelIndex &parent = QModelIndex()); bool insertRows(int position, int rows, const QModelIndex &index = QModelIndex()) override; bool removeRows(int position, int rows, const QModelIndex &index = QModelIndex()) override;