Clean up a bit.
This commit is contained in:
parent
6db6dc0e08
commit
f31a45e53a
@ -442,28 +442,7 @@ ChoicePage::applyActionChoice( ChoicePage::Choice choice )
|
||||
watcher->deleteLater();
|
||||
} );
|
||||
|
||||
auto doReplace = [ this, current ]
|
||||
{
|
||||
cDebug() << "begin doReplace";
|
||||
QMutexLocker( &( ChoicePage::m_coreMutex ) );
|
||||
|
||||
if ( m_core->isDirty() )
|
||||
{
|
||||
m_core->revertDevice( selectedDevice() );
|
||||
}
|
||||
// We can't use the PartitionPtrRole because we need to make changes to the
|
||||
// main DeviceModel, not the immutable copy.
|
||||
QString partPath = current.data( PartitionModel::PartitionPathRole ).toString();
|
||||
Partition* partition = KPMHelpers::findPartitionByPath( { selectedDevice() },
|
||||
partPath );
|
||||
if ( partition )
|
||||
PartitionActions::doReplacePartition( m_core,
|
||||
selectedDevice(),
|
||||
partition );
|
||||
cDebug() << "end doReplace";
|
||||
};
|
||||
|
||||
QFuture< void > future = QtConcurrent::run( doReplace );
|
||||
QFuture< void > future = QtConcurrent::run( this, &ChoicePage::doReplaceSelectedPartition, current );
|
||||
watcher->setFuture( future );
|
||||
} );
|
||||
break;
|
||||
@ -475,6 +454,29 @@ ChoicePage::applyActionChoice( ChoicePage::Choice choice )
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
ChoicePage::doReplaceSelectedPartition( const QModelIndex& current )
|
||||
{
|
||||
cDebug() << "begin doReplace";
|
||||
QMutexLocker locker( &m_coreMutex );
|
||||
|
||||
if ( m_core->isDirty() )
|
||||
{
|
||||
m_core->revertDevice( selectedDevice() );
|
||||
}
|
||||
// We can't use the PartitionPtrRole because we need to make changes to the
|
||||
// main DeviceModel, not the immutable copy.
|
||||
QString partPath = current.data( PartitionModel::PartitionPathRole ).toString();
|
||||
Partition* partition = KPMHelpers::findPartitionByPath( { selectedDevice() },
|
||||
partPath );
|
||||
if ( partition )
|
||||
PartitionActions::doReplacePartition( m_core,
|
||||
selectedDevice(),
|
||||
partition );
|
||||
cDebug() << "end doReplace";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief ChoicePage::updateDeviceStatePreview clears and rebuilds the contents of the
|
||||
* preview widget for the current on-disk state. This also triggers a rescan in the
|
||||
|
@ -76,6 +76,7 @@ private:
|
||||
ExpandableRadioButton* createEraseButton();
|
||||
Device* selectedDevice();
|
||||
void applyDeviceChoice();
|
||||
void doReplaceSelectedPartition( const QModelIndex& current );
|
||||
void updateDeviceStatePreview();
|
||||
void applyActionChoice( ChoicePage::Choice choice );
|
||||
void updateActionChoicePreview( ChoicePage::Choice choice );
|
||||
|
Loading…
Reference in New Issue
Block a user