diff options
author | Petr Mrázek <peterix@gmail.com> | 2013-12-15 23:47:57 +0100 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2013-12-15 23:47:57 +0100 |
commit | 5df86d9ffa53877f7e7b84bafb8dc8134c61ab82 (patch) | |
tree | 10bb64b1aaca91e24978302e984e73e1d9908859 /logic/updater/DownloadUpdateTask.h | |
parent | b773ef08afff14bf0e342578c21122758c26b680 (diff) | |
parent | 7f884a18a85eca8c1a395ab0e9d421f17a98f142 (diff) | |
download | PrismLauncher-5df86d9ffa53877f7e7b84bafb8dc8134c61ab82.tar.gz PrismLauncher-5df86d9ffa53877f7e7b84bafb8dc8134c61ab82.tar.bz2 PrismLauncher-5df86d9ffa53877f7e7b84bafb8dc8134c61ab82.zip |
Merge branch 'updater_tests' of https://github.com/02JanDal/MultiMC5 into develop
Diffstat (limited to 'logic/updater/DownloadUpdateTask.h')
-rw-r--r-- | logic/updater/DownloadUpdateTask.h | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/logic/updater/DownloadUpdateTask.h b/logic/updater/DownloadUpdateTask.h index f5b23d12..8530be77 100644 --- a/logic/updater/DownloadUpdateTask.h +++ b/logic/updater/DownloadUpdateTask.h @@ -34,7 +34,8 @@ public: */ QString updateFilesDir(); -protected: +public: + // TODO: We should probably put these data structures into a separate header... /*! @@ -53,7 +54,6 @@ protected: QString url; QString compressionType; }; - typedef QList<FileSource> FileSourceList; /*! @@ -66,10 +66,8 @@ protected: FileSourceList sources; QString md5; }; - typedef QList<VersionFileEntry> VersionFileList; - /*! * Structure that describes an operation to perform when installing updates. */ @@ -100,9 +98,12 @@ protected: // Yeah yeah, polymorphism blah blah inheritance, blah blah object oriented. I'm lazy, OK? }; - typedef QList<UpdateOperation> UpdateOperationList; +protected: + friend class DownloadUpdateTaskTest; + + /*! * Used for arguments to parseVersionInfo and friends to specify which version info file to parse. */ @@ -120,6 +121,13 @@ protected: virtual void findCurrentVersionInfo(); /*! + * This runs after we've tried loading the channel list. + * If the channel list doesn't need to be loaded, this will be called immediately. + * If the channel list does need to be loaded, this will be called when it's done. + */ + void processChannels(); + + /*! * Downloads the version info files from the repository. * The files for both the current build, and the build that we're updating to need to be downloaded. * If the current version's info file can't be found, MultiMC will not delete files that @@ -142,20 +150,25 @@ protected: /*! * Loads the file list from the given version info JSON object into the given list. */ - virtual void parseVersionInfo(VersionInfoFileEnum vfile, VersionFileList* list); + virtual bool parseVersionInfo(const QByteArray &data, VersionFileList* list, QString *error); /*! * Takes a list of file entries for the current version's files and the new version's files * and populates the downloadList and operationList with information about how to download and install the update. */ + virtual void processFileLists(NetJob *job, const VersionFileList ¤tVersion, const VersionFileList &newVersion, UpdateOperationList &ops); + + /*! + * Calls \see processFileLists to populate the \see m_operationList and a NetJob, and then executes + * the NetJob to fetch all needed files + */ virtual void processFileLists(); /*! * Takes the operations list and writes an install script for the updater to the update files directory. */ - virtual void writeInstallScript(UpdateOperationList& opsList, QString scriptFile); + virtual bool writeInstallScript(UpdateOperationList& opsList, QString scriptFile); - VersionFileList m_downloadList; UpdateOperationList m_operationList; VersionFileList m_nVersionFileList; @@ -181,6 +194,11 @@ protected: */ QTemporaryDir m_updateFilesDir; + /*! + * Substitutes $PWD for the application directory + */ + static QString preparePath(const QString &path); + protected slots: void vinfoDownloadFinished(); void vinfoDownloadFailed(); |