[partition] Apply newer formatting tool

This commit is contained in:
Adriaan de Groot 2021-03-16 16:08:13 +01:00
parent 3b9c0bdf91
commit 2b4bc7adf4

View file

@ -360,12 +360,13 @@ ChoicePage::applyDeviceChoice()
if ( m_core->isDirty() ) if ( m_core->isDirty() )
{ {
ScanningDialog::run( QtConcurrent::run( [=] { ScanningDialog::run(
QMutexLocker locker( &m_coreMutex ); QtConcurrent::run( [=] {
m_core->revertAllDevices(); QMutexLocker locker( &m_coreMutex );
} ), m_core->revertAllDevices();
[this] { continueApplyDeviceChoice(); }, } ),
this ); [this] { continueApplyDeviceChoice(); },
this );
} }
else else
{ {
@ -452,15 +453,16 @@ ChoicePage::applyActionChoice( InstallChoice choice )
if ( m_core->isDirty() ) if ( m_core->isDirty() )
{ {
ScanningDialog::run( QtConcurrent::run( [=] { ScanningDialog::run(
QMutexLocker locker( &m_coreMutex ); QtConcurrent::run( [=] {
m_core->revertDevice( selectedDevice() ); QMutexLocker locker( &m_coreMutex );
} ), m_core->revertDevice( selectedDevice() );
[=] { } ),
PartitionActions::doAutopartition( m_core, selectedDevice(), options ); [=] {
emit deviceChosen(); PartitionActions::doAutopartition( m_core, selectedDevice(), options );
}, emit deviceChosen();
this ); },
this );
} }
else else
{ {
@ -472,12 +474,13 @@ ChoicePage::applyActionChoice( InstallChoice choice )
case InstallChoice::Replace: case InstallChoice::Replace:
if ( m_core->isDirty() ) if ( m_core->isDirty() )
{ {
ScanningDialog::run( QtConcurrent::run( [=] { ScanningDialog::run(
QMutexLocker locker( &m_coreMutex ); QtConcurrent::run( [=] {
m_core->revertDevice( selectedDevice() ); QMutexLocker locker( &m_coreMutex );
} ), m_core->revertDevice( selectedDevice() );
[] {}, } ),
this ); [] {},
this );
} }
updateNextEnabled(); updateNextEnabled();
@ -491,17 +494,18 @@ ChoicePage::applyActionChoice( InstallChoice choice )
case InstallChoice::Alongside: case InstallChoice::Alongside:
if ( m_core->isDirty() ) if ( m_core->isDirty() )
{ {
ScanningDialog::run( QtConcurrent::run( [=] { ScanningDialog::run(
QMutexLocker locker( &m_coreMutex ); QtConcurrent::run( [=] {
m_core->revertDevice( selectedDevice() ); QMutexLocker locker( &m_coreMutex );
} ), m_core->revertDevice( selectedDevice() );
[this] { } ),
// We need to reupdate after reverting because the splitter widget is [this] {
// not a true view. // We need to reupdate after reverting because the splitter widget is
updateActionChoicePreview( m_config->installChoice() ); // not a true view.
updateNextEnabled(); updateActionChoicePreview( m_config->installChoice() );
}, updateNextEnabled();
this ); },
this );
} }
updateNextEnabled(); updateNextEnabled();
@ -1033,22 +1037,23 @@ ChoicePage::updateActionChoicePreview( InstallChoice choice )
Calamares::restoreSelectedBootLoader( *m_bootloaderComboBox, m_core->bootLoaderInstallPath() ); Calamares::restoreSelectedBootLoader( *m_bootloaderComboBox, m_core->bootLoaderInstallPath() );
} }
} ); } );
connect( m_core, connect(
&PartitionCoreModule::deviceReverted, m_core,
this, &PartitionCoreModule::deviceReverted,
[this]( Device* dev ) { this,
Q_UNUSED( dev ) [this]( Device* dev ) {
if ( !m_bootloaderComboBox.isNull() ) Q_UNUSED( dev )
{ if ( !m_bootloaderComboBox.isNull() )
if ( m_bootloaderComboBox->model() != m_core->bootLoaderModel() ) {
{ if ( m_bootloaderComboBox->model() != m_core->bootLoaderModel() )
m_bootloaderComboBox->setModel( m_core->bootLoaderModel() ); {
} m_bootloaderComboBox->setModel( m_core->bootLoaderModel() );
}
m_bootloaderComboBox->setCurrentIndex( m_lastSelectedDeviceIndex ); m_bootloaderComboBox->setCurrentIndex( m_lastSelectedDeviceIndex );
} }
}, },
Qt::QueuedConnection ); Qt::QueuedConnection );
// ^ Must be Queued so it's sure to run when the widget is already visible. // ^ Must be Queued so it's sure to run when the widget is already visible.
eraseLayout->addWidget( m_bootloaderComboBox ); eraseLayout->addWidget( m_bootloaderComboBox );