legacyapplication.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #ifndef LEGACYAPPLICATION_H
  2. #define LEGACYAPPLICATION_H
  3. #include <QApplication>
  4. #include <QThread>
  5. #include <QTimer>
  6. class LotroDatManager;
  7. class PatchList;
  8. class MainWindow;
  9. class LegacyApplication : public QApplication
  10. {
  11. Q_OBJECT
  12. public:
  13. enum ErrorStatus : int {
  14. E_WRONG_GAME_FOLDER = 32,
  15. E_DAT_FILES_MISSING = 16,
  16. E_WRONG_FILE_PERMISSIONS = 8,
  17. E_CANNOT_ACCESS_DAT_FILES = 4,
  18. E_DAT_FILE_INCORRECT = 2,
  19. E_NO_SERVER_CONNECTION = 1,
  20. E_NO_ERRORS = 0
  21. };
  22. LegacyApplication(int &argc, char** argv);
  23. bool init();
  24. signals:
  25. void ErrorStatusChanged(ErrorStatus status);
  26. void SecondsToNextTryToInitChanged(size_t seconds_elapsed);
  27. private:
  28. void InitModules();
  29. ErrorStatus CheckErrorStatus();
  30. private slots:
  31. void HandleModulesInitTimer();
  32. private:
  33. LotroDatManager *lotro_dat_manager = nullptr;
  34. QThread *lotro_dat_manager_thread = nullptr;
  35. PatchList *patch_list = nullptr;
  36. MainWindow *gui = nullptr;
  37. QTimer modules_init_timer_;
  38. size_t seconds_after_previous_try_to_init_ = 10; // init value should be equal to try_to_init_timeout_
  39. const size_t try_to_init_timeout_ = 10;
  40. };
  41. QDebug operator<<(QDebug dbg, const LegacyApplication::ErrorStatus &status);
  42. #endif // LEGACYAPPLICATION_H