lotromanager.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. #ifndef LOTROMANAGER_H
  2. #define LOTROMANAGER_H
  3. #include <QObject>
  4. #include <QPushButton>
  5. #include <queue>
  6. #include <functional>
  7. #include <LotroDat.h>
  8. class LotroManager : public QObject
  9. {
  10. Q_OBJECT
  11. private:
  12. explicit LotroManager(QObject *parent = nullptr);
  13. public:
  14. static LotroManager& getInstance() {
  15. static LotroManager lotro_mgr_instance;
  16. return lotro_mgr_instance;
  17. }
  18. bool execute(QStringList operation);
  19. bool isBusy();
  20. private:
  21. void startGame();
  22. bool openDatFile(int id);
  23. void applyPatch(QString name);
  24. void applyGlobal();
  25. bool isDatReady();
  26. int checkDatFile();
  27. void applyMicroPatch();
  28. void applyLoadscreens();
  29. bool setGameLocale(QString locale);
  30. void changeBaseLocale(QString locale);
  31. void saveDatFiles();
  32. void processFile();
  33. void installMicroPatch();
  34. void prepareMicroPatch();
  35. private:
  36. bool busy_;
  37. LOTRO_DAT::LOCALE dat_locale_;
  38. std::vector<LOTRO_DAT::DatFile> dat_files_;
  39. LOTRO_DAT::Database database_;
  40. std::deque<QStringList> operations_queue_;
  41. const std::vector<QString> available_operations_ = {
  42. "StartGame",
  43. "SetLocale",
  44. "ChangeBaseLocale",
  45. "ApplyGlobal",
  46. "ApplyPatch",
  47. "ApplyMicroPatch",
  48. "ApplyLoadScreens",
  49. "CheckDatFile",
  50. "SaveDatFiles"
  51. };
  52. signals:
  53. void dat_operation_started(QString operation);
  54. void dat_operation_finished(QString operation, QString result = "");
  55. void update_hint_label(QString head, QString content);
  56. private slots:
  57. void on_dat_operation_started(QString operation);
  58. void on_dat_operation_finished(QString operation, QString result = "");
  59. };
  60. #endif // LOTROMANAGER_H