Merge pull request #2199 from demmm/calamares
[users] CheckPWQuality.cpp Qt6 correction
This commit is contained in:
commit
1b235e56a3
@ -17,6 +17,7 @@ Frameworks are required as well, and those need to be Qt6-based as well.
|
||||
|
||||
This release contains contributions from (alphabetically by first name):
|
||||
- Adriaan de Groot
|
||||
- Anke Boersma
|
||||
- Hector Martin
|
||||
- Ivan Borzenkov
|
||||
|
||||
|
@ -30,10 +30,10 @@ if(NOT TARGET calapmcore)
|
||||
add_library(calapmcore INTERFACE)
|
||||
|
||||
if(KPMcore_FOUND)
|
||||
find_package(Qt5 REQUIRED DBus) # Needed for KPMCore
|
||||
find_package(KF5 REQUIRED I18n WidgetsAddons) # Needed for KPMCore
|
||||
find_package(${qtname} REQUIRED DBus) # 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})
|
||||
# If there were KPMcore API variations, figure them out here
|
||||
# target_compile_definitions(calapmcore INTERFACE WITH_KPMcore)
|
||||
|
@ -60,13 +60,13 @@ accumulate_deps(qt_required Calamares::calamaresui ${qtname}::)
|
||||
find_package(${qtname} CONFIG REQUIRED ${qt_required})
|
||||
|
||||
set(kf5_required "")
|
||||
accumulate_deps(kf5_required Calamares::calamares KF5::)
|
||||
accumulate_deps(kf5_required Calamares::calamaresui KF5::)
|
||||
accumulate_deps(kf5_required Calamares::calamares ${kfname}::)
|
||||
accumulate_deps(kf5_required Calamares::calamaresui ${kfname}::)
|
||||
if(kf5_required)
|
||||
find_package(ECM ${ECM_VERSION} NO_MODULE)
|
||||
if( ECM_FOUND )
|
||||
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()
|
||||
|
||||
|
@ -25,6 +25,7 @@ const auto CharVariantType = QVariant::Char;
|
||||
const auto StringListVariantType = QVariant::StringList;
|
||||
const auto BoolVariantType = QVariant::Bool;
|
||||
const auto IntVariantType = QVariant::Int;
|
||||
const auto UIntVariantType = QVariant::UInt;
|
||||
const auto LongLongVariantType = QVariant::LongLong;
|
||||
const auto ULongLongVariantType = QVariant::ULongLong;
|
||||
const auto DoubleVariantType = QVariant::Double;
|
||||
@ -38,6 +39,7 @@ 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 UIntVariantType = QMetaType::Type::UInt;
|
||||
const auto LongLongVariantType = QMetaType::Type::LongLong;
|
||||
const auto ULongLongVariantType = QMetaType::Type::ULongLong;
|
||||
const auto DoubleVariantType = QMetaType::Type::Double;
|
||||
|
@ -45,9 +45,9 @@ find_package(ECM ${ECM_VERSION} REQUIRED NO_MODULE)
|
||||
|
||||
include(KPMcoreHelper)
|
||||
|
||||
find_package(KF5Config CONFIG)
|
||||
find_package(KF5I18n CONFIG)
|
||||
find_package(KF5WidgetsAddons CONFIG)
|
||||
find_package(${kfname}Config CONFIG)
|
||||
find_package(${kfname}I18n CONFIG)
|
||||
find_package(${kfname}WidgetsAddons CONFIG)
|
||||
|
||||
if(KPMcore_FOUND)
|
||||
include_directories(${PROJECT_BINARY_DIR}/src/libcalamaresui)
|
||||
@ -115,7 +115,7 @@ if(KPMcore_FOUND)
|
||||
gui/VolumeGroupBaseDialog.ui
|
||||
LINK_PRIVATE_LIBRARIES
|
||||
calamares::kpmcore
|
||||
KF5::CoreAddons
|
||||
${kfname}::CoreAddons
|
||||
COMPILE_DEFINITIONS ${_partition_defs}
|
||||
SHARED_LIB
|
||||
)
|
||||
|
@ -696,7 +696,11 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
|
||||
this->m_future = nullptr;
|
||||
} );
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
|
||||
QFuture< void > future = QtConcurrent::run( this, &PartitionViewStep::initPartitionCoreModule );
|
||||
#else
|
||||
QFuture< void > future = QtConcurrent::run( &PartitionViewStep::initPartitionCoreModule, this );
|
||||
#endif
|
||||
m_future->setFuture( future );
|
||||
|
||||
m_core->partitionLayout().init( m_config->defaultFsType(), configurationMap.value( "partitionLayout" ).toList() );
|
||||
|
@ -1114,7 +1114,11 @@ PartitionCoreModule::asyncRevertDevice( Device* dev, std::function< void() > cal
|
||||
watcher->deleteLater();
|
||||
} );
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
|
||||
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 );
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
*/
|
||||
|
||||
#include "core/PartitionInfo.h"
|
||||
#include "compat/Variant.h"
|
||||
|
||||
// KPMcore
|
||||
#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
|
||||
// of those types; we don't just want to check QVariant::canConvert()
|
||||
// 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() );
|
||||
}
|
||||
|
@ -340,7 +340,11 @@ PartitionSplitterWidget::mousePressEvent( QMouseEvent* event )
|
||||
{
|
||||
if ( m_itemToResize && m_itemToResizeNext && event->button() == Qt::LeftButton )
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
|
||||
if ( qAbs( event->x() - m_resizeHandleX ) < HANDLE_SNAP )
|
||||
#else
|
||||
if ( qAbs( event->position().x() - m_resizeHandleX ) < HANDLE_SNAP )
|
||||
#endif
|
||||
{
|
||||
m_resizing = true;
|
||||
}
|
||||
@ -393,7 +397,11 @@ PartitionSplitterWidget::mouseMoveEvent( QMouseEvent* event )
|
||||
int ew = rect().width(); //effective width
|
||||
qreal bpp = total / static_cast< qreal >( ew ); //bytes per pixel
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
|
||||
qreal mx = event->x() * bpp - start;
|
||||
#else
|
||||
qreal mx = event->position().x() * bpp - start;
|
||||
#endif
|
||||
|
||||
// make sure we are within resize range
|
||||
mx = qBound( static_cast< qreal >( m_itemMinSize ), mx, static_cast< qreal >( m_itemMaxSize ) );
|
||||
@ -428,7 +436,11 @@ PartitionSplitterWidget::mouseMoveEvent( QMouseEvent* event )
|
||||
{
|
||||
if ( m_itemToResize && m_itemToResizeNext )
|
||||
{
|
||||
#if QT_VERSION < QT_VERSION_CHECK( 6, 0, 0 )
|
||||
if ( qAbs( event->x() - m_resizeHandleX ) < HANDLE_SNAP )
|
||||
#else
|
||||
if ( qAbs( event->position().x() - m_resizeHandleX ) < HANDLE_SNAP )
|
||||
#endif
|
||||
{
|
||||
setCursor( Qt::SplitHCursor );
|
||||
}
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "core/KPMHelpers.h"
|
||||
#include "core/PartitionInfo.h"
|
||||
#include "compat/Variant.h"
|
||||
|
||||
#include "Branding.h"
|
||||
#include "GlobalStorage.h"
|
||||
@ -146,7 +147,7 @@ prettyFileSystemFeatures( const QVariantMap& features )
|
||||
for ( const auto& key : features.keys() )
|
||||
{
|
||||
const auto& value = features.value( key );
|
||||
if ( value.type() == QVariant::Bool )
|
||||
if ( Calamares::typeOf( value ) == Calamares::BoolVariantType )
|
||||
{
|
||||
if ( value.toBool() )
|
||||
{
|
||||
@ -187,7 +188,7 @@ FillGlobalStorageJob::prettyDescription() const
|
||||
const auto partitionList = createPartitionList();
|
||||
for ( const QVariant& partitionItem : partitionList )
|
||||
{
|
||||
if ( partitionItem.type() == QVariant::Map )
|
||||
if ( Calamares::typeOf( partitionItem ) == Calamares::MapVariantType )
|
||||
{
|
||||
QVariantMap partitionMap = partitionItem.toMap();
|
||||
QString path = partitionMap.value( "device" ).toString();
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "CheckPWQuality.h"
|
||||
|
||||
#include "compat/Variant.h"
|
||||
#include "utils/Logger.h"
|
||||
|
||||
#include <QCoreApplication>
|
||||
@ -344,7 +345,7 @@ private:
|
||||
|
||||
DEFINE_CHECK_FUNC( libpwquality )
|
||||
{
|
||||
if ( !value.canConvert( QVariant::List ) )
|
||||
if ( !value.canConvert< QVariantList >() )
|
||||
{
|
||||
cWarning() << "libpwquality settings is not a list";
|
||||
return;
|
||||
@ -355,7 +356,7 @@ DEFINE_CHECK_FUNC( libpwquality )
|
||||
auto settings = std::make_shared< PWSettingsHolder >();
|
||||
for ( const auto& v : l )
|
||||
{
|
||||
if ( v.type() == QVariant::String )
|
||||
if ( Calamares::typeOf( v ) == Calamares::StringVariantType )
|
||||
{
|
||||
QString option = v.toString();
|
||||
int r = settings->set( option );
|
||||
|
Loading…
Reference in New Issue
Block a user