diff options
author | pommicket <pommicket@gmail.com> | 2025-08-08 10:42:40 -0400 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2025-08-08 10:42:40 -0400 |
commit | 551c51c02649aeb38d72002d6bb70b58dbee1eb2 (patch) | |
tree | c8b7117657854171105c14e8568a6ec8c489e30f /quacker/macondobackend.h | |
parent | 91af6685bdbfad63a035bb7997a8f3d2eb20d64a (diff) |
MacondoBackend
Diffstat (limited to 'quacker/macondobackend.h')
-rw-r--r-- | quacker/macondobackend.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/quacker/macondobackend.h b/quacker/macondobackend.h new file mode 100644 index 0000000..dfda0c5 --- /dev/null +++ b/quacker/macondobackend.h @@ -0,0 +1,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 |