This repository has been archived by the owner on May 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
/
task.h
118 lines (87 loc) · 1.9 KB
/
task.h
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
// Andrew Naplavkov
#ifndef TASK_H
#define TASK_H
#include "utility.h"
#include <QObject>
#include <QRunnable>
#include <QString>
#include <QTextStream>
#include <memory>
#include <mutex>
class task : public QObject {
public:
enum class status { Waiting, Running, Canceling, Failed, Successed };
task();
status state();
void push_output(const QString&);
QString pop_output();
void cancel();
void run();
protected:
virtual void run_event() = 0;
private:
std::mutex guard_;
status state_;
QString str_;
QTextStream output_;
};
void push_output(task& tsk, const std::string& str);
using task_ptr = std::shared_ptr<task>;
class runnable : public QRunnable {
public:
void run() override;
static void start(task_ptr);
private:
task_ptr tsk_;
explicit runnable(task_ptr);
};
class columns_task : public task {
Q_OBJECT
public:
columns_task(bark::qt::layer, bark::qt::layer);
signals:
void columns_sig(layer_columns, layer_columns);
protected:
void run_event() override;
private:
bark::qt::layer lhs_;
bark::qt::layer rhs_;
};
class deletion_task : public task {
Q_OBJECT
public:
explicit deletion_task(bark::qt::layer);
signals:
void refresh_sig();
protected:
void run_event() override;
private:
bark::qt::layer lr_;
};
class sql_task : public task {
public:
sql_task(bark::qt::link, std::string);
protected:
void run_event() override;
private:
bark::qt::link lnk_;
std::string sql_;
};
class attributes_task : public task {
public:
attributes_task(bark::qt::layer, bark::qt::georeference);
protected:
void run_event() override;
private:
bark::qt::layer lr_;
bark::qt::georeference ref_;
};
class metadata_task : public task {
public:
explicit metadata_task(bark::qt::layer);
protected:
void run_event() override;
private:
bark::qt::layer lr_;
};
#endif // TASK_H