#ifndef LEGACYAPP_H #define LEGACYAPP_H #include #include #include "models/downloader.h" #include #include class PatchInstaller : public QObject { Q_OBJECT public: struct Status { size_t total_parts = 0; size_t finished_parts = 0; }; public: static PatchInstaller& instance() { static PatchInstaller instance_; return instance_; } bool initialised(); ~PatchInstaller(); // TODO: bool NotPatched(); 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 deinit(); void installPatch(QString patch_name, LOTRO_DAT::Database* database); void installLoadscreens(LOTRO_DAT::Database* database); void installVideos(LOTRO_DAT::Database* database); public slots: 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(); 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 (?);"; Status current_status; int download_video_finished_videos = 0; int download_video_total_videos = 0; }; Q_DECLARE_METATYPE(PatchInstaller::Status) #endif // LEGACYAPP_H