Cute Chess
0.1
Main Page
Namespaces
Classes
Files
File List
projects
lib
src
worker.h
1
/*
2
This file is part of Cute Chess.
3
4
Cute Chess is free software: you can redistribute it and/or modify
5
it under the terms of the GNU General Public License as published by
6
the Free Software Foundation, either version 3 of the License, or
7
(at your option) any later version.
8
9
Cute Chess is distributed in the hope that it will be useful,
10
but WITHOUT ANY WARRANTY; without even the implied warranty of
11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
GNU General Public License for more details.
13
14
You should have received a copy of the GNU General Public License
15
along with Cute Chess. If not, see <http://www.gnu.org/licenses/>.
16
*/
17
18
#ifndef WORKER_H
19
#define WORKER_H
20
21
#include <QObject>
22
#include <QRunnable>
23
#include <QTime>
24
#include <QString>
25
29
class
LIB_EXPORT
Worker
:
public
QObject
,
public
QRunnable
30
{
31
Q_OBJECT
32
33
public
:
39
explicit
Worker
(
const
QString
& title);
41
virtual
~
Worker
();
43
QTime
startTime()
const
;
45
QString
title()
const
;
46
47
// Inherited from QRunnable
48
void
run()
override
;
49
50
signals:
57
void
started();
62
void
progressChanged(
int
value);
71
void
statusChanged(
const
QString
& statusMessage);
77
void
cancelled();
83
void
finished();
89
void
error(
int
error);
90
91
public
slots:
98
void
cancel();
99
100
protected
:
113
virtual
void
work() = 0;
115
bool
cancelRequested()
const
;
116
117
private
:
118
bool
m_cancel;
119
QString
m_title;
120
QTime
m_startTime;
121
};
122
123
#endif // WORKER_H
Worker
Definition:
worker.h:29
QTime
QObject
QString
Generated by
1.8.11