Merge branch 'work/qt6' into calamares

This commit is contained in:
Adriaan de Groot 2023-09-03 23:04:12 +02:00
commit 8f836969eb
53 changed files with 502 additions and 243 deletions

View File

@ -23,4 +23,4 @@ target_include_directories(
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
)
target_link_libraries(kdsingleapplication Qt5::Core Qt5::Network)
target_link_libraries(kdsingleapplication ${qtname}::Core ${qtname}::Network)

View File

@ -1,7 +0,0 @@
include(CMakeFindDependencyMacro)
find_dependency(Qt5Widgets REQUIRED)
find_dependency(Qt5Network REQUIRED)
# Add the targets file
include("${CMAKE_CURRENT_LIST_DIR}/KDSingleApplicationTargets.cmake")

View File

@ -19,7 +19,8 @@
#
# SKIP_MODULES : a space or semicolon-separated list of directory names
# under src/modules that should not be built.
# USE_<foo> : fills in SKIP_MODULES for modules called <foo>-<something>
# USE_<foo> : fills in SKIP_MODULES for modules called <foo>-<something>.
# WITH_QT6 : use Qt6, rather than Qt5 (default to OFF).
# WITH_<foo> : try to enable <foo> (these usually default to ON). For
# a list of WITH_<foo> grep CMakeCache.txt after running
# CMake once. These affect the ABI offered by Calamares.
@ -32,14 +33,14 @@
# - TESTING (standard CMake option)
# - SCHEMA_TESTING (requires Python, see ci/configvalidator.py)
# - KF5Crash (uses KCrash, rather than Calamares internal, for crash reporting)
# DEBUG_<foo> : special developer flags for debugging
# DEBUG_<foo> : special developer flags for debugging.
#
# Example usage:
#
# cmake . -DSKIP_MODULES="partition luksbootkeycfg"
#
# One special target is "show-version", which can be built
# to obtain the version number from here.
# To obtain the version number of calamares, run CMake in script mode, e.g.
# cmake -P CMakeLists.txt
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
@ -79,6 +80,7 @@ option(INSTALL_COMPLETION "Install shell completions" OFF)
# also update libcalamares/CalamaresConfig.h.in
option(WITH_PYTHON "Enable Python modules API (requires Boost.Python)." ON)
option(WITH_QML "Enable QML UI options." ON)
option(WITH_QT6 "Use Qt6 instead of Qt5" OFF)
#
# Additional parts to build that do not affect ABI
option(BUILD_SCHEMA_TESTING "Enable schema-validation-tests" ON)
@ -161,11 +163,26 @@ set( _tx_incomplete eo es_PR gu ie ja-Hira kk kn lo lv mk ne_NP
### Required versions
#
# See DEPENDENCIES section below.
set(QT_VERSION 5.15.0)
set(YAMLCPP_VERSION 0.5.1)
set(ECM_VERSION 5.58)
set(PYTHONLIBS_VERSION 3.6)
if(WITH_QT6)
message(STATUS "Building Calamares with Qt6")
set(qtname "Qt6")
set(QT_VERSION 6.5.0)
# API that was deprecated before Qt 5.15 causes a compile error
add_compile_definitions(QT_DISABLE_DEPRECATED_BEFORE=0x060400)
set(BUILD_KF5Crash OFF) # TODO: Qt6
else()
message(STATUS "Building Calamares with Qt5")
set(qtname "Qt5")
set(QT_VERSION 5.15.0)
# API that was deprecated before Qt 5.15 causes a compile error
add_compile_definitions(QT_DISABLE_DEPRECATED_BEFORE=0x050f00)
endif()
set(BOOSTPYTHON_VERSION 1.72.0)
set(ECM_VERSION 5.100)
set(PYTHONLIBS_VERSION 3.6)
set(YAMLCPP_VERSION 0.5.1)
### CMAKE SETUP
#
@ -287,30 +304,27 @@ if(CMAKE_COMPILER_IS_GNUCXX)
endif()
endif()
# API that was deprecated before Qt 5.15 causes a compile error
add_compile_definitions(QT_DISABLE_DEPRECATED_BEFORE=0x050f00)
### DEPENDENCIES
#
find_package(Qt5 ${QT_VERSION} CONFIG REQUIRED Concurrent Core DBus Gui LinguistTools Network Svg Widgets)
find_package(${qtname} ${QT_VERSION} CONFIG REQUIRED Concurrent Core DBus Gui LinguistTools Network Svg Widgets)
if(WITH_QML)
find_package(Qt5 ${QT_VERSION} CONFIG REQUIRED Quick QuickWidgets)
find_package(${qtname} ${QT_VERSION} CONFIG REQUIRED Quick QuickWidgets)
endif()
# Note that some modules need more Qt modules, optionally.
find_package(YAMLCPP ${YAMLCPP_VERSION} REQUIRED)
if(INSTALL_POLKIT)
find_package(PolkitQt5-1 REQUIRED)
find_package(Polkit${qtname}-1 REQUIRED)
else()
# Find it anyway, for dependencies-reporting
find_package(PolkitQt5-1)
find_package(Polkit${qtname}-1)
endif()
set_package_properties(
PolkitQt5-1
Polkit${qtname}-1
PROPERTIES
DESCRIPTION "Qt5 support for Polkit"
DESCRIPTION "${qtname} support for Polkit"
URL "https://cgit.kde.org/polkit-qt-1.git"
PURPOSE "PolkitQt5-1 helps with installing Polkit configuration"
PURPOSE "Polkit${qtname}-1 helps with installing Polkit configuration"
)
# Find ECM once, and add it to the module search path; Calamares
@ -322,7 +336,7 @@ if(ECM_FOUND)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${CMAKE_MODULE_PATH})
if(BUILD_TESTING)
# ECM implies that we can build the tests, too
find_package(Qt5 COMPONENTS Test REQUIRED)
find_package(${qtname} COMPONENTS Test REQUIRED)
include(ECMAddTests)
endif()
include(KDEInstallDirs)
@ -409,6 +423,7 @@ endif()
# when building out-of-tree.
set(Calamares_WITH_PYTHON ${WITH_PYTHON})
set(Calamares_WITH_QML ${WITH_QML})
set(Calamares_WITH_QT6 ${WITH_QT6})
### Transifex Translation status
#
@ -625,7 +640,9 @@ endif()
### CMAKE SUMMARY REPORT
#
if(NOT WITH_QT6) # TODO: Qt6
get_directory_property(SKIPPED_MODULES DIRECTORY src/modules DEFINITION LIST_SKIPPED_MODULES)
endif()
calamares_explain_skipped_modules( ${SKIPPED_MODULES} )
feature_summary(WHAT DISABLED_FEATURES DESCRIPTION "The following features have been disabled:" QUIET_ON_EMPTY)

View File

@ -101,7 +101,7 @@ function( calamares_add_branding_translations NAME )
file( GLOB BRANDING_TRANSLATION_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "${SUBDIRECTORY}/lang/calamares-${NAME}_*.ts" )
if ( BRANDING_TRANSLATION_FILES )
qt5_add_translation( QM_FILES ${BRANDING_TRANSLATION_FILES} )
qt_add_translation( QM_FILES ${BRANDING_TRANSLATION_FILES} )
add_custom_target( branding-translation-${NAME} ALL DEPENDS ${QM_FILES}
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/${SUBDIRECTORY}/lang/
COMMAND ${CMAKE_COMMAND} -E copy ${QM_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${SUBDIRECTORY}/lang/

View File

@ -86,9 +86,9 @@ function(calamares_add_library)
# add link targets
target_link_libraries(${target}
LINK_PUBLIC ${Calamares_LIBRARIES}
Qt5::Core
Qt5::Gui
Qt5::Widgets
${qtname}::Core
${qtname}::Gui
${qtname}::Widgets
)
if(LIBRARY_LINK_LIBRARIES)
target_link_libraries(${target} LINK_PUBLIC ${LIBRARY_LINK_LIBRARIES})

View File

@ -36,8 +36,8 @@ function(calamares_add_test name)
LINK_LIBRARIES
Calamares::calamares
${TEST_LIBRARIES}
Qt5::Core
Qt5::Test
${qtname}::Core
${qtname}::Test
)
calamares_automoc( ${TEST_NAME} )
# We specifically pass in the source directory of the test-being-
@ -47,7 +47,7 @@ function(calamares_add_test name)
PRIVATE -DBUILD_AS_TEST="${CMAKE_CURRENT_SOURCE_DIR}" ${TEST_DEFINITIONS}
)
if(TEST_GUI)
target_link_libraries(${TEST_NAME} Calamares::calamaresui Qt5::Gui)
target_link_libraries(${TEST_NAME} Calamares::calamaresui ${qtname}::Gui)
endif()
if(TEST_RESOURCES)
calamares_autorcc( ${TEST_NAME} ${TEST_RESOURCES} )

