forked from minecraft-linux/mcpelauncher-ui-qt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgamelauncher.h
72 lines (46 loc) · 1.69 KB
/
gamelauncher.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
#ifndef GAMELAUNCHER_H
#define GAMELAUNCHER_H
#include <QObject>
#include <QProcess>
class ProfileInfo;
class GameLauncher : public QObject {
Q_OBJECT
Q_PROPERTY(QString gameDir READ gameDir WRITE setGameDir)
Q_PROPERTY(ProfileInfo* profile READ profile WRITE setProfile)
Q_PROPERTY(bool crashed READ crashed NOTIFY stateChanged)
Q_PROPERTY(bool running READ running NOTIFY stateChanged)
private:
QScopedPointer<QProcess> process;
QScopedPointer<QProcess> fileprocess;
QString m_gameDir;
ProfileInfo* m_profile;
bool m_crashed = false;
bool m_gamelogopen = false;
bool m_disableGameLog = false;
void handleStdOutAvailable();
void handleFinished(int exitCode, QProcess::ExitStatus exitStatus);
void handleError(QProcess::ProcessError error);
public:
explicit GameLauncher(QObject *parent = nullptr);
static std::string findLauncher(std::string name);
QString const& gameDir() { return m_gameDir; }
void setGameDir(QString const& value) { m_gameDir = value; }
ProfileInfo* profile() { return m_profile; }
void setProfile(ProfileInfo* value) { m_profile = value; }
bool running() const { return !process.isNull() && !m_crashed; }
bool crashed() const { return m_crashed; }
public slots:
void start(bool disableGameLog, QString arch = "", bool hasVerifiedLicense = true, QString filepath = "");
void startFile(QString file);
void kill();
void logAttached();
void logDetached();
signals:
void logCleared();
void logAppended(QString const& text);
void stateChanged();
void launchFailed();
void corruptedInstall();
void fileStarted(bool success);
};
#endif // GAMELAUNCHER_H