legacyapplication.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. public slots:
  28. void TryToInitFunctionalModules();
  29. private:
  30. ErrorStatus CheckErrorStatus();
  31. private:
  32. LotroDatManager *lotro_dat_manager = nullptr;
  33. QThread *lotro_dat_manager_thread = nullptr;
  34. PatchList *patch_list = nullptr;
  35. MainWindow *gui = nullptr;
  36. QTimer try_to_init_functional_modules_timer_;
  37. size_t seconds_after_previous_try_to_init_ = 10; // init value should be equal to try_to_init_timeout_
  38. const size_t try_to_init_timeout_ = 10;
  39. };
  40. QDebug operator<<(QDebug dbg, const LegacyApplication::ErrorStatus &status);
  41. #endif // LEGACYAPPLICATION_H