From cf913b87fff4b32777d4ac74f7d4aeafa7de9179 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Tue, 1 Feb 2022 16:03:49 +0100 Subject: [PATCH] [partition] Apply coding style This applies the new(er) style to the whole module, rather than just the files that recently changed. --- src/modules/partition/PartitionViewStep.cpp | 14 +- src/modules/partition/core/DeviceModel.cpp | 6 +- .../partition/core/PartitionCoreModule.cpp | 32 ++-- .../partition/core/PartitionLayout.cpp | 2 +- src/modules/partition/core/SizeUtils.h | 3 +- src/modules/partition/gui/ChoicePage.cpp | 162 +++++++++++------- .../partition/gui/CreatePartitionDialog.cpp | 5 +- .../gui/EditExistingPartitionDialog.cpp | 30 ++-- src/modules/partition/gui/EncryptWidget.cpp | 5 +- .../partition/gui/PartitionBarsView.cpp | 12 +- .../partition/gui/PartitionDialogHelpers.cpp | 3 +- .../partition/gui/PartitionLabelsView.cpp | 2 +- src/modules/partition/gui/PartitionPage.cpp | 24 +-- .../partition/gui/PartitionSplitterWidget.cpp | 64 +++---- src/modules/partition/gui/ReplaceWidget.cpp | 7 +- src/modules/partition/gui/ScanningDialog.cpp | 16 +- .../partition/gui/VolumeGroupBaseDialog.cpp | 26 ++- .../partition/jobs/AutoMountManagementJob.cpp | 4 +- src/modules/partition/jobs/ClearMountsJob.cpp | 8 +- .../partition/tests/AutoMountTests.cpp | 4 +- .../partition/tests/ClearMountsJobTests.cpp | 8 +- 21 files changed, 258 insertions(+), 179 deletions(-) diff --git a/src/modules/partition/PartitionViewStep.cpp b/src/modules/partition/PartitionViewStep.cpp index 18f10d629..5e8bf2ef0 100644 --- a/src/modules/partition/PartitionViewStep.cpp +++ b/src/modules/partition/PartitionViewStep.cpp @@ -675,11 +675,15 @@ 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] { - continueLoading(); - this->m_future->deleteLater(); - this->m_future = nullptr; - } ); + connect( m_future, + &QFutureWatcher< void >::finished, + this, + [ this ] + { + continueLoading(); + this->m_future->deleteLater(); + this->m_future = nullptr; + } ); QFuture< void > future = QtConcurrent::run( this, &PartitionViewStep::initPartitionCoreModule ); m_future->setFuture( future ); diff --git a/src/modules/partition/core/DeviceModel.cpp b/src/modules/partition/core/DeviceModel.cpp index 25bdbff6c..6959ac9c2 100644 --- a/src/modules/partition/core/DeviceModel.cpp +++ b/src/modules/partition/core/DeviceModel.cpp @@ -28,9 +28,9 @@ static void sortDevices( DeviceModel::DeviceList& l ) { - std::sort( l.begin(), l.end(), []( const Device* dev1, const Device* dev2 ) { - return dev1->deviceNode() < dev2->deviceNode(); - } ); + std::sort( l.begin(), + l.end(), + []( const Device* dev1, const Device* dev2 ) { return dev1->deviceNode() < dev2->deviceNode(); } ); } DeviceModel::DeviceModel( QObject* parent ) diff --git a/src/modules/partition/core/PartitionCoreModule.cpp b/src/modules/partition/core/PartitionCoreModule.cpp index 16e5a7ea1..989327ef0 100644 --- a/src/modules/partition/core/PartitionCoreModule.cpp +++ b/src/modules/partition/core/PartitionCoreModule.cpp @@ -262,11 +262,9 @@ PartitionCoreModule::doInit() // Gives ownership of the Device* to the DeviceInfo object auto deviceInfo = new DeviceInfo( device ); m_deviceInfos << deviceInfo; - cDebug() << Logger::SubEntry - << device->deviceNode() - << device->capacity() - << Logger::RedactedName( "DevName", device->name() ) - << Logger::RedactedName( "DevNamePretty", device->prettyName() ); + cDebug() << Logger::SubEntry << device->deviceNode() << device->capacity() + << Logger::RedactedName( "DevName", device->name() ) + << Logger::RedactedName( "DevNamePretty", device->prettyName() ); } else { @@ -685,9 +683,8 @@ PartitionCoreModule::lvmPVs() const bool PartitionCoreModule::hasVGwithThisName( const QString& name ) const { - auto condition = [name]( DeviceInfo* d ) { - return dynamic_cast< LvmDevice* >( d->device.data() ) && d->device.data()->name() == name; - }; + auto condition = [ name ]( DeviceInfo* d ) + { return dynamic_cast< LvmDevice* >( d->device.data() ) && d->device.data()->name() == name; }; return std::find_if( m_deviceInfos.begin(), m_deviceInfos.end(), condition ) != m_deviceInfos.end(); } @@ -695,7 +692,8 @@ 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 ); }; @@ -964,9 +962,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(); @@ -1089,10 +1087,14 @@ void PartitionCoreModule::asyncRevertDevice( Device* dev, std::function< void() > callback ) { QFutureWatcher< void >* watcher = new QFutureWatcher< void >(); - connect( watcher, &QFutureWatcher< void >::finished, this, [watcher, callback] { - callback(); - watcher->deleteLater(); - } ); + connect( watcher, + &QFutureWatcher< void >::finished, + this, + [ watcher, callback ] + { + callback(); + watcher->deleteLater(); + } ); QFuture< void > future = QtConcurrent::run( this, &PartitionCoreModule::revertDevice, dev, true ); watcher->setFuture( future ); diff --git a/src/modules/partition/core/PartitionLayout.cpp b/src/modules/partition/core/PartitionLayout.cpp index 3813207ef..765d9fffa 100644 --- a/src/modules/partition/core/PartitionLayout.cpp +++ b/src/modules/partition/core/PartitionLayout.cpp @@ -283,7 +283,7 @@ PartitionLayout::createPartitions( Device* dev, } } - auto correctFS = [d = m_defaultFsType]( FileSystem::Type t ) { return t == FileSystem::Type::Unknown ? d : t; }; + auto correctFS = [ d = m_defaultFsType ]( FileSystem::Type t ) { return t == FileSystem::Type::Unknown ? d : t; }; // Create the partitions. currentSector = firstSector; diff --git a/src/modules/partition/core/SizeUtils.h b/src/modules/partition/core/SizeUtils.h index d474656c9..155cbd923 100644 --- a/src/modules/partition/core/SizeUtils.h +++ b/src/modules/partition/core/SizeUtils.h @@ -19,7 +19,8 @@ * to bother with one-byte accuracy (and anyway, a double has at least 50 bits * at which point we're printing giga (or gibi) bytes). */ -static inline QString formatByteSize( qint64 sizeValue ) +static inline QString +formatByteSize( qint64 sizeValue ) { return Capacity::formatByteSize( static_cast< double >( sizeValue ) ); } diff --git a/src/modules/partition/gui/ChoicePage.cpp b/src/modules/partition/gui/ChoicePage.cpp index 9226eb3b6..588c1b643 100644 --- a/src/modules/partition/gui/ChoicePage.cpp +++ b/src/modules/partition/gui/ChoicePage.cpp @@ -176,10 +176,14 @@ ChoicePage::init( PartitionCoreModule* core ) // We need to do this because a PCM revert invalidates the deviceModel. - connect( core, &PartitionCoreModule::reverted, this, [=] { - setModelToComboBox( m_drivesCombo, core->deviceModel() ); - m_drivesCombo->setCurrentIndex( m_lastSelectedDeviceIndex ); - } ); + connect( core, + &PartitionCoreModule::reverted, + this, + [ = ] + { + setModelToComboBox( m_drivesCombo, core->deviceModel() ); + m_drivesCombo->setCurrentIndex( m_lastSelectedDeviceIndex ); + } ); setModelToComboBox( m_drivesCombo, core->deviceModel() ); connect( m_drivesCombo, qOverload< int >( &QComboBox::currentIndexChanged ), this, &ChoicePage::applyDeviceChoice ); @@ -303,26 +307,30 @@ ChoicePage::setupChoices() #else auto buttonSignal = &QButtonGroup::idToggled; #endif - connect( m_grp, buttonSignal, this, [this]( int id, bool checked ) { - if ( checked ) // An action was picked. - { - m_config->setInstallChoice( id ); - updateNextEnabled(); + connect( m_grp, + buttonSignal, + this, + [ this ]( int id, bool checked ) + { + if ( checked ) // An action was picked. + { + m_config->setInstallChoice( id ); + updateNextEnabled(); - Q_EMIT actionChosen(); - } - else // An action was unpicked, either on its own or because of another selection. - { - if ( m_grp->checkedButton() == nullptr ) // If no other action is chosen, we must - { - // set m_choice to NoChoice and reset previews. - m_config->setInstallChoice( InstallChoice::NoChoice ); - updateNextEnabled(); + Q_EMIT actionChosen(); + } + else // An action was unpicked, either on its own or because of another selection. + { + if ( m_grp->checkedButton() == nullptr ) // If no other action is chosen, we must + { + // set m_choice to NoChoice and reset previews. + m_config->setInstallChoice( InstallChoice::NoChoice ); + updateNextEnabled(); - Q_EMIT actionChosen(); - } - } - } ); + Q_EMIT actionChosen(); + } + } + } ); m_rightLayout->setStretchFactor( m_itemsLayout, 1 ); m_rightLayout->setStretchFactor( m_previewBeforeFrame, 0 ); @@ -401,11 +409,13 @@ ChoicePage::applyDeviceChoice() if ( m_core->isDirty() ) { ScanningDialog::run( - QtConcurrent::run( [=] { - QMutexLocker locker( &m_coreMutex ); - m_core->revertAllDevices(); - } ), - [this] { continueApplyDeviceChoice(); }, + QtConcurrent::run( + [ = ] + { + QMutexLocker locker( &m_coreMutex ); + m_core->revertAllDevices(); + } ), + [ this ] { continueApplyDeviceChoice(); }, this ); } else @@ -493,11 +503,14 @@ ChoicePage::applyActionChoice( InstallChoice choice ) if ( m_core->isDirty() ) { ScanningDialog::run( - QtConcurrent::run( [=] { - QMutexLocker locker( &m_coreMutex ); - m_core->revertDevice( selectedDevice() ); - } ), - [=] { + QtConcurrent::run( + [ = ] + { + QMutexLocker locker( &m_coreMutex ); + m_core->revertDevice( selectedDevice() ); + } ), + [ = ] + { PartitionActions::doAutopartition( m_core, selectedDevice(), options ); Q_EMIT deviceChosen(); }, @@ -514,10 +527,12 @@ ChoicePage::applyActionChoice( InstallChoice choice ) if ( m_core->isDirty() ) { ScanningDialog::run( - QtConcurrent::run( [=] { - QMutexLocker locker( &m_coreMutex ); - m_core->revertDevice( selectedDevice() ); - } ), + QtConcurrent::run( + [ = ] + { + QMutexLocker locker( &m_coreMutex ); + m_core->revertDevice( selectedDevice() ); + } ), [] {}, this ); } @@ -532,11 +547,14 @@ ChoicePage::applyActionChoice( InstallChoice choice ) if ( m_core->isDirty() ) { ScanningDialog::run( - QtConcurrent::run( [=] { - QMutexLocker locker( &m_coreMutex ); - m_core->revertDevice( selectedDevice() ); - } ), - [this] { + QtConcurrent::run( + [ = ] + { + QMutexLocker locker( &m_coreMutex ); + m_core->revertDevice( selectedDevice() ); + } ), + [ this ] + { // We need to reupdate after reverting because the splitter widget is // not a true view. updateActionChoicePreview( m_config->installChoice() ); @@ -772,7 +790,8 @@ ChoicePage::doReplaceSelectedPartition( const QModelIndex& current ) ScanningDialog::run( QtConcurrent::run( - [this, current, homePartitionPath]( bool doReuseHomePartition ) { + [ this, current, homePartitionPath ]( bool doReuseHomePartition ) + { QMutexLocker locker( &m_coreMutex ); if ( m_core->isDirty() ) @@ -853,7 +872,8 @@ ChoicePage::doReplaceSelectedPartition( const QModelIndex& current ) } }, m_reuseHomeCheckBox->isChecked() ), - [this, homePartitionPath] { + [ this, homePartitionPath ] + { m_reuseHomeCheckBox->setVisible( !homePartitionPath->isEmpty() ); if ( !homePartitionPath->isEmpty() ) m_reuseHomeCheckBox->setText( tr( "Reuse %1 as home partition for %2." ) @@ -1006,7 +1026,8 @@ 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 " @@ -1020,7 +1041,8 @@ ChoicePage::updateActionChoicePreview( InstallChoice choice ) m_previewAfterFrame->show(); m_previewAfterLabel->show(); - SelectionFilter filter = []( const QModelIndex& index ) { + SelectionFilter filter = []( const QModelIndex& index ) + { return PartUtils::canBeResized( static_cast< Partition* >( index.data( PartitionModel::PartitionPtrRole ).value< void* >() ), Logger::Once() ); @@ -1069,17 +1091,22 @@ ChoicePage::updateActionChoicePreview( InstallChoice choice ) eraseBootloaderLabel->setText( tr( "Boot loader location:" ) ); m_bootloaderComboBox = createBootloaderComboBox( eraseWidget ); - connect( m_core->bootLoaderModel(), &QAbstractItemModel::modelReset, [this]() { - if ( !m_bootloaderComboBox.isNull() ) - { - Calamares::restoreSelectedBootLoader( *m_bootloaderComboBox, m_core->bootLoaderInstallPath() ); - } - } ); + connect( m_core->bootLoaderModel(), + &QAbstractItemModel::modelReset, + [ this ]() + { + if ( !m_bootloaderComboBox.isNull() ) + { + Calamares::restoreSelectedBootLoader( *m_bootloaderComboBox, + m_core->bootLoaderInstallPath() ); + } + } ); connect( m_core, &PartitionCoreModule::deviceReverted, this, - [this]( Device* dev ) { + [ this ]( Device* dev ) + { Q_UNUSED( dev ) if ( !m_bootloaderComboBox.isNull() ) { @@ -1110,7 +1137,8 @@ ChoicePage::updateActionChoicePreview( InstallChoice choice ) } else { - SelectionFilter filter = []( const QModelIndex& index ) { + SelectionFilter filter = []( const QModelIndex& index ) + { return PartUtils::canBeReplaced( static_cast< Partition* >( index.data( PartitionModel::PartitionPtrRole ).value< void* >() ), Logger::Once() ); @@ -1217,18 +1245,22 @@ ChoicePage::createBootloaderComboBox( QWidget* parent ) comboForBootloader->setModel( m_core->bootLoaderModel() ); // When the chosen bootloader device changes, we update the choice in the PCM - connect( comboForBootloader, QOverload< int >::of( &QComboBox::currentIndexChanged ), this, [this]( int newIndex ) { - QComboBox* bootloaderCombo = qobject_cast< QComboBox* >( sender() ); - if ( bootloaderCombo ) - { - QVariant var = bootloaderCombo->itemData( newIndex, BootLoaderModel::BootLoaderPathRole ); - if ( !var.isValid() ) - { - return; - } - m_core->setBootLoaderInstallPath( var.toString() ); - } - } ); + connect( comboForBootloader, + QOverload< int >::of( &QComboBox::currentIndexChanged ), + this, + [ this ]( int newIndex ) + { + QComboBox* bootloaderCombo = qobject_cast< QComboBox* >( sender() ); + if ( bootloaderCombo ) + { + QVariant var = bootloaderCombo->itemData( newIndex, BootLoaderModel::BootLoaderPathRole ); + if ( !var.isValid() ) + { + return; + } + m_core->setBootLoaderInstallPath( var.toString() ); + } + } ); return comboForBootloader; } diff --git a/src/modules/partition/gui/CreatePartitionDialog.cpp b/src/modules/partition/gui/CreatePartitionDialog.cpp index 8a82d2901..c5b17c69e 100644 --- a/src/modules/partition/gui/CreatePartitionDialog.cpp +++ b/src/modules/partition/gui/CreatePartitionDialog.cpp @@ -325,7 +325,10 @@ CreatePartitionDialog::updateMountPointUi() void CreatePartitionDialog::checkMountPointSelection() { - validateMountPoint( selectedMountPoint( m_ui->mountPointComboBox ), m_usedMountPoints, m_ui->mountPointExplanation, m_ui->buttonBox->button( QDialogButtonBox::Ok )); + validateMountPoint( selectedMountPoint( m_ui->mountPointComboBox ), + m_usedMountPoints, + m_ui->mountPointExplanation, + m_ui->buttonBox->button( QDialogButtonBox::Ok ) ); } void diff --git a/src/modules/partition/gui/EditExistingPartitionDialog.cpp b/src/modules/partition/gui/EditExistingPartitionDialog.cpp index 1568572f4..0bc35cabe 100644 --- a/src/modules/partition/gui/EditExistingPartitionDialog.cpp +++ b/src/modules/partition/gui/EditExistingPartitionDialog.cpp @@ -69,22 +69,25 @@ EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device, replacePartResizerWidget(); - connect( m_ui->formatRadioButton, &QAbstractButton::toggled, [this]( bool doFormat ) { - replacePartResizerWidget(); + connect( m_ui->formatRadioButton, + &QAbstractButton::toggled, + [ this ]( bool doFormat ) + { + replacePartResizerWidget(); - m_ui->fileSystemLabel->setEnabled( doFormat ); - m_ui->fileSystemComboBox->setEnabled( doFormat ); + m_ui->fileSystemLabel->setEnabled( doFormat ); + m_ui->fileSystemComboBox->setEnabled( doFormat ); - if ( !doFormat ) - { - m_ui->fileSystemComboBox->setCurrentText( userVisibleFS( m_partition->fileSystem() ) ); - } + if ( !doFormat ) + { + m_ui->fileSystemComboBox->setCurrentText( userVisibleFS( m_partition->fileSystem() ) ); + } - updateMountPointPicker(); - } ); + updateMountPointPicker(); + } ); connect( - m_ui->fileSystemComboBox, &QComboBox::currentTextChanged, [this]( QString ) { updateMountPointPicker(); } ); + m_ui->fileSystemComboBox, &QComboBox::currentTextChanged, [ this ]( QString ) { updateMountPointPicker(); } ); // File system QStringList fsNames; @@ -295,5 +298,8 @@ EditExistingPartitionDialog::updateMountPointPicker() void EditExistingPartitionDialog::checkMountPointSelection() { - validateMountPoint( selectedMountPoint( m_ui->mountPointComboBox ), m_usedMountPoints, m_ui->mountPointExplanation, m_ui->buttonBox->button( QDialogButtonBox::Ok )); + validateMountPoint( selectedMountPoint( m_ui->mountPointComboBox ), + m_usedMountPoints, + m_ui->mountPointExplanation, + m_ui->buttonBox->button( QDialogButtonBox::Ok ) ); } diff --git a/src/modules/partition/gui/EncryptWidget.cpp b/src/modules/partition/gui/EncryptWidget.cpp index e62ae512e..fe7623050 100644 --- a/src/modules/partition/gui/EncryptWidget.cpp +++ b/src/modules/partition/gui/EncryptWidget.cpp @@ -28,7 +28,8 @@ * Since we don't have an oracle that can answer that question, * just pretend every system can do it. */ -static inline bool systemSupportsEncryptionAcceptably() +static inline bool +systemSupportsEncryptionAcceptably() { return true; } @@ -53,7 +54,7 @@ EncryptWidget::EncryptWidget( QWidget* parent ) else { // This is really ugly, but the character is unicode "unlocked" - m_ui->m_encryptionUnsupportedLabel->setText( QStringLiteral("🔓") ); + m_ui->m_encryptionUnsupportedLabel->setText( QStringLiteral( "🔓" ) ); m_ui->m_encryptionUnsupportedLabel->show(); } diff --git a/src/modules/partition/gui/PartitionBarsView.cpp b/src/modules/partition/gui/PartitionBarsView.cpp index 81f518acc..305184b13 100644 --- a/src/modules/partition/gui/PartitionBarsView.cpp +++ b/src/modules/partition/gui/PartitionBarsView.cpp @@ -54,9 +54,10 @@ PartitionBarsView::PartitionBarsView( QWidget* parent ) setSelectionMode( QAbstractItemView::SingleSelection ); // Debug - connect( this, &PartitionBarsView::clicked, this, [=]( const QModelIndex& index ) { - cDebug() << "Clicked row" << index.row(); - } ); + connect( this, + &PartitionBarsView::clicked, + this, + [ = ]( const QModelIndex& index ) { cDebug() << "Clicked row" << index.row(); } ); setMouseTracking( true ); } @@ -399,7 +400,7 @@ void PartitionBarsView::setSelectionModel( QItemSelectionModel* selectionModel ) { QAbstractItemView::setSelectionModel( selectionModel ); - connect( selectionModel, &QItemSelectionModel::selectionChanged, this, [=] { viewport()->repaint(); } ); + connect( selectionModel, &QItemSelectionModel::selectionChanged, this, [ = ] { viewport()->repaint(); } ); } @@ -410,7 +411,8 @@ PartitionBarsView::setSelectionFilter( std::function< bool( const QModelIndex& ) } -QModelIndex PartitionBarsView::moveCursor( CursorAction, Qt::KeyboardModifiers ) +QModelIndex +PartitionBarsView::moveCursor( CursorAction, Qt::KeyboardModifiers ) { return QModelIndex(); } diff --git a/src/modules/partition/gui/PartitionDialogHelpers.cpp b/src/modules/partition/gui/PartitionDialogHelpers.cpp index 46b26bc2d..1ba110338 100644 --- a/src/modules/partition/gui/PartitionDialogHelpers.cpp +++ b/src/modules/partition/gui/PartitionDialogHelpers.cpp @@ -80,7 +80,8 @@ setSelectedMountPoint( QComboBox& combo, const QString& selected ) } } -bool validateMountPoint( const QString& mountPoint, const QStringList& inUse, QLabel* label, QPushButton* button ) +bool +validateMountPoint( const QString& mountPoint, const QStringList& inUse, QLabel* label, QPushButton* button ) { QString msg; bool ok = true; diff --git a/src/modules/partition/gui/PartitionLabelsView.cpp b/src/modules/partition/gui/PartitionLabelsView.cpp index e73d7f4af..e3a50c576 100644 --- a/src/modules/partition/gui/PartitionLabelsView.cpp +++ b/src/modules/partition/gui/PartitionLabelsView.cpp @@ -519,7 +519,7 @@ void PartitionLabelsView::setSelectionModel( QItemSelectionModel* selectionModel ) { QAbstractItemView::setSelectionModel( selectionModel ); - connect( selectionModel, &QItemSelectionModel::selectionChanged, this, [=] { viewport()->repaint(); } ); + connect( selectionModel, &QItemSelectionModel::selectionChanged, this, [ = ] { viewport()->repaint(); } ); } diff --git a/src/modules/partition/gui/PartitionPage.cpp b/src/modules/partition/gui/PartitionPage.cpp index 9d7a2f0d7..0b3cf2478 100644 --- a/src/modules/partition/gui/PartitionPage.cpp +++ b/src/modules/partition/gui/PartitionPage.cpp @@ -451,15 +451,18 @@ void PartitionPage::onRevertClicked() { ScanningDialog::run( - QtConcurrent::run( [this] { - QMutexLocker locker( &m_revertMutex ); + QtConcurrent::run( + [ this ] + { + QMutexLocker locker( &m_revertMutex ); - int oldIndex = m_ui->deviceComboBox->currentIndex(); - m_core->revertAllDevices(); - m_ui->deviceComboBox->setCurrentIndex( ( oldIndex < 0 ) ? 0 : oldIndex ); - updateFromCurrentDevice(); - } ), - [this] { + int oldIndex = m_ui->deviceComboBox->currentIndex(); + m_core->revertAllDevices(); + m_ui->deviceComboBox->setCurrentIndex( ( oldIndex < 0 ) ? 0 : oldIndex ); + updateFromCurrentDevice(); + } ), + [ this ] + { m_lastSelectedBootLoaderIndex = -1; if ( m_ui->bootLoaderComboBox->currentIndex() < 0 ) { @@ -606,7 +609,8 @@ 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 ); @@ -625,7 +629,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 ); } diff --git a/src/modules/partition/gui/PartitionSplitterWidget.cpp b/src/modules/partition/gui/PartitionSplitterWidget.cpp index 0cafe7814..e52afaa74 100644 --- a/src/modules/partition/gui/PartitionSplitterWidget.cpp +++ b/src/modules/partition/gui/PartitionSplitterWidget.cpp @@ -159,14 +159,16 @@ PartitionSplitterWidget::setSplitPartition( const QString& path, qint64 minSize, m_itemToResizePath.clear(); } - PartitionSplitterItem itemToResize = _findItem( m_items, [path]( PartitionSplitterItem& item ) -> bool { - if ( path == item.itemPath ) - { - item.status = PartitionSplitterItem::Resizing; - return true; - } - return false; - } ); + PartitionSplitterItem itemToResize = _findItem( m_items, + [ path ]( PartitionSplitterItem& item ) -> bool + { + if ( path == item.itemPath ) + { + item.status = PartitionSplitterItem::Resizing; + return true; + } + return false; + } ); if ( itemToResize.isNull() ) { @@ -184,14 +186,16 @@ 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 { - if ( item.status == PartitionSplitterItem::Resizing ) - { - item.size = preferredSize; - return true; - } - return false; - } ); + int opCount = _eachItem( m_items, + [ preferredSize ]( PartitionSplitterItem& item ) -> bool + { + if ( item.status == PartitionSplitterItem::Resizing ) + { + item.size = preferredSize; + return true; + } + return false; + } ); cDebug() << "each splitter item opcount:" << opCount; m_itemMinSize = minSize; m_itemMaxSize = maxSize; @@ -358,19 +362,21 @@ PartitionSplitterWidget::mouseMoveEvent( QMouseEvent* event ) m_itemToResize.size = qRound64( span * percent ); m_itemToResizeNext.size -= m_itemToResize.size - oldsize; - _eachItem( m_items, [this]( PartitionSplitterItem& item ) -> bool { - if ( item.status == PartitionSplitterItem::Resizing ) - { - item.size = m_itemToResize.size; - return true; - } - else if ( item.status == PartitionSplitterItem::ResizingNext ) - { - item.size = m_itemToResizeNext.size; - return true; - } - return false; - } ); + _eachItem( m_items, + [ this ]( PartitionSplitterItem& item ) -> bool + { + if ( item.status == PartitionSplitterItem::Resizing ) + { + item.size = m_itemToResize.size; + return true; + } + else if ( item.status == PartitionSplitterItem::ResizingNext ) + { + item.size = m_itemToResizeNext.size; + return true; + } + return false; + } ); repaint(); diff --git a/src/modules/partition/gui/ReplaceWidget.cpp b/src/modules/partition/gui/ReplaceWidget.cpp index 2e5675a11..76f9ff963 100644 --- a/src/modules/partition/gui/ReplaceWidget.cpp +++ b/src/modules/partition/gui/ReplaceWidget.cpp @@ -46,9 +46,10 @@ ReplaceWidget::ReplaceWidget( PartitionCoreModule* core, QComboBox* devicesCombo m_ui->bootStatusLabel->clear(); updateFromCurrentDevice( devicesComboBox ); - connect( devicesComboBox, &QComboBox::currentTextChanged, this, [=]( const QString& /* text */ ) { - updateFromCurrentDevice( devicesComboBox ); - } ); + connect( devicesComboBox, + &QComboBox::currentTextChanged, + this, + [ = ]( const QString& /* text */ ) { updateFromCurrentDevice( devicesComboBox ); } ); CALAMARES_RETRANSLATE( onPartitionSelected(); ); } diff --git a/src/modules/partition/gui/ScanningDialog.cpp b/src/modules/partition/gui/ScanningDialog.cpp index 4dffa922b..56133e21f 100644 --- a/src/modules/partition/gui/ScanningDialog.cpp +++ b/src/modules/partition/gui/ScanningDialog.cpp @@ -47,12 +47,16 @@ ScanningDialog::run( const QFuture< void >& future, theDialog->show(); QFutureWatcher< void >* watcher = new QFutureWatcher< void >(); - connect( watcher, &QFutureWatcher< void >::finished, theDialog, [watcher, theDialog, callback] { - watcher->deleteLater(); - theDialog->hide(); - theDialog->deleteLater(); - callback(); - } ); + connect( watcher, + &QFutureWatcher< void >::finished, + theDialog, + [ watcher, theDialog, callback ] + { + watcher->deleteLater(); + theDialog->hide(); + theDialog->deleteLater(); + callback(); + } ); watcher->setFuture( future ); } diff --git a/src/modules/partition/gui/VolumeGroupBaseDialog.cpp b/src/modules/partition/gui/VolumeGroupBaseDialog.cpp index 48b44f68d..818a60483 100644 --- a/src/modules/partition/gui/VolumeGroupBaseDialog.cpp +++ b/src/modules/partition/gui/VolumeGroupBaseDialog.cpp @@ -45,17 +45,25 @@ VolumeGroupBaseDialog::VolumeGroupBaseDialog( QString& vgName, QVector< const Pa updateOkButton(); updateTotalSize(); - connect( ui->pvList, &QListWidget::itemChanged, this, [&]( QListWidgetItem* ) { - updateTotalSize(); - updateOkButton(); - } ); + connect( ui->pvList, + &QListWidget::itemChanged, + this, + [ & ]( QListWidgetItem* ) + { + updateTotalSize(); + updateOkButton(); + } ); - connect( ui->peSize, qOverload< int >( &QSpinBox::valueChanged ), this, [&]( int ) { - updateTotalSectors(); - updateOkButton(); - } ); + 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() diff --git a/src/modules/partition/jobs/AutoMountManagementJob.cpp b/src/modules/partition/jobs/AutoMountManagementJob.cpp index e276447db..29b197933 100644 --- a/src/modules/partition/jobs/AutoMountManagementJob.cpp +++ b/src/modules/partition/jobs/AutoMountManagementJob.cpp @@ -26,7 +26,9 @@ Calamares::JobResult AutoMountManagementJob::exec() { cVerbose() << "this" << Logger::Pointer( this ) << "value" << Logger::Pointer( m_stored ) - << ( m_stored ? "restore" : m_disable ? "disable" : "enable" ); + << ( m_stored ? "restore" + : m_disable ? "disable" + : "enable" ); if ( m_stored ) { CalamaresUtils::Partition::automountRestore( m_stored ); diff --git a/src/modules/partition/jobs/ClearMountsJob.cpp b/src/modules/partition/jobs/ClearMountsJob.cpp index 2f5a8bd36..3d7b9d0de 100644 --- a/src/modules/partition/jobs/ClearMountsJob.cpp +++ b/src/modules/partition/jobs/ClearMountsJob.cpp @@ -157,9 +157,11 @@ getLVMVolumes() QStringList lvscanLines = QString::fromLocal8Bit( process.readAllStandardOutput() ).split( '\n' ); // Get the second column (`value(1)`) sinec that is the device name, // remove quoting. - std::transform( lvscanLines.begin(), lvscanLines.end(), lvscanLines.begin(), []( const QString& lvscanLine ) { - return lvscanLine.simplified().split( ' ' ).value( 1 ).replace( '\'', "" ); - } ); + std::transform( lvscanLines.begin(), + lvscanLines.end(), + lvscanLines.begin(), + []( const QString& lvscanLine ) + { return lvscanLine.simplified().split( ' ' ).value( 1 ).replace( '\'', "" ); } ); return lvscanLines; } else diff --git a/src/modules/partition/tests/AutoMountTests.cpp b/src/modules/partition/tests/AutoMountTests.cpp index 45a7b4f12..103fe6f82 100644 --- a/src/modules/partition/tests/AutoMountTests.cpp +++ b/src/modules/partition/tests/AutoMountTests.cpp @@ -69,8 +69,8 @@ AutoMountJobTests::testRunQueue() QVERIFY( !q.isRunning() ); QEventLoop loop; - QTimer::singleShot( std::chrono::milliseconds( 100 ), [&q]() { q.start(); } ); - QTimer::singleShot( std::chrono::milliseconds( 5000 ), [&loop]() { loop.quit(); } ); + QTimer::singleShot( std::chrono::milliseconds( 100 ), [ &q ]() { q.start(); } ); + QTimer::singleShot( std::chrono::milliseconds( 5000 ), [ &loop ]() { loop.quit(); } ); connect( &q, &Calamares::JobQueue::finished, &loop, &QEventLoop::quit ); loop.exec(); diff --git a/src/modules/partition/tests/ClearMountsJobTests.cpp b/src/modules/partition/tests/ClearMountsJobTests.cpp index 3af400fde..17565e756 100644 --- a/src/modules/partition/tests/ClearMountsJobTests.cpp +++ b/src/modules/partition/tests/ClearMountsJobTests.cpp @@ -32,10 +32,10 @@ getPartitionsForDevice_other( const QString& deviceName ) { QProcess process; process.setProgram( "sh" ); - process.setArguments( - { "-c", - QString( "echo $(awk '{print \"/dev/\"$4}' /proc/partitions | sed -e '/name/d' -e '/^$/d' -e '/[1-9]/!d' | grep %1)" ) - .arg( deviceName ) } ); + process.setArguments( { "-c", + QString( "echo $(awk '{print \"/dev/\"$4}' /proc/partitions | sed -e '/name/d' -e '/^$/d' " + "-e '/[1-9]/!d' | grep %1)" ) + .arg( deviceName ) } ); process.start(); process.waitForFinished();