diff options
Diffstat (limited to 'application/dialogs')
-rw-r--r-- | application/dialogs/ProgressDialog.cpp | 12 | ||||
-rw-r--r-- | application/dialogs/ProgressDialog.h | 3 |
2 files changed, 15 insertions, 0 deletions
diff --git a/application/dialogs/ProgressDialog.cpp b/application/dialogs/ProgressDialog.cpp index 17ab79cd..5d7c7968 100644 --- a/application/dialogs/ProgressDialog.cpp +++ b/application/dialogs/ProgressDialog.cpp @@ -97,6 +97,18 @@ int ProgressDialog::execWithTask(Task *task) } } +// TODO: only provide the unique_ptr overloads +int ProgressDialog::execWithTask(std::unique_ptr<Task> &&task) +{ + connect(this, &ProgressDialog::destroyed, task.get(), &Task::deleteLater); + return execWithTask(task.release()); +} +int ProgressDialog::execWithTask(std::unique_ptr<Task> &task) +{ + connect(this, &ProgressDialog::destroyed, task.get(), &Task::deleteLater); + return execWithTask(task.release()); +} + bool ProgressDialog::handleImmediateResult(QDialog::DialogCode &result) { if(task->isFinished()) diff --git a/application/dialogs/ProgressDialog.h b/application/dialogs/ProgressDialog.h index 9ddbceb1..28d4e639 100644 --- a/application/dialogs/ProgressDialog.h +++ b/application/dialogs/ProgressDialog.h @@ -16,6 +16,7 @@ #pragma once #include <QDialog> +#include <memory> class Task; @@ -35,6 +36,8 @@ public: void updateSize(); int execWithTask(Task *task); + int execWithTask(std::unique_ptr<Task> &&task); + int execWithTask(std::unique_ptr<Task> &task); void setSkipButton(bool present, QString label = QString()); |