restrict files you can input

This commit is contained in:
leca 2025-06-21 22:28:38 +03:00
parent 37a77d7228
commit b06e2f8ef2
6 changed files with 114 additions and 63 deletions

69
.qt/QtDeploySupport.cmake Normal file
View File

@ -0,0 +1,69 @@
cmake_minimum_required(VERSION 3.16...3.21)
# These are part of the public API. Projects should use them to provide a
# consistent set of prefix-relative destinations.
if(NOT QT_DEPLOY_BIN_DIR)
set(QT_DEPLOY_BIN_DIR "bin")
endif()
if(NOT QT_DEPLOY_LIBEXEC_DIR)
set(QT_DEPLOY_LIBEXEC_DIR "libexec")
endif()
if(NOT QT_DEPLOY_LIB_DIR)
set(QT_DEPLOY_LIB_DIR "lib")
endif()
if(NOT QT_DEPLOY_PLUGINS_DIR)
set(QT_DEPLOY_PLUGINS_DIR "plugins")
endif()
if(NOT QT_DEPLOY_QML_DIR)
set(QT_DEPLOY_QML_DIR "qml")
endif()
if(NOT QT_DEPLOY_TRANSLATIONS_DIR)
set(QT_DEPLOY_TRANSLATIONS_DIR "translations")
endif()
if(NOT QT_DEPLOY_PREFIX)
set(QT_DEPLOY_PREFIX "$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}")
endif()
if(QT_DEPLOY_PREFIX STREQUAL "")
set(QT_DEPLOY_PREFIX .)
endif()
if(NOT QT_DEPLOY_IGNORED_LIB_DIRS)
set(QT_DEPLOY_IGNORED_LIB_DIRS "/lib")
endif()
# These are internal implementation details. They may be removed at any time.
set(__QT_DEPLOY_SYSTEM_NAME "Linux")
set(__QT_DEPLOY_IS_SHARED_LIBS_BUILD "ON")
set(__QT_DEPLOY_TOOL "GRD")
set(__QT_DEPLOY_IMPL_DIR "/home/leca/checks-parser/.qt")
set(__QT_DEPLOY_VERBOSE "")
set(__QT_CMAKE_EXPORT_NAMESPACE "Qt6")
set(__QT_DEPLOY_GENERATOR_IS_MULTI_CONFIG "0")
set(__QT_DEPLOY_ACTIVE_CONFIG "Debug")
set(__QT_NO_CREATE_VERSIONLESS_FUNCTIONS "")
set(__QT_DEFAULT_MAJOR_VERSION "6")
set(__QT_DEPLOY_QT_ADDITIONAL_PACKAGES_PREFIX_PATH "")
set(__QT_DEPLOY_QT_INSTALL_PREFIX "/usr")
set(__QT_DEPLOY_QT_INSTALL_BINS "lib/qt6/bin")
set(__QT_DEPLOY_QT_INSTALL_DATA "share/qt6")
set(__QT_DEPLOY_QT_INSTALL_LIBEXECS "lib/qt6")
set(__QT_DEPLOY_QT_INSTALL_PLUGINS "lib/qt6/plugins")
set(__QT_DEPLOY_QT_INSTALL_TRANSLATIONS "share/qt6/translations")
set(__QT_DEPLOY_TARGET_QT_PATHS_PATH "/usr/lib/qt6/bin/qtpaths6")
set(__QT_DEPLOY_PLUGINS "")
set(__QT_DEPLOY_MUST_ADJUST_PLUGINS_RPATH "")
set(__QT_DEPLOY_USE_PATCHELF "")
set(__QT_DEPLOY_PATCHELF_EXECUTABLE "")
set(__QT_DEPLOY_QT_IS_MULTI_CONFIG_BUILD_WITH_DEBUG "FALSE")
set(__QT_DEPLOY_QT_DEBUG_POSTFIX "")
# Define the CMake commands to be made available during deployment.
set(__qt_deploy_support_files
"/home/leca/checks-parser/.qt/QtDeployTargets.cmake"
"/usr/lib/cmake/Qt6Core/Qt6CoreDeploySupport.cmake"
)
foreach(__qt_deploy_support_file IN LISTS __qt_deploy_support_files)
include("${__qt_deploy_support_file}")
endforeach()
unset(__qt_deploy_support_file)
unset(__qt_deploy_support_files)

