mirror of
https://github.com/parchlinux/calamares.git
synced 2025-02-24 19:05:46 -05:00
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
7 changed files with 29 additions and 23 deletions
|
@ -20,10 +20,8 @@ add_subdirectory(qml/calamares)
|
||||||
# application
|
# application
|
||||||
add_subdirectory(calamares)
|
add_subdirectory(calamares)
|
||||||
|
|
||||||
if(NOT WITH_QT6) # TODO: Qt6
|
|
||||||
# plugins
|
# plugins
|
||||||
add_subdirectory(modules)
|
add_subdirectory(modules)
|
||||||
|
|
||||||
# branding components
|
# branding components
|
||||||
add_subdirectory(branding)
|
add_subdirectory(branding)
|
||||||
endif()
|
|
||||||
|
|
|
@ -21,6 +21,10 @@ string(REPLACE " " ";" SKIP_LIST "${SKIP_MODULES}")
|
||||||
file(GLOB SUBDIRECTORIES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*")
|
file(GLOB SUBDIRECTORIES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "*")
|
||||||
list(SORT SUBDIRECTORIES)
|
list(SORT SUBDIRECTORIES)
|
||||||
|
|
||||||
|
if(WITH_QT6) # TODO: Qt6
|
||||||
|
set(SUBDIRECTORIES welcome welcomeq)
|
||||||
|
endif()
|
||||||
|
|
||||||
foreach(SUBDIRECTORY ${SUBDIRECTORIES})
|
foreach(SUBDIRECTORY ${SUBDIRECTORIES})
|
||||||
calamares_add_module_subdirectory( ${SUBDIRECTORY} LIST_SKIPPED_MODULES )
|
calamares_add_module_subdirectory( ${SUBDIRECTORY} LIST_SKIPPED_MODULES )
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
# SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
|
# SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
|
||||||
# SPDX-License-Identifier: BSD-2-Clause
|
# 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)
|
find_package(LIBPARTED)
|
||||||
if(LIBPARTED_FOUND)
|
if(LIBPARTED_FOUND)
|
||||||
|
@ -34,13 +34,13 @@ calamares_add_plugin(welcome
|
||||||
welcome.qrc
|
welcome.qrc
|
||||||
LINK_PRIVATE_LIBRARIES
|
LINK_PRIVATE_LIBRARIES
|
||||||
${PARTMAN_LIB}
|
${PARTMAN_LIB}
|
||||||
Qt5::DBus
|
${qtname}::DBus
|
||||||
Qt5::Network
|
${qtname}::Network
|
||||||
SHARED_LIB
|
SHARED_LIB
|
||||||
)
|
)
|
||||||
|
|
||||||
calamares_add_test(
|
calamares_add_test(
|
||||||
welcometest
|
welcometest
|
||||||
SOURCES checker/GeneralRequirements.cpp ${PARTMAN_SRC} Config.cpp Tests.cpp
|
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 "GlobalStorage.h"
|
||||||
#include "JobQueue.h"
|
#include "JobQueue.h"
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
|
#include "compat/Variant.h"
|
||||||
#include "geoip/Handler.h"
|
#include "geoip/Handler.h"
|
||||||
#include "locale/Global.h"
|
#include "locale/Global.h"
|
||||||
#include "locale/Lookup.h"
|
#include "locale/Lookup.h"
|
||||||
|
@ -301,11 +302,11 @@ jobOrBrandingSetting( Calamares::Branding::StringEntry e, const QVariantMap& map
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
auto v = map.value( key );
|
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();
|
return v.toBool() ? ( Calamares::Branding::instance()->string( e ) ) : QString();
|
||||||
}
|
}
|
||||||
if ( v.type() == QVariant::String )
|
if ( Calamares::typeOf( v ) == Calamares::StringVariantType )
|
||||||
{
|
{
|
||||||
return v.toString();
|
return v.toString();
|
||||||
}
|
}
|
||||||
|
@ -417,7 +418,7 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
|
||||||
::setGeoIP( this, configurationMap );
|
::setGeoIP( this, configurationMap );
|
||||||
|
|
||||||
if ( configurationMap.contains( "requirements" )
|
if ( configurationMap.contains( "requirements" )
|
||||||
&& configurationMap.value( "requirements" ).type() == QVariant::Map )
|
&& Calamares::typeOf( configurationMap.value( "requirements" ) ) == Calamares::MapVariantType )
|
||||||
{
|
{
|
||||||
m_requirementsChecker->setConfigurationMap( configurationMap.value( "requirements" ).toMap() );
|
m_requirementsChecker->setConfigurationMap( configurationMap.value( "requirements" ).toMap() );
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,11 +62,11 @@ WelcomeTests::testOneUrl()
|
||||||
|
|
||||||
// BUILD_AS_TEST is the source-directory path
|
// BUILD_AS_TEST is the source-directory path
|
||||||
QString filename = QStringLiteral( "1a-checkinternet.conf" );
|
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() );
|
QVERIFY( fi.exists() );
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
const auto map = CalamaresUtils::loadYaml( fi, &ok );
|
const auto map = CalamaresUtils::loadYaml( QFileInfo( fi ), &ok );
|
||||||
QVERIFY( ok );
|
QVERIFY( ok );
|
||||||
QVERIFY( map.count() > 0 );
|
QVERIFY( map.count() > 0 );
|
||||||
QVERIFY( map.contains( "requirements" ) );
|
QVERIFY( map.contains( "requirements" ) );
|
||||||
|
@ -100,7 +100,7 @@ WelcomeTests::testUrls()
|
||||||
Config c;
|
Config c;
|
||||||
|
|
||||||
// BUILD_AS_TEST is the source-directory path
|
// 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() );
|
QVERIFY( fi.exists() );
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
|
@ -130,7 +130,7 @@ WelcomeTests::testBadConfigDoesNotResetUrls()
|
||||||
const QString filename = QStringLiteral( "1b-checkinternet.conf" ); // "none"
|
const QString filename = QStringLiteral( "1b-checkinternet.conf" ); // "none"
|
||||||
|
|
||||||
// BUILD_AS_TEST is the source-directory path
|
// 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() );
|
QVERIFY( fi.exists() );
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
|
@ -147,7 +147,7 @@ WelcomeTests::testBadConfigDoesNotResetUrls()
|
||||||
const QString filename = QStringLiteral( "1d-checkinternet.conf" ); // "bogus"
|
const QString filename = QStringLiteral( "1d-checkinternet.conf" ); // "bogus"
|
||||||
|
|
||||||
// BUILD_AS_TEST is the source-directory path
|
// 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() );
|
QVERIFY( fi.exists() );
|
||||||
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include "GlobalStorage.h"
|
#include "GlobalStorage.h"
|
||||||
#include "JobQueue.h"
|
#include "JobQueue.h"
|
||||||
#include "Settings.h"
|
#include "Settings.h"
|
||||||
|
#include "compat/Variant.h"
|
||||||
#include "modulesystem/Requirement.h"
|
#include "modulesystem/Requirement.h"
|
||||||
#include "network/Manager.h"
|
#include "network/Manager.h"
|
||||||
#include "utils/CalamaresUtilsGui.h"
|
#include "utils/CalamaresUtilsGui.h"
|
||||||
|
@ -330,7 +331,8 @@ GeneralRequirements::setConfigurationMap( const QVariantMap& configurationMap )
|
||||||
{
|
{
|
||||||
bool incompleteConfiguration = false;
|
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.clear();
|
||||||
m_entriesToCheck.append( configurationMap.value( "check" ).toStringList() );
|
m_entriesToCheck.append( configurationMap.value( "check" ).toStringList() );
|
||||||
|
@ -341,7 +343,8 @@ GeneralRequirements::setConfigurationMap( const QVariantMap& configurationMap )
|
||||||
incompleteConfiguration = true;
|
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.clear();
|
||||||
m_entriesToRequire.append( configurationMap.value( "required" ).toStringList() );
|
m_entriesToRequire.append( configurationMap.value( "required" ).toStringList() );
|
||||||
|
@ -371,8 +374,8 @@ GeneralRequirements::setConfigurationMap( const QVariantMap& configurationMap )
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( configurationMap.contains( "requiredStorage" )
|
if ( configurationMap.contains( "requiredStorage" )
|
||||||
&& ( configurationMap.value( "requiredStorage" ).type() == QVariant::Double
|
&& ( Calamares::typeOf( configurationMap.value( "requiredStorage" ) ) == Calamares::DoubleVariantType
|
||||||
|| configurationMap.value( "requiredStorage" ).type() == QVariant::LongLong ) )
|
|| Calamares::typeOf( configurationMap.value( "requiredStorage" ) ) == Calamares::LongLongVariantType ) )
|
||||||
{
|
{
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
m_requiredStorageGiB = configurationMap.value( "requiredStorage" ).toDouble( &ok );
|
m_requiredStorageGiB = configurationMap.value( "requiredStorage" ).toDouble( &ok );
|
||||||
|
@ -392,8 +395,8 @@ GeneralRequirements::setConfigurationMap( const QVariantMap& configurationMap )
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( configurationMap.contains( "requiredRam" )
|
if ( configurationMap.contains( "requiredRam" )
|
||||||
&& ( configurationMap.value( "requiredRam" ).type() == QVariant::Double
|
&& ( Calamares::typeOf( configurationMap.value( "requiredRam" ) ) == Calamares::DoubleVariantType
|
||||||
|| configurationMap.value( "requiredRam" ).type() == QVariant::LongLong ) )
|
|| Calamares::typeOf( configurationMap.value( "requiredRam" ) ) == Calamares::LongLongVariantType ) )
|
||||||
{
|
{
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
m_requiredRamGiB = configurationMap.value( "requiredRam" ).toDouble( &ok );
|
m_requiredRamGiB = configurationMap.value( "requiredRam" ).toDouble( &ok );
|
||||||
|
|
|
@ -17,7 +17,7 @@ set(_welcome ${CMAKE_CURRENT_SOURCE_DIR}/../welcome)
|
||||||
include_directories(${_welcome})
|
include_directories(${_welcome})
|
||||||
|
|
||||||
# DUPLICATED WITH WELCOME MODULE
|
# 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)
|
find_package(LIBPARTED)
|
||||||
if(LIBPARTED_FOUND)
|
if(LIBPARTED_FOUND)
|
||||||
|
@ -42,7 +42,7 @@ calamares_add_plugin(welcomeq
|
||||||
welcomeq.qrc
|
welcomeq.qrc
|
||||||
LINK_PRIVATE_LIBRARIES
|
LINK_PRIVATE_LIBRARIES
|
||||||
${CHECKER_LINK_LIBRARIES}
|
${CHECKER_LINK_LIBRARIES}
|
||||||
Qt5::DBus
|
${qtname}::DBus
|
||||||
Qt5::Network
|
${qtname}::Network
|
||||||
SHARED_LIB
|
SHARED_LIB
|
||||||
)
|
)
|
||||||
|
|
Loading…
Add table
Reference in a new issue