Merge branch 'partition-warnings' into calamares
This commit is contained in:
commit
621ac9b8db
43
src/libcalamares/partition/KPMHelper.h
Normal file
43
src/libcalamares/partition/KPMHelper.h
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
/* === This file is part of Calamares - <https://calamares.io> ===
|
||||||
|
*
|
||||||
|
* SPDX-FileCopyrightText: 2020 Adriaan de Groot <groot@kde.org>
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*
|
||||||
|
* Calamares is Free Software: see the License-Identifier above.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* KPMCore header file inclusion.
|
||||||
|
*
|
||||||
|
* Includes the system KPMCore headers without warnings (by switching off
|
||||||
|
* the expected warnings).
|
||||||
|
*/
|
||||||
|
#ifndef PARTITION_KPMHELPER_H
|
||||||
|
#define PARTITION_KPMHELPER_H
|
||||||
|
|
||||||
|
// The kpmcore headers are not C++17 warning-proof, especially
|
||||||
|
// with picky compilers like Clang 10. Since we use Clang for the
|
||||||
|
// find-all-the-warnings case, switch those warnings off for
|
||||||
|
// the we-can't-change-them system headers.
|
||||||
|
#ifdef __clang__
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wdocumentation"
|
||||||
|
#pragma clang diagnostic ignored "-Wsuggest-destructor-override"
|
||||||
|
#pragma clang diagnostic ignored "-Winconsistent-missing-destructor-override"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <backend/corebackend.h>
|
||||||
|
#include <core/device.h>
|
||||||
|
#include <core/lvmdevice.h>
|
||||||
|
#include <core/partition.h>
|
||||||
|
#include <core/partitionrole.h>
|
||||||
|
#include <core/partitiontable.h>
|
||||||
|
#include <fs/filesystem.h>
|
||||||
|
#include <fs/filesystemfactory.h>
|
||||||
|
|
||||||
|
#ifdef __clang__
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
@ -24,9 +24,6 @@ static_assert( TimeZoneImageList::zoneCount == ( sizeof( zoneNames ) / sizeof( z
|
|||||||
|
|
||||||
#define ZONE_NAME QStringLiteral( "zone" )
|
#define ZONE_NAME QStringLiteral( "zone" )
|
||||||
|
|
||||||
/* static constexpr */ const int TimeZoneImageList::zoneCount;
|
|
||||||
/* static constexpr */ const QSize TimeZoneImageList::imageSize;
|
|
||||||
|
|
||||||
static_assert( TimeZoneImageList::zoneCount == 37, "Incorrect number of zones" );
|
static_assert( TimeZoneImageList::zoneCount == 37, "Incorrect number of zones" );
|
||||||
|
|
||||||
TimeZoneImageList::TimeZoneImageList() {}
|
TimeZoneImageList::TimeZoneImageList() {}
|
||||||
|
@ -736,14 +736,12 @@ ChoicePage::doReplaceSelectedPartition( const QModelIndex& current )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This will be deleted by the second lambda, below.
|
||||||
QString* homePartitionPath = new QString();
|
QString* homePartitionPath = new QString();
|
||||||
bool doReuseHomePartition = m_reuseHomeCheckBox->isChecked();
|
|
||||||
|
|
||||||
// NOTE: using by-ref captures because we need to write homePartitionPath and
|
|
||||||
// doReuseHomePartition *after* the device revert, for later use.
|
|
||||||
ScanningDialog::run(
|
ScanningDialog::run(
|
||||||
QtConcurrent::run(
|
QtConcurrent::run(
|
||||||
[this, current]( QString* homePartitionPath, bool doReuseHomePartition ) {
|
[this, current, homePartitionPath]( bool doReuseHomePartition ) {
|
||||||
QMutexLocker locker( &m_coreMutex );
|
QMutexLocker locker( &m_coreMutex );
|
||||||
|
|
||||||
if ( m_core->isDirty() )
|
if ( m_core->isDirty() )
|
||||||
@ -823,9 +821,8 @@ ChoicePage::doReplaceSelectedPartition( const QModelIndex& current )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
homePartitionPath,
|
m_reuseHomeCheckBox->isChecked() ),
|
||||||
doReuseHomePartition ),
|
[this, homePartitionPath] {
|
||||||
[=] {
|
|
||||||
m_reuseHomeCheckBox->setVisible( !homePartitionPath->isEmpty() );
|
m_reuseHomeCheckBox->setVisible( !homePartitionPath->isEmpty() );
|
||||||
if ( !homePartitionPath->isEmpty() )
|
if ( !homePartitionPath->isEmpty() )
|
||||||
m_reuseHomeCheckBox->setText( tr( "Reuse %1 as home partition for %2." )
|
m_reuseHomeCheckBox->setText( tr( "Reuse %1 as home partition for %2." )
|
||||||
@ -906,7 +903,9 @@ ChoicePage::updateDeviceStatePreview()
|
|||||||
m_beforePartitionBarsView->setSelectionMode( QAbstractItemView::SingleSelection );
|
m_beforePartitionBarsView->setSelectionMode( QAbstractItemView::SingleSelection );
|
||||||
m_beforePartitionLabelsView->setSelectionMode( QAbstractItemView::SingleSelection );
|
m_beforePartitionLabelsView->setSelectionMode( QAbstractItemView::SingleSelection );
|
||||||
break;
|
break;
|
||||||
default:
|
case InstallChoice::NoChoice:
|
||||||
|
case InstallChoice::Erase:
|
||||||
|
case InstallChoice::Manual:
|
||||||
m_beforePartitionBarsView->setSelectionMode( QAbstractItemView::NoSelection );
|
m_beforePartitionBarsView->setSelectionMode( QAbstractItemView::NoSelection );
|
||||||
m_beforePartitionLabelsView->setSelectionMode( QAbstractItemView::NoSelection );
|
m_beforePartitionLabelsView->setSelectionMode( QAbstractItemView::NoSelection );
|
||||||
}
|
}
|
||||||
@ -990,7 +989,7 @@ ChoicePage::updateActionChoicePreview( InstallChoice choice )
|
|||||||
m_previewAfterFrame->show();
|
m_previewAfterFrame->show();
|
||||||
m_previewAfterLabel->show();
|
m_previewAfterLabel->show();
|
||||||
|
|
||||||
SelectionFilter filter = [this]( const QModelIndex& index ) {
|
SelectionFilter filter = []( const QModelIndex& index ) {
|
||||||
return PartUtils::canBeResized(
|
return PartUtils::canBeResized(
|
||||||
static_cast< Partition* >( index.data( PartitionModel::PartitionPtrRole ).value< void* >() ) );
|
static_cast< Partition* >( index.data( PartitionModel::PartitionPtrRole ).value< void* >() ) );
|
||||||
};
|
};
|
||||||
@ -1079,7 +1078,7 @@ ChoicePage::updateActionChoicePreview( InstallChoice choice )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SelectionFilter filter = [this]( const QModelIndex& index ) {
|
SelectionFilter filter = []( const QModelIndex& index ) {
|
||||||
return PartUtils::canBeReplaced(
|
return PartUtils::canBeReplaced(
|
||||||
static_cast< Partition* >( index.data( PartitionModel::PartitionPtrRole ).value< void* >() ) );
|
static_cast< Partition* >( index.data( PartitionModel::PartitionPtrRole ).value< void* >() ) );
|
||||||
};
|
};
|
||||||
@ -1125,7 +1124,9 @@ ChoicePage::updateActionChoicePreview( InstallChoice choice )
|
|||||||
case InstallChoice::Alongside:
|
case InstallChoice::Alongside:
|
||||||
previewSelectionMode = QAbstractItemView::SingleSelection;
|
previewSelectionMode = QAbstractItemView::SingleSelection;
|
||||||
break;
|
break;
|
||||||
default:
|
case InstallChoice::NoChoice:
|
||||||
|
case InstallChoice::Erase:
|
||||||
|
case InstallChoice::Manual:
|
||||||
previewSelectionMode = QAbstractItemView::NoSelection;
|
previewSelectionMode = QAbstractItemView::NoSelection;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1179,15 +1180,15 @@ ChoicePage::setupEfiSystemPartitionSelector()
|
|||||||
QComboBox*
|
QComboBox*
|
||||||
ChoicePage::createBootloaderComboBox( QWidget* parent )
|
ChoicePage::createBootloaderComboBox( QWidget* parent )
|
||||||
{
|
{
|
||||||
QComboBox* bcb = new QComboBox( parent );
|
QComboBox* comboForBootloader = new QComboBox( parent );
|
||||||
bcb->setModel( m_core->bootLoaderModel() );
|
comboForBootloader->setModel( m_core->bootLoaderModel() );
|
||||||
|
|
||||||
// When the chosen bootloader device changes, we update the choice in the PCM
|
// When the chosen bootloader device changes, we update the choice in the PCM
|
||||||
connect( bcb, QOverload< int >::of( &QComboBox::currentIndexChanged ), this, [this]( int newIndex ) {
|
connect( comboForBootloader, QOverload< int >::of( &QComboBox::currentIndexChanged ), this, [this]( int newIndex ) {
|
||||||
QComboBox* bcb = qobject_cast< QComboBox* >( sender() );
|
QComboBox* bootloaderCombo = qobject_cast< QComboBox* >( sender() );
|
||||||
if ( bcb )
|
if ( bootloaderCombo )
|
||||||
{
|
{
|
||||||
QVariant var = bcb->itemData( newIndex, BootLoaderModel::BootLoaderPathRole );
|
QVariant var = bootloaderCombo->itemData( newIndex, BootLoaderModel::BootLoaderPathRole );
|
||||||
if ( !var.isValid() )
|
if ( !var.isValid() )
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -1196,7 +1197,7 @@ ChoicePage::createBootloaderComboBox( QWidget* parent )
|
|||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
|
||||||
return bcb;
|
return comboForBootloader;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1220,7 +1221,6 @@ operator<<( QDebug& s, PartitionIterator& it )
|
|||||||
* @brief ChoicePage::setupActions happens every time a new Device* is selected in the
|
* @brief ChoicePage::setupActions happens every time a new Device* is selected in the
|
||||||
* device picker. Sets up the text and visibility of the partitioning actions based
|
* device picker. Sets up the text and visibility of the partitioning actions based
|
||||||
* on the currently selected Device*, bootloader and os-prober output.
|
* on the currently selected Device*, bootloader and os-prober output.
|
||||||
* @param currentDevice
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
ChoicePage::setupActions()
|
ChoicePage::setupActions()
|
||||||
|
@ -15,10 +15,6 @@
|
|||||||
#include "partition/KPMManager.h"
|
#include "partition/KPMManager.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
|
|
||||||
#include <core/lvmdevice.h>
|
|
||||||
#include <core/partition.h>
|
|
||||||
#include <fs/filesystemfactory.h>
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include <QtTest/QtTest>
|
#include <QtTest/QtTest>
|
||||||
|
@ -10,8 +10,9 @@
|
|||||||
#ifndef CLEARMOUNTSJOBTESTS_H
|
#ifndef CLEARMOUNTSJOBTESTS_H
|
||||||
#define CLEARMOUNTSJOBTESTS_H
|
#define CLEARMOUNTSJOBTESTS_H
|
||||||
|
|
||||||
|
#include "partition/KPMHelper.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <core/device.h>
|
|
||||||
|
|
||||||
class CreateLayoutsTests : public QObject
|
class CreateLayoutsTests : public QObject
|
||||||
{
|
{
|
||||||
|
@ -15,14 +15,12 @@
|
|||||||
#include "jobs/CreatePartitionTableJob.h"
|
#include "jobs/CreatePartitionTableJob.h"
|
||||||
#include "jobs/ResizePartitionJob.h"
|
#include "jobs/ResizePartitionJob.h"
|
||||||
|
|
||||||
|
#include "partition/KPMHelper.h"
|
||||||
#include "partition/KPMManager.h"
|
#include "partition/KPMManager.h"
|
||||||
#include "partition/PartitionQuery.h"
|
#include "partition/PartitionQuery.h"
|
||||||
#include "utils/Logger.h"
|
#include "utils/Logger.h"
|
||||||
#include "utils/Units.h"
|
#include "utils/Units.h"
|
||||||
|
|
||||||
#include <backend/corebackend.h>
|
|
||||||
#include <fs/filesystemfactory.h>
|
|
||||||
|
|
||||||
#include <QEventLoop>
|
#include <QEventLoop>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
#include <QtTest/QtTest>
|
#include <QtTest/QtTest>
|
||||||
|
@ -12,12 +12,7 @@
|
|||||||
|
|
||||||
#include "JobQueue.h"
|
#include "JobQueue.h"
|
||||||
|
|
||||||
// CalaPM
|
#include "partition/KPMHelper.h"
|
||||||
#include <core/device.h>
|
|
||||||
#include <core/partition.h>
|
|
||||||
#include <core/partitionrole.h>
|
|
||||||
#include <core/partitiontable.h>
|
|
||||||
#include <fs/filesystem.h>
|
|
||||||
|
|
||||||
// Qt
|
// Qt
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
Loading…
Reference in New Issue
Block a user