diff --git a/api/logic/CMakeLists.txt b/api/logic/CMakeLists.txt index 38b15286..e5047d38 100644 --- a/api/logic/CMakeLists.txt +++ b/api/logic/CMakeLists.txt @@ -237,8 +237,8 @@ set(MINECRAFT_SOURCES minecraft/GradleSpecifier.h minecraft/MinecraftInstance.cpp minecraft/MinecraftInstance.h - minecraft/MinecraftProfile.cpp - minecraft/MinecraftProfile.h + minecraft/ComponentList.cpp + minecraft/ComponentList.h minecraft/MinecraftUpdate.h minecraft/MinecraftUpdate.cpp minecraft/MojangVersionFormat.cpp diff --git a/api/logic/InstanceImportTask.cpp b/api/logic/InstanceImportTask.cpp index 4e841694..e2782cd8 100644 --- a/api/logic/InstanceImportTask.cpp +++ b/api/logic/InstanceImportTask.cpp @@ -11,7 +11,7 @@ // FIXME: this does not belong here, it's Minecraft/Flame specific #include "minecraft/MinecraftInstance.h" -#include "minecraft/MinecraftProfile.h" +#include "minecraft/ComponentList.h" #include "minecraft/flame/FileResolvingTask.h" #include "minecraft/flame/PackManifest.h" #include "Json.h" @@ -293,7 +293,7 @@ void InstanceImportTask::processFlame() qDebug() << info.fileName(); jarMods.push_back(info.absoluteFilePath()); } - auto profile = instance.getMinecraftProfile(); + auto profile = instance.getComponentList(); profile->installJarMods(jarMods); // nuke the original files FS::deletePath(jarmodsPath); diff --git a/api/logic/meta/Version.cpp b/api/logic/meta/Version.cpp index b00a29e7..bf739157 100644 --- a/api/logic/meta/Version.cpp +++ b/api/logic/meta/Version.cpp @@ -18,7 +18,7 @@ #include #include "JsonFormat.h" -#include "minecraft/MinecraftProfile.h" +#include "minecraft/ComponentList.h" Meta::Version::Version(const QString &uid, const QString &version) : BaseVersion(), m_uid(uid), m_version(version) diff --git a/api/logic/minecraft/MinecraftProfile.cpp b/api/logic/minecraft/ComponentList.cpp similarity index 84% rename from api/logic/minecraft/MinecraftProfile.cpp rename to api/logic/minecraft/ComponentList.cpp index a9552af2..8ce1fded 100644 --- a/api/logic/minecraft/MinecraftProfile.cpp +++ b/api/logic/minecraft/ComponentList.cpp @@ -21,7 +21,7 @@ #include #include -#include "minecraft/MinecraftProfile.h" +#include "minecraft/ComponentList.h" #include "Exception.h" #include #include @@ -31,18 +31,18 @@ #include #include -MinecraftProfile::MinecraftProfile(MinecraftInstance * instance) +ComponentList::ComponentList(MinecraftInstance * instance) : QAbstractListModel() { m_instance = instance; clear(); } -MinecraftProfile::~MinecraftProfile() +ComponentList::~ComponentList() { } -void MinecraftProfile::reload() +void ComponentList::reload() { beginResetModel(); load_internal(); @@ -50,7 +50,7 @@ void MinecraftProfile::reload() endResetModel(); } -void MinecraftProfile::clear() +void ComponentList::clear() { m_minecraftVersion.clear(); m_minecraftVersionType.clear(); @@ -66,14 +66,14 @@ void MinecraftProfile::clear() m_problemSeverity = ProblemSeverity::None; } -void MinecraftProfile::clearPatches() +void ComponentList::clearPatches() { beginResetModel(); m_patches.clear(); endResetModel(); } -void MinecraftProfile::appendPatch(ProfilePatchPtr patch) +void ComponentList::appendPatch(ProfilePatchPtr patch) { int index = m_patches.size(); beginInsertRows(QModelIndex(), index, index); @@ -81,7 +81,7 @@ void MinecraftProfile::appendPatch(ProfilePatchPtr patch) endInsertRows(); } -bool MinecraftProfile::remove(const int index) +bool ComponentList::remove(const int index) { auto patch = versionPatch(index); if (!patch->isRemovable()) @@ -104,7 +104,7 @@ bool MinecraftProfile::remove(const int index) return true; } -bool MinecraftProfile::remove(const QString id) +bool ComponentList::remove(const QString id) { int i = 0; for (auto patch : m_patches) @@ -118,7 +118,7 @@ bool MinecraftProfile::remove(const QString id) return false; } -bool MinecraftProfile::customize(int index) +bool ComponentList::customize(int index) { auto patch = versionPatch(index); if (!patch->isCustomizable()) @@ -138,7 +138,7 @@ bool MinecraftProfile::customize(int index) return true; } -bool MinecraftProfile::revertToBase(int index) +bool ComponentList::revertToBase(int index) { auto patch = versionPatch(index); if (!patch->isRevertible()) @@ -158,7 +158,7 @@ bool MinecraftProfile::revertToBase(int index) return true; } -ProfilePatchPtr MinecraftProfile::versionPatch(const QString &id) +ProfilePatchPtr ComponentList::versionPatch(const QString &id) { for (auto patch : m_patches) { @@ -170,14 +170,14 @@ ProfilePatchPtr MinecraftProfile::versionPatch(const QString &id) return nullptr; } -ProfilePatchPtr MinecraftProfile::versionPatch(int index) +ProfilePatchPtr ComponentList::versionPatch(int index) { if(index < 0 || index >= m_patches.size()) return nullptr; return m_patches[index]; } -bool MinecraftProfile::isVanilla() +bool ComponentList::isVanilla() { for(auto patchptr: m_patches) { @@ -187,7 +187,7 @@ bool MinecraftProfile::isVanilla() return true; } -bool MinecraftProfile::revertToVanilla() +bool ComponentList::revertToVanilla() { // remove patches, if present auto VersionPatchesCopy = m_patches; @@ -213,7 +213,7 @@ bool MinecraftProfile::revertToVanilla() return true; } -QVariant MinecraftProfile::data(const QModelIndex &index, int role) const +QVariant ComponentList::data(const QModelIndex &index, int role) const { if (!index.isValid()) return QVariant(); @@ -272,7 +272,7 @@ QVariant MinecraftProfile::data(const QModelIndex &index, int role) const } return QVariant(); } -QVariant MinecraftProfile::headerData(int section, Qt::Orientation orientation, int role) const +QVariant ComponentList::headerData(int section, Qt::Orientation orientation, int role) const { if (orientation == Qt::Horizontal) { @@ -291,24 +291,24 @@ QVariant MinecraftProfile::headerData(int section, Qt::Orientation orientation, } return QVariant(); } -Qt::ItemFlags MinecraftProfile::flags(const QModelIndex &index) const +Qt::ItemFlags ComponentList::flags(const QModelIndex &index) const { if (!index.isValid()) return Qt::NoItemFlags; return Qt::ItemIsSelectable | Qt::ItemIsEnabled; } -int MinecraftProfile::rowCount(const QModelIndex &parent) const +int ComponentList::rowCount(const QModelIndex &parent) const { return m_patches.size(); } -int MinecraftProfile::columnCount(const QModelIndex &parent) const +int ComponentList::columnCount(const QModelIndex &parent) const { return 2; } -void MinecraftProfile::saveCurrentOrder() const +void ComponentList::saveCurrentOrder() const { ProfileUtils::PatchOrder order; for(auto item: m_patches) @@ -320,7 +320,7 @@ void MinecraftProfile::saveCurrentOrder() const saveOrder_internal(order); } -void MinecraftProfile::move(const int index, const MoveDirection direction) +void ComponentList::move(const int index, const MoveDirection direction) { int theirIndex; if (direction == MoveUp) @@ -355,13 +355,13 @@ void MinecraftProfile::move(const int index, const MoveDirection direction) reapplyPatches(); saveCurrentOrder(); } -void MinecraftProfile::resetOrder() +void ComponentList::resetOrder() { resetOrder_internal(); reload(); } -bool MinecraftProfile::reapplyPatches() +bool ComponentList::reapplyPatches() { try { @@ -388,32 +388,32 @@ static void applyString(const QString & from, QString & to) to = from; } -void MinecraftProfile::applyMinecraftVersion(const QString& id) +void ComponentList::applyMinecraftVersion(const QString& id) { applyString(id, this->m_minecraftVersion); } -void MinecraftProfile::applyAppletClass(const QString& appletClass) +void ComponentList::applyAppletClass(const QString& appletClass) { applyString(appletClass, this->m_appletClass); } -void MinecraftProfile::applyMainClass(const QString& mainClass) +void ComponentList::applyMainClass(const QString& mainClass) { applyString(mainClass, this->m_mainClass); } -void MinecraftProfile::applyMinecraftArguments(const QString& minecraftArguments) +void ComponentList::applyMinecraftArguments(const QString& minecraftArguments) { applyString(minecraftArguments, this->m_minecraftArguments); } -void MinecraftProfile::applyMinecraftVersionType(const QString& type) +void ComponentList::applyMinecraftVersionType(const QString& type) { applyString(type, this->m_minecraftVersionType); } -void MinecraftProfile::applyMinecraftAssets(MojangAssetIndexInfo::Ptr assets) +void ComponentList::applyMinecraftAssets(MojangAssetIndexInfo::Ptr assets) { if(assets) { @@ -421,12 +421,12 @@ void MinecraftProfile::applyMinecraftAssets(MojangAssetIndexInfo::Ptr assets) } } -void MinecraftProfile::applyTraits(const QSet& traits) +void ComponentList::applyTraits(const QSet& traits) { this->m_traits.unite(traits); } -void MinecraftProfile::applyTweakers(const QStringList& tweakers) +void ComponentList::applyTweakers(const QStringList& tweakers) { // if the applied tweakers override an existing one, skip it. this effectively moves it later in the sequence QStringList newTweakers; @@ -443,7 +443,7 @@ void MinecraftProfile::applyTweakers(const QStringList& tweakers) m_tweakers = newTweakers; } -void MinecraftProfile::applyJarMods(const QList& jarMods) +void ComponentList::applyJarMods(const QList& jarMods) { this->m_jarMods.append(jarMods); } @@ -464,7 +464,7 @@ static int findLibraryByName(QList *haystack, const GradleSpecifier return retval; } -void MinecraftProfile::applyMods(const QList& mods) +void ComponentList::applyMods(const QList& mods) { QList * list = &m_mods; for(auto & mod: mods) @@ -489,7 +489,7 @@ void MinecraftProfile::applyMods(const QList& mods) } } -void MinecraftProfile::applyLibrary(LibraryPtr library) +void ComponentList::applyLibrary(LibraryPtr library) { if(!library->isActive()) { @@ -521,12 +521,12 @@ void MinecraftProfile::applyLibrary(LibraryPtr library) } } -const LibraryPtr MinecraftProfile::getMainJar() const +const LibraryPtr ComponentList::getMainJar() const { return m_mainJar; } -void MinecraftProfile::applyMainJar(LibraryPtr jar) +void ComponentList::applyMainJar(LibraryPtr jar) { if(jar) { @@ -534,7 +534,7 @@ void MinecraftProfile::applyMainJar(LibraryPtr jar) } } -void MinecraftProfile::applyProblemSeverity(ProblemSeverity severity) +void ComponentList::applyProblemSeverity(ProblemSeverity severity) { if (m_problemSeverity < severity) { @@ -543,47 +543,47 @@ void MinecraftProfile::applyProblemSeverity(ProblemSeverity severity) } -QString MinecraftProfile::getMinecraftVersion() const +QString ComponentList::getMinecraftVersion() const { return m_minecraftVersion; } -QString MinecraftProfile::getAppletClass() const +QString ComponentList::getAppletClass() const { return m_appletClass; } -QString MinecraftProfile::getMainClass() const +QString ComponentList::getMainClass() const { return m_mainClass; } -const QSet &MinecraftProfile::getTraits() const +const QSet &ComponentList::getTraits() const { return m_traits; } -const QStringList & MinecraftProfile::getTweakers() const +const QStringList & ComponentList::getTweakers() const { return m_tweakers; } -bool MinecraftProfile::hasTrait(const QString& trait) const +bool ComponentList::hasTrait(const QString& trait) const { return m_traits.contains(trait); } -ProblemSeverity MinecraftProfile::getProblemSeverity() const +ProblemSeverity ComponentList::getProblemSeverity() const { return m_problemSeverity; } -QString MinecraftProfile::getMinecraftVersionType() const +QString ComponentList::getMinecraftVersionType() const { return m_minecraftVersionType; } -std::shared_ptr MinecraftProfile::getMinecraftAssets() const +std::shared_ptr ComponentList::getMinecraftAssets() const { if(!m_minecraftAssets) { @@ -592,27 +592,27 @@ std::shared_ptr MinecraftProfile::getMinecraftAssets() con return m_minecraftAssets; } -QString MinecraftProfile::getMinecraftArguments() const +QString ComponentList::getMinecraftArguments() const { return m_minecraftArguments; } -const QList & MinecraftProfile::getJarMods() const +const QList & ComponentList::getJarMods() const { return m_jarMods; } -const QList & MinecraftProfile::getLibraries() const +const QList & ComponentList::getLibraries() const { return m_libraries; } -const QList & MinecraftProfile::getNativeLibraries() const +const QList & ComponentList::getNativeLibraries() const { return m_nativeLibraries; } -void MinecraftProfile::getLibraryFiles(const QString& architecture, QStringList& jars, QStringList& nativeJars, const QString& overridePath, const QString& tempPath) const +void ComponentList::getLibraryFiles(const QString& architecture, QStringList& jars, QStringList& nativeJars, const QString& overridePath, const QString& tempPath) const { QStringList native32, native64; jars.clear(); @@ -649,12 +649,12 @@ void MinecraftProfile::getLibraryFiles(const QString& architecture, QStringList& } } -void MinecraftProfile::installJarMods(QStringList selectedFiles) +void ComponentList::installJarMods(QStringList selectedFiles) { installJarMods_internal(selectedFiles); } -void MinecraftProfile::installCustomJar(QString selectedFile) +void ComponentList::installCustomJar(QString selectedFile) { installCustomJar_internal(selectedFile); } @@ -663,7 +663,7 @@ void MinecraftProfile::installCustomJar(QString selectedFile) /* * TODO: get rid of this. Get rid of all order numbers. */ -int MinecraftProfile::getFreeOrderNumber() +int ComponentList::getFreeOrderNumber() { int largest = 100; // yes, I do realize this is dumb. The order thing itself is dumb. and to be removed next. @@ -676,7 +676,7 @@ int MinecraftProfile::getFreeOrderNumber() return largest + 1; } -void MinecraftProfile::upgradeDeprecatedFiles_internal() +void ComponentList::upgradeDeprecatedFiles_internal() { auto versionJsonPath = FS::PathCombine(m_instance->instanceRoot(), "version.json"); auto customJsonPath = FS::PathCombine(m_instance->instanceRoot(), "custom.json"); @@ -737,7 +737,7 @@ void MinecraftProfile::upgradeDeprecatedFiles_internal() } } -void MinecraftProfile::loadDefaultBuiltinPatches_internal() +void ComponentList::loadDefaultBuiltinPatches_internal() { auto addBuiltinPatch = [&](const QString &uid, const QString intendedVersion, int order) { @@ -768,7 +768,7 @@ void MinecraftProfile::loadDefaultBuiltinPatches_internal() addBuiltinPatch("org.lwjgl", m_instance->getComponentVersion("org.lwjgl"), -1); } -void MinecraftProfile::loadUserPatches_internal() +void ComponentList::loadUserPatches_internal() { // first, collect all patches (that are not builtins of OneSix) and load them QMap loadedPatches; @@ -858,7 +858,7 @@ void MinecraftProfile::loadUserPatches_internal() } -void MinecraftProfile::load_internal() +void ComponentList::load_internal() { clearPatches(); upgradeDeprecatedFiles_internal(); @@ -866,17 +866,17 @@ void MinecraftProfile::load_internal() loadUserPatches_internal(); } -bool MinecraftProfile::saveOrder_internal(ProfileUtils::PatchOrder order) const +bool ComponentList::saveOrder_internal(ProfileUtils::PatchOrder order) const { return ProfileUtils::writeOverrideOrders(FS::PathCombine(m_instance->instanceRoot(), "order.json"), order); } -bool MinecraftProfile::resetOrder_internal() +bool ComponentList::resetOrder_internal() { return QDir(m_instance->instanceRoot()).remove("order.json"); } -bool MinecraftProfile::removePatch_internal(ProfilePatchPtr patch) +bool ComponentList::removePatch_internal(ProfilePatchPtr patch) { bool ok = true; // first, remove the patch file. this ensures it's not used anymore @@ -926,7 +926,7 @@ bool MinecraftProfile::removePatch_internal(ProfilePatchPtr patch) return ok; } -bool MinecraftProfile::customizePatch_internal(ProfilePatchPtr patch) +bool ComponentList::customizePatch_internal(ProfilePatchPtr patch) { if(patch->isCustom()) { @@ -966,7 +966,7 @@ bool MinecraftProfile::customizePatch_internal(ProfilePatchPtr patch) return true; } -bool MinecraftProfile::revertPatch_internal(ProfilePatchPtr patch) +bool ComponentList::revertPatch_internal(ProfilePatchPtr patch) { if(!patch->isCustom()) { @@ -993,7 +993,7 @@ bool MinecraftProfile::revertPatch_internal(ProfilePatchPtr patch) return result; } -bool MinecraftProfile::installJarMods_internal(QStringList filepaths) +bool ComponentList::installJarMods_internal(QStringList filepaths) { QString patchDir = FS::PathCombine(m_instance->instanceRoot(), "patches"); if(!FS::ensureFolderPathExists(patchDir)) @@ -1059,7 +1059,7 @@ bool MinecraftProfile::installJarMods_internal(QStringList filepaths) return true; } -bool MinecraftProfile::installCustomJar_internal(QString filepath) +bool ComponentList::installCustomJar_internal(QString filepath) { QString patchDir = FS::PathCombine(m_instance->instanceRoot(), "patches"); if(!FS::ensureFolderPathExists(patchDir)) diff --git a/api/logic/minecraft/MinecraftProfile.h b/api/logic/minecraft/ComponentList.h similarity index 96% rename from api/logic/minecraft/MinecraftProfile.h rename to api/logic/minecraft/ComponentList.h index da8dcbbc..a566d8f5 100644 --- a/api/logic/minecraft/MinecraftProfile.h +++ b/api/logic/minecraft/ComponentList.h @@ -32,13 +32,13 @@ class MinecraftInstance; -class MULTIMC_LOGIC_EXPORT MinecraftProfile : public QAbstractListModel +class MULTIMC_LOGIC_EXPORT ComponentList : public QAbstractListModel { Q_OBJECT public: - explicit MinecraftProfile(MinecraftInstance * instance); - virtual ~MinecraftProfile(); + explicit ComponentList(MinecraftInstance * instance); + virtual ~ComponentList(); virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; virtual QVariant headerData(int section, Qt::Orientation orientation, int role) const override; @@ -55,7 +55,7 @@ public: /// install more jar mods void installJarMods(QStringList selectedFiles); - /// install more jar mods + /// install a jar/zip as a replacement for the main jar void installCustomJar(QString selectedFile); /// DEPRECATED, remove ASAP diff --git a/api/logic/minecraft/MinecraftInstance.cpp b/api/logic/minecraft/MinecraftInstance.cpp index 468b8ea1..e01d2616 100644 --- a/api/logic/minecraft/MinecraftInstance.cpp +++ b/api/logic/minecraft/MinecraftInstance.cpp @@ -31,7 +31,7 @@ #include "icons/IIconList.h" #include -#include "MinecraftProfile.h" +#include "ComponentList.h" #include "AssetsUtils.h" #include "MinecraftUpdate.h" @@ -133,7 +133,7 @@ bool MinecraftInstance::reload() void MinecraftInstance::createProfile() { - m_profile.reset(new MinecraftProfile(this)); + m_profile.reset(new ComponentList(this)); } void MinecraftInstance::reloadProfile() @@ -149,14 +149,14 @@ void MinecraftInstance::clearProfile() emit versionReloaded(); } -std::shared_ptr MinecraftInstance::getMinecraftProfile() const +std::shared_ptr MinecraftInstance::getComponentList() const { return m_profile; } QSet MinecraftInstance::traits() const { - auto version = getMinecraftProfile(); + auto version = getComponentList(); if (!version) { return {"version-incomplete"}; @@ -274,7 +274,7 @@ QStringList MinecraftInstance::getNativeJars() const QStringList MinecraftInstance::extraArguments() const { auto list = BaseInstance::extraArguments(); - auto version = getMinecraftProfile(); + auto version = getComponentList(); if (!version) return list; auto jarMods = getJarMods(); @@ -909,7 +909,7 @@ bool MinecraftInstance::setComponentVersion(const QString& uid, const QString& v { settings()->set("LiteloaderVersion", version); } - if(getMinecraftProfile()) + if(getComponentList()) { clearProfile(); } diff --git a/api/logic/minecraft/MinecraftInstance.h b/api/logic/minecraft/MinecraftInstance.h index d3a61c5d..417098da 100644 --- a/api/logic/minecraft/MinecraftInstance.h +++ b/api/logic/minecraft/MinecraftInstance.h @@ -9,7 +9,7 @@ class ModList; class WorldList; class LaunchStep; -class MinecraftProfile; +class ComponentList; class MULTIMC_LOGIC_EXPORT MinecraftInstance: public BaseInstance { @@ -52,7 +52,7 @@ public: ////// Profile management ////// void createProfile(); - std::shared_ptr getMinecraftProfile() const; + std::shared_ptr getComponentList() const; void reloadProfile(); void clearProfile(); bool reload() override; @@ -114,7 +114,7 @@ private: QString prettifyTimeDuration(int64_t duration); protected: // data - std::shared_ptr m_profile; + std::shared_ptr m_profile; mutable std::shared_ptr m_loader_mod_list; mutable std::shared_ptr m_core_mod_list; mutable std::shared_ptr m_resource_pack_list; diff --git a/api/logic/minecraft/MinecraftUpdate.cpp b/api/logic/minecraft/MinecraftUpdate.cpp index 61dce779..529cf13e 100644 --- a/api/logic/minecraft/MinecraftUpdate.cpp +++ b/api/logic/minecraft/MinecraftUpdate.cpp @@ -24,7 +24,7 @@ #include #include "BaseInstance.h" -#include "minecraft/MinecraftProfile.h" +#include "minecraft/ComponentList.h" #include "minecraft/Library.h" #include "net/URLConstants.h" #include @@ -52,7 +52,7 @@ OneSixUpdate::OneSixUpdate(MinecraftInstance *inst, QObject *parent) : Task(pare * We should not rely on the remote to be there... and prefer local files if it does not respond. */ qDebug() << "Updating patches..."; - auto profile = m_inst->getMinecraftProfile(); + auto profile = m_inst->getComponentList(); m_inst->reloadProfile(); for(int i = 0; i < profile->rowCount(); i++) { diff --git a/api/logic/minecraft/OneSixVersionFormat.h b/api/logic/minecraft/OneSixVersionFormat.h index 64f18da8..2306ac8e 100644 --- a/api/logic/minecraft/OneSixVersionFormat.h +++ b/api/logic/minecraft/OneSixVersionFormat.h @@ -1,7 +1,7 @@ #pragma once #include -#include +#include #include #include diff --git a/api/logic/minecraft/ProfilePatch.cpp b/api/logic/minecraft/ProfilePatch.cpp index 049463ac..b8b5c240 100644 --- a/api/logic/minecraft/ProfilePatch.cpp +++ b/api/logic/minecraft/ProfilePatch.cpp @@ -5,7 +5,7 @@ #include "meta/Version.h" #include "VersionFile.h" -#include "minecraft/MinecraftProfile.h" +#include "minecraft/ComponentList.h" ProfilePatch::ProfilePatch(std::shared_ptr version) :m_metaVersion(version) @@ -22,7 +22,7 @@ std::shared_ptr ProfilePatch::getMeta() return m_metaVersion; } -void ProfilePatch::applyTo(MinecraftProfile* profile) +void ProfilePatch::applyTo(ComponentList* profile) { auto vfile = getVersionFile(); if(vfile) diff --git a/api/logic/minecraft/ProfilePatch.h b/api/logic/minecraft/ProfilePatch.h index 59171a0a..af5e89a4 100644 --- a/api/logic/minecraft/ProfilePatch.h +++ b/api/logic/minecraft/ProfilePatch.h @@ -6,7 +6,7 @@ #include #include "ProblemProvider.h" -class MinecraftProfile; +class ComponentList; namespace Meta { class Version; @@ -21,7 +21,7 @@ public: ProfilePatch(std::shared_ptr file, const QString &filename = QString()); virtual ~ProfilePatch(){}; - virtual void applyTo(MinecraftProfile *profile); + virtual void applyTo(ComponentList *profile); virtual bool isMoveable(); virtual bool isCustomizable(); diff --git a/api/logic/minecraft/VersionFile.cpp b/api/logic/minecraft/VersionFile.cpp index 85989549..65675873 100644 --- a/api/logic/minecraft/VersionFile.cpp +++ b/api/logic/minecraft/VersionFile.cpp @@ -5,7 +5,7 @@ #include "minecraft/VersionFile.h" #include "minecraft/Library.h" -#include "minecraft/MinecraftProfile.h" +#include "minecraft/ComponentList.h" #include "ParseUtils.h" #include @@ -15,7 +15,7 @@ static bool isMinecraftVersion(const QString &uid) return uid == "net.minecraft"; } -void VersionFile::applyTo(MinecraftProfile *profile) +void VersionFile::applyTo(ComponentList *profile) { // Only real Minecraft can set those. Don't let anything override them. if (isMinecraftVersion(uid)) diff --git a/api/logic/minecraft/VersionFile.h b/api/logic/minecraft/VersionFile.h index e3fb46ed..001b696c 100644 --- a/api/logic/minecraft/VersionFile.h +++ b/api/logic/minecraft/VersionFile.h @@ -11,7 +11,7 @@ #include "ProblemProvider.h" #include "Library.h" -class MinecraftProfile; +class ComponentList; class VersionFile; struct MojangDownloadInfo; struct MojangAssetIndexInfo; @@ -22,7 +22,7 @@ class VersionFile : public ProblemContainer friend class MojangVersionFormat; friend class OneSixVersionFormat; public: /* methods */ - void applyTo(MinecraftProfile *profile); + void applyTo(ComponentList *profile); public: /* data */ /// MultiMC: order hint for this version file if no explicit order is set diff --git a/api/logic/minecraft/launch/ModMinecraftJar.cpp b/api/logic/minecraft/launch/ModMinecraftJar.cpp index 497a9d2d..14b00447 100644 --- a/api/logic/minecraft/launch/ModMinecraftJar.cpp +++ b/api/logic/minecraft/launch/ModMinecraftJar.cpp @@ -19,7 +19,7 @@ #include "minecraft/OpSys.h" #include "FileSystem.h" #include "minecraft/MinecraftInstance.h" -#include "minecraft/MinecraftProfile.h" +#include "minecraft/ComponentList.h" void ModMinecraftJar::executeTask() { @@ -42,7 +42,7 @@ void ModMinecraftJar::executeTask() } // create temporary modded jar, if needed - auto profile = m_inst->getMinecraftProfile(); + auto profile = m_inst->getComponentList(); auto jarMods = m_inst->getJarMods(); if(jarMods.size()) { diff --git a/api/logic/minecraft/legacy/LegacyUpgradeTask.cpp b/api/logic/minecraft/legacy/LegacyUpgradeTask.cpp index e41d87cb..fab48005 100644 --- a/api/logic/minecraft/legacy/LegacyUpgradeTask.cpp +++ b/api/logic/minecraft/legacy/LegacyUpgradeTask.cpp @@ -7,7 +7,7 @@ #include #include "LegacyInstance.h" #include "minecraft/MinecraftInstance.h" -#include "minecraft/MinecraftProfile.h" +#include "minecraft/ComponentList.h" #include "classparser.h" LegacyUpgradeTask::LegacyUpgradeTask(SettingsObjectPtr settings, const QString & stagingPath, InstancePtr origInstance, const QString & newName) @@ -90,7 +90,7 @@ void LegacyUpgradeTask::copyFinished() // BUG: reloadProfile should not be necessary, but setComponentVersion voids the profile created by init()! inst->reloadProfile(); - auto profile = inst->getMinecraftProfile(); + auto profile = inst->getComponentList(); if(legacyInst->shouldUseCustomBaseJar()) { diff --git a/api/logic/minecraft/update/AssetUpdateTask.cpp b/api/logic/minecraft/update/AssetUpdateTask.cpp index b67e630e..6919e0a6 100644 --- a/api/logic/minecraft/update/AssetUpdateTask.cpp +++ b/api/logic/minecraft/update/AssetUpdateTask.cpp @@ -1,7 +1,7 @@ #include "Env.h" #include "AssetUpdateTask.h" #include "minecraft/MinecraftInstance.h" -#include "minecraft/MinecraftProfile.h" +#include "minecraft/ComponentList.h" #include "net/ChecksumValidator.h" #include "minecraft/AssetsUtils.h" @@ -12,7 +12,7 @@ AssetUpdateTask::AssetUpdateTask(MinecraftInstance * inst) void AssetUpdateTask::executeTask() { setStatus(tr("Updating assets index...")); - auto profile = m_inst->getMinecraftProfile(); + auto profile = m_inst->getComponentList(); auto assets = profile->getMinecraftAssets(); QUrl indexUrl = assets->url; QString localPath = assets->id + ".json"; @@ -48,7 +48,7 @@ void AssetUpdateTask::assetIndexFinished() AssetsIndex index; qDebug() << m_inst->name() << ": Finished asset index download"; - auto profile = m_inst->getMinecraftProfile(); + auto profile = m_inst->getComponentList(); auto assets = profile->getMinecraftAssets(); QString asset_fname = "assets/indexes/" + assets->id + ".json"; diff --git a/api/logic/minecraft/update/FMLLibrariesTask.cpp b/api/logic/minecraft/update/FMLLibrariesTask.cpp index 63428a48..e64b7a82 100644 --- a/api/logic/minecraft/update/FMLLibrariesTask.cpp +++ b/api/logic/minecraft/update/FMLLibrariesTask.cpp @@ -3,7 +3,7 @@ #include #include "FMLLibrariesTask.h" #include "minecraft/MinecraftInstance.h" -#include "minecraft/MinecraftProfile.h" +#include "minecraft/ComponentList.h" FMLLibrariesTask::FMLLibrariesTask(MinecraftInstance * inst) { @@ -13,7 +13,7 @@ void FMLLibrariesTask::executeTask() { // Get the mod list MinecraftInstance *inst = (MinecraftInstance *)m_inst; - std::shared_ptr profile = inst->getMinecraftProfile(); + std::shared_ptr profile = inst->getComponentList(); bool forge_present = false; if (!profile->hasTrait("legacyFML")) diff --git a/api/logic/minecraft/update/LibrariesTask.cpp b/api/logic/minecraft/update/LibrariesTask.cpp index c408f432..bbbd5f02 100644 --- a/api/logic/minecraft/update/LibrariesTask.cpp +++ b/api/logic/minecraft/update/LibrariesTask.cpp @@ -1,7 +1,7 @@ #include "Env.h" #include "LibrariesTask.h" #include "minecraft/MinecraftInstance.h" -#include "minecraft/MinecraftProfile.h" +#include "minecraft/ComponentList.h" LibrariesTask::LibrariesTask(MinecraftInstance * inst) { @@ -21,7 +21,7 @@ void LibrariesTask::executeTask() } // Build a list of URLs that will need to be downloaded. - std::shared_ptr profile = inst->getMinecraftProfile(); + std::shared_ptr profile = inst->getComponentList(); auto job = new NetJob(tr("Libraries for instance %1").arg(inst->name())); downloadJob.reset(job); diff --git a/application/pages/ModFolderPage.cpp b/application/pages/ModFolderPage.cpp index 422e1eb4..be1c8289 100644 --- a/application/pages/ModFolderPage.cpp +++ b/application/pages/ModFolderPage.cpp @@ -28,7 +28,7 @@ #include "minecraft/ModList.h" #include "minecraft/Mod.h" #include "minecraft/VersionFilterData.h" -#include "minecraft/MinecraftProfile.h" +#include "minecraft/ComponentList.h" #include ModFolderPage::ModFolderPage(BaseInstance *inst, std::shared_ptr mods, QString id, @@ -103,7 +103,7 @@ bool CoreModFolderPage::shouldDisplay() const auto inst = dynamic_cast(m_inst); if (!inst) return true; - auto version = inst->getMinecraftProfile(); + auto version = inst->getComponentList(); if (!version) return true; if(!version->versionPatch("net.minecraftforge")) diff --git a/application/pages/VersionPage.cpp b/application/pages/VersionPage.cpp index c915b42b..d65d6bc7 100644 --- a/application/pages/VersionPage.cpp +++ b/application/pages/VersionPage.cpp @@ -35,7 +35,7 @@ #include #include -#include "minecraft/MinecraftProfile.h" +#include "minecraft/ComponentList.h" #include "minecraft/auth/MojangAccountList.h" #include "minecraft/Mod.h" #include "icons/IconList.h" @@ -104,9 +104,9 @@ VersionPage::VersionPage(MinecraftInstance *inst, QWidget *parent) ui->setupUi(this); ui->tabWidget->tabBar()->hide(); - reloadMinecraftProfile(); + reloadComponentList(); - m_profile = m_inst->getMinecraftProfile(); + m_profile = m_inst->getComponentList(); if (m_profile) { auto proxy = new IconProxy(ui->packageView); @@ -192,7 +192,7 @@ void VersionPage::disableVersionControls() updateButtons(); } -bool VersionPage::reloadMinecraftProfile() +bool VersionPage::reloadComponentList() { try { @@ -215,7 +215,7 @@ bool VersionPage::reloadMinecraftProfile() void VersionPage::on_reloadBtn_clicked() { - reloadMinecraftProfile(); + reloadComponentList(); m_container->refreshContainer(); } @@ -230,7 +230,7 @@ void VersionPage::on_removeBtn_clicked() } } updateButtons(); - reloadMinecraftProfile(); + reloadComponentList(); m_container->refreshContainer(); } @@ -279,7 +279,7 @@ void VersionPage::on_moveUpBtn_clicked() { try { - m_profile->move(currentRow(), MinecraftProfile::MoveUp); + m_profile->move(currentRow(), ComponentList::MoveUp); } catch (Exception &e) { @@ -292,7 +292,7 @@ void VersionPage::on_moveDownBtn_clicked() { try { - m_profile->move(currentRow(), MinecraftProfile::MoveDown); + m_profile->move(currentRow(), ComponentList::MoveDown); } catch (Exception &e) { @@ -345,7 +345,7 @@ void VersionPage::on_changeVersionBtn_clicked() if (result != QMessageBox::Ok) return; m_profile->revertToVanilla(); - reloadMinecraftProfile(); + reloadComponentList(); } } m_inst->setComponentVersion(uid, vselect.selectedVersion()->descriptor()); diff --git a/application/pages/VersionPage.h b/application/pages/VersionPage.h index 0017be5c..0ac10a14 100644 --- a/application/pages/VersionPage.h +++ b/application/pages/VersionPage.h @@ -18,7 +18,7 @@ #include #include "minecraft/MinecraftInstance.h" -#include "minecraft/MinecraftProfile.h" +#include "minecraft/ComponentList.h" #include "BasePage.h" namespace Ui @@ -76,11 +76,11 @@ private: protected: /// FIXME: this shouldn't be necessary! - bool reloadMinecraftProfile(); + bool reloadComponentList(); private: Ui::VersionPage *ui; - std::shared_ptr m_profile; + std::shared_ptr m_profile; MinecraftInstance *m_inst; int currentIdx = 0;