diff options
Diffstat (limited to 'qt/adapter.h')
| -rw-r--r-- | qt/adapter.h | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/qt/adapter.h b/qt/adapter.h deleted file mode 100644 index e961459..0000000 --- a/qt/adapter.h +++ /dev/null | |||
| @@ -1,55 +0,0 @@ | |||
| 1 | #ifndef ADAPTER_H | ||
| 2 | #define ADAPTER_H | ||
| 3 | |||
| 4 | #include "../cpp/nissy.h" | ||
| 5 | |||
| 6 | #include <map> | ||
| 7 | #include <string> | ||
| 8 | #include <QObject> | ||
| 9 | #include <QtQmlIntegration> | ||
| 10 | |||
| 11 | struct SolveOptions { | ||
| 12 | nissy::cube cube; | ||
| 13 | nissy::solver *solver; | ||
| 14 | unsigned minmoves; | ||
| 15 | unsigned maxmoves; | ||
| 16 | unsigned maxsolutions; | ||
| 17 | unsigned optimal; | ||
| 18 | }; | ||
| 19 | |||
| 20 | class NissyAdapter : public QObject { | ||
| 21 | Q_OBJECT | ||
| 22 | QML_SINGLETON | ||
| 23 | QML_ELEMENT | ||
| 24 | |||
| 25 | public: | ||
| 26 | static constexpr int maxSolutionsHardLimit = 9999; | ||
| 27 | |||
| 28 | NissyAdapter(); | ||
| 29 | |||
| 30 | Q_INVOKABLE bool isValidScramble(QString); | ||
| 31 | Q_INVOKABLE void requestSolve( | ||
| 32 | QString scramble, | ||
| 33 | QString solver, | ||
| 34 | int minmoves, | ||
| 35 | int maxmoves, | ||
| 36 | int maxsolutions, | ||
| 37 | int optimal | ||
| 38 | ); | ||
| 39 | |||
| 40 | signals: | ||
| 41 | void solutionsReady(QString, QString); | ||
| 42 | void solverError(QString); | ||
| 43 | void appendLog(QString); | ||
| 44 | |||
| 45 | private: | ||
| 46 | std::vector<nissy::solver> solvers; | ||
| 47 | std::function<void(std::string)> writeLog; | ||
| 48 | |||
| 49 | void initSolver(const std::string&); | ||
| 50 | void startSolve(SolveOptions); | ||
| 51 | bool loadSolverData(nissy::solver&); | ||
| 52 | void logLine(std::string); | ||
| 53 | }; | ||
| 54 | |||
| 55 | #endif | ||
