gameres.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. #ifndef GAMERES_H
  2. #define GAMERES_H
  3. #include <QObject>
  4. #include <QThread>
  5. #include <LotroDat.h>
  6. using namespace LOTRO_DAT;
  7. class GameRes : public QObject {
  8. Q_OBJECT
  9. // Singleton realisation of class
  10. private:
  11. GameRes();
  12. public:
  13. static GameRes* getInstance() {
  14. static GameRes instance;
  15. return &instance;
  16. }
  17. // Basic public functions
  18. public slots:
  19. void openDatFile(int id); // Opens .dat file by its id (0-local_English.dat)
  20. void closeDatFile(int id); // Closes .dat file by its id
  21. void applyPatch(QString name); // Applies patch by its name (sounds/texts/images/videos/textures/loadscreens)
  22. void setGameLocale(QString locale); // Sets locale by its name (Original/RU)
  23. void startGame(); // Starts detatched game application process
  24. void installMicroPatch(); // Installs latest micro-patch
  25. void applyAll(); // Installs all patches (applyGlobal)
  26. bool isBusy() {return false;} // !!!!TO BE DONE Returns true if operations with game res are working now
  27. void checkDatFile(); // Checks and returns information if dat file is clear/updated
  28. QStringList getLotroPath(); // Returns path to LotRO files
  29. void saveAllDatFiles(); // Saves and closes all .dat files
  30. signals:
  31. // Signals for every public function finish. Gives result int value.
  32. void openDatFileFinished(int result);
  33. void closeDatFileFinished(int result);
  34. void applyPatchFinished(int result);
  35. void setGameLocaleFinished(int result);
  36. void startGameFinished(int result);
  37. void installMicroPatchFinished(int result);
  38. void applyAllFinished(int result);
  39. void checkDatFileFinished(int result);
  40. // Signals for gui updating - describe process of patching.
  41. void startedPatching(QString patchname);
  42. void updatedPatchPercent(int percent);
  43. void finishedPatching(QString patchname, QString result);
  44. private:
  45. int dateToTimestamp(QString customDateString, QString format);
  46. void processFile();
  47. void applyLoadscreens();
  48. bool isDatReady(); // Checks if file is ready to write data
  49. std::string getDatPath(int id);
  50. private slots:
  51. void applyMicroPatch(QString filename);
  52. private:
  53. QThread *thread_;
  54. bool busy_;
  55. Database db_;
  56. DatFile datfiles_[5];
  57. LOCALE locale_;
  58. };
  59. #endif // GAMERES_H