[partition] start Qt6 work

make kpmcorehelper usable for both kf5 & 6, though no section added yet dealing with set to NOT for Qt6
adjust CalamaresConfig to not be hardcoded to kf5
one more var needed in Variant.h, used in PartitionInfo.cpp
adjust QVariant & QtConcurrent use
This commit is contained in:
demmm 2023-09-07 13:03:16 +02:00
parent 14419ac26f
commit 07e5a3a113
8 changed files with 25 additions and 13 deletions

View File

@ -30,10 +30,10 @@ if(NOT TARGET calapmcore)
add_library(calapmcore INTERFACE) add_library(calapmcore INTERFACE)
if(KPMcore_FOUND) if(KPMcore_FOUND)
find_package(Qt5 REQUIRED DBus) # Needed for KPMCore find_package(${qtname} REQUIRED DBus) # Needed for KPMCore
find_package(KF5 REQUIRED I18n WidgetsAddons) # Needed for KPMCore find_package(${kfname} REQUIRED I18n WidgetsAddons) # Needed for KPMCore
target_link_libraries(calapmcore INTERFACE kpmcore Qt5::DBus KF5::I18n KF5::WidgetsAddons) target_link_libraries(calapmcore INTERFACE kpmcore ${qtname}::DBus ${kfname}::I18n ${kfname}::WidgetsAddons)
target_include_directories(calapmcore INTERFACE ${KPMCORE_INCLUDE_DIR}) target_include_directories(calapmcore INTERFACE ${KPMCORE_INCLUDE_DIR})
# If there were KPMcore API variations, figure them out here # If there were KPMcore API variations, figure them out here
# target_compile_definitions(calapmcore INTERFACE WITH_KPMcore) # target_compile_definitions(calapmcore INTERFACE WITH_KPMcore)

View File

@ -60,13 +60,13 @@ accumulate_deps(qt_required Calamares::calamaresui ${qtname}::)
find_package(${qtname} CONFIG REQUIRED ${qt_required}) find_package(${qtname} CONFIG REQUIRED ${qt_required})
set(kf5_required "") set(kf5_required "")
accumulate_deps(kf5_required Calamares::calamares KF5::) accumulate_deps(kf5_required Calamares::calamares ${kfname}::)
accumulate_deps(kf5_required Calamares::calamaresui KF5::) accumulate_deps(kf5_required Calamares::calamaresui ${kfname}::)
if(kf5_required) if(kf5_required)
find_package(ECM ${ECM_VERSION} NO_MODULE) find_package(ECM ${ECM_VERSION} NO_MODULE)
if( ECM_FOUND ) if( ECM_FOUND )
list(INSERT CMAKE_MODULE_PATH 0 ${ECM_MODULE_PATH}) list(INSERT CMAKE_MODULE_PATH 0 ${ECM_MODULE_PATH})
find_package(KF5 REQUIRED COMPONENTS ${kf5_required}) find_package(${kfname} REQUIRED COMPONENTS ${kf5_required})
endif() endif()
endif() endif()

View File

@ -25,6 +25,7 @@ const auto CharVariantType = QVariant::Char;
const auto StringListVariantType = QVariant::StringList; const auto StringListVariantType = QVariant::StringList;
const auto BoolVariantType = QVariant::Bool; const auto BoolVariantType = QVariant::Bool;
const auto IntVariantType = QVariant::Int; const auto IntVariantType = QVariant::Int;
const auto UIntVariantType = QVariant::UInt;
const auto LongLongVariantType = QVariant::LongLong; const auto LongLongVariantType = QVariant::LongLong;
const auto ULongLongVariantType = QVariant::ULongLong; const auto ULongLongVariantType = QVariant::ULongLong;
const auto DoubleVariantType = QVariant::Double; const auto DoubleVariantType = QVariant::Double;
@ -38,6 +39,7 @@ const auto CharVariantType = QMetaType::Type::Char;
const auto StringListVariantType = QMetaType::Type::QStringList; const auto StringListVariantType = QMetaType::Type::QStringList;
const auto BoolVariantType = QMetaType::Type::Bool; const auto BoolVariantType = QMetaType::Type::Bool;
const auto IntVariantType = QMetaType::Type::Int; const auto IntVariantType = QMetaType::Type::Int;
const auto UIntVariantType = QMetaType::Type::UInt;
const auto LongLongVariantType = QMetaType::Type::LongLong; const auto LongLongVariantType = QMetaType::Type::LongLong;
const auto ULongLongVariantType = QMetaType::Type::ULongLong; const auto ULongLongVariantType = QMetaType::Type::ULongLong;
const auto DoubleVariantType = QMetaType::Type::Double; const auto DoubleVariantType = QMetaType::Type::Double;

View File

