summaryrefslogtreecommitdiffstats
path: root/job.cpp
blob: ae3a9e2617dc64d68ab6845023d413fd1c5b5383 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include "job.h"
#include "video.h"
#include <QtConcurrentRun>

Job::Job(QObject *parent)
		: QObject(parent),
		m_gui(0)
{
	m_watcher = new QFutureWatcher<bool>;
	m_watcher->setParent(this);
	connect(m_watcher, SIGNAL(finished()), this, SLOT(jobFinished()));
}
void Job::runJob()
{
	m_watcher->setFuture(QtConcurrent::run(this, &Job::executeJob));
}
void Job::jobFinished()
{
	emit completed(m_watcher->future().result());
}
QWidget* Job::widget()
{
	if (!m_gui)
		m_gui = gui();
	return m_gui;
}