View File

@ -0,0 +1,2 @@
set(__QT_DEPLOY_TARGET_checks-parser_FILE /home/leca/checks-parser/checks-parser)
set(__QT_DEPLOY_TARGET_checks-parser_TYPE EXECUTABLE)

View File

@ -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 opencv_objdetect videoio highgui)
find_package(OpenCV REQUIRED COMPONENTS core imgproc imgcodecs opencv_objdetect videoio)
target_link_libraries(checks-parser PRIVATE ${OpenCV_LIBS})
target_include_directories(checks-parser PUBLIC ${OpenCV_INCLUDE_DIRS})
include_directories( ${OpenCV_INCLUDE_DIRS} )

View File

@ -135,14 +135,9 @@ void MainWindow::httpNewMessageHandler(QString message) {
#ifdef BUILD_OFD_LOCAL_QR_SCAN
void MainWindow::on_choose_image_button_clicked() {
QString filename = QFileDialog::getOpenFileName();
QString filename = QFileDialog::getOpenFileName(this, QString(), QString(), tr("Images (*.jpg *.jpeg *.png)"));
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;
}
@ -161,14 +156,9 @@ void MainWindow::onDataDecode(std::map<std::string, std::string> data) {
#ifdef BUILD_EMAIL_MODE
void MainWindow::on_parse_email_button_clicked() {
QString filename = QFileDialog::getOpenFileName();
QString filename = QFileDialog::getOpenFileName(this, QString(), QString(), tr("E-Mail files (*.eml)"));
if (filename == "") {
QMessageBox infoDialog;
infoDialog.setText(tr("Please, select an e-mail which contains QR code"));
infoDialog.setIcon(QMessageBox::Critical);
infoDialog.setWindowTitle(tr("E-Mail was not selected"));
infoDialog.exec();
return;
}
@ -185,12 +175,6 @@ void MainWindow::on_parse_email_button_clicked() {
}
set_check_params(paramsMap);
// QMessageBox infoDialog;
// infoDialog.setText(tr("This feature is under development. Wait it to appear in next updates."));
// infoDialog.setIcon(QMessageBox::Warning);
// infoDialog.setWindowTitle(tr("Under development"));
// infoDialog.exec();
// return;
}
#endif // ifdef BUILD_EMAIL_MODE

View File

@ -273,7 +273,12 @@
<translation>Could not start http server.</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="149"/>
<location filename="../mainwindow.cpp" line="138"/>
<source>Images (*.jpg *.jpeg *.png)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="144"/>
<source>Selected image: </source>
<translation>Selected image: </translation>
</message>
@ -286,62 +291,57 @@
<translation type="vanished">Under development</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="168"/>
<source>Please, select an e-mail which contains QR code</source>
<location filename="../mainwindow.cpp" line="159"/>
<source>E-Mail files (*.eml)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="170"/>
<source>E-Mail was not selected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="180"/>
<source>QR code in this E-Mail was not found. If you are sure that the e-mail you supplied has qr code, please, contact the developer and send him the .eml file.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="182"/>
<location filename="../mainwindow.cpp" line="172"/>
<source>QR code was not found in E-Mail</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="202"/>
<location filename="../mainwindow.cpp" line="186"/>
<source>Please, add check(s) to parse</source>
<translation>Please, add check(s) to parse</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="204"/>
<location filename="../mainwindow.cpp" line="188"/>
<source>No checks to parse</source>
<translation>No checks to parse</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="271"/>
<location filename="../mainwindow.cpp" line="255"/>
<source>Captcha was not solved correctly!</source>
<translation>Captcha was not solved correctly!</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="273"/>
<location filename="../mainwindow.cpp" line="257"/>
<source>Captcha is incorrect</source>
<translation>Captcha is incorrect</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="277"/>
<location filename="../mainwindow.cpp" line="261"/>
<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="279"/>
<location filename="../mainwindow.cpp" line="263"/>
<source>Internal server error</source>
<translation>Internal server error</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="283"/>
<location filename="../mainwindow.cpp" line="267"/>
<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="285"/>
<location filename="../mainwindow.cpp" line="269"/>
<source>Check was not found</source>
<translation>Check was not found</translation>
</message>
@ -354,14 +354,12 @@
<translation type="vanished">Error in parsing</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="142"/>
<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>
<translation type="vanished">Please, select a picture where QR code that contains info about check is present</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="144"/>
<source>Picture was not selected</source>
<translation>Picture was not selected</translation>
<translation type="vanished">Picture was not selected</translation>
</message>
<message>
<source>Please, select a picture to scan</source>
@ -671,7 +669,7 @@
<context>
<name>QObject</name>
<message>
<location filename="../main.cpp" line="59"/>
<location filename="../main.cpp" line="55"/>
<source>Using locale: </source>
<translation>Using locale: </translation>
</message>

View File

@ -261,67 +261,67 @@
<translation>Не получилось запустить HTTP сервер.</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="149"/>
<location filename="../mainwindow.cpp" line="138"/>
<source>Images (*.jpg *.jpeg *.png)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="144"/>
<source>Selected image: </source>
<translation>Выбранное изображение: </translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="168"/>
<source>Please, select an e-mail which contains QR code</source>
<location filename="../mainwindow.cpp" line="159"/>
<source>E-Mail files (*.eml)</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="170"/>
<source>E-Mail was not selected</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="180"/>
<source>QR code in this E-Mail was not found. If you are sure that the e-mail you supplied has qr code, please, contact the developer and send him the .eml file.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="182"/>
<location filename="../mainwindow.cpp" line="172"/>
<source>QR code was not found in E-Mail</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="202"/>
<location filename="../mainwindow.cpp" line="186"/>
<source>Please, add check(s) to parse</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="204"/>
<location filename="../mainwindow.cpp" line="188"/>
<source>No checks to parse</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="271"/>
<location filename="../mainwindow.cpp" line="255"/>
<source>Captcha was not solved correctly!</source>
<translation>Капча была решена неверно!</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="273"/>
<location filename="../mainwindow.cpp" line="257"/>
<source>Captcha is incorrect</source>
<translation>Капча введена неверно</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="277"/>
<location filename="../mainwindow.cpp" line="261"/>
<source>Internal server error. Please, try again later.</source>
<translation>Внутренняя ошибка сервера. Пожалуйста, попробуйте снова позже.</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="279"/>
<location filename="../mainwindow.cpp" line="263"/>
<source>Internal server error</source>
<translation>Внутренняя ошибка сервера</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="283"/>
<location filename="../mainwindow.cpp" line="267"/>
<source>Check not found. Please, ensure correctness of entered data.</source>
<translation>Чек не найден. Пожалуйста, убедитесь в правильности введённых данных.</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="285"/>
<location filename="../mainwindow.cpp" line="269"/>
<source>Check was not found</source>
<translation>Чек не найден</translation>
</message>
@ -334,14 +334,12 @@
<translation type="vanished">Ошибка в парсинге</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="142"/>
<source>Please, select a picture where QR code that contains info about check is present</source>
<translation>Пожалуйста, выберете изображение, содержащее QR код с информацией о чеке</translation>
<translation type="vanished">Пожалуйста, выберете изображение, содержащее QR код с информацией о чеке</translation>
</message>
<message>
<location filename="../mainwindow.cpp" line="144"/>
<source>Picture was not selected</source>
<translation>Изображение не было выбрано</translation>
<translation type="vanished">Изображение не было выбрано</translation>
</message>
<message>
<source>Please, select a picture to scan</source>
@ -647,7 +645,7 @@
<context>
<name>QObject</name>
<message>
<location filename="../main.cpp" line="59"/>
<location filename="../main.cpp" line="55"/>
<source>Using locale: </source>
<translation>Использую локаль: </translation>
</message>