From d7df1a8eca96aea7329941fb88ef2980788bc8ba Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 5 Sep 2023 22:58:29 +0200 Subject: [PATCH] packagechooser: Adapt to Qt6 While here, deal with the WITH_ -> BUILD_ change of options. --- CMakeLists.txt | 8 +++++--- src/modules/packagechooser/CMakeLists.txt | 17 ++++++++--------- src/modules/packagechooser/Config.cpp | 3 ++- src/modules/packagechooserq/CMakeLists.txt | 17 ++++++++--------- 4 files changed, 23 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cad505366..886f0e64e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,19 +20,21 @@ # SKIP_MODULES : a space or semicolon-separated list of directory names # under src/modules that should not be built. # USE_ : fills in SKIP_MODULES for modules called -. -# WITH_QT6 : use Qt6, rather than Qt5 (default to OFF). # WITH_ : try to enable (these usually default to ON). For # a list of WITH_ grep CMakeCache.txt after running # CMake once. These affect the ABI offered by Calamares. # - PYTHON (enable Python Job modules) # - QML (enable QML UI View modules) +# - QT6 (use Qt6 rather than Qt5, default to OFF) # The WITH_* options affect the ABI of Calamares: you must # build (C++) modules for Calamares with the same WITH_* # settings, or they may not load at all. # BUILD_ : choose additional things to build -# - TESTING (standard CMake option) -# - SCHEMA_TESTING (requires Python, see ci/configvalidator.py) +# - APPDATA (use AppData in packagechooser, requires QtXml) +# - APPSTREAM (use AppStream in packagechooser, requires libappstream-qt) # - BUILD_CRASH_REPORTING (uses KCrash, rather than Calamares internal, for crash reporting) +# - SCHEMA_TESTING (requires Python, see ci/configvalidator.py) +# - TESTING (standard CMake option) # DEBUG_ : special developer flags for debugging. # # Example usage: diff --git a/src/modules/packagechooser/CMakeLists.txt b/src/modules/packagechooser/CMakeLists.txt index e565fd05e..f42029964 100644 --- a/src/modules/packagechooser/CMakeLists.txt +++ b/src/modules/packagechooser/CMakeLists.txt @@ -3,20 +3,19 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -find_package(Qt5 COMPONENTS Core Gui Widgets REQUIRED) +find_package(${qtname} COMPONENTS Core Gui Widgets REQUIRED) set(_extra_libraries "") set(_extra_src "") ### OPTIONAL AppData XML support in PackageModel # # -# TODO:3.3:WITH->BUILD (this doesn't affect the ABI offered by Calamares) -option(WITH_APPDATA "Support appdata: items in PackageChooser (requires QtXml)" ON) -if(WITH_APPDATA) - find_package(Qt5 COMPONENTS Xml) - if(Qt5Xml_FOUND) +option(BUILD_APPDATA "Support appdata: items in PackageChooser (requires QtXml)" ON) +if(BUILD_APPDATA) + find_package(${qtname} COMPONENTS Xml) + if(TARGET ${qtname}::Xml) add_definitions(-DHAVE_APPDATA) - list(APPEND _extra_libraries Qt5::Xml) + list(APPEND _extra_libraries ${qtname}::Xml) list(APPEND _extra_src ItemAppData.cpp) endif() endif() @@ -24,8 +23,8 @@ endif() ### OPTIONAL AppStream support in PackageModel # # -option(WITH_APPSTREAM "Support appstream: items in PackageChooser (requires libappstream-qt)" ON) -if(WITH_APPSTREAM) +option(BUILD_APPSTREAM "Support appstream: items in PackageChooser (requires libappstream-qt)" ON) +if(BUILD_APPSTREAM) find_package(AppStreamQt) set_package_properties( AppStreamQt diff --git a/src/modules/packagechooser/Config.cpp b/src/modules/packagechooser/Config.cpp index 667621597..b596fe6e8 100644 --- a/src/modules/packagechooser/Config.cpp +++ b/src/modules/packagechooser/Config.cpp @@ -23,6 +23,7 @@ #include "GlobalStorage.h" #include "JobQueue.h" +#include "compat/Variant.h" #include "packages/Globals.h" #include "utils/Logger.h" #include "utils/Variant.h" @@ -175,7 +176,7 @@ Config::updateGlobalStorage( const QStringList& selected ) const if ( gs->contains( "netinstallSelect" ) ) { auto selectedOrig = gs->value( "netinstallSelect" ); - if ( selectedOrig.canConvert( QVariant::StringList ) ) + if ( selectedOrig.canConvert< QStringList >() ) { newSelected += selectedOrig.toStringList(); } diff --git a/src/modules/packagechooserq/CMakeLists.txt b/src/modules/packagechooserq/CMakeLists.txt index 0b2c4b23a..5591f5a8f 100644 --- a/src/modules/packagechooserq/CMakeLists.txt +++ b/src/modules/packagechooserq/CMakeLists.txt @@ -9,7 +9,7 @@ if(NOT WITH_QML) return() endif() -find_package(Qt5 ${QT_VERSION} CONFIG REQUIRED Core) +find_package(${qtname} ${QT_VERSION} CONFIG REQUIRED Core) # Add optional libraries here set(USER_EXTRA_LIB) @@ -21,13 +21,12 @@ include_directories(${_packagechooser}) ### OPTIONAL AppData XML support in PackageModel # # -# TODO:3.3:WITH->BUILD (this doesn't affect the ABI offered by Calamares) -option(WITH_APPDATA "Support appdata: items in PackageChooser (requires QtXml)" ON) -if(WITH_APPDATA) - find_package(Qt5 COMPONENTS Xml) - if(Qt5Xml_FOUND) +option(BUILD_APPDATA "Support appdata: items in PackageChooser (requires QtXml)" ON) +if(BUILD_APPDATA) + find_package(${qtname} COMPONENTS Xml) + if(TARGET ${qtname}::Xml) add_definitions(-DHAVE_APPDATA) - list(APPEND _extra_libraries Qt5::Xml) + list(APPEND _extra_libraries ${qtname}::Xml) list(APPEND _extra_src ${_packagechooser}/ItemAppData.cpp) endif() endif() @@ -35,8 +34,8 @@ endif() ### OPTIONAL AppStream support in PackageModel # # -option(WITH_APPSTREAM "Support appstream: items in PackageChooser (requires libappstream-qt)" ON) -if(WITH_APPSTREAM) +option(BUILD_APPSTREAM "Support appstream: items in PackageChooser (requires libappstream-qt)" ON) +if(BUILD_APPSTREAM) find_package(AppStreamQt) set_package_properties( AppStreamQt