lotromanager.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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(QString command, QString args, QString name);
  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. const std::vector<QString> available_operations_ = {
  41. "StartGame",
  42. "SetLocale",
  43. "ChangeBaseLocale",
  44. "ApplyGlobal",
  45. "ApplyPatch",
  46. "ApplyMicroPatch",
  47. "ApplyLoadScreens",
  48. "CheckDatFile",
  49. "SaveDatFiles"
  50. };
  51. signals:
  52. void dat_operation_started(QString command, QString args, QString name);
  53. void dat_operation_finished(QString command, QString args, QString name, QString result = "");
  54. void changePatchStatus(QString patch_name, QString new_status);
  55. void changeHint(QString head, QString hint);
  56. private slots:
  57. void on_dat_operation_started(QString command, QString args, QString name);
  58. void on_dat_operation_finished(QString command, QString args, QString name, QString result = "");
  59. };
  60. #endif // LOTROMANAGER_H