Revert "Test out a way to make the rescan asynchronous."

This reverts commit e3f28189ced7aa22b3b7a6dc1506a17cbc1325b5.
This commit is contained in:
Teo Mrnjavac 2015-12-23 18:39:13 +01:00
parent d742431ee9
commit 019faf730c

View File

@ -46,8 +46,6 @@
#include <QDir> #include <QDir>
#include <QLabel> #include <QLabel>
#include <QListView> #include <QListView>
#include <QFutureWatcher>
#include <QtConcurrent/QtConcurrent>
@ -439,8 +437,12 @@ ChoicePage::applyActionChoice( ChoicePage::Choice choice )
connect( m_beforePartitionBarsView->selectionModel(), &QItemSelectionModel::currentRowChanged, connect( m_beforePartitionBarsView->selectionModel(), &QItemSelectionModel::currentRowChanged,
this, [ this ]( const QModelIndex& current, const QModelIndex& previous ) this, [ this ]( const QModelIndex& current, const QModelIndex& previous )
{ {
auto doReplace = [=] if ( m_core->isDirty() )
{ {
m_core->revertDevice( selectedDevice() );
m_core->clearJobs();
}
// We can't use the PartitionPtrRole because we need to make changes to the // We can't use the PartitionPtrRole because we need to make changes to the
// main DeviceModel, not the immutable copy. // main DeviceModel, not the immutable copy.
QString partPath = current.data( PartitionModel::PartitionPathRole ).toString(); QString partPath = current.data( PartitionModel::PartitionPathRole ).toString();
@ -450,24 +452,6 @@ ChoicePage::applyActionChoice( ChoicePage::Choice choice )
PartitionActions::doReplacePartition( m_core, PartitionActions::doReplacePartition( m_core,
selectedDevice(), selectedDevice(),
partition ); partition );
};
if ( m_core->isDirty() )
{
QFutureWatcher< void > watcher;
connect( &watcher, &QFutureWatcher< void >::finished,
this, doReplace );
QFuture< void > future = QtConcurrent::run( [=]
{
m_core->revertDevice( selectedDevice() );
m_core->clearJobs();
} );
watcher.setFuture( future );
}
else
doReplace();
} ); } );
break; break;
case NoChoice: case NoChoice: