summaryrefslogtreecommitdiffstats
path: root/job.cpp
blob: af3510485c30850eef1e261597ea12d7bebba62a (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
27
28
29
30
31
#include "job.h"
#include "video.h"
#include <QtConcurrentRun>

Job::Job(Video *parent)
		: 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()));
}
Video* Job::video() const
{
	return m_video;
}
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;
}