Apply coding style globally again

main
Adriaan de Groot 4 years ago
parent cff24bdd79
commit a955791766

@ -57,15 +57,13 @@ enum class InsertMode
* in *localeConf*, e.g. "LANG" or "LC_TIME". No effort is made to
* enforce this.
*/
DLLEXPORT void
insertGS( Calamares::GlobalStorage& gs, const QVariantMap& values, InsertMode mode = InsertMode::Merge );
DLLEXPORT void insertGS( Calamares::GlobalStorage& gs, const QVariantMap& values, InsertMode mode = InsertMode::Merge );
/** @brief Insert the given @p values into the *localeConf* map in @p gs
*
* Alternate way of providing the keys and values.
*/
DLLEXPORT void insertGS( Calamares::GlobalStorage& gs,
const QMap< QString, QString >& values,
InsertMode mode = InsertMode::Merge );
DLLEXPORT void
insertGS( Calamares::GlobalStorage& gs, const QMap< QString, QString >& values, InsertMode mode = InsertMode::Merge );
/** @brief Write a single @p key and @p value to the *localeConf* map
*/
DLLEXPORT void insertGS( Calamares::GlobalStorage& gs, const QString& key, const QString& value );

@ -281,9 +281,7 @@ ModuleManager::loadModules()
if ( !failedModules.isEmpty() )
{
ViewManager::instance()->onInitFailed( failedModules );
QTimer::singleShot( 10, [=]() {
emit modulesFailed( failedModules );
} );
QTimer::singleShot( 10, [=]() { emit modulesFailed( failedModules ); } );
}
else
{

@ -41,9 +41,7 @@ ImageRegistry::cacheKey( const QSize& size )
QPixmap
ImageRegistry::pixmap( const QString& image,
const QSize& size,
CalamaresUtils::ImageMode mode )
ImageRegistry::pixmap( const QString& image, const QSize& size, CalamaresUtils::ImageMode mode )
{
Q_ASSERT( !( size.width() < 0 || size.height() < 0 ) );
if ( size.width() < 0 || size.height() < 0 )

@ -22,16 +22,12 @@ public:
explicit ImageRegistry();
QIcon icon( const QString& image, CalamaresUtils::ImageMode mode = CalamaresUtils::Original );
QPixmap pixmap( const QString& image,
const QSize& size,
CalamaresUtils::ImageMode mode = CalamaresUtils::Original );
QPixmap
pixmap( const QString& image, const QSize& size, CalamaresUtils::ImageMode mode = CalamaresUtils::Original );
private:
qint64 cacheKey( const QSize& size );
void putInCache( const QString& image,
const QSize& size,
CalamaresUtils::ImageMode mode,
const QPixmap& pixmap );
void putInCache( const QString& image, const QSize& size, CalamaresUtils::ImageMode mode, const QPixmap& pixmap );
};
#endif // IMAGE_REGISTRY_H

@ -76,14 +76,12 @@ KeyboardPage::KeyboardPage( QWidget* parent )
connect(
ui->buttonRestore, &QPushButton::clicked, [this] { ui->comboBoxModel->setCurrentIndex( m_defaultIndex ); } );
connect( ui->comboBoxModel,
&QComboBox::currentTextChanged,
[this]( const QString& text ) {
QString model = m_models.value( text, "pc105" );
// Set Xorg keyboard model
QProcess::execute( "setxkbmap", QStringList { "-model", model } );
} );
connect( ui->comboBoxModel, &QComboBox::currentTextChanged, [this]( const QString& text ) {
QString model = m_models.value( text, "pc105" );
// Set Xorg keyboard model
QProcess::execute( "setxkbmap", QStringList { "-model", model } );
} );
CALAMARES_RETRANSLATE( ui->retranslateUi( this ); )
}

