summaryrefslogtreecommitdiffstats
path: root/job.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'job.cpp')
-rw-r--r--job.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/job.cpp b/job.cpp
index af35104..bbc55b4 100644
--- a/job.cpp
+++ b/job.cpp
@@ -2,14 +2,17 @@
#include "video.h"
#include <QtConcurrentRun>
-Job::Job(Video *parent)
+Job::Job(Video *parent, bool threaded)
: QObject(parent),
m_gui(0),
m_video(parent)
{
- m_watcher = new QFutureWatcher<bool>;
- m_watcher->setParent(this);
- connect(m_watcher, SIGNAL(finished()), this, SLOT(jobFinished()));
+ if (threaded) {
+ m_watcher = new QFutureWatcher<bool>;
+ m_watcher->setParent(this);
+ connect(m_watcher, SIGNAL(finished()), this, SLOT(jobFinished()));
+ } else
+ m_watcher = 0;
}
Video* Job::video() const
{
@@ -17,7 +20,10 @@ Video* Job::video() const
}
void Job::runJob()
{
- m_watcher->setFuture(QtConcurrent::run(this, &Job::executeJob));
+ if (m_watcher)
+ m_watcher->setFuture(QtConcurrent::run(this, &Job::executeJob));
+ else
+ executeJob();
}
void Job::jobFinished()
{
@@ -29,3 +35,7 @@ QWidget* Job::widget()
m_gui = gui();
return m_gui;
}
+QFutureWatcher<bool>* Job::watcher() const
+{
+ return m_watcher;
+}