welcome: enable Qt6 build
- Adjust for QVariant changes - Fix tests, no more conversion available from QFile to QFileInfo
This commit is contained in:
parent
2ffcfb3ddd
commit
c5929e30d1
@ -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()
|
||||
|
@ -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()
|
||||
|
@ -3,7 +3,7 @@
|
||||
# SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
|
||||
# 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
|
||||
)
|
||||
|
@ -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() );
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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 );
|
||||
|
@ -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
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user