Apply coding style globally again

This commit is contained in:
Adriaan de Groot 2020-10-12 14:27:01 +02:00
parent cff24bdd79
commit a955791766
21 changed files with 125 additions and 126 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -159,7 +159,7 @@ PartitionSplitterWidget::setSplitPartition( const QString& path, qint64 minSize,
m_itemToResizePath.clear(); 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 ) if ( path == item.itemPath )
{ {
item.status = PartitionSplitterItem::Resizing; item.status = PartitionSplitterItem::Resizing;
@ -184,7 +184,7 @@ PartitionSplitterWidget::setSplitPartition( const QString& path, qint64 minSize,
qint64 newSize = m_itemToResize.size - preferredSize; qint64 newSize = m_itemToResize.size - preferredSize;
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 ) if ( item.status == PartitionSplitterItem::Resizing )
{ {
item.size = preferredSize; item.size = preferredSize;
@ -358,7 +358,7 @@ PartitionSplitterWidget::mouseMoveEvent( QMouseEvent* event )
m_itemToResize.size = qRound64( span * percent ); m_itemToResize.size = qRound64( span * percent );
m_itemToResizeNext.size -= m_itemToResize.size - oldsize; 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 ) if ( item.status == PartitionSplitterItem::Resizing )
{ {
item.size = m_itemToResize.size; item.size = m_itemToResize.size;

View file

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

View file

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

View file

@ -47,7 +47,7 @@ ScanningDialog::run( const QFuture< void >& future,
theDialog->show(); theDialog->show();
QFutureWatcher< void >* watcher = new QFutureWatcher< void >(); 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(); watcher->deleteLater();
theDialog->hide(); theDialog->hide();
theDialog->deleteLater(); theDialog->deleteLater();

View file

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

View file

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

View file

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

View file

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