|
|
@ -49,7 +49,8 @@
|
|
|
|
#include <QStandardItemModel>
|
|
|
|
#include <QStandardItemModel>
|
|
|
|
#include <QDir>
|
|
|
|
#include <QDir>
|
|
|
|
#include <QProcess>
|
|
|
|
#include <QProcess>
|
|
|
|
#include <QTimer>
|
|
|
|
#include <QFutureWatcher>
|
|
|
|
|
|
|
|
#include <QtConcurrent/QtConcurrent>
|
|
|
|
|
|
|
|
|
|
|
|
static bool
|
|
|
|
static bool
|
|
|
|
hasRootPartition( Device* device )
|
|
|
|
hasRootPartition( Device* device )
|
|
|
@ -531,11 +532,16 @@ PartitionCoreModule::revertDevice( Device* dev )
|
|
|
|
void
|
|
|
|
void
|
|
|
|
PartitionCoreModule::asyncRevertDevice( Device* dev, std::function< void() > callback )
|
|
|
|
PartitionCoreModule::asyncRevertDevice( Device* dev, std::function< void() > callback )
|
|
|
|
{
|
|
|
|
{
|
|
|
|
QTimer::singleShot( 0, this, [=]
|
|
|
|
QFutureWatcher< void >* watcher = new QFutureWatcher< void >();
|
|
|
|
|
|
|
|
connect( watcher, &QFutureWatcher< void >::finished,
|
|
|
|
|
|
|
|
this, [ watcher, callback ]
|
|
|
|
{
|
|
|
|
{
|
|
|
|
revertDevice( dev );
|
|
|
|
callback();
|
|
|
|
QTimer::singleShot( 0, callback );
|
|
|
|
watcher->deleteLater();
|
|
|
|
} );
|
|
|
|
} );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QFuture< void > future = QtConcurrent::run( this, &PartitionCoreModule::revertDevice, dev );
|
|
|
|
|
|
|
|
watcher->setFuture( future );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|