lotromanager.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. QString patchTitleFromName(QString name);
  21. private:
  22. bool startGame();
  23. bool openDatFile(int id);
  24. void applyPatch(QString name);
  25. void applyPatch(QStringList patches_list);
  26. bool correctPatchName(QString patch_name);
  27. void applyGlobal();
  28. bool isDatReady();
  29. int checkDatFile();
  30. void applyMicroPatch();
  31. void applyLoadscreens();
  32. bool setGameLocale(QString locale);
  33. void changeBaseLocale(QString locale);
  34. void saveDatFiles();
  35. void processFile();
  36. void installMicroPatch();
  37. void prepareMicroPatch();
  38. private:
  39. bool busy_;
  40. qint64 last_second_files_count;
  41. qint64 last_second_time;
  42. qint64 start_time;
  43. QString elapsed_time;
  44. LOTRO_DAT::LOCALE dat_locale_;
  45. std::vector<LOTRO_DAT::DatFile> dat_files_;
  46. LOTRO_DAT::Database database_;
  47. const std::vector<QString> available_operations_ = {
  48. "StartGame",
  49. "SetLocale",
  50. "ChangeBaseLocale",
  51. "ApplyGlobal",
  52. "ApplyPatch",
  53. "ApplyPatchList",
  54. "ApplyMicroPatch",
  55. "ApplyLoadScreens",
  56. "CheckDatFile",
  57. "SaveDatFiles"
  58. };
  59. signals:
  60. void dat_operation_started(QString command, QString args, QString name);
  61. void dat_operation_finished(QString command, QString args, QString name, QString result = "");
  62. void changePatchStatus(QString patch_name, QString new_status);
  63. void changeHint(QString head, QString hint);
  64. private slots:
  65. void on_dat_operation_started(QString command, QString args, QString name);
  66. void on_dat_operation_finished(QString command, QString args, QString name, QString result = "");
  67. };
  68. #endif // LOTROMANAGER_H