-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathagprocessthread.h
56 lines (38 loc) · 1.1 KB
/
agprocessthread.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
#ifndef AGProcessAndThread_H
#define AGProcessAndThread_H
#include <QProcess>
#include <QThread>
#include <QObject>
#include <QTime>
#ifdef Q_OS_WIN
#include <QWinTaskbarButton>
#endif
class AGProcessAndThread: public QObject
{
Q_OBJECT
QString commandString;
#ifdef Q_OS_WIN
QWinTaskbarButton *taskbarButton;
#endif
int timeOffsetMsec = 0;
public:
AGProcessAndThread(QObject *parent = nullptr);
~AGProcessAndThread();
QProcess *process = nullptr;
QThread *jobThread = nullptr;
QStringList log;
void command(QString name, QString commandString, int timeOffsetMsec = 0);
void command(QString name, std::function<void ()> commandFunction);
QString name;
void start();
void kill();
bool processStopped = false;
QTime totalTime;
QString errorMessage;
public slots:
void addProcessLog(QString event, QString outputString);
signals:
void processOutput(QTime time, QTime totalTime, QString event, QString outputString);
void stopThreadProcess();
};
#endif // AGProcessAndThread_H