-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathabstractthreadworker.h
More file actions
49 lines (38 loc) · 1.11 KB
/
Copy pathabstractthreadworker.h
File metadata and controls
49 lines (38 loc) · 1.11 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef THREADWORKER_H
#define THREADWORKER_H
#include <QObject>
class CAbstractTranslator;
class CAbstractThreadWorker : public QObject
{
friend class CAbstractTranslator;
Q_OBJECT
private:
QAtomicInteger<bool> m_started;
QAtomicInteger<bool> m_abortFlag;
QAtomicInteger<bool> m_abortedFinished;
qint64 m_loadedTotalSize { 0L };
qint64 m_loadedRequestCount { 0L };
protected:
bool exitIfAborted();
bool isAborted();
void resetAbortFlag();
void addLoadedRequest(qint64 size);
virtual void startMain() = 0;
public:
explicit CAbstractThreadWorker(QObject *parent = nullptr);
virtual QString workerDescription() const = 0;
virtual int workerWeight();
qint64 loadedTotalSize() const;
qint64 loadedRequestCount() const;
public Q_SLOTS:
void start();
void abort();
Q_SIGNALS:
void started();
void finished();
void dataLoaded(qint64 loadedTotalSize, qint64 loadedRequestCount,
const QString& description);
void errorOccured(const QString& message);
void statusMessage(const QString& text);
};
#endif // THREADWORKER_H