View File

@ -46,11 +46,18 @@ macro(accumulate_deps outvar target namespace)
endforeach()
endmacro()
# Qt5 infrastructure for translations is required
set(qt5_required Core Widgets LinguistTools)
accumulate_deps(qt5_required Calamares::calamares Qt5::)
accumulate_deps(qt5_required Calamares::calamaresui Qt5::)
find_package(Qt5 CONFIG REQUIRED ${qt5_required})
set(Calamares_WITH_QT6 @WITH_QT6@)
if(Calamares_WITH_QT6)
set(qtname "Qt6")
else()
set(qtname "Qt5")
endif()
# Qt infrastructure for translations is required
set(qt_required Core Widgets LinguistTools)
accumulate_deps(qt_required Calamares::calamares ${qtname}::)
accumulate_deps(qt_required Calamares::calamaresui ${qtname}::)
find_package(${qtname} CONFIG REQUIRED ${qt_required})
set(kf5_required "")
accumulate_deps(kf5_required Calamares::calamares KF5::)

View File

@ -15,10 +15,10 @@
include(CalamaresAddTranslations)
find_package(Qt5 COMPONENTS Xml)
if(Qt5Xml_FOUND)
find_package(${qtname} COMPONENTS Xml)
if(TARGET ${qtname}::Xml)
add_executable(txload txload.cpp)
target_link_libraries(txload Qt5::Xml)
target_link_libraries(txload ${qtname}::Xml)
endif()
install_calamares_gettext_translations(python
@ -50,7 +50,7 @@ set(CALAMARES_TRANSLATIONS_SOURCE ${trans_outfile})
configure_file(${CMAKE_SOURCE_DIR}/lang/calamares_i18n.qrc.in ${trans_infile} @ONLY)
qt5_add_translation(QM_FILES ${TS_FILES})
qt_add_translation(QM_FILES ${TS_FILES})
# Run the resource compiler (rcc_options should already be set)
add_custom_command(

View File

@ -12,7 +12,6 @@ include(CalamaresAddTranslations)
# library
add_subdirectory(libcalamares)
add_subdirectory(libcalamaresui)
# all things qml

View File

@ -123,10 +123,10 @@ navigation: widget
strings:
productName: "${NAME}"
shortProductName: Generic
version: 2020.2 LTS
shortVersion: 2020.2
versionedName: Fancy GNU/Linux 2020.2 LTS "Turgid Tuba"
shortVersionedName: FancyGL 2020.2
version: 2023.3 LTS
shortVersion: 2023.3
versionedName: Fancy GNU/Linux 2023.3 LTS "Venomous Vole"
shortVersionedName: FancyGL 2023.3
bootloaderEntryName: FancyGL
productUrl: https://calamares.io/
supportUrl: https://github.com/calamares/calamares/wiki

View File

@ -38,8 +38,11 @@ calamares_autorcc( calamares_bin )
target_link_libraries(
calamares_bin
PRIVATE calamares calamaresui calamares-i18n kdsingleapplication Qt5::Core Qt5::Widgets KF5::CoreAddons
PRIVATE calamares calamaresui calamares-i18n kdsingleapplication ${qtname}::Core ${qtname}::Widgets
)
if(NOT WITH_QT6) # TODO: Qt6
target_link_libraries(calamares_bin PRIVATE KF5::CoreAddons)
endif()
if(BUILD_KF5Crash)
target_link_libraries(calamares_bin PRIVATE KF5::Crash)
target_compile_definitions(calamares_bin PRIVATE BUILD_KF5Crash)
@ -59,8 +62,8 @@ install(
if(BUILD_TESTING)
# Don't install, these are just for enable_testing
add_executable(loadmodule testmain.cpp)
target_link_libraries(loadmodule PRIVATE Qt5::Core Qt5::Widgets calamares calamaresui)
target_link_libraries(loadmodule PRIVATE ${qtname}::Core ${qtname}::Widgets calamares calamaresui)
add_executable(test_conf test_conf.cpp)
target_link_libraries(test_conf PUBLIC yamlcpp::yamlcpp Qt5::Core)
target_link_libraries(test_conf PUBLIC yamlcpp::yamlcpp ${qtname}::Core)
endif()

View File

@ -30,7 +30,6 @@
#include "utils/Retranslator.h"
#include "viewpages/ViewStep.h"
#include <QDesktopWidget>
#include <QDir>
#include <QFileInfo>
#include <QScreen>

View File

@ -27,7 +27,9 @@
#include <QApplication>
#include <QBoxLayout>
#include <QCloseEvent>
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
#include <QDesktopWidget>
#endif
#include <QFile>
#include <QFileInfo>
#include <QLabel>
@ -39,6 +41,16 @@
#endif
#include <QTreeView>
static QSize
desktopSize( QWidget* w )
{
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
return qApp->desktop()->availableGeometry( w ).size();
#else
return w->screen()->availableGeometry().size();
#endif
}
static inline int
windowDimensionToPixels( const Calamares::Branding::WindowDimension& u )
{
@ -143,11 +155,9 @@ getWidgetSidebar( Calamares::DebugWindowManager* debug,
CalamaresUtils::Original,
2 * QSize( defaultFontHeight, defaultFontHeight ) ) );
CALAMARES_RETRANSLATE_FOR(
aboutDialog,
aboutDialog->setText(
QCoreApplication::translate( "calamares-sidebar", "About" ) );
aboutDialog->setToolTip( QCoreApplication::translate( "calamares-sidebar",
"Show information about Calamares" ) ); );
aboutDialog, aboutDialog->setText( QCoreApplication::translate( "calamares-sidebar", "About" ) );
aboutDialog->setToolTip(
QCoreApplication::translate( "calamares-sidebar", "Show information about Calamares" ) ); );
extraButtons->addWidget( aboutDialog );
aboutDialog->setFlat( true );
aboutDialog->setCheckable( true );
@ -159,11 +169,10 @@ getWidgetSidebar( Calamares::DebugWindowManager* debug,
debugWindowBtn->setObjectName( "debugButton" );
debugWindowBtn->setIcon( CalamaresUtils::defaultPixmap(
CalamaresUtils::Bugs, CalamaresUtils::Original, 2 * QSize( defaultFontHeight, defaultFontHeight ) ) );
CALAMARES_RETRANSLATE_FOR( debugWindowBtn,
debugWindowBtn->setText( QCoreApplication::translate(
"calamares-sidebar", "Debug" ) );
debugWindowBtn->setToolTip( QCoreApplication::translate(
"calamares-sidebar", "Show debug information" ) ); );
CALAMARES_RETRANSLATE_FOR(
debugWindowBtn, debugWindowBtn->setText( QCoreApplication::translate( "calamares-sidebar", "Debug" ) );
debugWindowBtn->setToolTip(
QCoreApplication::translate( "calamares-sidebar", "Show debug information" ) ); );
extraButtons->addWidget( debugWindowBtn );
debugWindowBtn->setFlat( true );
debugWindowBtn->setCheckable( true );
@ -409,7 +418,7 @@ CalamaresWindow::CalamaresWindow( QWidget* parent )
// Needs to match what's checked in DebugWindow
this->setObjectName( "mainApp" );
QSize availableSize = qApp->desktop()->availableGeometry( this ).size();
QSize availableSize = desktopSize( this );
QSize minimumSize( qBound( windowMinimumWidth, availableSize.width(), windowPreferredWidth ),
qBound( windowMinimumHeight, availableSize.height(), windowPreferredHeight ) );
setMinimumSize( minimumSize );
@ -507,7 +516,7 @@ void
CalamaresWindow::ensureSize( QSize size )
{
auto mainGeometry = this->geometry();
QSize availableSize = qApp->desktop()->availableGeometry( this ).size();
QSize availableSize = desktopSize( this );
// We only care about vertical sizes that are big enough
int embiggenment = qMax( 0, size.height() - m_viewManager->centralWidget()->size().height() );

View File

@ -19,7 +19,14 @@
// From 3rdparty/
#include "kdsingleapplication.h"
#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
// TODO: Qt6
// Ignore KAboutData
#define HAVE_KABOUTDATA 0
#else
#include <KCoreAddons/KAboutData>
#define HAVE_KABOUTDATA 1
#endif
#ifdef BUILD_KF5Crash
#include <KCrash/KCrash>
#endif
@ -107,9 +114,13 @@ handle_args( CalamaresApplication& a )
int
main( int argc, char* argv[] )
{
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
// Not needed in Qt6
QApplication::setAttribute( Qt::AA_EnableHighDpiScaling );
#endif
CalamaresApplication a( argc, argv );
#if HAVE_KABOUTDATA
KAboutData aboutData( "calamares",
"Calamares",
a.applicationVersion(),
@ -120,6 +131,7 @@ main( int argc, char* argv[] )
"https://calamares.io",
"https://github.com/calamares/calamares/issues" );
KAboutData::setApplicationData( aboutData );
#endif
a.setApplicationDisplayName( QString() ); // To avoid putting an extra "Calamares/" into the log-file
#ifdef BUILD_KF5Crash

View File

@ -100,14 +100,17 @@ set_target_properties(
SOVERSION ${CALAMARES_SOVERSION}
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_INSTALL_FULL_INCLUDEDIR}/libcalamares
)
target_link_libraries(calamares LINK_PUBLIC yamlcpp::yamlcpp Qt5::Core KF5::CoreAddons)
target_link_libraries(calamares LINK_PUBLIC yamlcpp::yamlcpp ${qtname}::Core)
if(NOT WITH_QT6) # TODO: Qt6
target_link_libraries(calamares LINK_PUBLIC KF5::CoreAddons)
endif()
### OPTIONAL Automount support (requires dbus)
#
#
if(Qt5DBus_FOUND)
if(TARGET ${qtname}::DBus)
target_sources(calamares PRIVATE partition/AutoMount.cpp)
target_link_libraries(calamares PRIVATE Qt5::DBus)
target_link_libraries(calamares PRIVATE ${qtname}::DBus)
endif()
### OPTIONAL Python support
@ -121,10 +124,10 @@ endif()
### OPTIONAL GeoIP XML support
#
#
find_package(Qt5 COMPONENTS Xml)
if(Qt5Xml_FOUND)
find_package(${qtname} ${QT_VERSION} COMPONENTS Xml)
if(TARGET ${qtname}::Xml)
target_sources(calamares PRIVATE geoip/GeoIPXML.cpp)
target_link_libraries(calamares PRIVATE Qt5::Network Qt5::Xml)
target_link_libraries(calamares PRIVATE ${qtname}::Network ${qtname}::Xml)
endif()
### OPTIONAL KPMcore support
@ -219,7 +222,7 @@ function(calamares_qrc_translations basename)
endforeach()
configure_file(${CMAKE_SOURCE_DIR}/lang/calamares_i18n.qrc.in ${translations_qrc_infile} @ONLY)
qt5_add_translation(QM_FILES ${calamares_i18n_ts_filelist})
qt_add_translation(QM_FILES ${calamares_i18n_ts_filelist})
# Run the resource compiler (rcc_options should already be set)
add_custom_command(
@ -274,10 +277,10 @@ calamares_add_test(libcalamaresutilspathstest SOURCES utils/TestPaths.cpp)
# This is not an actual test, it's a test / demo application
# for experimenting with GeoIP.
add_executable(test_geoip geoip/test_geoip.cpp ${geoip_src})
target_link_libraries(test_geoip Calamares::calamares Qt5::Network yamlcpp::yamlcpp)
target_link_libraries(test_geoip Calamares::calamares ${qtname}::Network yamlcpp::yamlcpp)
calamares_automoc( test_geoip )
if(Qt5DBus_FOUND)
if(TARGET ${qtname}::DBus)
add_executable(test_automount partition/calautomount.cpp)
target_link_libraries(test_automount Calamares::calamares Qt5::DBus)
target_link_libraries(test_automount Calamares::calamares ${qtname}::DBus)
endif()

View File

@ -20,11 +20,13 @@ static const char s_footer[]
= QT_TRANSLATE_NOOP( "AboutData",
"Thanks to <a href=\"https://calamares.io/team/\">the Calamares team</a> "
"and the <a href=\"https://app.transifex.com/calamares/calamares/\">Calamares "
"translators team</a>.<br/><br/>"
"<a href=\"https://calamares.io/\">Calamares</a> "
"development is sponsored by <br/>"
"<a href=\"http://www.blue-systems.com/\">Blue Systems</a> - "
"Liberating Software." );
"translators team</a>." );
static const char s_sponsor[] = QT_TRANSLATE_NOOP( "AboutData",
"<a href=\"https://calamares.io/\">Calamares</a> "
"development is sponsored by <br/>"
"<a href=\"http://www.blue-systems.com/\">Blue Systems</a> - "
"Liberating Software." );
struct Maintainer
{
@ -45,7 +47,7 @@ struct Maintainer
static constexpr const Maintainer maintainers[] = {
{ 2014, 2017, "Teo Mrnjavac", "teo@kde.org" },
{ 2017, 2022, "Adriaan de Groot", "groot@kde.org" },
{ 2017, 2023, "Adriaan de Groot", "groot@kde.org" },
};
static QString
@ -70,6 +72,7 @@ substituteVersions( const QString& s )
const QString
Calamares::aboutString()
{
Q_UNUSED( s_sponsor )
return substituteVersions( QCoreApplication::translate( "AboutData", s_header ) ) + aboutMaintainers()
+ QCoreApplication::translate( "AboutData", s_footer );
}

View File

@ -11,33 +11,34 @@
#include "GlobalStorage.h"
#include "compat/Mutex.h"
#include "utils/Logger.h"
#include "utils/Units.h"
#include "utils/Yaml.h"
#include <QFile>
#include <QJsonDocument>
#include <QMutexLocker>
using namespace CalamaresUtils::Units;
namespace Calamares
{
class GlobalStorage::ReadLock : public QMutexLocker
class GlobalStorage::ReadLock : public MutexLocker
{
public:
ReadLock( const GlobalStorage* gs )
: QMutexLocker( &gs->m_mutex )
: MutexLocker( &gs->m_mutex )
{
}
};
class GlobalStorage::WriteLock : public QMutexLocker
class GlobalStorage::WriteLock : public MutexLocker
{
public:
WriteLock( GlobalStorage* gs )
: QMutexLocker( &gs->m_mutex )
: MutexLocker( &gs->m_mutex )
, m_gs( gs )
{
}

View File

@ -13,10 +13,10 @@
#include "CalamaresConfig.h"
#include "GlobalStorage.h"
#include "Job.h"
#include "compat/Mutex.h"
#include "utils/Logger.h"
#include <QMutex>
#include <QMutexLocker>
#include <QThread>
#include <memory>
@ -61,8 +61,8 @@ public:
void finalize()
{
Q_ASSERT( m_runningJobs->isEmpty() );
QMutexLocker qlock( &m_enqueMutex );
QMutexLocker rlock( &m_runMutex );
Calamares::MutexLocker qlock( &m_enqueMutex );
Calamares::MutexLocker rlock( &m_runMutex );
std::swap( m_runningJobs, m_queuedJobs );
m_overallQueueWeight
= m_runningJobs->isEmpty() ? 0.0 : ( m_runningJobs->last().cumulative + m_runningJobs->last().weight );
@ -83,7 +83,7 @@ public:
void enqueue( int moduleWeight, const JobList& jobs )
{
QMutexLocker qlock( &m_enqueMutex );
Calamares::MutexLocker qlock( &m_enqueMutex );
qreal cumulative
= m_queuedJobs->isEmpty() ? 0.0 : ( m_queuedJobs->last().cumulative + m_queuedJobs->last().weight );
@ -108,7 +108,7 @@ public:
void run() override
{
QMutexLocker rlock( &m_runMutex );
Calamares::MutexLocker rlock( &m_runMutex );
bool failureEncountered = false;
QString message; ///< Filled in with errors
QString details;
@ -159,7 +159,7 @@ public:
*/
QStringList queuedJobs() const
{
QMutexLocker qlock( &m_enqueMutex );
Calamares::MutexLocker qlock( &m_enqueMutex );
QStringList l;
l.reserve( m_queuedJobs->count() );
for ( const auto& j : *m_queuedJobs )

View File

@ -11,6 +11,7 @@
#include "PythonHelper.h"
#include "GlobalStorage.h"
#include "compat/Variant.h"
#include "utils/Dirs.h"
#include "utils/Logger.h"
@ -29,41 +30,56 @@ variantToPyObject( const QVariant& variant )
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wswitch-enum"
#endif
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
const auto HashVariantType = QVariant::Hash;
const auto IntVariantType = QVariant::Int;
const auto UIntVariantType = QVariant::UInt;
#else
const auto HashVariantType = QMetaType::Type::QVariantHash;
const auto IntVariantType = QMetaType::Type::Int;
const auto UIntVariantType = QMetaType::Type::UInt;
#endif
// 49 enumeration values not handled
switch ( variant.type() )
switch ( Calamares::typeOf( variant ) )
{
case QVariant::Map:
case Calamares::MapVariantType:
return variantMapToPyDict( variant.toMap() );
case QVariant::Hash:
case HashVariantType:
return variantHashToPyDict( variant.toHash() );
case QVariant::List:
case QVariant::StringList:
case Calamares::ListVariantType:
case Calamares::StringListVariantType:
return variantListToPyList( variant.toList() );
case QVariant::Int:
case IntVariantType:
return bp::object( variant.toInt() );
case QVariant::UInt:
case UIntVariantType:
return bp::object( variant.toUInt() );
case QVariant::LongLong:
case Calamares::LongLongVariantType:
return bp::object( variant.toLongLong() );
case QVariant::ULongLong:
case Calamares::ULongLongVariantType:
return bp::object( variant.toULongLong() );
case QVariant::Double:
case Calamares::DoubleVariantType:
return bp::object( variant.toDouble() );
case QVariant::Char:
case QVariant::String:
case Calamares::CharVariantType:
#if QT_VERSION > QT_VERSION_CHECK( 6, 0, 0 )
case QMetaType::Type::QChar:
#endif
case Calamares::StringVariantType:
return bp::object( variant.toString().toStdString() );
case QVariant::Bool:
case Calamares::BoolVariantType:
return bp::object( variant.toBool() );
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
case QVariant::Invalid:
#endif
default:
return bp::object();
}

View File

@ -14,6 +14,7 @@
#include "Settings.h"
#include "CalamaresConfig.h"
#include "compat/Variant.h"
#include "utils/Dirs.h"
#include "utils/Logger.h"
#include "utils/Yaml.h"
@ -157,12 +158,12 @@ interpretInstances( const YAML::Node& node, Settings::InstanceDescriptionList& c
if ( node )
{
QVariant instancesV = CalamaresUtils::yamlToVariant( node ).toList();
if ( instancesV.type() == QVariant::List )
if ( typeOf( instancesV ) == ListVariantType )
{
const auto instances = instancesV.toList();
for ( const QVariant& instancesVListItem : instances )
{
if ( instancesVListItem.type() != QVariant::Map )
if ( typeOf( instancesVListItem ) != MapVariantType )
{
continue;
}
@ -185,7 +186,7 @@ interpretSequence( const YAML::Node& node, Settings::ModuleSequence& moduleSeque
if ( node )
{
QVariant sequenceV = CalamaresUtils::yamlToVariant( node );
if ( !( sequenceV.type() == QVariant::List ) )
if ( typeOf( sequenceV ) != ListVariantType )
{
throw YAML::Exception( YAML::Mark(), "sequence key does not have a list-value" );
}
@ -193,7 +194,7 @@ interpretSequence( const YAML::Node& node, Settings::ModuleSequence& moduleSeque
const auto sequence = sequenceV.toList();
for ( const QVariant& sequenceVListItem : sequence )
{
if ( sequenceVListItem.type() != QVariant::Map )
if ( typeOf( sequenceVListItem ) != MapVariantType )
{
continue;
}

View File

@ -12,6 +12,7 @@
#include "GlobalStorage.h"
#include "JobQueue.h"
#include "Settings.h"
#include "compat/Variant.h"
#include "modulesystem/InstanceKey.h"
#include "utils/Logger.h"
@ -55,7 +56,7 @@ TestLibCalamares::testGSModify()
gs.insert( key, value );
QCOMPARE( gs.count(), 1 );
QVERIFY( gs.contains( key ) );
QCOMPARE( gs.value( key ).type(), QVariant::Int );
QCOMPARE( Calamares::typeOf( gs.value( key ) ), Calamares::IntVariantType );
QCOMPARE( gs.value( key ).toString(), QString( "17" ) ); // It isn't a string, but does convert
QCOMPARE( gs.value( key ).toInt(), value );
@ -137,8 +138,8 @@ TestLibCalamares::testGSLoadSave2()
QVERIFY( gs1.loadYaml( filename ) );
QCOMPARE( gs1.count(), 3 ); // From examining the file
QVERIFY( gs1.contains( key ) );
cDebug() << gs1.value( key ).type() << gs1.value( key );
QCOMPARE( gs1.value( key ).type(), QVariant::List );
cDebug() << Calamares::typeOf( gs1.value( key ) ) << gs1.value( key );
QCOMPARE( Calamares::typeOf( gs1.value( key ) ), Calamares::ListVariantType );
const QString yamlfilename( "gs.test.yaml" );
QVERIFY( gs1.saveYaml( yamlfilename ) );
@ -146,7 +147,7 @@ TestLibCalamares::testGSLoadSave2()
Calamares::GlobalStorage gs2;
QVERIFY( gs2.loadYaml( yamlfilename ) );
QVERIFY( gs2.contains( key ) );
QCOMPARE( gs2.value( key ).type(), QVariant::List );
QCOMPARE( Calamares::typeOf( gs2.value( key ) ), Calamares::ListVariantType );
}
void
@ -396,6 +397,7 @@ TestLibCalamares::testSettings()
QVERIFY( s.brandingComponentName().isEmpty() );
QVERIFY( !s.isValid() );
// *INDENT-OFF*
s.setConfiguration( R"(---
branding: default # needed for it to be considered valid
instances:
@ -415,6 +417,7 @@ sequence:
- welcome@hi
)",
QStringLiteral( "<testdata>" ) );
// *INDENT-ON*
QVERIFY( s.debugMode() );
QCOMPARE( s.moduleInstances().count(), 4 ); // there are 4 module instances mentioned

View File

@ -0,0 +1,30 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2023 Adriaan de Groot <groot@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Calamares is Free Software: see the License-Identifier above.
*
*
*/
#ifndef CALAMARES_COMPAT_MUTEX_H
#define CALAMARES_COMPAT_MUTEX_H
#include <QMutexLocker>
namespace Calamares
{
/*
* In Qt5, QMutexLocker is a class and operates implicitly on
* QMutex but in Qt6 it is a template and needs a specialization.
*/
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
using MutexLocker = QMutexLocker;
#else
using MutexLocker = QMutexLocker< QMutex >;
#endif
} // namespace Calamares
#endif

View File

@ -0,0 +1,46 @@
/* === This file is part of Calamares - <https://calamares.io> ===
*
* SPDX-FileCopyrightText: 2023 Adriaan de Groot <groot@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
*
* Calamares is Free Software: see the License-Identifier above.
*
*
*/
#ifndef CALAMARES_COMPAT_VARIANT_H
#define CALAMARES_COMPAT_VARIANT_H
#include <QVariant>
namespace Calamares
{
/* Compatibility of QVariant between Qt5 and Qt6 */
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
const auto typeOf = []( const QVariant& v ) { return v.type(); };
const auto ListVariantType = QVariant::List;
const auto MapVariantType = QVariant::Map;
const auto StringVariantType = QVariant::String;
const auto CharVariantType = QVariant::Char;
const auto StringListVariantType = QVariant::StringList;
const auto BoolVariantType = QVariant::Bool;
const auto IntVariantType = QVariant::Int;
const auto LongLongVariantType = QVariant::LongLong;
const auto ULongLongVariantType = QVariant::ULongLong;
const auto DoubleVariantType = QVariant::Double;
#else
const auto typeOf = []( const QVariant& v ) { return v.typeId(); };
const auto ListVariantType = QMetaType::Type::QVariantList;
const auto MapVariantType = QMetaType::Type::QVariantMap;
const auto StringVariantType = QMetaType::Type::QString;
const auto CharVariantType = QMetaType::Type::Char;
const auto StringListVariantType = QMetaType::Type::QStringList;
const auto BoolVariantType = QMetaType::Type::Bool;
const auto IntVariantType = QMetaType::Type::Int;
const auto LongLongVariantType = QMetaType::Type::LongLong;
const auto ULongLongVariantType = QMetaType::Type::ULongLong;
const auto DoubleVariantType = QMetaType::Type::Double;
#endif
} // namespace Calamares
#endif

View File

@ -10,6 +10,7 @@
#include "GeoIPJSON.h"
#include "compat/Variant.h"
#include "utils/Logger.h"
#include "utils/Variant.h"
#include "utils/Yaml.h"
@ -64,7 +65,7 @@ GeoIPJSON::rawReply( const QByteArray& data )
YAML::Node doc = YAML::Load( data );
QVariant var = CalamaresUtils::yamlToVariant( doc );
if ( !var.isNull() && var.isValid() && var.type() == QVariant::Map )
if ( !var.isNull() && var.isValid() && Calamares::typeOf( var ) == Calamares::MapVariantType )
{
return selectMap( var.toMap(), m_element.split( '.' ), 0 );
}

View File

@ -12,16 +12,19 @@
#include "DllMacro.h"
#include <QPair>
#include <QString>
#include <QUrl>
#include <utility>
class QByteArray;
namespace CalamaresUtils
{
namespace GeoIP
{
using RegionZonePairBase = std::pair< QString, QString >;
/** @brief A Region, Zone pair of strings
*
* A GeoIP lookup returns a timezone, which is represented as a Region,
@ -29,22 +32,22 @@ namespace GeoIP
* pasting the strings back together with a "/" is the right thing to
* do. The Zone **may** contain a "/" (e.g. "Kentucky/Monticello").
*/
class DLLEXPORT RegionZonePair : public QPair< QString, QString >
class DLLEXPORT RegionZonePair : public RegionZonePairBase
{
public:
/** @brief Construct from an existing pair. */
explicit RegionZonePair( const QPair& p )
: QPair( p )
explicit RegionZonePair( const RegionZonePairBase& p )
: RegionZonePairBase( p )
{
}
/** @brief Construct from two strings, like qMakePair(). */
RegionZonePair( const QString& region, const QString& zone )
: QPair( region, zone )
: RegionZonePairBase( region, zone )
{
}
/** @brief An invalid zone pair (empty strings). */
RegionZonePair()
: QPair( QString(), QString() )
: RegionZonePairBase( QString(), QString() )
{
}

View File

@ -230,7 +230,8 @@ LocaleTests::testTranslatableConfig2()
continue;
}
// Could be QVERIFY, but then we don't see what language code fails
QCOMPARE( ts1.get( language ) == QString( "description (language %1)" ).arg( language ) ? language : QString(),
QCOMPARE( ts1.get( QLocale( language ) ) == QString( "description (language %1)" ).arg( language ) ? language
: QString(),
language );
}
QCOMPARE( ts1.get( QLocale( QLocale::Language::Serbian, QLocale::Script::LatinScript, QLocale::Country::Serbia ) ),

View File

@ -15,6 +15,7 @@
#include "utils/String.h"
#include <QFile>
#include <QRegularExpression>
#include <QString>
static const char TZ_DATA_FILE[] = "/usr/share/zoneinfo/zone.tab";
@ -108,7 +109,7 @@ loadTZData( RegionVector& regions, ZoneVector& zones, QTextStream& in )
continue;
}
QStringList list = line.split( QRegExp( "[\t ]" ), SplitSkipEmptyParts );
QStringList list = line.split( QRegularExpression( "[\t ]" ), SplitSkipEmptyParts );
if ( list.size() < 3 )
{
continue;
@ -140,7 +141,7 @@ loadTZData( RegionVector& regions, ZoneVector& zones, QTextStream& in )
}
QString position = list.at( 1 );
int cooSplitPos = position.indexOf( QRegExp( "[-+]" ), 1 );
int cooSplitPos = position.indexOf( QRegularExpression( "[-+]" ), 1 );
double latitude;
double longitude;
if ( cooSplitPos > 0 )

View File

@ -13,9 +13,10 @@
#include <QDebug>
#include <QList>
#include <QPair>
#include <QString>
#include <utility>
namespace Calamares
{
namespace ModuleSystem
@ -34,12 +35,14 @@ namespace ModuleSystem
* This is supported by the *instances* configuration entry
* in `settings.conf`.
*/
class InstanceKey : public QPair< QString, QString >
class InstanceKey : public std::pair< QString, QString >
{
public:
using Base = std::pair< QString, QString >;
/// @brief Create an instance key from explicit module and id.
InstanceKey( const QString& module, const QString& id )
: QPair( module, id )
: Base( module, id )
{
if ( second.isEmpty() )
{
@ -50,7 +53,7 @@ public:
/// @brief Create unusual, invalid instance key
InstanceKey()
: QPair( QString(), QString() )
: Base( QString(), QString() )
{
}

View File

@ -10,6 +10,7 @@
#include "RequirementsChecker.h"
#include "compat/Mutex.h"
#include "modulesystem/Module.h"
#include "modulesystem/Requirement.h"
#include "modulesystem/RequirementsModel.h"
@ -48,7 +49,11 @@ RequirementsChecker::run()
for ( const auto& module : m_modules )
{
Watcher* watcher = new Watcher( this );
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
watcher->setFuture( QtConcurrent::run( this, &RequirementsChecker::addCheckedRequirements, module ) );
#else
watcher->setFuture( QtConcurrent::run( &RequirementsChecker::addCheckedRequirements, this, module ) );
#endif
watcher->setObjectName( module->name() );
m_watchers.append( watcher );
connect( watcher, &Watcher::finished, this, &RequirementsChecker::finished );
@ -61,7 +66,7 @@ void
RequirementsChecker::finished()
{
static QMutex finishedMutex;
QMutexLocker lock( &finishedMutex );
Calamares::MutexLocker lock( &finishedMutex );
if ( m_progressTimer
&& std::all_of(

View File

@ -10,6 +10,7 @@
#include "RequirementsModel.h"
#include "compat/Mutex.h"
#include "utils/Logger.h"
namespace Calamares
@ -18,7 +19,7 @@ namespace Calamares
void
RequirementsModel::clear()
{
QMutexLocker l( &m_addLock );
Calamares::MutexLocker l( &m_addLock );
beginResetModel();
m_requirements.clear();
endResetModel();
@ -28,7 +29,7 @@ RequirementsModel::clear()
void
RequirementsModel::addRequirementsList( const Calamares::RequirementsList& requirements )
{
QMutexLocker l( &m_addLock );
Calamares::MutexLocker l( &m_addLock );
beginResetModel();
for ( const auto& r : requirements )

View File

@ -9,11 +9,11 @@
#include "Manager.h"
#include "compat/Mutex.h"
#include "utils/Logger.h"
#include <QEventLoop>
#include <QMutex>
#include <QMutexLocker>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QNetworkRequest>
@ -84,7 +84,7 @@ namMutex()
QNetworkAccessManager*
Manager::Private::nam()
{
QMutexLocker lock( namMutex() );
Calamares::MutexLocker lock( namMutex() );
auto* thread = QThread::currentThread();
for ( const auto& n : m_perThreadNams )
@ -106,7 +106,7 @@ Manager::Private::nam()
void
Manager::Private::cleanupNam()
{
QMutexLocker lock( namMutex() );
Calamares::MutexLocker lock( namMutex() );
auto* thread = QThread::currentThread();
bool cleanupFound = false;

View File

@ -8,6 +8,7 @@
#include "AutoMount.h"
#include "compat/Variant.h"
#include "utils/Logger.h"
#include <QtDBus>
@ -114,7 +115,7 @@ querySolidAutoMount( QDBusConnection& dbus, AutoMountInfo& info )
if ( arg.length() == 1 )
{
auto v = arg.at( 0 );
if ( v.isValid() && v.type() == QVariant::Bool )
if ( v.isValid() && Calamares::typeOf( v ) == Calamares::BoolVariantType )
{
result = v.toBool();
}

View File

@ -13,7 +13,7 @@
#include "GlobalStorage.h"
#include "JobQueue.h"
// #include "utils/CalamaresUtils.h"
#include "compat/Variant.h"
#include "utils/CalamaresUtilsSystem.h"
#include "utils/Logger.h"
#include "utils/StringExpander.h"
@ -46,11 +46,11 @@ get_variant_stringlist( const QVariantList& l )
unsigned int count = 0;
for ( const auto& v : l )
{
if ( v.type() == QVariant::String )
if ( Calamares::typeOf( v ) == Calamares::StringVariantType )
{
retl.append( CommandLine( v.toString(), CommandLine::TimeoutNotSet() ) );
}
else if ( v.type() == QVariant::Map )
else if ( Calamares::typeOf( v ) == Calamares::MapVariantType )
{
auto command( get_variant_object( v.toMap() ) );
if ( command.isValid() )
@ -61,7 +61,7 @@ get_variant_stringlist( const QVariantList& l )
}
else
{
cWarning() << "Bad CommandList element" << count << v.type() << v;
cWarning() << "Bad CommandList element" << count << v;
}
++count;
}
@ -119,7 +119,7 @@ CommandList::CommandList( bool doChroot, std::chrono::seconds timeout )
CommandList::CommandList::CommandList( const QVariant& v, bool doChroot, std::chrono::seconds timeout )
: CommandList( doChroot, timeout )
{
if ( v.type() == QVariant::List )
if ( Calamares::typeOf( v ) == Calamares::ListVariantType )
{
const auto v_list = v.toList();
if ( v_list.count() )
@ -131,11 +131,11 @@ CommandList::CommandList::CommandList( const QVariant& v, bool doChroot, std::ch
cWarning() << "Empty CommandList";
}
}
else if ( v.type() == QVariant::String )
else if ( Calamares::typeOf( v ) == Calamares::StringVariantType )
{
append( { v.toString(), m_timeout } );
}
else if ( v.type() == QVariant::Map )
else if ( Calamares::typeOf( v ) == Calamares::MapVariantType )
{
auto c( get_variant_object( v.toMap() ) );
if ( c.isValid() )
@ -146,7 +146,7 @@ CommandList::CommandList::CommandList( const QVariant& v, bool doChroot, std::ch
}
else
{
cWarning() << "CommandList does not understand variant" << v.type();
cWarning() << "CommandList does not understand variant" << Calamares::typeOf( v );
}
}

View File

@ -17,33 +17,35 @@
#include <QVariant>
#include <chrono>
#include <utility>
class KMacroExpanderBase;
namespace CalamaresUtils
{
using CommandLineBase = std::pair< QString, std::chrono::seconds >;
/**
* Each command can have an associated timeout in seconds. The timeout
* defaults to 10 seconds. Provide some convenience naming and construction.
*/
struct CommandLine : public QPair< QString, std::chrono::seconds >
struct CommandLine : public CommandLineBase
{
static inline constexpr std::chrono::seconds TimeoutNotSet() { return std::chrono::seconds( -1 ); }
/// An invalid command line
CommandLine()
: QPair( QString(), TimeoutNotSet() )
: CommandLineBase( QString(), TimeoutNotSet() )
{
}
CommandLine( const QString& s )
: QPair( s, TimeoutNotSet() )
: CommandLineBase( s, TimeoutNotSet() )
{
}
CommandLine( const QString& s, std::chrono::seconds t )
: QPair( s, t )
: CommandLineBase( s, t )
{
}

View File

@ -14,6 +14,8 @@
#include "Logger.h"
#include "CalamaresVersionX.h"
#include "compat/Mutex.h"
#include "compat/Variant.h"
#include "utils/Dirs.h"
#include <QCoreApplication>
@ -84,7 +86,7 @@ log_enabled( unsigned int level )
static void
log_implementation( const char* msg, unsigned int debugLevel, const bool withTime )
{
QMutexLocker lock( &s_mutex );
Calamares::MutexLocker lock( &s_mutex );
const auto date = QDate::currentDate().toString( Qt::ISODate );
const auto time = QTime::currentTime().toString();
@ -173,7 +175,7 @@ setupLogfile()
// Lock while (re-)opening the logfile
{
QMutexLocker lock( &s_mutex );
Calamares::MutexLocker lock( &s_mutex );
logfile.open( logFile().toLocal8Bit(), std::ios::app );
if ( logfile.tellp() )
{
@ -227,9 +229,9 @@ const constexpr Quote_t Quote {};
QString
toString( const QVariant& v )
{
auto t = v.type();
auto t = Calamares::typeOf( v );
if ( t == QVariant::List )
if ( t == Calamares::ListVariantType )
{
QStringList s;
auto l = v.toList();

View File

@ -17,6 +17,7 @@
#include <QDebug>
#include <QSharedPointer>
#include <QVariant>
#include <memory>

View File

@ -11,6 +11,16 @@
#include "StringExpander.h"
#include "Logger.h"
#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
// TODO: Qt6
KWordMacroExpander::~KWordMacroExpander() {};
bool
KWordMacroExpander::expandMacro( const QString& str, QStringList& ret )
{
return false;
}
#endif
namespace Calamares
{
namespace String

View File

@ -13,7 +13,44 @@
#include "DllMacro.h"
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
#include <KMacroExpander>
#else
// TODO: Qt6
//
// Mock up part of KF6
#include <QHash>
#include <QString>
class KMacroExpanderBase
{
public:
QString expandMacrosShellQuote( const QString& c ) { return c; }
};
class KMacroExpander
{
public:
static QString expandMacros( const QString& source, const QHash< QString, QString > dict, char sep )
{
return source;
}
};
class KWordMacroExpander : public KMacroExpanderBase
{
public:
KWordMacroExpander( QChar c )
: m_escape( c )
{
}
virtual ~KWordMacroExpander();
virtual bool expandMacro( const QString& str, QStringList& ret );
void expandMacros( QString& s ) {}
QChar escapeChar() const { return m_escape; }
private:
QChar m_escape;
};
#endif
#include <QString>
#include <QStringList>
@ -25,6 +62,7 @@ namespace Calamares
namespace String
{
/** @brief Expand variables in a string against a dictionary.
*
* This class provides a convenience API for building up a dictionary

View File

@ -24,6 +24,7 @@
#include "GlobalStorage.h"
#include "JobQueue.h"
#include "compat/Variant.h"
#include <QTemporaryFile>
@ -151,7 +152,7 @@ LibCalamaresTests::testLoadSaveYaml()
auto map = CalamaresUtils::loadYaml( f.fileName() );
QVERIFY( map.contains( "sequence" ) );
QCOMPARE( map[ "sequence" ].type(), QVariant::List );
QCOMPARE( Calamares::typeOf( map[ "sequence" ] ), Calamares::ListVariantType );
// The source-repo example `settings.conf` has a show and an exec phase
auto sequence = map[ "sequence" ].toList();
@ -159,7 +160,7 @@ LibCalamaresTests::testLoadSaveYaml()
for ( const auto& v : sequence )
{
cDebug() << Logger::SubEntry << v;
QCOMPARE( v.type(), QVariant::Map );
QCOMPARE( Calamares::typeOf( v ), Calamares::MapVariantType );
QVERIFY( v.toMap().contains( "show" ) || v.toMap().contains( "exec" ) );
}
@ -553,11 +554,11 @@ LibCalamaresTests::testVariantStringListYAMLDashed()
QTemporaryFile f;
QVERIFY( f.open() );
f.write( R"(---
strings:
- aap
- noot
- mies
)" );
strings:
- aap
- noot
- mies
)" );
f.close();
bool ok = false;
QVariantMap m = loadYaml( f.fileName(), &ok );
@ -581,8 +582,8 @@ LibCalamaresTests::testVariantStringListYAMLBracketed()
QTemporaryFile f;
QVERIFY( f.open() );
f.write( R"(---
strings: [ aap, noot, mies ]
)" );
strings: [ aap, noot, mies ]
)" );
f.close();
bool ok = false;
QVariantMap m = loadYaml( f.fileName(), &ok );
@ -604,24 +605,24 @@ LibCalamaresTests::testStringTruncation()
using namespace Calamares::String;
const QString longString( R"(---
--- src/libcalamares/utils/String.h
+++ src/libcalamares/utils/String.h
@@ -62,15 +62,22 @@ DLLEXPORT QString removeDiacritics( const QString& string );
*/
DLLEXPORT QString obscure( const QString& string );
--- src/libcalamares/utils/String.h
+++ src/libcalamares/utils/String.h
@@ -62,15 +62,22 @@ DLLEXPORT QString removeDiacritics( const QString& string );
*/
DLLEXPORT QString obscure( const QString& string );
+/** @brief Parameter for counting lines at beginning and end of string
+/** @brief Parameter for counting lines at beginning and end of string
+ *
+ * This is used by truncateMultiLine() to indicate how many lines from
+ * the beginning and how many from the end should be kept.
+ */
struct LinesStartEnd
{
- int atStart;
- int atEnd;
+ int atStart = 0;
+ int atEnd = 0;
)" );
struct LinesStartEnd
{
- int atStart;
- int atEnd;
+ int atStart = 0;
+ int atEnd = 0;
)" );
const int sufficientLength = 812;
// There's 18 lines in all
@ -685,8 +686,8 @@ LibCalamaresTests::testStringTruncationShorter()
using namespace Calamares::String;
const QString longString( R"(Some strange string artifacts appeared, leading to `{1?}` being
displayed in various user-facing messages. These have been removed
and the translations updated.)" );
displayed in various user-facing messages. These have been removed
and the translations updated.)" );
const char NEWLINE = '\n';
const int insufficientLength = 42;

View File

@ -17,6 +17,7 @@
#include "Variant.h"
#include "Logger.h"
#include "compat/Variant.h"
#include <QString>
#include <QVariantMap>
@ -29,7 +30,7 @@ getBool( const QVariantMap& map, const QString& key, bool d )
if ( map.contains( key ) )
{
auto v = map.value( key );
if ( v.type() == QVariant::Bool )
if ( Calamares::typeOf( v ) == Calamares::BoolVariantType )
{
return v.toBool();
}
@ -43,7 +44,7 @@ getString( const QVariantMap& map, const QString& key, const QString& d )
if ( map.contains( key ) )
{
auto v = map.value( key );
if ( v.type() == QVariant::String )
if ( Calamares::typeOf( v ) == Calamares::StringVariantType )
{
return v.toString();
}
@ -57,7 +58,7 @@ getStringList( const QVariantMap& map, const QString& key, const QStringList& d
if ( map.contains( key ) )
{
auto v = map.value( key );
if ( v.canConvert( QMetaType::QStringList ) )
if ( v.canConvert< QStringList >() )
{
return v.toStringList();
}
@ -71,7 +72,7 @@ getList( const QVariantMap& map, const QString& key, const QList< QVariant >& d
if ( map.contains( key ) )
{
auto v = map.value( key );
if ( v.canConvert( QVariant::List ) )
if ( v.canConvert< QVariantList >() )
{
return v.toList();
}
@ -107,11 +108,11 @@ getDouble( const QVariantMap& map, const QString& key, double d )
if ( map.contains( key ) )
{
auto v = map.value( key );
if ( v.type() == QVariant::Int )
if ( Calamares::typeOf( v ) == Calamares::IntVariantType )
{
return v.toInt();
}
else if ( v.type() == QVariant::Double )
else if ( Calamares::typeOf( v ) == Calamares::DoubleVariantType )
{
return v.toDouble();
}
@ -126,7 +127,7 @@ getSubMap( const QVariantMap& map, const QString& key, bool& success, const QVar
if ( map.contains( key ) )
{
auto v = map.value( key );
if ( v.type() == QVariant::Map )
if ( Calamares::typeOf( v ) == Calamares::MapVariantType )
{
success = true;
return v.toMap();

View File

@ -12,12 +12,13 @@
*/
#include "Yaml.h"
#include "compat/Variant.h"
#include "utils/Logger.h"
#include <QByteArray>
#include <QFile>
#include <QFileInfo>
#include <QRegExp>
#include <QRegularExpression>
void
operator>>( const YAML::Node& node, QStringList& v )
@ -31,9 +32,6 @@ operator>>( const YAML::Node& node, QStringList& v )
namespace CalamaresUtils
{
const QRegExp _yamlScalarTrueValues = QRegExp( "true|True|TRUE|on|On|ON" );
const QRegExp _yamlScalarFalseValues = QRegExp( "false|False|FALSE|off|Off|OFF" );
QVariant
yamlToVariant( const YAML::Node& node )
{
@ -59,21 +57,26 @@ yamlToVariant( const YAML::Node& node )
QVariant
yamlScalarToVariant( const YAML::Node& scalarNode )
{
static const auto yamlScalarTrueValues = QRegularExpression( "^(true|True|TRUE|on|On|ON)$" );
static const auto yamlScalarFalseValues = QRegularExpression( "^(false|False|FALSE|off|Off|OFF)$" );
static const auto yamlIntegerValues = QRegularExpression( "^[-+]?\\d+$" );
static const auto yamlFloatValues = QRegularExpression( "^[-+]?\\d*\\.?\\d+$" );
std::string stdScalar = scalarNode.as< std::string >();
QString scalarString = QString::fromStdString( stdScalar );
if ( _yamlScalarTrueValues.exactMatch( scalarString ) )
if ( yamlScalarTrueValues.match( scalarString ).hasMatch() )
{
return QVariant( true );
}
if ( _yamlScalarFalseValues.exactMatch( scalarString ) )
if ( yamlScalarFalseValues.match( scalarString ).hasMatch() )
{
return QVariant( false );
}
if ( QRegExp( "[-+]?\\d+" ).exactMatch( scalarString ) )
if ( yamlIntegerValues.match( scalarString ).hasMatch() )
{
return QVariant( scalarString.toLongLong() );
}
if ( QRegExp( "[-+]?\\d*\\.?\\d+" ).exactMatch( scalarString ) )
if ( yamlFloatValues.match( scalarString ).hasMatch() )
{
return QVariant( scalarString.toDouble() );
}
@ -204,7 +207,8 @@ loadYaml( const QString& filename, bool* ok )
}
if ( yamlContents.isValid() && !yamlContents.isNull() && yamlContents.type() == QVariant::Map )
if ( yamlContents.isValid() && !yamlContents.isNull()
&& Calamares::typeOf( yamlContents ) == Calamares::MapVariantType )
{
if ( ok )
{
@ -237,35 +241,36 @@ static const char newline[] = "\n";
static void
dumpYamlElement( QFile& f, const QVariant& value, int indent )
{
if ( value.type() == QVariant::Type::Bool )
const auto t = Calamares::typeOf( value );
if ( t == Calamares::BoolVariantType )
{
f.write( value.toBool() ? "true" : "false" );
}
else if ( value.type() == QVariant::Type::String )
else if ( t == Calamares::StringVariantType )
{
f.write( quote );
f.write( value.toString().toUtf8() );
f.write( quote );
}
else if ( value.type() == QVariant::Type::Int )
else if ( t == Calamares::IntVariantType )
{
f.write( QString::number( value.toInt() ).toUtf8() );
}
else if ( value.type() == QVariant::Type::LongLong )
else if ( t == Calamares::LongLongVariantType )
{
f.write( QString::number( value.toLongLong() ).toUtf8() );
}
else if ( value.type() == QVariant::Type::Double )
else if ( t == Calamares::DoubleVariantType )
{
f.write( QString::number( value.toDouble(), 'f', 2 ).toUtf8() );
}
else if ( value.canConvert( QVariant::Type::ULongLong ) )
else if ( value.canConvert< qulonglong >() )
{
// This one needs to be *after* bool, int, double to avoid this branch
// .. grabbing those convertible types un-necessarily.
f.write( QString::number( value.toULongLong() ).toUtf8() );
}
else if ( value.type() == QVariant::Type::List )
else if ( t == Calamares::ListVariantType )
{
int c = 0;
for ( const auto& it : value.toList() )
@ -281,7 +286,7 @@ dumpYamlElement( QFile& f, const QVariant& value, int indent )
f.write( "[]" );
}
}
else if ( value.type() == QVariant::Type::Map )
else if ( t == Calamares::MapVariantType )
{
f.write( newline );
dumpYaml( f, value.toMap(), indent + 1 );

View File

@ -47,7 +47,7 @@ calamares_add_library(calamaresui
SOURCES ${calamaresui_SOURCES}
EXPORT_MACRO UIDLLEXPORT_PRO
LINK_LIBRARIES
Qt5::Svg
${qtname}::Svg
RESOURCES libcalamaresui.qrc
EXPORT Calamares
UI
@ -56,12 +56,14 @@ calamares_add_library(calamaresui
SOVERSION ${CALAMARES_SOVERSION}
)
target_link_libraries(calamaresui PRIVATE yamlcpp::yamlcpp)
if(NOT WITH_QT6) # TODO: Qt6
if(KF5CoreAddons_FOUND AND KF5CoreAddons_VERSION VERSION_GREATER_EQUAL 5.58)
target_compile_definitions(calamaresui PRIVATE WITH_KOSRelease)
target_link_libraries(calamaresui PRIVATE KF5::CoreAddons)
endif()
endif()
if(WITH_QML)
target_link_libraries(calamaresui PUBLIC Qt5::QuickWidgets)
target_link_libraries(calamaresui PUBLIC ${qtname}::QuickWidgets)
endif()
add_library(Calamares::calamaresui ALIAS calamaresui)

View File

@ -287,6 +287,37 @@ isAtVeryEnd( const ViewStepList& steps, int index )
return ( index >= steps.count() ) || ( index == steps.count() - 1 && steps.last()->isAtEnd() );
}
static int
questionBox( QWidget* parent,
const QString& title,
const QString& question,
const QString& button0,
const QString& button1 )
{
#if QT_VERSION >= QT_VERSION_CHECK( 6, 0, 0 )
QMessageBox mb( QMessageBox::Question, title, question, QMessageBox::StandardButton::NoButton, parent );
const auto* const okButton = mb.addButton( button0, QMessageBox::AcceptRole );
mb.addButton( button1, QMessageBox::RejectRole );
mb.exec();
if ( mb.clickedButton() == okButton )
{
return 0;
}
return 1; // Cancel
#else
return QMessageBox::question( parent,
title,
question,
button0,
button1,
QString(),
0 /* default first button, i.e. confirm */,
1 /* escape is second button, i.e. cancel */ );
#endif
}
void
ViewManager::next()
{
@ -318,15 +349,11 @@ ViewManager::next()
QString confirm = settings->isSetupMode() ? tr( "&Set up now" ) : tr( "&Install now" );
const auto* branding = Calamares::Branding::instance();
int reply
= QMessageBox::question( m_widget,
title,
question.arg( branding->shortProductName(), branding->shortVersionedName() ),
confirm,
tr( "Go &back" ),
QString(),
0 /* default first button, i.e. confirm */,
1 /* escape is second button, i.e. cancel */ );
int reply = questionBox( m_widget,
title,
question.arg( branding->shortProductName(), branding->shortVersionedName() ),
confirm,
tr( "Go &back" ) );
if ( reply == 1 )
{
return;
@ -548,7 +575,7 @@ ViewManager::data( const QModelIndex& index, int role ) const
// we must be in debug-mode (-d) so presumably it
// is a distro-developer or Calamares-developer
// running it, and we don't need translation for them.
QString toolTip( "<b>Debug information</b>" ); // Intentionally no translation here
QString toolTip( "<b>Debug information</b>" ); // Intentionally no translation here
toolTip.append( "<br/>Type:\tViewStep" );
toolTip.append( QString( "<br/>Pretty:\t%1" ).arg( step->prettyName() ) );
toolTip.append( QString( "<br/>Status:\t%1" ).arg( step->prettyStatus() ) );

View File

@ -12,6 +12,7 @@
#include "Branding.h"
#include "ViewManager.h"
#include "compat/Variant.h"
#include "utils/Dirs.h"
#include "utils/Logger.h"
#include "utils/NamedEnum.h"
@ -52,7 +53,8 @@ changeQMLState( QMLAction action, QQuickItem* item )
CalamaresUtils::callQmlFunction( item, activate ? "onActivate" : "onLeave" );
auto property = item->property( propertyName );
if ( property.isValid() && ( property.type() == QVariant::Bool ) && ( property.toBool() != activate ) )
if ( property.isValid() && ( Calamares::typeOf( property ) == Calamares::BoolVariantType )
&& ( property.toBool() != activate ) )
{
item->setProperty( propertyName, activate );
}

View File

@ -12,6 +12,8 @@
#include "Slideshow.h"
#include "Branding.h"
#include "compat/Mutex.h"
#include "compat/Variant.h"
#include "utils/Dirs.h"
#include "utils/Logger.h"
#ifdef WITH_QML
@ -79,7 +81,7 @@ SlideshowQML::widget()
void
SlideshowQML::loadQmlV2()
{
QMutexLocker l( &m_mutex );
Calamares::MutexLocker l( &m_mutex );
if ( !m_qmlComponent && !Calamares::Branding::instance()->slideshowPath().isEmpty() )
{
m_qmlComponent = new QQmlComponent( m_qmlShow->engine(),
@ -92,7 +94,7 @@ SlideshowQML::loadQmlV2()
void
SlideshowQML::loadQmlV2Complete()
{
QMutexLocker l( &m_mutex );
Calamares::MutexLocker l( &m_mutex );
if ( m_qmlComponent && m_qmlComponent->isReady() && !m_qmlObject )
{
cDebug() << "QML component complete, API 2";
@ -158,7 +160,7 @@ SlideshowQML::startSlideShow()
void
SlideshowQML::changeSlideShowState( Action state )
{
QMutexLocker l( &m_mutex );
Calamares::MutexLocker l( &m_mutex );
bool activate = state == Slideshow::Start;
if ( Branding::instance()->slideshowAPI() == 2 )
@ -182,7 +184,7 @@ SlideshowQML::changeSlideShowState( Action state )
{
static const char propertyName[] = "activatedInCalamares";
auto property = m_qmlObject->property( propertyName );
if ( property.isValid() && ( property.type() == QVariant::Bool ) && ( property.toBool() != activate ) )
if ( property.isValid() && ( Calamares::typeOf( property ) == Calamares::BoolVariantType ) && ( property.toBool() != activate ) )
{
m_qmlObject->setProperty( propertyName, activate );
}
@ -228,7 +230,7 @@ SlideshowPictures::widget()
void
SlideshowPictures::changeSlideShowState( Calamares::Slideshow::Action a )
{
QMutexLocker l( &m_mutex );
Calamares::MutexLocker l( &m_mutex );
m_state = a;
if ( a == Slideshow::Start )
{
@ -253,7 +255,7 @@ SlideshowPictures::changeSlideShowState( Calamares::Slideshow::Action a )
void
SlideshowPictures::next()
{
QMutexLocker l( &m_mutex );
Calamares::MutexLocker l( &m_mutex );
if ( m_imageIndex < 0 )
{

View File

@ -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 finished finishedq welcome welcomeq)
endif()
foreach(SUBDIRECTORY ${SUBDIRECTORIES})
calamares_add_module_subdirectory( ${SUBDIRECTORY} LIST_SKIPPED_MODULES )
endforeach()

View File

@ -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)
include_directories(${PROJECT_BINARY_DIR}/src/libcalamaresui)
@ -17,6 +17,6 @@ calamares_add_plugin(finished
UI
FinishedPage.ui
LINK_PRIVATE_LIBRARIES
Qt5::DBus
${qtname}::DBus
SHARED_LIB
)

View File

@ -8,8 +8,8 @@ if(NOT WITH_QML)
return()
endif()
find_package(Qt5 ${QT_VERSION} CONFIG COMPONENTS DBus Network)
if(NOT TARGET Qt5::DBus OR NOT TARGET Qt5::Network)
find_package(${qtname} ${QT_VERSION} CONFIG COMPONENTS DBus Network)
if(NOT TARGET ${qtname}::DBus OR NOT TARGET ${qtname}::Network)
calamares_skip_module( "finishedq (missing DBus or Network)" )
return()
endif()
@ -26,6 +26,6 @@ calamares_add_plugin(finishedq
RESOURCES
finishedq.qrc
LINK_PRIVATE_LIBRARIES
Qt5::DBus
${qtname}::DBus
SHARED_LIB
)

View File

@ -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
)

View File

@ -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() );
}

View File

@ -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;

View File

@ -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 );

View File

@ -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
)