GpgFrontend Project
A Free, Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP(pgp) Crypto Tool.
Task.h
1
27
#ifndef GPGFRONTEND_TASK_H
28
#define GPGFRONTEND_TASK_H
29
30
#include <functional>
31
32
#include "core/GpgFrontendCore.h"
33
34
namespace
GpgFrontend::Thread
{
35
36
class
TaskRunner;
37
38
class
GPGFRONTEND_CORE_EXPORT
Task
:
public
QObject,
public
QRunnable {
39
Q_OBJECT
40
public
:
41
using
TaskRunnable = std::function<int()>;
42
using
TaskCallback = std::function<void(
int
)>;
43
friend
class
TaskRunner
;
44
49
Task
();
50
57
Task
(TaskCallback callback);
58
64
Task
(
65
TaskRunnable runnable, TaskCallback callback = [](
int
) {});
66
71
virtual
~
Task
()
override
;
72
77
virtual
void
Run();
78
79
signals:
80
void
SignalTaskFinished();
81
82
protected
:
83
void
SetFinishAfterRun(
bool
finish_after_run);
84
85
void
SetRTN(
int
rtn);
86
87
private
:
88
TaskCallback callback_;
89
TaskRunnable runnable_;
90
bool
finish_after_run_ =
true
;
91
int
rtn_ = 0;
92
97
void
before_finish_task();
98
103
void
init();
104
109
virtual
void
run()
override
;
110
};
111
}
// namespace GpgFrontend::Thread
112
113
#endif // GPGFRONTEND_TASK_H
GpgFrontend::Thread::TaskRunner
Definition:
TaskRunner.h:39
GpgFrontend::Thread::Task::~Task
virtual ~Task() override
Destroy the Task object.
GpgFrontend::Thread::Task::Task
Task()
Construct a new Task object.
Definition:
Task.cpp:33
GpgFrontend::Thread
Definition:
CtxCheckTask.h:33
GpgFrontend::Thread::Task::Run
virtual void Run()
Run - run the task.
Definition:
Task.cpp:70
GpgFrontend::Thread::Task
Definition:
Task.h:38
src
core
thread
Task.h
Generated by
1.8.17