@ -45,9 +45,9 @@ find_package(ECM ${ECM_VERSION} REQUIRED NO_MODULE)
include(KPMcoreHelper) include(KPMcoreHelper)
find_package(KF5Config CONFIG) find_package(${kfname}Config CONFIG)
find_package(KF5I18n CONFIG) find_package(${kfname}I18n CONFIG)
find_package(KF5WidgetsAddons CONFIG) find_package(${kfname}WidgetsAddons CONFIG)
if(KPMcore_FOUND) if(KPMcore_FOUND)
include_directories(${PROJECT_BINARY_DIR}/src/libcalamaresui) include_directories(${PROJECT_BINARY_DIR}/src/libcalamaresui)
@ -115,7 +115,7 @@ if(KPMcore_FOUND)
gui/VolumeGroupBaseDialog.ui gui/VolumeGroupBaseDialog.ui
LINK_PRIVATE_LIBRARIES LINK_PRIVATE_LIBRARIES
calamares::kpmcore calamares::kpmcore
KF5::CoreAddons ${kfname}::CoreAddons
COMPILE_DEFINITIONS ${_partition_defs} COMPILE_DEFINITIONS ${_partition_defs}
SHARED_LIB SHARED_LIB
) )

View File

@ -696,7 +696,11 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
this->m_future = nullptr; this->m_future = nullptr;
} ); } );
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
QFuture< void > future = QtConcurrent::run( this, &PartitionViewStep::initPartitionCoreModule ); QFuture< void > future = QtConcurrent::run( this, &PartitionViewStep::initPartitionCoreModule );
#else
QFuture< void > future = QtConcurrent::run( &PartitionViewStep::initPartitionCoreModule, this );
#endif
m_future->setFuture( future ); m_future->setFuture( future );
m_core->partitionLayout().init( m_config->defaultFsType(), configurationMap.value( "partitionLayout" ).toList() ); m_core->partitionLayout().init( m_config->defaultFsType(), configurationMap.value( "partitionLayout" ).toList() );

View File

@ -1114,7 +1114,11 @@ PartitionCoreModule::asyncRevertDevice( Device* dev, std::function< void() > cal
watcher->deleteLater(); watcher->deleteLater();
} ); } );
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
QFuture< void > future = QtConcurrent::run( this, &PartitionCoreModule::revertDevice, dev, true ); QFuture< void > future = QtConcurrent::run( this, &PartitionCoreModule::revertDevice, dev, true );
#else
QFuture< void > future = QtConcurrent::run( &PartitionCoreModule::revertDevice, this, dev, true );
#endif
watcher->setFuture( future ); watcher->setFuture( future );
} }

View File

@ -9,6 +9,7 @@
*/ */
#include "core/PartitionInfo.h" #include "core/PartitionInfo.h"
#include "compat/Variant.h"
// KPMcore // KPMcore
#include <kpmcore/core/lvmdevice.h> #include <kpmcore/core/lvmdevice.h>
@ -60,7 +61,7 @@ flags( const Partition* partition )
// (see qflags.h) and so setting those flags can create a QVariant // (see qflags.h) and so setting those flags can create a QVariant
// of those types; we don't just want to check QVariant::canConvert() // of those types; we don't just want to check QVariant::canConvert()
// here because that will also accept QByteArray and some other things. // here because that will also accept QByteArray and some other things.
if ( v.type() == QVariant::Int || v.type() == QVariant::UInt ) if ( Calamares::typeOf( v ) == Calamares::IntVariantType || Calamares::typeOf( v ) == Calamares::UIntVariantType )
{ {
return static_cast< PartitionTable::Flags >( v.toInt() ); return static_cast< PartitionTable::Flags >( v.toInt() );
} }

View File

@ -13,6 +13,7 @@
#include "core/KPMHelpers.h" #include "core/KPMHelpers.h"
#include "core/PartitionInfo.h" #include "core/PartitionInfo.h"
#include "compat/Variant.h"
#include "Branding.h" #include "Branding.h"
#include "GlobalStorage.h" #include "GlobalStorage.h"
@ -146,7 +147,7 @@ prettyFileSystemFeatures( const QVariantMap& features )
for ( const auto& key : features.keys() ) for ( const auto& key : features.keys() )
{ {
const auto& value = features.value( key ); const auto& value = features.value( key );
if ( value.type() == QVariant::Bool ) if ( Calamares::typeOf( value ) == Calamares::BoolVariantType )
{ {
if ( value.toBool() ) if ( value.toBool() )
{ {
@ -187,7 +188,7 @@ FillGlobalStorageJob::prettyDescription() const
const auto partitionList = createPartitionList(); const auto partitionList = createPartitionList();
for ( const QVariant& partitionItem : partitionList ) for ( const QVariant& partitionItem : partitionList )
{ {
if ( partitionItem.type() == QVariant::Map ) if ( Calamares::typeOf( partitionItem ) == Calamares::MapVariantType )
{ {
QVariantMap partitionMap = partitionItem.toMap(); QVariantMap partitionMap = partitionItem.toMap();
QString path = partitionMap.value( "device" ).toString(); QString path = partitionMap.value( "device" ).toString();