@ -240,19 +240,19 @@ Config::setConfigurationMap( const QVariantMap& configurationMap )
gs->insert( "allowManualPartitioning",
CalamaresUtils::getBool( configurationMap, "allowManualPartitioning", true ) );
if ( configurationMap.contains( "requiredPartitionTableType" ) &&
configurationMap.value( "requiredPartitionTableType" ).type() == QVariant::List )
if ( configurationMap.contains( "requiredPartitionTableType" )
&& configurationMap.value( "requiredPartitionTableType" ).type() == QVariant::List )
{
m_requiredPartitionTableType.clear();
m_requiredPartitionTableType.append( configurationMap.value( "requiredPartitionTableType" ).toStringList() );
}
else if ( configurationMap.contains( "requiredPartitionTableType" ) &&
configurationMap.value( "requiredPartitionTableType" ).type() == QVariant::String )
else if ( configurationMap.contains( "requiredPartitionTableType" )
&& configurationMap.value( "requiredPartitionTableType" ).type() == QVariant::String )
{
m_requiredPartitionTableType.clear();
m_requiredPartitionTableType.append( configurationMap.value( "requiredPartitionTableType" ).toString() );
}
gs->insert( "requiredPartitionTableType", m_requiredPartitionTableType);
gs->insert( "requiredPartitionTableType", m_requiredPartitionTableType );
}
void

