patchlist.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #ifndef PATCHLIST_H
  2. #define PATCHLIST_H
  3. #include <QObject>
  4. #include <QTimer>
  5. #include <QThread>
  6. #include <QList>
  7. #include "models/patch/patch.h"
  8. #include "models/patch/textspatch.h"
  9. #include "models/patch/graphicspatch.h"
  10. #include "models/patch/soundspatch.h"
  11. #include "models/patch/videospatch.h"
  12. class PatchList : public QObject
  13. {
  14. Q_OBJECT
  15. public:
  16. explicit PatchList(LotroDatManager* mgr, QObject *parent = nullptr);
  17. ~PatchList();
  18. QList<Patch *> getPatchList();
  19. LotroDatManager* getManager();
  20. signals:
  21. void progressChanged(Patch::OperationProgress total_status);
  22. void patchOperationsStarted();
  23. void patchOperationsFinished();
  24. void backupSettingsInfoChanged();
  25. public slots:
  26. void startAutoUpdate();
  27. void stopAutoUpdate();
  28. void update();
  29. void initialize();
  30. void createBackup();
  31. void restoreFromBackup();
  32. void removeBackup();
  33. void forceInstallPatches();
  34. void cleanUpPatchDirectory();
  35. private slots:
  36. void onPatchOperationStarted(Patch::Operation operation, Patch* patch);
  37. void onPatchOperationFinished(Patch::Operation operation, Patch* patch);
  38. void onPatchOperationProgressChanged(Patch::OperationProgress operation_progress, Patch* patch);
  39. private slots:
  40. void onLotroManagerOperationFinished(QString operation_name, QVector<QVariant> args, bool result);
  41. void onLotroManagerOperationStarted(QString operation_name, QVector<QVariant> args);
  42. private:
  43. LotroDatManager *lotro_mgr_ = nullptr;
  44. bool lotro_mgr_initialised_ = false;
  45. bool operations_running_ = false;
  46. TextsPatch *texts_patch_ = nullptr;
  47. GraphicsPatch *graphics_patch_ = nullptr;
  48. SoundsPatch *sounds_patch_ = nullptr;
  49. VideosPatch *videos_patch_ = nullptr;
  50. QThread *texts_patch_thread_;
  51. QThread *graphics_patch_thread_ = nullptr;
  52. QThread *sounds_patch_thread_ = nullptr;
  53. QThread *videos_patch_thread_ = nullptr;
  54. QMap<Patch*, Patch::OperationProgress> patch_operations_status_;
  55. quint32 active_operations_num_ = 0;
  56. bool auto_updates_enabled_ = false;
  57. QTimer patch_update_timer;
  58. };
  59. #endif // PATCHLIST_H