gameres.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. GameRes(const GameRes&);
  13. GameRes& operator=(GameRes&);
  14. public:
  15. GameRes* getInstance() {
  16. static GameRes instance;
  17. return instance;
  18. }
  19. // Basic public functions
  20. public:
  21. void openDatFile(int id); // Opens .dat file by its id (0-local_English.dat)
  22. void closeDatFile(int id); // Closes .dat file by its id
  23. void applyPatch(QString name); // Applies patch by its name (sounds/texts/images/videos/textures/loadscreens)
  24. void setGameLocale(QString locale); // Sets locale by its name (Original/RU)
  25. void startGame(); // Starts detatched game application process
  26. void installMicroPatch(); // Installs latest micro-patch
  27. void applyAll(); // Installs all patches (applyGlobal)
  28. bool isBusy() {} // !!!!TO BE DONE Returns true if operations with game res are working now
  29. void checkDatFile(); // Checks and returns information if dat file is clear/updated
  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. void processFile();
  46. void prepareMicroPatch();
  47. void applyMicroPatch();
  48. void applyLoadscreens();
  49. bool isDatReady(); // Checks if file is ready to write data
  50. private:
  51. QThread *thread_;
  52. bool busy_;
  53. DatFile datfiles_[5];
  54. Database db_;
  55. LOCALE locale_;
  56. };
  57. #endif // GAMERES_H