summaryrefslogtreecommitdiffstats
path: root/gui/taskdialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gui/taskdialog.cpp')
-rw-r--r--gui/taskdialog.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/gui/taskdialog.cpp b/gui/taskdialog.cpp
index efa64256..f61614e8 100644
--- a/gui/taskdialog.cpp
+++ b/gui/taskdialog.cpp
@@ -45,12 +45,14 @@ void TaskDialog::exec(Task *task)
this->task = task;
// Connect signals.
- connect(task, SIGNAL(started(Task*)), SLOT(onTaskStarted(Task*)));
- connect(task, SIGNAL(ended(Task*)), SLOT(onTaskEnded(Task*)));
+ connect(task, SIGNAL(started()), SLOT(onTaskStarted()));
+ connect(task, SIGNAL(failed(QString)), SLOT(onTaskEnded()));
+ connect(task, SIGNAL(succeeded()), SLOT(onTaskEnded()));
connect(task, SIGNAL(statusChanged(const QString&)), SLOT(changeStatus(const QString&)));
connect(task, SIGNAL(progressChanged(int)), SLOT(changeProgress(int)));
- task->startTask();
+ // this makes sure that the task is started after the dialog is created
+ QMetaObject::invokeMethod(task, "startTask", Qt::QueuedConnection);
QDialog::exec();
}
@@ -59,12 +61,12 @@ Task* TaskDialog::getTask()
return task;
}
-void TaskDialog::onTaskStarted(Task*)
+void TaskDialog::onTaskStarted()
{
}
-void TaskDialog::onTaskEnded(Task*)
+void TaskDialog::onTaskEnded()
{
close();
}