diff options
author | Petr Mrázek <peterix@gmail.com> | 2014-05-11 12:37:21 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2014-06-09 01:38:30 +0200 |
commit | 69c3e7111f93290d1278d6116e9fd50079b4fe79 (patch) | |
tree | cbaed3022e8705f1da29777afea0fca16c1abe60 /logic/minecraft/MinecraftVersionList.h | |
parent | 92abe4c603e1f4931cd02ae6b752cb7054d8e30d (diff) | |
download | MultiMC-69c3e7111f93290d1278d6116e9fd50079b4fe79.tar MultiMC-69c3e7111f93290d1278d6116e9fd50079b4fe79.tar.gz MultiMC-69c3e7111f93290d1278d6116e9fd50079b4fe79.tar.lz MultiMC-69c3e7111f93290d1278d6116e9fd50079b4fe79.tar.xz MultiMC-69c3e7111f93290d1278d6116e9fd50079b4fe79.zip |
Make 1.6+ work with new instance format.
Diffstat (limited to 'logic/minecraft/MinecraftVersionList.h')
-rw-r--r-- | logic/minecraft/MinecraftVersionList.h | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/logic/minecraft/MinecraftVersionList.h b/logic/minecraft/MinecraftVersionList.h index 18b9b21e..bbbd71e1 100644 --- a/logic/minecraft/MinecraftVersionList.h +++ b/logic/minecraft/MinecraftVersionList.h @@ -22,8 +22,10 @@ #include "logic/BaseVersionList.h" #include "logic/tasks/Task.h" #include "logic/minecraft/MinecraftVersion.h" +#include <logic/net/NetJob.h> class MCVListLoadTask; +class MCVListVersionUpdateTask; class QNetworkReply; class MinecraftVersionList : public BaseVersionList @@ -32,11 +34,18 @@ class MinecraftVersionList : public BaseVersionList private: void sortInternal(); void loadBuiltinList(); + void loadMojangList(QByteArray data, VersionSource source); + void loadCachedList(); + void saveCachedList(); + void finalizeUpdate(QString version); public: friend class MCVListLoadTask; + friend class MCVListVersionUpdateTask; explicit MinecraftVersionList(QObject *parent = 0); + std::shared_ptr<Task> createUpdateTask(QString version); + virtual Task *getLoadTask(); virtual bool isLoaded(); virtual const BaseVersionPtr at(int i) const; @@ -47,8 +56,12 @@ public: protected: QList<BaseVersionPtr> m_vlist; + QMap<QString, BaseVersionPtr> m_lookup; bool m_loaded = false; + bool m_hasLocalIndex = false; + QString m_latestReleaseID = "INVALID"; + QString m_latestSnapshotID = "INVALID"; protected slots: @@ -61,9 +74,9 @@ class MCVListLoadTask : public Task public: explicit MCVListLoadTask(MinecraftVersionList *vlist); - ~MCVListLoadTask(); + virtual ~MCVListLoadTask() override{}; - virtual void executeTask(); + virtual void executeTask() override; protected slots: @@ -74,3 +87,22 @@ protected: MinecraftVersionList *m_list; MinecraftVersion *m_currentStable; }; + +class MCVListVersionUpdateTask : public Task +{ + Q_OBJECT + +public: + explicit MCVListVersionUpdateTask(MinecraftVersionList *vlist, QString updatedVersion); + virtual ~MCVListVersionUpdateTask() override{}; + virtual void executeTask() override; + +protected +slots: + void json_downloaded(); + +protected: + NetJobPtr specificVersionDownloadJob; + QString versionToUpdate; + MinecraftVersionList *m_list; +}; |