lotrodatmanager.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. #ifndef LEGACYAPP_H
  2. #define LEGACYAPP_H
  3. #include <QObject>
  4. #include <QSettings>
  5. #include <QApplication>
  6. #include <QVector>
  7. #include <QVariant>
  8. #include <LotroDat/LotroDat.h>
  9. using LOTRO_DAT::DatStatus;
  10. class LotroDatManager : public QObject
  11. {
  12. Q_OBJECT
  13. public:
  14. using Status = LOTRO_DAT::DatStatus::ProgressInfo;
  15. enum Category : int {
  16. E_TEXTS_COMMON = 100,
  17. E_TEXTS_ITEMS = 101,
  18. E_TEXTS_EMOTES = 102,
  19. E_TEXTS_VIDEOS_REFS = 103,
  20. E_MAPS_COMMON = 200,
  21. E_TEXTURES_COMMON = 201,
  22. E_AUDIOS_COMMON = 300,
  23. E_FONTS_COMMON = 400
  24. };
  25. public:
  26. explicit LotroDatManager(QObject *parent = nullptr);
  27. ~LotroDatManager();
  28. bool Initialised();
  29. bool NotPatched();
  30. public slots:
  31. void initializeManager();
  32. void deinitializeManager();
  33. void startGame(LOTRO_DAT::DatLocaleManager::LOCALE locale);
  34. void installPatch(QString patch_name, QString database_path);
  35. void enableCategory(QString patch_name, LotroDatManager::Category category);
  36. void disableCategory(QString patch_name, LotroDatManager::Category category);
  37. void createBackup();
  38. void restoreFromBackup();
  39. void removeBackup();
  40. private:
  41. bool startLotroLauncherWithParameters(LOTRO_DAT::DatLocaleManager::LOCALE locale);
  42. signals:
  43. void operationStarted(QString operation_name, QVector<QVariant> args = {});
  44. void errorOccured(QString operation_name, QVector<QVariant> args = {}, QString message = "No error message provided");
  45. void operationFinished(QString operation_name, QVector<QVariant> args = {}, bool successful = true);
  46. void statusChanged(Status status);
  47. private:
  48. LOTRO_DAT::DatFile client_local_file_;
  49. LOTRO_DAT::DatFile client_general_file_;
  50. const LOTRO_DAT::DatStatus::Callback file_status_updated_callback_ = [&](Status status) {
  51. emit statusChanged(status);
  52. };
  53. };
  54. #endif // LEGACYAPP_H