diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0ae829fd4..2d5d885c7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -20,10 +20,8 @@ add_subdirectory(qml/calamares) # application add_subdirectory(calamares) -if(NOT WITH_QT6) # TODO: Qt6 # plugins add_subdirectory(modules) # branding components add_subdirectory(branding) -endif() diff --git a/src/modules/CMakeLists.txt b/src/modules/CMakeLists.txt index bb7335316..1d6dbe255 100644 --- a/src/modules/CMakeLists.txt +++ b/src/modules/CMakeLists.txt @@ -21,6 +21,10 @@ string(REPLACE " " ";" SKIP_LIST "${SKIP_MODULES}") file(GLOB SUBDIRECTORIES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*") list(SORT SUBDIRECTORIES) +if(WITH_QT6) # TODO: Qt6 +set(SUBDIRECTORIES welcome welcomeq) +endif() + foreach(SUBDIRECTORY ${SUBDIRECTORIES}) calamares_add_module_subdirectory( ${SUBDIRECTORY} LIST_SKIPPED_MODULES ) endforeach() diff --git a/src/modules/welcome/CMakeLists.txt b/src/modules/welcome/CMakeLists.txt index 0a8353084..19714e9c3 100644 --- a/src/modules/welcome/CMakeLists.txt +++ b/src/modules/welcome/CMakeLists.txt @@ -3,7 +3,7 @@ # SPDX-FileCopyrightText: 2020 Adriaan de Groot # SPDX-License-Identifier: BSD-2-Clause # -find_package(Qt5 ${QT_VERSION} CONFIG REQUIRED DBus Network) +find_package(${qtname} ${QT_VERSION} CONFIG REQUIRED DBus Network) find_package(LIBPARTED) if(LIBPARTED_FOUND) @@ -34,13 +34,13 @@ calamares_add_plugin(welcome welcome.qrc LINK_PRIVATE_LIBRARIES ${PARTMAN_LIB} - Qt5::DBus - Qt5::Network + ${qtname}::DBus + ${qtname}::Network SHARED_LIB ) calamares_add_test( welcometest SOURCES checker/GeneralRequirements.cpp ${PARTMAN_SRC} Config.cpp Tests.cpp - LIBRARIES ${PARTMAN_LIB} Qt5::DBus Qt5::Network Qt5::Widgets Calamares::calamaresui + LIBRARIES ${PARTMAN_LIB} ${qtname}::DBus ${qtname}::Network ${qtname}::Widgets Calamares::calamaresui ) diff --git a/src/modules/welcome/Config.cpp b/src/modules/welcome/Config.cpp index ca907d384..7847627a0 100644 --- a/src/modules/welcome/Config.cpp +++ b/src/modules/welcome/Config.cpp @@ -14,6 +14,7 @@ #include "GlobalStorage.h" #include "JobQueue.h" #include "Settings.h" +#include "compat/Variant.h" #include "geoip/Handler.h" #include "locale/Global.h" #include "locale/Lookup.h" @@ -301,11 +302,11 @@ jobOrBrandingSetting( Calamares::Branding::StringEntry e, const QVariantMap& map return QString(); } auto v = map.value( key ); - if ( v.type() == QVariant::Bool ) + if ( Calamares::typeOf( v ) == Calamares::BoolVariantType ) { return v.toBool() ? ( Calamares::Branding::instance()->string( e ) ) : QString(); } - if ( v.type() == QVariant::String ) + if ( Calamares::typeOf( v ) == Calamares::StringVariantType ) { return v.toString(); } @@ -417,7 +418,7 @@ Config::setConfigurationMap( const QVariantMap& configurationMap ) ::setGeoIP( this, configurationMap ); if ( configurationMap.contains( "requirements" ) - && configurationMap.value( "requirements" ).type() == QVariant::Map ) + && Calamares::typeOf( configurationMap.value( "requirements" ) ) == Calamares::MapVariantType ) { m_requirementsChecker->setConfigurationMap( configurationMap.value( "requirements" ).toMap() ); } diff --git a/src/modules/welcome/Tests.cpp b/src/modules/welcome/Tests.cpp index 1e1d07c4b..70e18b88f 100644 --- a/src/modules/welcome/Tests.cpp +++ b/src/modules/welcome/Tests.cpp @@ -62,11 +62,11 @@ WelcomeTests::testOneUrl() // BUILD_AS_TEST is the source-directory path QString filename = QStringLiteral( "1a-checkinternet.conf" ); - QFile fi( QString( "%1/tests/%2" ).arg( BUILD_AS_TEST, filename ) ); + QFileInfo fi( QString( "%1/tests/%2" ).arg( BUILD_AS_TEST, filename ) ); QVERIFY( fi.exists() ); bool ok = false; - const auto map = CalamaresUtils::loadYaml( fi, &ok ); + const auto map = CalamaresUtils::loadYaml( QFileInfo( fi ), &ok ); QVERIFY( ok ); QVERIFY( map.count() > 0 ); QVERIFY( map.contains( "requirements" ) ); @@ -100,7 +100,7 @@ WelcomeTests::testUrls() Config c; // BUILD_AS_TEST is the source-directory path - QFile fi( QString( "%1/tests/%2" ).arg( BUILD_AS_TEST, filename ) ); + QFileInfo fi( QString( "%1/tests/%2" ).arg( BUILD_AS_TEST, filename ) ); QVERIFY( fi.exists() ); bool ok = false; @@ -130,7 +130,7 @@ WelcomeTests::testBadConfigDoesNotResetUrls() const QString filename = QStringLiteral( "1b-checkinternet.conf" ); // "none" // BUILD_AS_TEST is the source-directory path - QFile fi( QString( "%1/tests/%2" ).arg( BUILD_AS_TEST, filename ) ); + QFileInfo fi( QString( "%1/tests/%2" ).arg( BUILD_AS_TEST, filename ) ); QVERIFY( fi.exists() ); bool ok = false; @@ -147,7 +147,7 @@ WelcomeTests::testBadConfigDoesNotResetUrls() const QString filename = QStringLiteral( "1d-checkinternet.conf" ); // "bogus" // BUILD_AS_TEST is the source-directory path - QFile fi( QString( "%1/tests/%2" ).arg( BUILD_AS_TEST, filename ) ); + QFileInfo fi( QString( "%1/tests/%2" ).arg( BUILD_AS_TEST, filename ) ); QVERIFY( fi.exists() ); bool ok = false; diff --git a/src/modules/welcome/checker/GeneralRequirements.cpp b/src/modules/welcome/checker/GeneralRequirements.cpp index cebfc1a4b..330288965 100644 --- a/src/modules/welcome/checker/GeneralRequirements.cpp +++ b/src/modules/welcome/checker/GeneralRequirements.cpp @@ -19,6 +19,7 @@ #include "GlobalStorage.h" #include "JobQueue.h" #include "Settings.h" +#include "compat/Variant.h" #include "modulesystem/Requirement.h" #include "network/Manager.h" #include "utils/CalamaresUtilsGui.h" @@ -330,7 +331,8 @@ GeneralRequirements::setConfigurationMap( const QVariantMap& configurationMap ) { bool incompleteConfiguration = false; - if ( configurationMap.contains( "check" ) && configurationMap.value( "check" ).type() == QVariant::List ) + if ( configurationMap.contains( "check" ) + && Calamares::typeOf( configurationMap.value( "check" ) ) == Calamares::ListVariantType ) { m_entriesToCheck.clear(); m_entriesToCheck.append( configurationMap.value( "check" ).toStringList() ); @@ -341,7 +343,8 @@ GeneralRequirements::setConfigurationMap( const QVariantMap& configurationMap ) incompleteConfiguration = true; } - if ( configurationMap.contains( "required" ) && configurationMap.value( "required" ).type() == QVariant::List ) + if ( configurationMap.contains( "required" ) + && Calamares::typeOf( configurationMap.value( "required" ) ) == Calamares::ListVariantType ) { m_entriesToRequire.clear(); m_entriesToRequire.append( configurationMap.value( "required" ).toStringList() ); @@ -371,8 +374,8 @@ GeneralRequirements::setConfigurationMap( const QVariantMap& configurationMap ) } if ( configurationMap.contains( "requiredStorage" ) - && ( configurationMap.value( "requiredStorage" ).type() == QVariant::Double - || configurationMap.value( "requiredStorage" ).type() == QVariant::LongLong ) ) + && ( Calamares::typeOf( configurationMap.value( "requiredStorage" ) ) == Calamares::DoubleVariantType + || Calamares::typeOf( configurationMap.value( "requiredStorage" ) ) == Calamares::LongLongVariantType ) ) { bool ok = false; m_requiredStorageGiB = configurationMap.value( "requiredStorage" ).toDouble( &ok ); @@ -392,8 +395,8 @@ GeneralRequirements::setConfigurationMap( const QVariantMap& configurationMap ) } if ( configurationMap.contains( "requiredRam" ) - && ( configurationMap.value( "requiredRam" ).type() == QVariant::Double - || configurationMap.value( "requiredRam" ).type() == QVariant::LongLong ) ) + && ( Calamares::typeOf( configurationMap.value( "requiredRam" ) ) == Calamares::DoubleVariantType + || Calamares::typeOf( configurationMap.value( "requiredRam" ) ) == Calamares::LongLongVariantType ) ) { bool ok = false; m_requiredRamGiB = configurationMap.value( "requiredRam" ).toDouble( &ok ); diff --git a/src/modules/welcomeq/CMakeLists.txt b/src/modules/welcomeq/CMakeLists.txt index 7afdf638c..2538dc14b 100644 --- a/src/modules/welcomeq/CMakeLists.txt +++ b/src/modules/welcomeq/CMakeLists.txt @@ -17,7 +17,7 @@ set(_welcome ${CMAKE_CURRENT_SOURCE_DIR}/../welcome) include_directories(${_welcome}) # DUPLICATED WITH WELCOME MODULE -find_package(Qt5 ${QT_VERSION} CONFIG REQUIRED DBus Network) +find_package(${qtname} ${QT_VERSION} CONFIG REQUIRED DBus Network) find_package(LIBPARTED) if(LIBPARTED_FOUND) @@ -42,7 +42,7 @@ calamares_add_plugin(welcomeq welcomeq.qrc LINK_PRIVATE_LIBRARIES ${CHECKER_LINK_LIBRARIES} - Qt5::DBus - Qt5::Network + ${qtname}::DBus + ${qtname}::Network SHARED_LIB )