summaryrefslogtreecommitdiffstats
path: root/logic/updater/DownloadUpdateTask.h
diff options
context:
space:
mode:
Diffstat (limited to 'logic/updater/DownloadUpdateTask.h')
-rw-r--r--logic/updater/DownloadUpdateTask.h34
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 &currentVersion, 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();