@ -29,12 +29,12 @@ namespace Choices
{
struct ReplacePartitionOptions
{
QString defaultPartitionTableType; // e.g. "gpt" or "msdos"
QString defaultPartitionTableType; // e.g. "gpt" or "msdos"
QString defaultFsType; // e.g. "ext4" or "btrfs"
QString luksPassphrase; // optional
ReplacePartitionOptions( const QString& pt, const QString& fs, const QString& luks )
: defaultPartitionTableType ( pt )
: defaultPartitionTableType( pt )
, defaultFsType( fs )
, luksPassphrase( luks )
{

@ -618,7 +618,7 @@ PartitionCoreModule::lvmPVs() const
bool
PartitionCoreModule::hasVGwithThisName( const QString& name ) const
{
auto condition = [ name ]( DeviceInfo* d ) {
auto condition = [name]( DeviceInfo* d ) {
return dynamic_cast< LvmDevice* >( d->device.data() ) && d->device.data()->name() == name;
};
@ -628,7 +628,7 @@ PartitionCoreModule::hasVGwithThisName( const QString& name ) const
bool
PartitionCoreModule::isInVG( const Partition* partition ) const
{
auto condition = [ partition ]( DeviceInfo* d ) {
auto condition = [partition]( DeviceInfo* d ) {
LvmDevice* vg = dynamic_cast< LvmDevice* >( d->device.data() );
return vg && vg->physicalVolumes().contains( partition );
};
@ -961,9 +961,9 @@ PartitionCoreModule::layoutApply( Device* dev,
const QString boot = QStringLiteral( "/boot" );
const QString root = QStringLiteral( "/" );
const auto is_boot
= [ & ]( Partition* p ) -> bool { return PartitionInfo::mountPoint( p ) == boot || p->mountPoint() == boot; };
= [&]( Partition* p ) -> bool { return PartitionInfo::mountPoint( p ) == boot || p->mountPoint() == boot; };
const auto is_root
= [ & ]( Partition* p ) -> bool { return PartitionInfo::mountPoint( p ) == root || p->mountPoint() == root; };
= [&]( Partition* p ) -> bool { return PartitionInfo::mountPoint( p ) == root || p->mountPoint() == root; };
const bool separate_boot_partition
= std::find_if( partList.constBegin(), partList.constEnd(), is_boot ) != partList.constEnd();
@ -1078,7 +1078,7 @@ void
PartitionCoreModule::asyncRevertDevice( Device* dev, std::function< void() > callback )
{
QFutureWatcher< void >* watcher = new QFutureWatcher< void >();
connect( watcher, &QFutureWatcher< void >::finished, this, [ watcher, callback ] {
connect( watcher, &QFutureWatcher< void >::finished, this, [watcher, callback] {
callback();
watcher->deleteLater();
} );

@ -150,7 +150,7 @@ ChoicePage::init( PartitionCoreModule* core )
// We need to do this because a PCM revert invalidates the deviceModel.
connect( core, &PartitionCoreModule::reverted, this, [ = ] {
connect( core, &PartitionCoreModule::reverted, this, [=] {
m_drivesCombo->setModel( core->deviceModel() );
m_drivesCombo->setCurrentIndex( m_lastSelectedDeviceIndex );
} );
@ -270,7 +270,7 @@ ChoicePage::setupChoices()
#else
auto buttonSignal = &QButtonGroup::idToggled;
#endif
connect( m_grp, buttonSignal, this, [ this ]( int id, bool checked ) {
connect( m_grp, buttonSignal, this, [this]( int id, bool checked ) {
if ( checked ) // An action was picked.
{
m_config->setInstallChoice( id );
@ -367,11 +367,11 @@ ChoicePage::applyDeviceChoice()
if ( m_core->isDirty() )
{
ScanningDialog::run(
QtConcurrent::run( [ = ] {
QtConcurrent::run( [=] {
QMutexLocker locker( &m_coreMutex );
m_core->revertAllDevices();
} ),
[ this ] { continueApplyDeviceChoice(); },
[this] { continueApplyDeviceChoice(); },
this );
}
else
@ -460,11 +460,11 @@ ChoicePage::applyActionChoice( InstallChoice choice )
if ( m_core->isDirty() )
{
ScanningDialog::run(
QtConcurrent::run( [ = ] {
QtConcurrent::run( [=] {
QMutexLocker locker( &m_coreMutex );
m_core->revertDevice( selectedDevice() );
} ),
[ = ] {
[=] {
PartitionActions::doAutopartition( m_core, selectedDevice(), options );
emit deviceChosen();
},
@ -481,7 +481,7 @@ ChoicePage::applyActionChoice( InstallChoice choice )
if ( m_core->isDirty() )
{
ScanningDialog::run(
QtConcurrent::run( [ = ] {
QtConcurrent::run( [=] {
QMutexLocker locker( &m_coreMutex );
m_core->revertDevice( selectedDevice() );
} ),
@ -501,11 +501,11 @@ ChoicePage::applyActionChoice( InstallChoice choice )
if ( m_core->isDirty() )
{
ScanningDialog::run(
QtConcurrent::run( [ = ] {
QtConcurrent::run( [=] {
QMutexLocker locker( &m_coreMutex );
m_core->revertDevice( selectedDevice() );
} ),
[ this ] {
[this] {
// We need to reupdate after reverting because the splitter widget is
// not a true view.
updateActionChoicePreview( m_config->installChoice() );
@ -743,7 +743,7 @@ ChoicePage::doReplaceSelectedPartition( const QModelIndex& current )
// doReuseHomePartition *after* the device revert, for later use.
ScanningDialog::run(
QtConcurrent::run(
[ this, current ]( QString* homePartitionPath, bool doReuseHomePartition ) {
[this, current]( QString* homePartitionPath, bool doReuseHomePartition ) {
QMutexLocker locker( &m_coreMutex );
if ( m_core->isDirty() )
@ -803,13 +803,12 @@ ChoicePage::doReplaceSelectedPartition( const QModelIndex& current )
Calamares::GlobalStorage* gs = Calamares::JobQueue::instance()->globalStorage();
PartitionActions::doReplacePartition(
m_core,
selectedDevice(),
selectedPartition,
{ gs->value( "defaultPartitionType" ).toString(),
gs->value( "defaultFileSystemType" ).toString(),
m_encryptWidget->passphrase() } );
PartitionActions::doReplacePartition( m_core,
selectedDevice(),
selectedPartition,
{ gs->value( "defaultPartitionType" ).toString(),
gs->value( "defaultFileSystemType" ).toString(),
m_encryptWidget->passphrase() } );
Partition* homePartition = findPartitionByPath( { selectedDevice() }, *homePartitionPath );
if ( homePartition && doReuseHomePartition )
@ -826,7 +825,7 @@ ChoicePage::doReplaceSelectedPartition( const QModelIndex& current )
},
homePartitionPath,
doReuseHomePartition ),
[ = ] {
[=] {
m_reuseHomeCheckBox->setVisible( !homePartitionPath->isEmpty() );
if ( !homePartitionPath->isEmpty() )
m_reuseHomeCheckBox->setText( tr( "Reuse %1 as home partition for %2." )
@ -976,7 +975,7 @@ ChoicePage::updateActionChoicePreview( InstallChoice choice )
connect( m_afterPartitionSplitterWidget,
&PartitionSplitterWidget::partitionResized,
this,
[ this, sizeLabel ]( const QString& path, qint64 size, qint64 sizeNext ) {
[this, sizeLabel]( const QString& path, qint64 size, qint64 sizeNext ) {
Q_UNUSED( path )
sizeLabel->setText(
tr( "%1 will be shrunk to %2MiB and a new "
@ -990,7 +989,7 @@ ChoicePage::updateActionChoicePreview( InstallChoice choice )
m_previewAfterFrame->show();
m_previewAfterLabel->show();
SelectionFilter filter = [ this ]( const QModelIndex& index ) {
SelectionFilter filter = [this]( const QModelIndex& index ) {
return PartUtils::canBeResized(
static_cast< Partition* >( index.data( PartitionModel::PartitionPtrRole ).value< void* >() ) );
};
@ -1038,7 +1037,7 @@ ChoicePage::updateActionChoicePreview( InstallChoice choice )
eraseBootloaderLabel->setText( tr( "Boot loader location:" ) );
m_bootloaderComboBox = createBootloaderComboBox( eraseWidget );
connect( m_core->bootLoaderModel(), &QAbstractItemModel::modelReset, [ this ]() {
connect( m_core->bootLoaderModel(), &QAbstractItemModel::modelReset, [this]() {
if ( !m_bootloaderComboBox.isNull() )
{
Calamares::restoreSelectedBootLoader( *m_bootloaderComboBox, m_core->bootLoaderInstallPath() );
@ -1048,7 +1047,7 @@ ChoicePage::updateActionChoicePreview( InstallChoice choice )
m_core,
&PartitionCoreModule::deviceReverted,
this,
[ this ]( Device* dev ) {
[this]( Device* dev ) {
Q_UNUSED( dev )
if ( !m_bootloaderComboBox.isNull() )
{
@ -1079,7 +1078,7 @@ ChoicePage::updateActionChoicePreview( InstallChoice choice )
}
else
{
SelectionFilter filter = [ this ]( const QModelIndex& index ) {
SelectionFilter filter = [this]( const QModelIndex& index ) {
return PartUtils::canBeReplaced(
static_cast< Partition* >( index.data( PartitionModel::PartitionPtrRole ).value< void* >() ) );
};
@ -1183,7 +1182,7 @@ ChoicePage::createBootloaderComboBox( QWidget* parent )
bcb->setModel( m_core->bootLoaderModel() );
// 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( bcb, QOverload< int >::of( &QComboBox::currentIndexChanged ), this, [this]( int newIndex ) {
QComboBox* bcb = qobject_cast< QComboBox* >( sender() );
if ( bcb )
{
@ -1268,8 +1267,8 @@ ChoicePage::setupActions()
if ( currentDevice->partitionTable() )
{
tableType = currentDevice->partitionTable()->type();
matchTableType = m_requiredPartitionTableType.size() == 0 ||
m_requiredPartitionTableType.contains( PartitionTable::tableTypeToName( tableType ) );
matchTableType = m_requiredPartitionTableType.size() == 0
|| m_requiredPartitionTableType.contains( PartitionTable::tableTypeToName( tableType ) );
}
for ( auto it = PartitionIterator::begin( currentDevice ); it != PartitionIterator::end( currentDevice ); ++it )
@ -1454,9 +1453,10 @@ ChoicePage::setupActions()
m_messageLabel->show();
cWarning() << "Partition table" << PartitionTable::tableTypeToName( tableType )
<< "does not match the requirement " << m_requiredPartitionTableType.join( " or " ) << ", "
<< "does not match the requirement " << m_requiredPartitionTableType.join( " or " )
<< ", "
"ENABLING erease feature and ";
"DISABLING alongside, replace and manual features.";
"DISABLING alongside, replace and manual features.";
m_eraseButton->show();
m_alongsideButton->hide();
m_replaceButton->hide();
@ -1465,20 +1465,22 @@ ChoicePage::setupActions()
force_uncheck( m_grp, m_replaceButton );
}
if ( m_somethingElseButton->isHidden()
&& m_alongsideButton->isHidden()
&& m_replaceButton->isHidden()
if ( m_somethingElseButton->isHidden() && m_alongsideButton->isHidden() && m_replaceButton->isHidden()
&& m_somethingElseButton->isHidden() )
{
if (atLeastOneIsMounted)
if ( atLeastOneIsMounted )
{
m_messageLabel->setText( tr( "This storage device has one of its partitions <strong>mounted</strong>." ) );
else
m_messageLabel->setText( tr( "This storage device is a part of an <strong>inactive RAID</strong> device." ) );
}
else
{
m_messageLabel->setText(
tr( "This storage device is a part of an <strong>inactive RAID</strong> device." ) );
}
m_messageLabel->show();
cWarning() << "No buttons available"
<< "replaced?" << atLeastOneCanBeReplaced
<< "resized?" << atLeastOneCanBeResized
<< "replaced?" << atLeastOneCanBeReplaced << "resized?" << atLeastOneCanBeResized
<< "erased? (not-mounted and not-raid)" << !atLeastOneIsMounted << "and" << !isInactiveRAID;
}
}

@ -64,7 +64,7 @@ EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device,
replacePartResizerWidget();
connect( m_ui->formatRadioButton, &QAbstractButton::toggled, [ this ]( bool doFormat ) {
connect( m_ui->formatRadioButton, &QAbstractButton::toggled, [this]( bool doFormat ) {
replacePartResizerWidget();
m_ui->fileSystemLabel->setEnabled( doFormat );
@ -79,7 +79,7 @@ EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device,
} );
connect(
m_ui->fileSystemComboBox, &QComboBox::currentTextChanged, [ this ]( QString ) { updateMountPointPicker(); } );
m_ui->fileSystemComboBox, &QComboBox::currentTextChanged, [this]( QString ) { updateMountPointPicker(); } );
// File system
QStringList fsNames;

@ -54,7 +54,7 @@ PartitionBarsView::PartitionBarsView( QWidget* parent )
setSelectionMode( QAbstractItemView::SingleSelection );
// Debug
connect( this, &PartitionBarsView::clicked, this, [ = ]( const QModelIndex& index ) {
connect( this, &PartitionBarsView::clicked, this, [=]( const QModelIndex& index ) {
cDebug() << "Clicked row" << index.row();
} );
setMouseTracking( true );
@ -399,7 +399,7 @@ void
PartitionBarsView::setSelectionModel( QItemSelectionModel* selectionModel )
{
QAbstractItemView::setSelectionModel( selectionModel );
connect( selectionModel, &QItemSelectionModel::selectionChanged, this, [ = ] { viewport()->repaint(); } );
connect( selectionModel, &QItemSelectionModel::selectionChanged, this, [=] { viewport()->repaint(); } );
}

@ -520,7 +520,7 @@ void
PartitionLabelsView::setSelectionModel( QItemSelectionModel* selectionModel )
{
QAbstractItemView::setSelectionModel( selectionModel );
connect( selectionModel, &QItemSelectionModel::selectionChanged, this, [ = ] { viewport()->repaint(); } );
connect( selectionModel, &QItemSelectionModel::selectionChanged, this, [=] { viewport()->repaint(); } );
}

@ -438,7 +438,7 @@ void
PartitionPage::onRevertClicked()
{
ScanningDialog::run(
QtConcurrent::run( [ this ] {
QtConcurrent::run( [this] {
QMutexLocker locker( &m_revertMutex );
int oldIndex = m_ui->deviceComboBox->currentIndex();
@ -446,7 +446,7 @@ PartitionPage::onRevertClicked()
m_ui->deviceComboBox->setCurrentIndex( ( oldIndex < 0 ) ? 0 : oldIndex );
updateFromCurrentDevice();
} ),
[ this ] {
[this] {
m_lastSelectedBootLoaderIndex = -1;
if ( m_ui->bootLoaderComboBox->currentIndex() < 0 )
{
@ -594,7 +594,7 @@ PartitionPage::updateFromCurrentDevice()
m_ui->partitionBarsView->selectionModel(),
&QItemSelectionModel::currentChanged,
this,
[ = ] {
[=] {
QModelIndex selectedIndex = m_ui->partitionBarsView->selectionModel()->currentIndex();
selectedIndex = selectedIndex.sibling( selectedIndex.row(), 0 );
m_ui->partitionBarsView->setCurrentIndex( selectedIndex );
@ -613,7 +613,7 @@ PartitionPage::updateFromCurrentDevice()
// model changes
connect( m_ui->partitionTreeView->selectionModel(),
&QItemSelectionModel::currentChanged,
[ this ]( const QModelIndex&, const QModelIndex& ) { updateButtons(); } );
[this]( const QModelIndex&, const QModelIndex& ) { updateButtons(); } );
connect( model, &QAbstractItemModel::modelReset, this, &PartitionPage::onPartitionModelReset );
}

@ -159,7 +159,7 @@ PartitionSplitterWidget::setSplitPartition( const QString& path, qint64 minSize,
m_itemToResizePath.clear();
}
PartitionSplitterItem itemToResize = _findItem( m_items, [ path ]( PartitionSplitterItem& item ) -> bool {
PartitionSplitterItem itemToResize = _findItem( m_items, [path]( PartitionSplitterItem& item ) -> bool {
if ( path == item.itemPath )
{
item.status = PartitionSplitterItem::Resizing;
@ -184,7 +184,7 @@ PartitionSplitterWidget::setSplitPartition( const QString& path, qint64 minSize,
qint64 newSize = m_itemToResize.size - preferredSize;
m_itemToResize.size = preferredSize;
int opCount = _eachItem( m_items, [ preferredSize ]( PartitionSplitterItem& item ) -> bool {
int opCount = _eachItem( m_items, [preferredSize]( PartitionSplitterItem& item ) -> bool {
if ( item.status == PartitionSplitterItem::Resizing )
{
item.size = preferredSize;
@ -358,7 +358,7 @@ PartitionSplitterWidget::mouseMoveEvent( QMouseEvent* event )
m_itemToResize.size = qRound64( span * percent );
m_itemToResizeNext.size -= m_itemToResize.size - oldsize;
_eachItem( m_items, [ this ]( PartitionSplitterItem& item ) -> bool {
_eachItem( m_items, [this]( PartitionSplitterItem& item ) -> bool {
if ( item.status == PartitionSplitterItem::Resizing )
{
item.size = m_itemToResize.size;

@ -586,7 +586,7 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
// because it could take a while. Then when it's done, we can set up the widgets
// and remove the spinner.
m_future = new QFutureWatcher< void >();
connect( m_future, &QFutureWatcher< void >::finished, this, [ this ] {
connect( m_future, &QFutureWatcher< void >::finished, this, [this] {
continueLoading();
this->m_future->deleteLater();
this->m_future = nullptr;

@ -46,7 +46,7 @@ ReplaceWidget::ReplaceWidget( PartitionCoreModule* core, QComboBox* devicesCombo
m_ui->bootStatusLabel->clear();
updateFromCurrentDevice( devicesComboBox );
connect( devicesComboBox, &QComboBox::currentTextChanged, this, [ = ]( const QString& /* text */ ) {
connect( devicesComboBox, &QComboBox::currentTextChanged, this, [=]( const QString& /* text */ ) {
updateFromCurrentDevice( devicesComboBox );
} );
@ -84,9 +84,12 @@ ReplaceWidget::applyChanges()
{
Device* dev = model->device();
PartitionActions::doReplacePartition(
m_core, dev, partition, { gs->value( "defaultPartitionTableType" ).toString(),
gs->value( "defaultFileSystemType" ).toString(), QString() } );
PartitionActions::doReplacePartition( m_core,
dev,
partition,
{ gs->value( "defaultPartitionTableType" ).toString(),
gs->value( "defaultFileSystemType" ).toString(),
QString() } );
if ( m_isEfi )
{

@ -47,7 +47,7 @@ ScanningDialog::run( const QFuture< void >& future,
theDialog->show();
QFutureWatcher< void >* watcher = new QFutureWatcher< void >();
connect( watcher, &QFutureWatcher< void >::finished, theDialog, [ watcher, theDialog, callback ] {
connect( watcher, &QFutureWatcher< void >::finished, theDialog, [watcher, theDialog, callback] {
watcher->deleteLater();
theDialog->hide();
theDialog->deleteLater();

@ -46,17 +46,17 @@ VolumeGroupBaseDialog::VolumeGroupBaseDialog( QString& vgName, QVector< const Pa
updateOkButton();
updateTotalSize();
connect( ui->pvList, &QListWidget::itemChanged, this, [ & ]( QListWidgetItem* ) {
connect( ui->pvList, &QListWidget::itemChanged, this, [&]( QListWidgetItem* ) {
updateTotalSize();
updateOkButton();
} );
connect( ui->peSize, qOverload< int >( &QSpinBox::valueChanged ), this, [ & ]( int ) {
connect( ui->peSize, qOverload< int >( &QSpinBox::valueChanged ), this, [&]( int ) {
updateTotalSectors();
updateOkButton();
} );
connect( ui->vgName, &QLineEdit::textChanged, this, [ & ]( const QString& ) { updateOkButton(); } );
connect( ui->vgName, &QLineEdit::textChanged, this, [&]( const QString& ) { updateOkButton(); } );
}
VolumeGroupBaseDialog::~VolumeGroupBaseDialog()

@ -11,9 +11,9 @@
#include "core/PartitionLayout.h"
#include "utils/Logger.h"
#include "partition/KPMManager.h"
#include "JobQueue.h"
#include "partition/KPMManager.h"
#include "utils/Logger.h"
#include <core/lvmdevice.h>
#include <core/partition.h>
@ -57,72 +57,72 @@ void
CreateLayoutsTests::testFixedSizePartition()
{
PartitionLayout layout = PartitionLayout();
TestDevice dev( QString( "test" ), LOGICAL_SIZE, 5_GiB/LOGICAL_SIZE );
TestDevice dev( QString( "test" ), LOGICAL_SIZE, 5_GiB / LOGICAL_SIZE );
PartitionRole role( PartitionRole::Role::Any );
QList< Partition* > partitions;
if (!layout.addEntry( QString( "/" ), QString( "5MiB" ) ))
if ( !layout.addEntry( QString( "/" ), QString( "5MiB" ) ) )
{
QFAIL( qPrintable( "Unable to create / partition" ) );
}
partitions = layout.execute( static_cast<Device *>(&dev), 0, dev.totalLogical(), nullptr, nullptr, role );
partitions = layout.execute( static_cast< Device* >( &dev ), 0, dev.totalLogical(), nullptr, nullptr, role );
QCOMPARE( partitions.count(), 1 );
QCOMPARE( partitions[0]->length(), 5_MiB/LOGICAL_SIZE );
QCOMPARE( partitions[ 0 ]->length(), 5_MiB / LOGICAL_SIZE );
}
void
CreateLayoutsTests::testPercentSizePartition()
{
PartitionLayout layout = PartitionLayout();
TestDevice dev( QString( "test" ), LOGICAL_SIZE, 5_GiB/LOGICAL_SIZE );
TestDevice dev( QString( "test" ), LOGICAL_SIZE, 5_GiB / LOGICAL_SIZE );
PartitionRole role( PartitionRole::Role::Any );
QList< Partition* > partitions;
if (!layout.addEntry( QString( "/" ), QString( "50%" ) ))
if ( !layout.addEntry( QString( "/" ), QString( "50%" ) ) )
{
QFAIL( qPrintable( "Unable to create / partition" ) );
}
partitions = layout.execute( static_cast<Device *>(&dev), 0, dev.totalLogical(), nullptr, nullptr, role );
partitions = layout.execute( static_cast< Device* >( &dev ), 0, dev.totalLogical(), nullptr, nullptr, role );
QCOMPARE( partitions.count(), 1 );
QCOMPARE( partitions[0]->length(), (5_GiB/2)/LOGICAL_SIZE );
QCOMPARE( partitions[ 0 ]->length(), ( 5_GiB / 2 ) / LOGICAL_SIZE );
}
void
CreateLayoutsTests::testMixedSizePartition()
{
PartitionLayout layout = PartitionLayout();
TestDevice dev( QString( "test" ), LOGICAL_SIZE, 5_GiB/LOGICAL_SIZE );
TestDevice dev( QString( "test" ), LOGICAL_SIZE, 5_GiB / LOGICAL_SIZE );
PartitionRole role( PartitionRole::Role::Any );
QList< Partition* > partitions;
if (!layout.addEntry( QString( "/" ), QString( "5MiB" ) ))
if ( !layout.addEntry( QString( "/" ), QString( "5MiB" ) ) )
{
QFAIL( qPrintable( "Unable to create / partition" ) );
}
if (!layout.addEntry( QString( "/home" ), QString( "50%" ) ))
if ( !layout.addEntry( QString( "/home" ), QString( "50%" ) ) )
{
QFAIL( qPrintable( "Unable to create /home partition" ) );
}
if (!layout.addEntry( QString( "/bkup" ), QString( "50%" ) ))
if ( !layout.addEntry( QString( "/bkup" ), QString( "50%" ) ) )
{
QFAIL( qPrintable( "Unable to create /bkup partition" ) );
}
partitions = layout.execute( static_cast<Device *>(&dev), 0, dev.totalLogical(), nullptr, nullptr, role );
partitions = layout.execute( static_cast< Device* >( &dev ), 0, dev.totalLogical(), nullptr, nullptr, role );
QCOMPARE( partitions.count(), 3 );
QCOMPARE( partitions[0]->length(), 5_MiB/LOGICAL_SIZE );
QCOMPARE( partitions[1]->length(), ((5_GiB - 5_MiB)/2)/LOGICAL_SIZE );
QCOMPARE( partitions[2]->length(), ((5_GiB - 5_MiB)/2)/LOGICAL_SIZE );
QCOMPARE( partitions[ 0 ]->length(), 5_MiB / LOGICAL_SIZE );
QCOMPARE( partitions[ 1 ]->length(), ( ( 5_GiB - 5_MiB ) / 2 ) / LOGICAL_SIZE );
QCOMPARE( partitions[ 2 ]->length(), ( ( 5_GiB - 5_MiB ) / 2 ) / LOGICAL_SIZE );
}
#ifdef WITH_KPMCORE4API
@ -132,21 +132,27 @@ class DevicePrivate
public:
QString m_Name;
QString m_DeviceNode;
qint64 m_LogicalSectorSize;
qint64 m_TotalLogical;
qint64 m_LogicalSectorSize;
qint64 m_TotalLogical;
PartitionTable* m_PartitionTable;
QString m_IconName;
std::shared_ptr<SmartStatus> m_SmartStatus;
std::shared_ptr< SmartStatus > m_SmartStatus;
Device::Type m_Type;
};
TestDevice::TestDevice(const QString& name, const qint64 logicalSectorSize, const qint64 totalLogicalSectors)
: Device (std::make_shared<DevicePrivate>(), name, QString( "node" ), logicalSectorSize, totalLogicalSectors, QString(), Device::Type::Unknown_Device)
TestDevice::TestDevice( const QString& name, const qint64 logicalSectorSize, const qint64 totalLogicalSectors )
: Device( std::make_shared< DevicePrivate >(),
name,
QString( "node" ),
logicalSectorSize,
totalLogicalSectors,
QString(),
Device::Type::Unknown_Device )
{
}
#else
TestDevice::TestDevice(const QString& name, const qint64 logicalSectorSize, const qint64 totalLogicalSectors)
: Device (name, QString( "node" ), logicalSectorSize, totalLogicalSectors, QString(), Device::Type::Unknown_Device)
TestDevice::TestDevice( const QString& name, const qint64 logicalSectorSize, const qint64 totalLogicalSectors )
: Device( name, QString( "node" ), logicalSectorSize, totalLogicalSectors, QString(), Device::Type::Unknown_Device )
{
}
#endif

@ -30,7 +30,7 @@ private Q_SLOTS:
class TestDevice : public Device
{
public:
TestDevice(const QString& name, const qint64 logicalSectorSize, const qint64 totalLogicalSectors);
TestDevice( const QString& name, const qint64 logicalSectorSize, const qint64 totalLogicalSectors );
};
#endif

@ -21,16 +21,16 @@
#include <QVariantMap>
#ifdef WEBVIEW_WITH_WEBKIT
# define C_QWEBVIEW QWebView
#define C_QWEBVIEW QWebView
#endif
#ifdef WEBVIEW_WITH_WEBENGINE
# ifdef C_QWEBVIEW
# error Both WEBENGINE and WEBKIT enabled
# endif
# define C_QWEBVIEW QWebEngineView
#ifdef C_QWEBVIEW
#error Both WEBENGINE and WEBKIT enabled
#endif
#define C_QWEBVIEW QWebEngineView
#endif
#ifndef C_QWEBVIEW
# error Neither WEBENGINE nor WEBKIT enabled
#error Neither WEBENGINE nor WEBKIT enabled
#endif
class C_QWEBVIEW;

Loading…
Cancel
Save