From a9557917662af4567138996764c0295998e6e511 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 12 Oct 2020 14:27:01 +0200 Subject: [PATCH] Apply coding style globally again --- src/libcalamares/locale/Global.h | 8 +- .../modulesystem/ModuleManager.cpp | 4 +- src/libcalamaresui/utils/ImageRegistry.cpp | 4 +- src/libcalamaresui/utils/ImageRegistry.h | 10 +-- src/modules/keyboard/KeyboardPage.cpp | 12 ++- src/modules/partition/core/Config.cpp | 10 +-- src/modules/partition/core/PartitionActions.h | 4 +- .../partition/core/PartitionCoreModule.cpp | 10 +-- src/modules/partition/gui/ChoicePage.cpp | 74 ++++++++++--------- .../gui/EditExistingPartitionDialog.cpp | 4 +- .../partition/gui/PartitionBarsView.cpp | 4 +- .../partition/gui/PartitionLabelsView.cpp | 2 +- src/modules/partition/gui/PartitionPage.cpp | 8 +- .../partition/gui/PartitionSplitterWidget.cpp | 6 +- .../partition/gui/PartitionViewStep.cpp | 2 +- src/modules/partition/gui/ReplaceWidget.cpp | 11 ++- src/modules/partition/gui/ScanningDialog.cpp | 2 +- .../partition/gui/VolumeGroupBaseDialog.cpp | 6 +- .../partition/tests/CreateLayoutsTests.cpp | 56 +++++++------- .../partition/tests/CreateLayoutsTests.h | 2 +- src/modules/webview/WebViewStep.h | 12 +-- 21 files changed, 125 insertions(+), 126 deletions(-) diff --git a/src/libcalamares/locale/Global.h b/src/libcalamares/locale/Global.h index 56f09ce4c..abcf43dcd 100644 --- a/src/libcalamares/locale/Global.h +++ b/src/libcalamares/locale/Global.h @@ -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 ); diff --git a/src/libcalamaresui/modulesystem/ModuleManager.cpp b/src/libcalamaresui/modulesystem/ModuleManager.cpp index d630e67f2..5a971d661 100644 --- a/src/libcalamaresui/modulesystem/ModuleManager.cpp +++ b/src/libcalamaresui/modulesystem/ModuleManager.cpp @@ -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 { diff --git a/src/libcalamaresui/utils/ImageRegistry.cpp b/src/libcalamaresui/utils/ImageRegistry.cpp index 57683dbd0..3ae519f55 100644 --- a/src/libcalamaresui/utils/ImageRegistry.cpp +++ b/src/libcalamaresui/utils/ImageRegistry.cpp @@ -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 ) diff --git a/src/libcalamaresui/utils/ImageRegistry.h b/src/libcalamaresui/utils/ImageRegistry.h index 4cf48968e..513fd254c 100644 --- a/src/libcalamaresui/utils/ImageRegistry.h +++ b/src/libcalamaresui/utils/ImageRegistry.h @@ -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 diff --git a/src/modules/keyboard/KeyboardPage.cpp b/src/modules/keyboard/KeyboardPage.cpp index bd300d7e3..07c5cf763 100644 --- a/src/modules/keyboard/KeyboardPage.cpp +++ b/src/modules/keyboard/KeyboardPage.cpp @@ -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" ); + 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 } ); - } ); + // Set Xorg keyboard model + QProcess::execute( "setxkbmap", QStringList { "-model", model } ); + } ); CALAMARES_RETRANSLATE( ui->retranslateUi( this ); ) } diff --git a/src/modules/partition/core/Config.cpp b/src/modules/partition/core/Config.cpp index 268399dbd..55e0d8d0a 100644 --- a/src/modules/partition/core/Config.cpp +++ b/src/modules/partition/core/Config.cpp @@ -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 diff --git a/src/modules/partition/core/PartitionActions.h b/src/modules/partition/core/PartitionActions.h index 45d6f460a..3a345dc4e 100644 --- a/src/modules/partition/core/PartitionActions.h +++ b/src/modules/partition/core/PartitionActions.h @@ -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 ) { diff --git a/src/modules/partition/core/PartitionCoreModule.cpp b/src/modules/partition/core/PartitionCoreModule.cpp index 4c3003e8d..3d726aef1 100644 --- a/src/modules/partition/core/PartitionCoreModule.cpp +++ b/src/modules/partition/core/PartitionCoreModule.cpp @@ -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(); } ); diff --git a/src/modules/partition/gui/ChoicePage.cpp b/src/modules/partition/gui/ChoicePage.cpp index c3ac14735..d99fd1b0d 100644 --- a/src/modules/partition/gui/ChoicePage.cpp +++ b/src/modules/partition/gui/ChoicePage.cpp @@ -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 mounted." ) ); - else - m_messageLabel->setText( tr( "This storage device is a part of an inactive RAID device." ) ); + } + else + { + m_messageLabel->setText( + tr( "This storage device is a part of an inactive RAID 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; } } diff --git a/src/modules/partition/gui/EditExistingPartitionDialog.cpp b/src/modules/partition/gui/EditExistingPartitionDialog.cpp index 287a0e488..1e66c539c 100644 --- a/src/modules/partition/gui/EditExistingPartitionDialog.cpp +++ b/src/modules/partition/gui/EditExistingPartitionDialog.cpp @@ -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; diff --git a/src/modules/partition/gui/PartitionBarsView.cpp b/src/modules/partition/gui/PartitionBarsView.cpp index 03e06ee64..81f518acc 100644 --- a/src/modules/partition/gui/PartitionBarsView.cpp +++ b/src/modules/partition/gui/PartitionBarsView.cpp @@ -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(); } ); } diff --git a/src/modules/partition/gui/PartitionLabelsView.cpp b/src/modules/partition/gui/PartitionLabelsView.cpp index 1fb5c6f3e..7e861d994 100644 --- a/src/modules/partition/gui/PartitionLabelsView.cpp +++ b/src/modules/partition/gui/PartitionLabelsView.cpp @@ -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(); } ); } diff --git a/src/modules/partition/gui/PartitionPage.cpp b/src/modules/partition/gui/PartitionPage.cpp index 2c2df5b97..b9930504f 100644 --- a/src/modules/partition/gui/PartitionPage.cpp +++ b/src/modules/partition/gui/PartitionPage.cpp @@ -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 ); } diff --git a/src/modules/partition/gui/PartitionSplitterWidget.cpp b/src/modules/partition/gui/PartitionSplitterWidget.cpp index 0d6ea84d1..93c77bb69 100644 --- a/src/modules/partition/gui/PartitionSplitterWidget.cpp +++ b/src/modules/partition/gui/PartitionSplitterWidget.cpp @@ -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; diff --git a/src/modules/partition/gui/PartitionViewStep.cpp b/src/modules/partition/gui/PartitionViewStep.cpp index a9860cd1e..20c7d0f08 100644 --- a/src/modules/partition/gui/PartitionViewStep.cpp +++ b/src/modules/partition/gui/PartitionViewStep.cpp @@ -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; diff --git a/src/modules/partition/gui/ReplaceWidget.cpp b/src/modules/partition/gui/ReplaceWidget.cpp index 3304aa68a..a8ab40570 100644 --- a/src/modules/partition/gui/ReplaceWidget.cpp +++ b/src/modules/partition/gui/ReplaceWidget.cpp @@ -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 ) { diff --git a/src/modules/partition/gui/ScanningDialog.cpp b/src/modules/partition/gui/ScanningDialog.cpp index df3d7b082..cd22bb861 100644 --- a/src/modules/partition/gui/ScanningDialog.cpp +++ b/src/modules/partition/gui/ScanningDialog.cpp @@ -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(); diff --git a/src/modules/partition/gui/VolumeGroupBaseDialog.cpp b/src/modules/partition/gui/VolumeGroupBaseDialog.cpp index 3043a1c5e..6277c30e5 100644 --- a/src/modules/partition/gui/VolumeGroupBaseDialog.cpp +++ b/src/modules/partition/gui/VolumeGroupBaseDialog.cpp @@ -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() diff --git a/src/modules/partition/tests/CreateLayoutsTests.cpp b/src/modules/partition/tests/CreateLayoutsTests.cpp index 6bfc8caee..7589b5b65 100644 --- a/src/modules/partition/tests/CreateLayoutsTests.cpp +++ b/src/modules/partition/tests/CreateLayoutsTests.cpp @@ -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 #include @@ -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(&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(&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(&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 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(), 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 diff --git a/src/modules/partition/tests/CreateLayoutsTests.h b/src/modules/partition/tests/CreateLayoutsTests.h index 9d37d7067..98d2d8cb9 100644 --- a/src/modules/partition/tests/CreateLayoutsTests.h +++ b/src/modules/partition/tests/CreateLayoutsTests.h @@ -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 diff --git a/src/modules/webview/WebViewStep.h b/src/modules/webview/WebViewStep.h index 339997320..6fd71222e 100644 --- a/src/modules/webview/WebViewStep.h +++ b/src/modules/webview/WebViewStep.h @@ -21,16 +21,16 @@ #include #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;