gameres.h 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. int openDatFile(int id); // Opens .dat file by its id (0-local_English.dat)
  20. int 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. int 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. int 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. std::string getDatPath(int id);
  31. signals:
  32. // Signals for gui updating - describe process of patching.
  33. void startedPatching(QString patchname);
  34. void updatedPatchPercent(int percent);
  35. void finishedPatching(QString patchname, QString result);
  36. private:
  37. int dateToTimestamp(QString customDateString, QString format);
  38. void processFile();
  39. void applyLoadscreens();
  40. bool isDatReady(); // Checks if file is ready to write data
  41. private slots:
  42. void applyMicroPatch(QString filename);
  43. private:
  44. QThread *thread_;
  45. bool busy_;
  46. Database db_;
  47. DatFile datfiles_[5];
  48. LOCALE locale_;
  49. };
  50. #endif // GAMERES_H