blob: dfda0c54f1826240b7f8831530e63ec89be1391f (
plain)
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
|
#ifndef MACONDO_BACKEND_H_
#define MACONDO_BACKEND_H_
#include <QObject>
#include <QProcess>
namespace Quackle {
class Game;
}
enum class MacondoCommand {
None,
Simulate,
Solve,
};
class MacondoBackend: public QObject {
Q_OBJECT
public:
struct InitOptions {
inline InitOptions(std::string execPath) {
this->execPath = execPath;
}
std::string execPath;
};
MacondoBackend(Quackle::Game *game, const InitOptions &);
struct SimulateOptions {
inline SimulateOptions() {}
};
void simulate(const SimulateOptions &);
~MacondoBackend();
std::string getSimResults();
inline MacondoCommand command() const { return m_command; }
protected slots:
void processStarted();
void processFinished(int, QProcess::ExitStatus);
private:
void loadGCG();
void killProcess();
std::string m_execPath;
std::string m_tempGCG;
QProcess *m_process = nullptr;
bool m_runningSimulation = false;
Quackle::Game *m_game;
MacondoCommand m_command = MacondoCommand::None;
};
#endif
|