From 037dbf5ed3b1fc1df74ea28035f639d76e5e0f91 Mon Sep 17 00:00:00 2001 From: EndrII Date: Wed, 17 Aug 2022 23:35:03 +0300 Subject: [PATCH] simple fixes for Qt6.3 --- CMakeLists.txt | 1 - .../src/Distributions/idistribution.cpp | 7 ++ src/LibDeploy/src/configparser.cpp | 4 +- src/LibDeploy/src/deploycore.cpp | 4 +- src/LibDeploy/src/filemanager.cpp | 13 ++- src/LibDeploy/src/packing.h | 1 + src/LibDeploy/src/pathutils.cpp | 16 ++-- src/LibDeploy/src/qml.cpp | 19 ++-- tests/CMakeLists.txt | 8 ++ tests/examples/TestCPPOnly/CMakeLists.txt | 2 +- tests/examples/TestOnlyC/CMakeLists.txt | 2 +- tests/examples/TestQMLWidgets/CMakeLists.txt | 96 ++----------------- tests/examples/TestQMLWidgets/conf.qrc | 5 - tests/examples/TestQMLWidgets/main.cpp | 2 - tests/examples/TestQMLWidgets/qml.qrc | 1 - tests/examples/TestQtWidgets/CMakeLists.txt | 96 ++----------------- .../examples/quicknanobrowser/CMakeLists.txt | 59 ++---------- tests/examples/webui/CMakeLists.txt | 33 ++----- 18 files changed, 82 insertions(+), 287 deletions(-) delete mode 100644 tests/examples/TestQMLWidgets/conf.qrc diff --git a/CMakeLists.txt b/CMakeLists.txt index 98ee158..50a29ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -53,7 +53,6 @@ endif() make_directory(Distro) initAll() - add_subdirectory(submodules/QuasarAppLib) add_subdirectory(src/QtELFReader) diff --git a/src/LibDeploy/src/Distributions/idistribution.cpp b/src/LibDeploy/src/Distributions/idistribution.cpp index 33b6377..2c29b2c 100644 --- a/src/LibDeploy/src/Distributions/idistribution.cpp +++ b/src/LibDeploy/src/Distributions/idistribution.cpp @@ -9,7 +9,10 @@ #include "pathutils.h" #include #include +#if QT_VERSION <= QT_VERSION_CHECK(6, 0, 0) #include +#endif + #include #include #include @@ -82,7 +85,11 @@ bool iDistribution::unpackFile(const QFileInfo &resource, } QTextStream stream(&file); +#if QT_VERSION <= QT_VERSION_CHECK(6, 0, 0) stream.setCodec(QTextCodec::codecForName("UTF-8")); +#else + stream.setEncoding(QStringConverter::Utf8); +#endif stream << inputText; } else { file.write(inputData); diff --git a/src/LibDeploy/src/configparser.cpp b/src/LibDeploy/src/configparser.cpp index f7dcc77..5eeda1a 100644 --- a/src/LibDeploy/src/configparser.cpp +++ b/src/LibDeploy/src/configparser.cpp @@ -1213,7 +1213,7 @@ bool ConfigParser::initQmake() { auto qt = *qtList.begin(); - if (qt.rightRef(3).compare(QString("lib"), Qt::CaseInsensitive)) { + if (qt.right(3).compare(QString("lib"), Qt::CaseInsensitive)) { return initQmakePrivate(QFileInfo(qt + "/../bin/qmake").absoluteFilePath()); } @@ -1645,7 +1645,7 @@ bool ConfigParser::smartMoveTargets() { } - _config.targetsEdit() = temp; + _config.targetsEdit() = QHash{temp.begin(), temp.end()}; return result && configureTargets(); } diff --git a/src/LibDeploy/src/deploycore.cpp b/src/LibDeploy/src/deploycore.cpp index 56ecba9..21e8ebd 100644 --- a/src/LibDeploy/src/deploycore.cpp +++ b/src/LibDeploy/src/deploycore.cpp @@ -155,7 +155,7 @@ LibPriority DeployCore::getLibPriority(const QString &lib) { } bool DeployCore::containsModule(const QString& moduleLibrary, const QString& lib) { - QRegExp erfexp(QString(moduleLibrary).replace("QtX", "Qt[4,5,6]")); + QRegularExpression erfexp(QString(moduleLibrary).replace("QtX", "Qt[4,5,6]")); return lib.contains(erfexp); } @@ -985,7 +985,7 @@ QString DeployCore::transportPathToSnapRoot(const QString &path) { return path; } - if (path.size() && path[0] != "/") { + if (path.size() && path[0] != QString("/")) { auto absalutPath = QProcessEnvironment::systemEnvironment().value("PWD") + "/" + path; if (!absalutPath.contains(DeployCore::snapRootFS())) { return snapRootFS() + "/" + absalutPath; diff --git a/src/LibDeploy/src/filemanager.cpp b/src/LibDeploy/src/filemanager.cpp index 73eef4c..0c0cba4 100644 --- a/src/LibDeploy/src/filemanager.cpp +++ b/src/LibDeploy/src/filemanager.cpp @@ -10,13 +10,15 @@ #include "filemanager.h" #include #include -#include "configparser.h" #include "defines.h" +#include "deployconfig.h" #include "deploycore.h" #include #include #include #include "pathutils.h" +#include +#include #ifdef Q_OS_WIN #include "windows.h" @@ -436,7 +438,7 @@ void FileManager::clear(const QString& targetDir, bool force) { for (auto it = sortedOldData.end(); it != sortedOldData.begin(); --it) { - auto index = it - 1; + auto index = std::prev(it); if (!index.value().exists()) { continue; @@ -470,9 +472,10 @@ bool FileManager::copyFile(const QString &file, const QString &target, QString FileManager::changeDistanation(const QString& absalutePath, QString basePath, int depch) { - - auto prefixes = absalutePath.split(QRegExp("[\\/]"), splitbehavior); - depch = std::min(depch, prefixes.size()); + QRegularExpression _matcher; + _matcher.setPattern("[\\/]"); + auto prefixes = absalutePath.split(_matcher, splitbehavior); + depch = std::min(static_cast(depch), static_cast(prefixes.size())); while (depch) { auto index = prefixes.size() - depch; if (index >= 0) { diff --git a/src/LibDeploy/src/packing.h b/src/LibDeploy/src/packing.h index 0b7d78c..7aea55f 100644 --- a/src/LibDeploy/src/packing.h +++ b/src/LibDeploy/src/packing.h @@ -8,6 +8,7 @@ #ifndef PACKING_H #define PACKING_H +#include #include #include #include "deploy_global.h" diff --git a/src/LibDeploy/src/pathutils.cpp b/src/LibDeploy/src/pathutils.cpp index ab44240..a191a67 100644 --- a/src/LibDeploy/src/pathutils.cpp +++ b/src/LibDeploy/src/pathutils.cpp @@ -89,12 +89,12 @@ QChar PathUtils::getDrive(QString path) { return path[0]; } - return 0; + return {}; } bool PathUtils::isAbsalutPath(const QString &path) { if (getDrive(path).isNull()) { - return path.size() && (path.at(0) == "/" || path.at(0) == "\\"); + return path.size() && (path.at(0) == QString("/") || path.at(0) == QString("\\")); } return true; @@ -117,9 +117,11 @@ QString PathUtils::getName(const QString &path) { if (fixedPath == "/") { return fixedPath; } + QRegularExpression _matche; - short endIndex = fixedPath.lastIndexOf(QRegularExpression("[/\\\\]")); - short beginIndex = fixedPath.lastIndexOf(QRegularExpression("[/\\\\]"), endIndex - 1) + 1; + _matche.setPattern("[/\\\\]"); + short endIndex = fixedPath.lastIndexOf(_matche); + short beginIndex = fixedPath.lastIndexOf(_matche, endIndex - 1) + 1; return fixedPath.mid(beginIndex, endIndex - beginIndex); } @@ -134,9 +136,11 @@ QString PathUtils::popItem(QString &path) { path = ""; return fixedPath; } + QRegularExpression _matche; - short endIndex = fixedPath.lastIndexOf(QRegularExpression("[/\\\\]")); - short beginIndex = fixedPath.lastIndexOf(QRegularExpression("[/\\\\]"), endIndex - 1) + 1; + _matche.setPattern("[/\\\\]"); + short endIndex = fixedPath.lastIndexOf(_matche); + short beginIndex = fixedPath.lastIndexOf(_matche, endIndex - 1) + 1; path = fixedPath.left(beginIndex); diff --git a/src/LibDeploy/src/qml.cpp b/src/LibDeploy/src/qml.cpp index a9669c4..20535fd 100644 --- a/src/LibDeploy/src/qml.cpp +++ b/src/LibDeploy/src/qml.cpp @@ -10,9 +10,8 @@ #include #include #include "defines.h" -#include "quasarapp.h" #include "deploycore.h" -#include "deployconfig.h" +#include "qregularexpression.h" QStringList QML::extractImportLine(const QString& line) const { QStringList result; @@ -25,7 +24,7 @@ QStringList QML::extractImportLine(const QString& line) const { return result; } // qt5 - result << (list[2][0] + "#" + list[1].replace(".", "/")); + result << (list[2][0] + QString("#") + list[1].replace(".", "/")); } else if (list.count() == 2 || (list.count() == 4 && list[2] == "as")) { // qt6 result << (list[1].replace(".", "/")); @@ -40,8 +39,13 @@ QStringList QML::extractImportsFromFile(const QString &filepath) const { if (!F.open(QIODevice::ReadOnly)) return QStringList(); QString content = F.readAll(); - content.remove(QRegExp("\\{(.*)\\}")); - content.remove(QRegExp("/\\*(.*)\\*/")); + QRegularExpression matcher; + + matcher.setPattern("\\{(.*)\\}"); + content.remove(matcher); + + matcher.setPattern("/\\*(.*)\\*/"); + content.remove(matcher); const auto list = content.split("\n"); for (const QString &line : list) for (QString &word : line.split(";", splitbehavior)) @@ -126,8 +130,9 @@ QString QML::getPathFromImport(const QString &import, bool checkVersions) { } else { return ""; } - - auto words = importData.value(index).split(QRegExp("[/\\\\]")); + QRegularExpression matcher; + matcher.setPattern("[/\\\\]"); + auto words = importData.value(index).split(matcher); const bool isSecond = importData.first() == "2" && checkVersions; bool secondVersion = isSecond; diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index e8d8964..a4aa1b2 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -31,3 +31,11 @@ target_include_directories(${CURRENT_PROJECT} PUBLIC ${PUBLIC_INCUDE_DIR}) initTests() addTests(${PROJECT_NAME} ${CURRENT_PROJECT}) + +add_subdirectory(examples/quicknanobrowser) +add_subdirectory(examples/TestCPPOnly) +add_subdirectory(examples/TestOnlyC) +add_subdirectory(examples/TestQMLWidgets) +add_subdirectory(examples/TestQtWidgets) +add_subdirectory(examples/virtualkeyboard) +add_subdirectory(examples/webui) diff --git a/tests/examples/TestCPPOnly/CMakeLists.txt b/tests/examples/TestCPPOnly/CMakeLists.txt index aeae3f8..f6cb98c 100644 --- a/tests/examples/TestCPPOnly/CMakeLists.txt +++ b/tests/examples/TestCPPOnly/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16) project(TestCPPOnly LANGUAGES CXX) -qt_add_executable(TestCPPOnly +add_executable(TestCPPOnly main.cpp ) diff --git a/tests/examples/TestOnlyC/CMakeLists.txt b/tests/examples/TestOnlyC/CMakeLists.txt index ab70185..4d3a789 100644 --- a/tests/examples/TestOnlyC/CMakeLists.txt +++ b/tests/examples/TestOnlyC/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.16) project(TestOnlyC LANGUAGES C) -qt_add_executable(TestOnlyC +add_executable(TestOnlyC main.cpp ) diff --git a/tests/examples/TestQMLWidgets/CMakeLists.txt b/tests/examples/TestQMLWidgets/CMakeLists.txt index 83dff93..3bf50b9 100644 --- a/tests/examples/TestQMLWidgets/CMakeLists.txt +++ b/tests/examples/TestQMLWidgets/CMakeLists.txt @@ -7,104 +7,22 @@ cmake_minimum_required(VERSION 3.18) -get_filename_component(CURRENT_PROJECT_DIR ${CMAKE_CURRENT_SOURCE_DIR} NAME) +find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Gui Quick) -set(CURRENT_PROJECT "${PROJECT_NAME}") -option(SIGN_APP "This option enable od disabled sign apk and aab files" ON) +set(CURRENT_PROJECT "TestQMLWidgets") file(GLOB_RECURSE SOURCE_CPP "*.cpp" "*.h" ) -if (${QT_VERSION_MAJOR}) - file(GLOB_RECURSE SOURCE_QRC - "*.qrc" - ) -endif() +file(GLOB_RECURSE SOURCE_QRC + "*.qrc" +) set(ALL_SOURCES ${SOURCE_CPP} ${SOURCE_QRC}) - set(PUBLIC_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") -set(PRIVATE_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Private") - - -if (${QT_VERSION_MAJOR} EQUAL 6) - - qt_add_executable(${CURRENT_PROJECT} MANUAL_FINALIZATION ${ALL_SOURCES}) - -else() - if (ANDROID) - add_library(${CURRENT_PROJECT} ${ALL_SOURCES}) - else () - add_executable(${CURRENT_PROJECT} ${ALL_SOURCES} ) - endif() - -endif() - -target_link_libraries(${CURRENT_PROJECT} PUBLIC LibDeploy) +add_executable(${CURRENT_PROJECT} ${ALL_SOURCES} ) +target_link_libraries(${CURRENT_PROJECT} PUBLIC Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Quick) target_include_directories(${CURRENT_PROJECT} PUBLIC ${PUBLIC_INCUDE_DIR}) -target_include_directories(${CURRENT_PROJECT} PRIVATE ${PRIVATE_INCUDE_DIR}) - -SET(TARGET_DIR "${CMAKE_SOURCE_DIR}/Distro") -file(MAKE_DIRECTORY ${TARGET_DIR}) - -if(QT_VERSION_MAJOR EQUAL 6) - # Add This line if your project use the Quick module - # qt_import_qml_plugins(${CURRENT_PROJECT}) - qt_finalize_executable(${CURRENT_PROJECT}) -endif() - - -set(LANGS ${CMAKE_CURRENT_SOURCE_DIR}/languages/en.ts - ${CMAKE_CURRENT_SOURCE_DIR}/languages/ru.ts - ${CMAKE_CURRENT_SOURCE_DIR}/languages/uk.ts - ${CMAKE_CURRENT_SOURCE_DIR}/languages/ja.ts - ${CMAKE_CURRENT_SOURCE_DIR}/languages/tr.ts - ${CMAKE_CURRENT_SOURCE_DIR}/languages/zh.ts - ${CMAKE_CURRENT_SOURCE_DIR}/languages/de.ts - ${CMAKE_CURRENT_SOURCE_DIR}/languages/fr.ts - ${CMAKE_CURRENT_SOURCE_DIR}/languages/es.ts - ${CMAKE_CURRENT_SOURCE_DIR}/languages/pl.ts) - -prepareQM(${CURRENT_PROJECT} ${CMAKE_CURRENT_SOURCE_DIR}/../ "${LANGS}") - -configure_file_in(${CURRENT_PROJECT} "${CMAKE_CURRENT_SOURCE_DIR}/Deploy/CQtDeployer.json") -configure_file_in(${CURRENT_PROJECT} "${CMAKE_CURRENT_SOURCE_DIR}/Deploy/CQtDeployerSingle.json") - -# qifw installer -configure_file_in(${CURRENT_PROJECT} "${CMAKE_CURRENT_SOURCE_DIR}/Deploy/QIFWTemplate/packages/CQtDeployer/meta/package.xml") -configure_file_in(${CURRENT_PROJECT} "${CMAKE_CURRENT_SOURCE_DIR}/Deploy/QIFWTemplate/packages/CQtDeployer.1_6/meta/package.xml") -configure_file_in(${CURRENT_PROJECT} "${CMAKE_CURRENT_SOURCE_DIR}/Deploy/QIFWTemplate/packages/QIF/meta/package.xml") - -# snap -configure_file_in(${CURRENT_PROJECT} "${CMAKE_SOURCE_DIR}/snap/snapcraft.yaml") - - -# sets qifw variable -set(HomeDir "@HomeDir@") -configure_file_in(${CURRENT_PROJECT} "${CMAKE_CURRENT_SOURCE_DIR}/Deploy/QIFWTemplate/config/config.xml") - - -addDeployFromCustomFile(${CURRENT_PROJECT} "${CMAKE_CURRENT_SOURCE_DIR}/Deploy/CQtDeployer.json") - -set(QIFW_PLATFORM linux) - -if (WIN32) - set(QIFW_PLATFORM windows) -endif() - -ADD_CUSTOM_TARGET( - downloadQIFW - SOURCES ${${name}files} - COMMAND python "${CMAKE_CURRENT_SOURCE_DIR}/Deploy/QIFW.py" ${QIFW_PLATFORM} ${QIFW_VERSION} "${CMAKE_CURRENT_SOURCE_DIR}/Deploy/QIFW" - COMMENT python "${CMAKE_CURRENT_SOURCE_DIR}/Deploy/QIFW.py" ${QIFW_PLATFORM} ${QIFW_VERSION} "${CMAKE_CURRENT_SOURCE_DIR}/Deploy/QIFW" - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -) -add_dependencies(deploy${CURRENT_PROJECT} downloadQIFW) - -addDeployFromCustomFile(${CURRENT_PROJECT}Single "${CMAKE_CURRENT_SOURCE_DIR}/Deploy/CQtDeployerSingle.json") - -set(SNAPCRAFT_EXTRA_ARG "--use-lxd") -addDeploySnap(${CURRENT_PROJECT} "${CMAKE_SOURCE_DIR}/Distro/") diff --git a/tests/examples/TestQMLWidgets/conf.qrc b/tests/examples/TestQMLWidgets/conf.qrc deleted file mode 100644 index 03a1bfc..0000000 --- a/tests/examples/TestQMLWidgets/conf.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - qt.conf - - diff --git a/tests/examples/TestQMLWidgets/main.cpp b/tests/examples/TestQMLWidgets/main.cpp index b532603..38c8a2f 100644 --- a/tests/examples/TestQMLWidgets/main.cpp +++ b/tests/examples/TestQMLWidgets/main.cpp @@ -4,8 +4,6 @@ int main(int argc, char *argv[]) { - QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); - QGuiApplication app(argc, argv); QQmlApplicationEngine engine; diff --git a/tests/examples/TestQMLWidgets/qml.qrc b/tests/examples/TestQMLWidgets/qml.qrc index 7725989..2e09c08 100644 --- a/tests/examples/TestQMLWidgets/qml.qrc +++ b/tests/examples/TestQMLWidgets/qml.qrc @@ -4,6 +4,5 @@ HomeForm.ui.qml Page1Form.ui.qml Page2Form.ui.qml - qtquickcontrols2.conf diff --git a/tests/examples/TestQtWidgets/CMakeLists.txt b/tests/examples/TestQtWidgets/CMakeLists.txt index 83dff93..c36940a 100644 --- a/tests/examples/TestQtWidgets/CMakeLists.txt +++ b/tests/examples/TestQtWidgets/CMakeLists.txt @@ -7,104 +7,22 @@ cmake_minimum_required(VERSION 3.18) -get_filename_component(CURRENT_PROJECT_DIR ${CMAKE_CURRENT_SOURCE_DIR} NAME) +find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Gui Widgets) -set(CURRENT_PROJECT "${PROJECT_NAME}") -option(SIGN_APP "This option enable od disabled sign apk and aab files" ON) +set(CURRENT_PROJECT "TestQtWidgets") file(GLOB_RECURSE SOURCE_CPP "*.cpp" "*.h" ) -if (${QT_VERSION_MAJOR}) - file(GLOB_RECURSE SOURCE_QRC - "*.qrc" - ) -endif() +file(GLOB_RECURSE SOURCE_QRC + "*.qrc" +) set(ALL_SOURCES ${SOURCE_CPP} ${SOURCE_QRC}) - set(PUBLIC_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") -set(PRIVATE_INCUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/Private") - - -if (${QT_VERSION_MAJOR} EQUAL 6) - - qt_add_executable(${CURRENT_PROJECT} MANUAL_FINALIZATION ${ALL_SOURCES}) - -else() - if (ANDROID) - add_library(${CURRENT_PROJECT} ${ALL_SOURCES}) - else () - add_executable(${CURRENT_PROJECT} ${ALL_SOURCES} ) - endif() - -endif() - -target_link_libraries(${CURRENT_PROJECT} PUBLIC LibDeploy) +add_executable(${CURRENT_PROJECT} ${ALL_SOURCES} ) +target_link_libraries(${CURRENT_PROJECT} PUBLIC Qt${QT_VERSION_MAJOR}::Gui Qt${QT_VERSION_MAJOR}::Widgets) target_include_directories(${CURRENT_PROJECT} PUBLIC ${PUBLIC_INCUDE_DIR}) -target_include_directories(${CURRENT_PROJECT} PRIVATE ${PRIVATE_INCUDE_DIR}) - -SET(TARGET_DIR "${CMAKE_SOURCE_DIR}/Distro") -file(MAKE_DIRECTORY ${TARGET_DIR}) - -if(QT_VERSION_MAJOR EQUAL 6) - # Add This line if your project use the Quick module - # qt_import_qml_plugins(${CURRENT_PROJECT}) - qt_finalize_executable(${CURRENT_PROJECT}) -endif() - - -set(LANGS ${CMAKE_CURRENT_SOURCE_DIR}/languages/en.ts - ${CMAKE_CURRENT_SOURCE_DIR}/languages/ru.ts - ${CMAKE_CURRENT_SOURCE_DIR}/languages/uk.ts - ${CMAKE_CURRENT_SOURCE_DIR}/languages/ja.ts - ${CMAKE_CURRENT_SOURCE_DIR}/languages/tr.ts - ${CMAKE_CURRENT_SOURCE_DIR}/languages/zh.ts - ${CMAKE_CURRENT_SOURCE_DIR}/languages/de.ts - ${CMAKE_CURRENT_SOURCE_DIR}/languages/fr.ts - ${CMAKE_CURRENT_SOURCE_DIR}/languages/es.ts - ${CMAKE_CURRENT_SOURCE_DIR}/languages/pl.ts) - -prepareQM(${CURRENT_PROJECT} ${CMAKE_CURRENT_SOURCE_DIR}/../ "${LANGS}") - -configure_file_in(${CURRENT_PROJECT} "${CMAKE_CURRENT_SOURCE_DIR}/Deploy/CQtDeployer.json") -configure_file_in(${CURRENT_PROJECT} "${CMAKE_CURRENT_SOURCE_DIR}/Deploy/CQtDeployerSingle.json") - -# qifw installer -configure_file_in(${CURRENT_PROJECT} "${CMAKE_CURRENT_SOURCE_DIR}/Deploy/QIFWTemplate/packages/CQtDeployer/meta/package.xml") -configure_file_in(${CURRENT_PROJECT} "${CMAKE_CURRENT_SOURCE_DIR}/Deploy/QIFWTemplate/packages/CQtDeployer.1_6/meta/package.xml") -configure_file_in(${CURRENT_PROJECT} "${CMAKE_CURRENT_SOURCE_DIR}/Deploy/QIFWTemplate/packages/QIF/meta/package.xml") - -# snap -configure_file_in(${CURRENT_PROJECT} "${CMAKE_SOURCE_DIR}/snap/snapcraft.yaml") - - -# sets qifw variable -set(HomeDir "@HomeDir@") -configure_file_in(${CURRENT_PROJECT} "${CMAKE_CURRENT_SOURCE_DIR}/Deploy/QIFWTemplate/config/config.xml") - - -addDeployFromCustomFile(${CURRENT_PROJECT} "${CMAKE_CURRENT_SOURCE_DIR}/Deploy/CQtDeployer.json") - -set(QIFW_PLATFORM linux) - -if (WIN32) - set(QIFW_PLATFORM windows) -endif() - -ADD_CUSTOM_TARGET( - downloadQIFW - SOURCES ${${name}files} - COMMAND python "${CMAKE_CURRENT_SOURCE_DIR}/Deploy/QIFW.py" ${QIFW_PLATFORM} ${QIFW_VERSION} "${CMAKE_CURRENT_SOURCE_DIR}/Deploy/QIFW" - COMMENT python "${CMAKE_CURRENT_SOURCE_DIR}/Deploy/QIFW.py" ${QIFW_PLATFORM} ${QIFW_VERSION} "${CMAKE_CURRENT_SOURCE_DIR}/Deploy/QIFW" - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} -) -add_dependencies(deploy${CURRENT_PROJECT} downloadQIFW) - -addDeployFromCustomFile(${CURRENT_PROJECT}Single "${CMAKE_CURRENT_SOURCE_DIR}/Deploy/CQtDeployerSingle.json") - -set(SNAPCRAFT_EXTRA_ARG "--use-lxd") -addDeploySnap(${CURRENT_PROJECT} "${CMAKE_SOURCE_DIR}/Distro/") diff --git a/tests/examples/quicknanobrowser/CMakeLists.txt b/tests/examples/quicknanobrowser/CMakeLists.txt index cdccc26..023000a 100644 --- a/tests/examples/quicknanobrowser/CMakeLists.txt +++ b/tests/examples/quicknanobrowser/CMakeLists.txt @@ -3,17 +3,17 @@ project(quicknanobrowser LANGUAGES CXX) set(CMAKE_AUTOMOC ON) -if(NOT DEFINED INSTALL_EXAMPLESDIR) - set(INSTALL_EXAMPLESDIR "examples") -endif() +find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui Qml Quick WebEngineQuick) -set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/webenginequick/quicknanobrowser") +# Resources: +file(GLOB_RECURSE SOURCE_QRC + "*.qrc" +) -find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick WebEngineQuick) - -qt_add_executable(quicknanobrowser +add_executable(quicknanobrowser main.cpp utils.h + ${SOURCE_QRC} ) set_target_properties(quicknanobrowser PROPERTIES @@ -28,48 +28,3 @@ target_link_libraries(quicknanobrowser PUBLIC Qt::Quick Qt::WebEngineQuick ) - -# Resources: -set(resources_resource_files - "ApplicationRoot.qml" - "BrowserDialog.qml" - "BrowserWindow.qml" - "DownloadView.qml" - "FindBar.qml" - "FullScreenNotification.qml" -) - -qt_add_resources(quicknanobrowser "resources" - PREFIX - "/" - FILES - ${resources_resource_files} -) - -set(resources1_resource_files - "icons/3rdparty/go-next.png" - "icons/3rdparty/go-previous.png" - "icons/3rdparty/process-stop.png" - "icons/3rdparty/view-refresh.png" -) - -qt_add_resources(quicknanobrowser "resources1" - PREFIX - "/icons" - BASE - "icons/3rdparty" - FILES - ${resources1_resource_files} -) - -if(TARGET Qt::Widgets) - target_link_libraries(quicknanobrowser PUBLIC - Qt::Widgets - ) -endif() - -install(TARGETS quicknanobrowser - RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" - BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" - LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" -) diff --git a/tests/examples/webui/CMakeLists.txt b/tests/examples/webui/CMakeLists.txt index e736a2c..30caa51 100644 --- a/tests/examples/webui/CMakeLists.txt +++ b/tests/examples/webui/CMakeLists.txt @@ -3,17 +3,20 @@ project(webui LANGUAGES CXX) set(CMAKE_AUTOMOC ON) -if(NOT DEFINED INSTALL_EXAMPLESDIR) - set(INSTALL_EXAMPLESDIR "examples") -endif() - set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/webenginewidgets/webui") -find_package(Qt6 REQUIRED COMPONENTS Core Gui WebEngineWidgets) +find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Gui WebEngineWidgets) -qt_add_executable(webui +# Resources: +file(GLOB_RECURSE SOURCE_QRC + "*.qrc" +) + +add_executable(webui main.cpp webuihandler.cpp webuihandler.h + ${SOURCE_QRC} + ) set_target_properties(webui PROPERTIES @@ -26,21 +29,3 @@ target_link_libraries(webui PUBLIC Qt::Gui Qt::WebEngineWidgets ) - -# Resources: -set(webui_resource_files - "about.html" -) - -qt_add_resources(webui "webui" - PREFIX - "/" - FILES - ${webui_resource_files} -) - -install(TARGETS webui - RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" - BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" - LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" -)