Add callback support to ScanningDialog statics.
This commit is contained in:
parent
50ef1f1b70
commit
5df78cc513
@ -51,6 +51,7 @@ void
|
||||
ScanningDialog::run( const QFuture< void >& future,
|
||||
const QString& text,
|
||||
const QString& windowTitle,
|
||||
const std::function< void() >& callback,
|
||||
QWidget* parent )
|
||||
{
|
||||
ScanningDialog* theDialog =
|
||||
@ -61,11 +62,12 @@ ScanningDialog::run( const QFuture< void >& future,
|
||||
|
||||
QFutureWatcher< void >* watcher = new QFutureWatcher< void >();
|
||||
connect( watcher, &QFutureWatcher< void >::finished,
|
||||
theDialog, [ watcher, theDialog ]
|
||||
theDialog, [ watcher, theDialog, callback ]
|
||||
{
|
||||
watcher->deleteLater();
|
||||
theDialog->hide();
|
||||
theDialog->deleteLater();
|
||||
callback();
|
||||
} );
|
||||
|
||||
watcher->setFuture( future );
|
||||
@ -73,11 +75,14 @@ ScanningDialog::run( const QFuture< void >& future,
|
||||
|
||||
|
||||
void
|
||||
ScanningDialog::run( const QFuture< void >& future, QWidget* parent )
|
||||
ScanningDialog::run( const QFuture< void >& future,
|
||||
const std::function< void() >& callback,
|
||||
QWidget* parent )
|
||||
{
|
||||
ScanningDialog::run( future,
|
||||
tr( "Scanning storage devices..." ),
|
||||
tr( "Partitioning" ),
|
||||
callback,
|
||||
parent );
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,8 @@
|
||||
#include <QDialog>
|
||||
#include <QFuture>
|
||||
|
||||
#include <functional>
|
||||
|
||||
class ScanningDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -33,9 +35,11 @@ public:
|
||||
static void run( const QFuture< void >& future,
|
||||
const QString& text,
|
||||
const QString& windowTitle,
|
||||
const std::function< void() >& callback = []{},
|
||||
QWidget* parent = nullptr );
|
||||
|
||||
static void run( const QFuture< void >& future,
|
||||
const std::function< void() >& callback = []{},
|
||||
QWidget* parent = nullptr );
|
||||
|
||||
public slots:
|
||||
|
Loading…
Reference in New Issue
Block a user