diff options
Diffstat (limited to 'api')
85 files changed, 1649 insertions, 5033 deletions
diff --git a/api/logic/BaseInstance.cpp b/api/logic/BaseInstance.cpp index 6d719c32..ee9e919d 100644 --- a/api/logic/BaseInstance.cpp +++ b/api/logic/BaseInstance.cpp @@ -23,7 +23,6 @@ #include "settings/Setting.h" #include "settings/OverrideSetting.h" -#include "minecraft/MinecraftVersionList.h" #include "FileSystem.h" #include "Commandline.h" diff --git a/api/logic/BaseVersionList.cpp b/api/logic/BaseVersionList.cpp index 5ad4df3c..8b424c11 100644 --- a/api/logic/BaseVersionList.cpp +++ b/api/logic/BaseVersionList.cpp @@ -30,7 +30,7 @@ BaseVersionPtr BaseVersionList::findVersion(const QString &descriptor) return BaseVersionPtr(); } -BaseVersionPtr BaseVersionList::getLatestStable() const +BaseVersionPtr BaseVersionList::getRecommended() const { if (count() <= 0) return BaseVersionPtr(); @@ -38,11 +38,6 @@ BaseVersionPtr BaseVersionList::getLatestStable() const return at(0); } -BaseVersionPtr BaseVersionList::getRecommended() const -{ - return getLatestStable(); -} - QVariant BaseVersionList::data(const QModelIndex &index, int role) const { if (!index.isValid()) @@ -93,7 +88,7 @@ QHash<int, QByteArray> BaseVersionList::roleNames() const QHash<int, QByteArray> roles = QAbstractListModel::roleNames(); roles.insert(VersionRole, "version"); roles.insert(VersionIdRole, "versionId"); - roles.insert(ParentGameVersionRole, "parentGameVersion"); + roles.insert(ParentVersionRole, "parentGameVersion"); roles.insert(RecommendedRole, "recommended"); roles.insert(LatestRole, "latest"); roles.insert(TypeRole, "type"); diff --git a/api/logic/BaseVersionList.h b/api/logic/BaseVersionList.h index eadc6933..655bbd43 100644 --- a/api/logic/BaseVersionList.h +++ b/api/logic/BaseVersionList.h @@ -22,6 +22,7 @@ #include "BaseVersion.h" #include "tasks/Task.h" #include "multimc_logic_export.h" +#include "QObjectPtr.h" /*! * \brief Class that each instance type's version list derives from. @@ -44,7 +45,7 @@ public: VersionPointerRole = Qt::UserRole, VersionRole, VersionIdRole, - ParentGameVersionRole, + ParentVersionRole, RecommendedRole, LatestRole, TypeRole, @@ -63,7 +64,7 @@ public: * The task returned by this function should reset the model when it's done. * \return A pointer to a task that reloads the version list. */ - virtual Task *getLoadTask() = 0; + virtual shared_qobject_ptr<Task> getLoadTask() = 0; //! Checks whether or not the list is loaded. If this returns false, the list should be //loaded. @@ -76,28 +77,23 @@ public: virtual int count() const = 0; //////// List Model Functions //////// - virtual QVariant data(const QModelIndex &index, int role) const; - virtual int rowCount(const QModelIndex &parent) const; - virtual int columnCount(const QModelIndex &parent) const; - virtual QHash<int, QByteArray> roleNames() const override; + QVariant data(const QModelIndex &index, int role) const override; + int rowCount(const QModelIndex &parent) const override; + int columnCount(const QModelIndex &parent) const override; + virtual QHash<int, QByteArray> roleNames() const; //! which roles are provided by this version list? virtual RoleList providesRoles() const; /*! * \brief Finds a version by its descriptor. - * \param The descriptor of the version to find. + * \param descriptor The descriptor of the version to find. * \return A const pointer to the version with the given descriptor. NULL if * one doesn't exist. */ virtual BaseVersionPtr findVersion(const QString &descriptor); /*! - * \brief Gets the latest stable version from this list - */ - virtual BaseVersionPtr getLatestStable() const; - - /*! * \brief Gets the recommended version from this list * If the list doesn't support recommended versions, this works exactly as getLatestStable */ diff --git a/api/logic/CMakeLists.txt b/api/logic/CMakeLists.txt index bcf4b65a..da673c13 100644 --- a/api/logic/CMakeLists.txt +++ b/api/logic/CMakeLists.txt @@ -252,10 +252,6 @@ set(MINECRAFT_SOURCES minecraft/JarMod.h minecraft/MinecraftInstance.cpp minecraft/MinecraftInstance.h - minecraft/MinecraftVersion.cpp - minecraft/MinecraftVersion.h - minecraft/MinecraftVersionList.cpp - minecraft/MinecraftVersionList.h minecraft/Rule.cpp minecraft/Rule.h minecraft/OpSys.cpp @@ -271,6 +267,7 @@ set(MINECRAFT_SOURCES minecraft/VersionBuildError.h minecraft/VersionFile.cpp minecraft/VersionFile.h + minecraft/ProfilePatch.cpp minecraft/ProfilePatch.h minecraft/VersionFilterData.h minecraft/VersionFilterData.cpp @@ -300,22 +297,10 @@ set(MINECRAFT_SOURCES minecraft/AssetsUtils.cpp # Forge and all things forge related - minecraft/forge/ForgeVersion.h - minecraft/forge/ForgeVersion.cpp - minecraft/forge/ForgeVersionList.h - minecraft/forge/ForgeVersionList.cpp minecraft/forge/ForgeXzDownload.h minecraft/forge/ForgeXzDownload.cpp - minecraft/forge/LegacyForge.h - minecraft/forge/LegacyForge.cpp - minecraft/forge/ForgeInstaller.h - minecraft/forge/ForgeInstaller.cpp - - # Liteloader and related things - minecraft/liteloader/LiteLoaderInstaller.h - minecraft/liteloader/LiteLoaderInstaller.cpp - minecraft/liteloader/LiteLoaderVersionList.h - minecraft/liteloader/LiteLoaderVersionList.cpp + + # Skin upload utilities minecraft/SkinUpload.cpp minecraft/SkinUpload.h ) @@ -430,32 +415,22 @@ set(TOOLS_SOURCES tools/MCEditTool.h ) -set(WONKO_SOURCES - # Wonko - wonko/tasks/BaseWonkoEntityRemoteLoadTask.cpp - wonko/tasks/BaseWonkoEntityRemoteLoadTask.h - wonko/tasks/BaseWonkoEntityLocalLoadTask.cpp - wonko/tasks/BaseWonkoEntityLocalLoadTask.h - wonko/format/WonkoFormatV1.cpp - wonko/format/WonkoFormatV1.h - wonko/format/WonkoFormat.cpp - wonko/format/WonkoFormat.h - wonko/BaseWonkoEntity.cpp - wonko/BaseWonkoEntity.h - wonko/WonkoVersionList.cpp - wonko/WonkoVersionList.h - wonko/WonkoVersion.cpp - wonko/WonkoVersion.h - wonko/WonkoIndex.cpp - wonko/WonkoIndex.h - wonko/WonkoUtil.cpp - wonko/WonkoUtil.h - wonko/WonkoReference.cpp - wonko/WonkoReference.h +set(META_SOURCES + # Metadata sources + meta/JsonFormat.cpp + meta/JsonFormat.h + meta/BaseEntity.cpp + meta/BaseEntity.h + meta/VersionList.cpp + meta/VersionList.h + meta/Version.cpp + meta/Version.h + meta/Index.cpp + meta/Index.h ) -add_unit_test(WonkoIndex - SOURCES wonko/WonkoIndex_test.cpp +add_unit_test(Index + SOURCES meta/Index_test.cpp LIBS MultiMC_logic ) @@ -480,7 +455,7 @@ set(LOGIC_SOURCES ${JAVA_SOURCES} ${TRANSLATIONS_SOURCES} ${TOOLS_SOURCES} - ${WONKO_SOURCES} + ${META_SOURCES} ${ICONS_SOURCES} ) diff --git a/api/logic/Env.cpp b/api/logic/Env.cpp index a6341ebd..d7be4a28 100644 --- a/api/logic/Env.cpp +++ b/api/logic/Env.cpp @@ -7,7 +7,7 @@ #include <QNetworkAccessManager> #include <QDebug> #include "tasks/Task.h" -#include "wonko/WonkoIndex.h" +#include "meta/Index.h" #include <QDebug> @@ -18,8 +18,7 @@ public: shared_qobject_ptr<HttpMetaCache> m_metacache; std::shared_ptr<IIconList> m_iconlist; QMap<QString, std::shared_ptr<BaseVersionList>> m_versionLists; - shared_qobject_ptr<WonkoIndex> m_wonkoIndex; - QString m_wonkoRootUrl; + shared_qobject_ptr<Meta::Index> m_metadataIndex; }; static Env * instance; @@ -99,13 +98,13 @@ void Env::registerVersionList(QString name, std::shared_ptr< BaseVersionList > v d->m_versionLists[name] = vlist; } -shared_qobject_ptr<WonkoIndex> Env::wonkoIndex() +shared_qobject_ptr<Meta::Index> Env::metadataIndex() { - if (!d->m_wonkoIndex) + if (!d->m_metadataIndex) { - d->m_wonkoIndex.reset(new WonkoIndex()); + d->m_metadataIndex.reset(new Meta::Index()); } - return d->m_wonkoIndex; + return d->m_metadataIndex; } @@ -125,7 +124,7 @@ void Env::initHttpMetaCache() m_metacache->addBase("root", QDir::currentPath()); m_metacache->addBase("translations", QDir("translations").absolutePath()); m_metacache->addBase("icons", QDir("cache/icons").absolutePath()); - m_metacache->addBase("wonko", QDir("cache/wonko").absolutePath()); + m_metacache->addBase("meta", QDir("meta").absolutePath()); m_metacache->Load(); } @@ -191,14 +190,4 @@ void Env::updateProxySettings(QString proxyTypeStr, QString addr, int port, QStr qDebug() << proxyDesc; } -QString Env::wonkoRootUrl() const -{ - return d->m_wonkoRootUrl; -} - -void Env::setWonkoRootUrl(const QString& url) -{ - d->m_wonkoRootUrl = url; -} - -#include "Env.moc"
\ No newline at end of file +#include "Env.moc" diff --git a/api/logic/Env.h b/api/logic/Env.h index c72447ce..75ebe4a0 100644 --- a/api/logic/Env.h +++ b/api/logic/Env.h @@ -13,7 +13,11 @@ class QNetworkAccessManager; class HttpMetaCache; class BaseVersionList; class BaseVersion; -class WonkoIndex; + +namespace Meta +{ +class Index; +} #if defined(ENV) #undef ENV @@ -53,10 +57,7 @@ public: void registerIconList(std::shared_ptr<IIconList> iconlist); - shared_qobject_ptr<WonkoIndex> wonkoIndex(); - - QString wonkoRootUrl() const; - void setWonkoRootUrl(const QString &url); + shared_qobject_ptr<Meta::Index> metadataIndex(); protected: Private * d; diff --git a/api/logic/InstanceCreationTask.cpp b/api/logic/InstanceCreationTask.cpp index 00156701..e7b0de7c 100644 --- a/api/logic/InstanceCreationTask.cpp +++ b/api/logic/InstanceCreationTask.cpp @@ -4,7 +4,6 @@ #include "FileSystem.h" //FIXME: rem |
