#ifndef PATCHDOWNLOADER_H #define PATCHDOWNLOADER_H #include #include #include #include #include "models/downloader.h" class PatchDownloader : public QObject { Q_OBJECT public: static PatchDownloader& instance() { static PatchDownloader instance_; return instance_; } ~PatchDownloader(); private: Q_DISABLE_COPY(PatchDownloader) PatchDownloader(); void downloadDatabases(); // Starts downloading all necessary patches. static bool needDownloadDatabase(QString db_name); // Checks if database needs to be downloaded (by checksum comparing) public slots: void init(); void checkForUpdates(); // Checks for updates void startPatchDownloaderChain(); signals: void started(); void progressChanged(Downloader::Status status); void finished(); private slots: void onDownloaderProgressChanged(Downloader* context, Downloader::Status progress); void onDownloaderFinished(Downloader* context); private: bool started_ = false; const QList patches_ = {"text", "font", "image", "texture", "loadscreen", "sound", "video"}; QMap patch_downloaders_; QMap patch_downloaders_status_; }; #endif // PATCHDOWNLOADER_H