123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- #ifndef LEGACYAPP_H
- #define LEGACYAPP_H
- #include <QObject>
- #include <QSqlDatabase>
- #include "models/downloader.h"
- #include <LotroDat/datfile.h>
- #include <LotroDat/database.h>
- class PatchInstaller : public QObject
- {
- Q_OBJECT
- public:
- struct Status {
- size_t total_parts = 0;
- size_t finished_parts = 0;
- };
- struct AppliedPatchesInfo {
- bool patched_by_old_legacy = false;
- bool has_no_patch_mark = false;
- QString texts_patch_hashsum = "";
- QString images_patch_hashsum = "";
- QString sounds_patch_hashsum = "";
- QString loadscreens_patch_hashsum = "";
- QString textures_patch_hashsum = "";
- QString fonts_patch_hashsum = "";
- QString videos_patch_hashsum = "";
- };
- public:
- static PatchInstaller& instance() {
- static PatchInstaller instance_;
- return instance_;
- }
- bool initialised();
- ~PatchInstaller();
- AppliedPatchesInfo getPatchesInfo(); // TODO: Implement
- private:
- Q_DISABLE_COPY(PatchInstaller)
- enum RESOURCE_FILE_TYPE : int {
- E_CLIENT_LOCAL = 0,
- E_CLIENT_GENERAL = 1
- };
- explicit PatchInstaller(QObject *parent = nullptr);
- bool datPathIsRelevant();
- void installPatch(QString patch_name, LOTRO_DAT::Database* database);
- void installLoadscreens(LOTRO_DAT::Database* database);
- void installVideos(LOTRO_DAT::Database* database);
- AppliedPatchesInfo getAppliedPatchesInfoFromDatFile();
- void insertPatchesInfoInDatFile(const AppliedPatchesInfo& info);
- public slots:
- void deinit();
- void init();
- void startGame(bool freeze_updates);
- void startPatchInstallationChain();
- private slots:
- void onDownloaderProgressChanged(Downloader* context, Downloader::Status progress);
- signals:
- void started();
- void progressChanged(PatchInstaller::Status status);
- void videosDownloadProgressChanged(int finished_videos, int total_videos, Downloader::Status status);
- void finished();
- void successfullyInitialized();
- void deinitialized();
- private:
- LOTRO_DAT::DatFile* client_local_file_;
- LOTRO_DAT::DatFile* client_general_file_;
- QSqlDatabase orig_files_db;
- const QString create_table_query = "CREATE TABLE IF NOT EXISTS `patch_data` "
- "(`file_id` INTEGER PRIMARY KEY,"
- "`binary_data` BLOB, "
- "`text_data` TEXT, "
- "`options` TEXT NOT NULL)";
- // const QString upset_table_value_query = "INSERT INTO `patch_data` (`file_id`, ``) VALUES (?);";
- AppliedPatchesInfo _current_applied_patches_info;
- Status current_status;
- const int _applied_patches_file_id = 0x2500F0F0;
- int download_video_finished_videos = 0;
- int download_video_total_videos = 0;
- };
- Q_DECLARE_METATYPE(PatchInstaller::Status)
- #endif // LEGACYAPP_H
|