forked from Stremio/stremio-shell
-
Notifications
You must be signed in to change notification settings - Fork 0
/
stremioprocess.h
37 lines (30 loc) · 916 Bytes
/
stremioprocess.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
#ifndef STREMIOPROCESS_H
#define STREMIOPROCESS_H
#include <QProcess>
#include <QVariant>
#include <QStandardPaths>
#include <QObject>
#include <iostream>
class Process : public QProcess {
Q_OBJECT
public:
Process(QObject *parent = 0) : QProcess(parent) { }
Q_INVOKABLE void start(const QString &program, const QVariantList &arguments, const QString mPattern);
private:
void checkServerAddressMessage(QByteArray message);
QByteArray magicPattern;
QByteArrayList errBuff;
bool magicPatternFound = true; // will be set to false if we are searching for one
private slots:
void onError(QProcess::ProcessError error);
void onOutput();
void onStdErr();
void onStarted();
public slots:
bool waitForFinished(int msecs = 30000);
QByteArray getErrBuff();
signals:
void addressReady(QString address);
void errorThrown(int error);
};
#endif // STREMIOPROCESS_H