diff --git a/qt/CMakeLists.txt b/qt/CMakeLists.txt index f0e7cb57..4dbfea49 100644 --- a/qt/CMakeLists.txt +++ b/qt/CMakeLists.txt @@ -1,12 +1,19 @@ if(DESIRED_QT_VERSION) if(DESIRED_QT_VERSION MATCHES 4) find_package(Qt4 QUIET) - else() + elseif(DESIRED_QT_VERSION MATCHES 5) find_package(Qt5Widgets QUIET) find_package(Qt5Network QUIET) find_package(Qt5LinguistTools QUIET) + else() + find_package(Qt6Widgets QUIET) + find_package(Qt6Network QUIET) + find_package(Qt6LinguistTools QUIET) endif() else() + find_package(Qt6Widgets QUIET) + find_package(Qt6Network QUIET) + find_package(Qt6LinguistTools QUIET) find_package(Qt5Widgets QUIET) find_package(Qt5Network QUIET) find_package(Qt5LinguistTools QUIET) @@ -53,7 +60,23 @@ set(TS_FILES translations/android-file-transfer-linux_zh-CN.ts ) -if (Qt5Widgets_FOUND) +if (Qt6Widgets_FOUND) + message(STATUS "Using Qt6") + qt6_wrap_cpp(HEADERS_MOC ${HEADERS}) + qt6_wrap_ui(FORMS_HEADERS ${FORMS}) + + qt6_add_translation(QM_FILES ${TS_FILES}) + set(QM_FILES_XML "") + foreach(_QM ${QM_FILES}) + get_filename_component(_QM ${_QM} NAME) + set(QM_FILES_XML "${QM_FILES_XML}${_QM}") + endforeach() + configure_file(translations/translations.qrc.in translations.qrc) + + qt6_add_resources(RESOURCES android-file-transfer.qrc ${CMAKE_CURRENT_BINARY_DIR}/translations.qrc) + include_directories(${Qt6Widgets_INCLUDE_DIRS} ${Qt6Network_INCLUDE_DIRS}) + set(EXTRA_QT_LINK ${Qt6Widgets_LIBRARIES} ${Qt6Network_LIBRARIES}) +elseif (Qt5Widgets_FOUND) message(STATUS "Using Qt5") qt5_wrap_cpp(HEADERS_MOC ${HEADERS}) qt5_wrap_ui(FORMS_HEADERS ${FORMS}) diff --git a/qt/commandqueue.h b/qt/commandqueue.h index d7d9efd4..9471799c 100644 --- a/qt/commandqueue.h +++ b/qt/commandqueue.h @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include