-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjob.h
111 lines (100 loc) · 3.06 KB
/
job.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
// Copyright 2022-present Contributors to the jobman project.
// SPDX-License-Identifier: BSD-3-Clause
// https://github.com/mikaelsundell/jobman
#pragma once
#include <QList>
#include <QObject>
#include <QPair>
#include <QScopedPointer>
#include <QString>
#include <QUuid>
struct OS : public QObject {
public:
OS(QObject* parent = nullptr);
public:
QStringList searchpaths;
QList<QPair<QString, QString>> environmentvars;
};
struct Preprocess : public QObject {
public:
Preprocess(QObject* parent = nullptr);
public:
struct Copyoriginal {
QString filename;
bool run() const {
return (!filename.isEmpty());
}
};
Copyoriginal copyoriginal;
};
struct Postprocess : public QObject {
public:
Postprocess(QObject* parent = nullptr);
};
class JobPrivate;
class Job : public QObject {
Q_OBJECT
public:
enum Status {
Waiting,
Running,
Completed,
Failed,
DependencyFailed,
Stopped
};
Q_ENUM(Status)
public:
Job();
virtual ~Job();
QStringList arguments() const;
QString command() const;
QDateTime created() const;
QUuid dependson() const;
QString dir() const;
QString filename() const;
QString id() const;
QString name() const;
QString log() const;
QString output() const;
bool overwrite() const;
int pid() const;
int priority() const;
QString startin() const;
Status status() const;
QUuid uuid() const;
OS* os();
Preprocess* preprocess();
Postprocess* postprocess();
void setArguments(const QStringList& arguments);
void setCommand(const QString& command);
void setDependson(QUuid dependson);
void setDir(const QString& dir);
void setFilename(const QString& filename);
void setId(const QString& id);
void setLog(const QString& log);
void setName(const QString& name);
void setOutput(const QString& output);
void setOverwrite(bool overwrite);
void setPid(int pid);
void setPriority(int priority);
void setStartin(const QString& startin);
void setStatus(Status status);
Q_SIGNALS:
void argumentsChanged(const QStringList& arguments);
void commandChanged(const QString& command);
void dependsonChanged(QUuid uuid);
void dirChanged(QString dir);
void filenameChanged(const QString& filename);
void idChanged(const QString& id);
void logChanged(const QString& log);
void nameChanged(const QString& name);
void outputChanged(const QString& output);
void overwriteChanged(bool overwrite);
void pidChanged(int pid);
void priorityChanged(int priority);
void startinChanged(const QString& startin);
void statusChanged(Status status);
private:
QScopedPointer<JobPrivate> p;
};