diff options
29 files changed, 145 insertions, 145 deletions
diff --git a/api/logic/CMakeLists.txt b/api/logic/CMakeLists.txt index 50c2cb6e..cf9f9a17 100644 --- a/api/logic/CMakeLists.txt +++ b/api/logic/CMakeLists.txt @@ -259,8 +259,8 @@ set(MINECRAFT_SOURCES minecraft/LaunchProfile.h minecraft/Component.cpp minecraft/Component.h - minecraft/ComponentList.cpp - minecraft/ComponentList.h + minecraft/PackProfile.cpp + minecraft/PackProfile.h minecraft/ComponentUpdateTask.cpp minecraft/ComponentUpdateTask.h minecraft/MinecraftLoadAndCheck.h diff --git a/api/logic/InstanceCreationTask.cpp b/api/logic/InstanceCreationTask.cpp index 978d4687..eafc5126 100644 --- a/api/logic/InstanceCreationTask.cpp +++ b/api/logic/InstanceCreationTask.cpp @@ -4,7 +4,7 @@ //FIXME: remove this #include "minecraft/MinecraftInstance.h" -#include "minecraft/ComponentList.h" +#include "minecraft/PackProfile.h" InstanceCreationTask::InstanceCreationTask(BaseVersionPtr version) { @@ -20,7 +20,7 @@ void InstanceCreationTask::executeTask() instanceSettings->registerSetting("InstanceType", "Legacy"); instanceSettings->set("InstanceType", "OneSix"); MinecraftInstance inst(m_globalSettings, instanceSettings, m_stagingPath); - auto components = inst.getComponentList(); + auto components = inst.getPackProfile(); components->buildingFromScratch(); components->setComponentVersion("net.minecraft", m_version->descriptor(), true); inst.setName(m_instName); diff --git a/api/logic/InstanceImportTask.cpp b/api/logic/InstanceImportTask.cpp index 1e93174c..e2187416 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/ComponentList.h" +#include "minecraft/PackProfile.h" #include "modplatform/flame/FileResolvingTask.h" #include "modplatform/flame/PackManifest.h" #include "Json.h" @@ -236,7 +236,7 @@ void InstanceImportTask::processFlame() mcVersion.remove(QRegExp("[.]+$")); logWarning(tr("Mysterious trailing dots removed from Minecraft version while importing pack.")); } - auto components = instance.getComponentList(); + auto components = instance.getPackProfile(); components->buildingFromScratch(); components->setComponentVersion("net.minecraft", mcVersion, true); if(!forgeVersion.isEmpty()) @@ -288,7 +288,7 @@ void InstanceImportTask::processFlame() qDebug() << info.fileName(); jarMods.push_back(info.absoluteFilePath()); } - auto profile = instance.getComponentList(); + auto profile = instance.getPackProfile(); 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 ca889550..2bbe19a7 100644 --- a/api/logic/meta/Version.cpp +++ b/api/logic/meta/Version.cpp @@ -18,7 +18,7 @@ #include <QDateTime> #include "JsonFormat.h" -#include "minecraft/ComponentList.h" +#include "minecraft/PackProfile.h" Meta::Version::Version(const QString &uid, const QString &version) : BaseVersion(), m_uid(uid), m_version(version) diff --git a/api/logic/minecraft/Component.cpp b/api/logic/minecraft/Component.cpp index 51957d17..92821065 100644 --- a/api/logic/minecraft/Component.cpp +++ b/api/logic/minecraft/Component.cpp @@ -5,13 +5,13 @@ #include "meta/Version.h" #include "VersionFile.h" -#include "minecraft/ComponentList.h" +#include "minecraft/PackProfile.h" #include <FileSystem.h> #include <QSaveFile> #include "OneSixVersionFormat.h" #include <assert.h> -Component::Component(ComponentList * parent, const QString& uid) +Component::Component(PackProfile * parent, const QString& uid) { assert(parent); m_parent = parent; @@ -19,7 +19,7 @@ Component::Component(ComponentList * parent, const QString& uid) m_uid = uid; } -Component::Component(ComponentList * parent, std::shared_ptr<Meta::Version> version) +Component::Component(PackProfile * parent, std::shared_ptr<Meta::Version> version) { assert(parent); m_parent = parent; @@ -31,7 +31,7 @@ Component::Component(ComponentList * parent, std::shared_ptr<Meta::Version> vers m_loaded = version->isLoaded(); } -Component::Component(ComponentList * parent, const QString& uid, std::shared_ptr<VersionFile> file) +Component::Component(PackProfile * parent, const QString& uid, std::shared_ptr<VersionFile> file) { assert(parent); m_parent = parent; diff --git a/api/logic/minecraft/Component.h b/api/logic/minecraft/Component.h index 6a0f86c8..cb202f7f 100644 --- a/api/logic/minecraft/Component.h +++ b/api/logic/minecraft/Component.h @@ -9,7 +9,7 @@ #include "QObjectPtr.h" #include "multimc_logic_export.h" -class ComponentList; +class PackProfile; class LaunchProfile; namespace Meta { @@ -22,11 +22,11 @@ class MULTIMC_LOGIC_EXPORT Component : public QObject, public ProblemProvider { Q_OBJECT public: - Component(ComponentList * parent, const QString &uid); + Component(PackProfile * parent, const QString &uid); // DEPRECATED: remove these constructors? - Component(ComponentList * parent, std::shared_ptr<Meta::Version> version); - Component(ComponentList * parent, const QString & uid, std::shared_ptr<VersionFile> file); + Component(PackProfile * parent, std::shared_ptr<Meta::Version> version); + Component(PackProfile * parent, const QString & uid, std::shared_ptr<VersionFile> file); virtual ~Component(){}; void applyTo(LaunchProfile *profile); @@ -73,7 +73,7 @@ signals: void dataChanged(); public: /* data */ - ComponentList * m_parent; + PackProfile * m_parent; // BEGIN: persistent component list properties /// ID of the component diff --git a/api/logic/minecraft/ComponentUpdateTask.cpp b/api/logic/minecraft/ComponentUpdateTask.cpp index 84c0474c..241d9a49 100644 --- a/api/logic/minecraft/ComponentUpdateTask.cpp +++ b/api/logic/minecraft/ComponentUpdateTask.cpp @@ -1,7 +1,7 @@ #include "ComponentUpdateTask.h" -#include "ComponentList_p.h" -#include "ComponentList.h" +#include "PackProfile_p.h" +#include "PackProfile.h" #include "Component.h" #include <Env.h> #include <meta/Index.h> @@ -22,16 +22,16 @@ * Really, it should be a reactor/state machine that receives input from the application * and dynamically adapts to changing requirements... * - * The reactor should be the only entry into manipulating the ComponentList. + * The reactor should be the only entry into manipulating the PackProfile. * See: https://en.wikipedia.org/wiki/Reactor_pattern */ /* - * Or make this operate on a snapshot of the ComponentList state, then merge results in as long as the snapshot and ComponentList didn't change? + * Or make this operate on a snapshot of the PackProfile state, then merge results in as long as the snapshot and PackProfile didn't change? * If the component list changes, start over. */ -ComponentUpdateTask::ComponentUpdateTask(Mode mode, Net::Mode netmode, ComponentList* list, QObject* parent) +ComponentUpdateTask::ComponentUpdateTask(Mode mode, Net::Mode netmode, PackProfile* list, QObject* parent) : Task(parent) { d.reset(new ComponentUpdateTaskData); @@ -126,7 +126,7 @@ static LoadResult loadComponent(ComponentPtr component, shared_qobject_ptr<Task> // FIXME: dead code. determine if this can still be useful? /* -static LoadResult loadComponentList(ComponentPtr component, shared_qobject_ptr<Task>& loadTask, Net::Mode netmode) +static LoadResult loadPackProfile(ComponentPtr component, shared_qobject_ptr<Task>& loadTask, Net::Mode netmode) { if(component->m_loaded) { @@ -217,7 +217,7 @@ void ComponentUpdateTask::loadComponents() } case Mode::Resolution: { - singleResult = loadComponentList(component, loadTask, d->netmode); + singleResult = loadPackProfile(component, loadTask, d->netmode); loadType = RemoteLoadStatus::Type::List; break; } @@ -244,7 +244,7 @@ void ComponentUpdateTask::loadComponents() }); RemoteLoadStatus status; status.type = loadType; - status.componentListIndex = componentIndex; + status.PackProfileIndex = componentIndex; d->remoteLoadStatusList.append(status); taskIndex++; } @@ -495,7 +495,7 @@ static bool getTrivialComponentChanges(const ComponentIndex & index, const Requi } // FIXME, TODO: decouple dependency resolution from loading -// FIXME: This works directly with the ComponentList internals. It shouldn't! It needs richer data types than ComponentList uses. +// FIXME: This works directly with the PackProfile internals. It shouldn't! It needs richer data types than PackProfile uses. // FIXME: throw all this away and use a graph void ComponentUpdateTask::resolveDependencies(bool checkOnly) { @@ -648,7 +648,7 @@ void ComponentUpdateTask::remoteLoadSucceeded(size_t taskIndex) // update the cached data of the component from the downloaded version file. if (taskSlot.type == RemoteLoadStatus::Type::Version) { - auto component = d->m_list->getComponent(taskSlot.componentListIndex); + auto component = d->m_list->getComponent(taskSlot.PackProfileIndex); component->m_loaded = true; component->updateCachedData(); } diff --git a/api/logic/minecraft/ComponentUpdateTask.h b/api/logic/minecraft/ComponentUpdateTask.h index 4cb29a89..4274cabb 100644 --- a/api/logic/minecraft/ComponentUpdateTask.h +++ b/api/logic/minecraft/ComponentUpdateTask.h @@ -4,7 +4,7 @@ #include "net/Mode.h" #include <memory> -class ComponentList; +class PackProfile; struct ComponentUpdateTaskData; class ComponentUpdateTask : public Task @@ -18,7 +18,7 @@ public: }; public: - explicit ComponentUpdateTask(Mode mode, Net::Mode netmode, ComponentList * list, QObject *parent = 0); + explicit ComponentUpdateTask(Mode mode, Net::Mode netmode, PackProfile * list, QObject *parent = 0); virtual ~ComponentUpdateTask(); protected: diff --git a/api/logic/minecraft/ComponentUpdateTask_p.h b/api/logic/minecraft/ComponentUpdateTask_p.h index 5989cf07..5b02431b 100644 --- a/api/logic/minecraft/ComponentUpdateTask_p.h +++ b/api/logic/minecraft/ComponentUpdateTask_p.h @@ -5,7 +5,7 @@ #include <QList> #include "net/Mode.h" -class ComponentList; +class PackProfile; struct RemoteLoadStatus { @@ -15,7 +15,7 @@ struct RemoteLoadStatus List, Version } type = Type::Version; - size_t componentListIndex = 0; + size_t PackProfileIndex = 0; bool finished = false; bool succeeded = false; QString error; @@ -23,7 +23,7 @@ struct RemoteLoadStatus struct ComponentUpdateTaskData { - ComponentList * m_list = nullptr; + PackProfile * m_list = nullptr; QList<RemoteLoadStatus> remoteLoadStatusList; bool remoteLoadSuccessful = true; size_t remoteTasksInProgress = 0; diff --git a/api/logic/minecraft/MinecraftInstance.cpp b/api/logic/minecraft/MinecraftInstance.cpp index 28073edf..db259395 100644 --- a/api/logic/minecraft/MinecraftInstance.cpp +++ b/api/logic/minecraft/MinecraftInstance.cpp @@ -33,7 +33,7 @@ #include "icons/IIconList.h" #include <QCoreApplication> -#include "ComponentList.h" +#include "PackProfile.h" #include "AssetsUtils.h" #include "MinecraftUpdate.h" #include "MinecraftLoadAndCheck.h" @@ -106,7 +106,7 @@ MinecraftInstance::MinecraftInstance(SettingsObjectPtr globalSettings, SettingsO m_settings->registerSetting("ForgeVersion", ""); m_settings->registerSetting("LiteloaderVersion", ""); - m_components.reset(new ComponentList(this)); + m_components.reset(new PackProfile(this)); m_components->setOldConfigVersion("net.minecraft", m_settings->get("IntendedVersion").toString()); auto setting = m_settings->getSetting("LWJGLVersion"); m_components->setOldConfigVersion("org.lwjgl", m_settings->get("LWJGLVersion").toString()); @@ -124,14 +124,14 @@ QString MinecraftInstance::typeName() const return "Minecraft"; } -std::shared_ptr<ComponentList> MinecraftInstance::getComponentList() const +std::shared_ptr<PackProfile> MinecraftInstance::getPackProfile() const { return m_components; } QSet<QString> MinecraftInstance::traits() const { - auto components = getComponentList(); + auto components = getPackProfile(); if (!components) { return {"version-incomplete"}; @@ -265,7 +265,7 @@ QStringList MinecraftInstance::getNativeJars() const QStringList MinecraftInstance::extraArguments() const { auto list = BaseInstance::extraArguments(); - auto version = getComponentList(); + auto version = getPackProfile(); if (!version) return list; auto jarMods = getJarMods(); diff --git a/api/logic/minecraft/MinecraftInstance.h b/api/logic/minecraft/MinecraftInstance.h index a8f64109..985a8a76 100644 --- a/api/logic/minecraft/MinecraftInstance.h +++ b/api/logic/minecraft/MinecraftInstance.h @@ -10,7 +10,7 @@ class ModFolderModel; class WorldList; class GameOptions; class LaunchStep; -class ComponentList; +class PackProfile; class MULTIMC_LOGIC_EXPORT MinecraftInstance: public BaseInstance { @@ -64,7 +64,7 @@ public: ////// Profile management ////// - std::shared_ptr<ComponentList> getComponentList() const; + std::shared_ptr<PackProfile> getPackProfile() const; ////// Mod Lists ////// std::shared_ptr<ModFolderModel> loaderModList() const; @@ -120,7 +120,7 @@ private: QString prettifyTimeDuration(int64_t duration); protected: // data - std::shared_ptr<ComponentList> m_components; + std::shared_ptr<PackProfile> m_components; mutable std::shared_ptr<ModFolderModel> m_loader_mod_list; mutable std::shared_ptr<ModFolderModel> m_core_mod_list; mutable std::shared_ptr<ModFolderModel> m_resource_pack_list; diff --git a/api/logic/minecraft/MinecraftLoadAndCheck.cpp b/api/logic/minecraft/MinecraftLoadAndCheck.cpp index 593e2fc4..79b0c484 100644 --- a/api/logic/minecraft/MinecraftLoadAndCheck.cpp +++ b/api/logic/minecraft/MinecraftLoadAndCheck.cpp @@ -1,6 +1,6 @@ #include "MinecraftLoadAndCheck.h" #include "MinecraftInstance.h" -#include "ComponentList.h" +#include "PackProfile.h" MinecraftLoadAndCheck::MinecraftLoadAndCheck(MinecraftInstance *inst, QObject *parent) : Task(parent), m_inst(inst) { @@ -9,7 +9,7 @@ MinecraftLoadAndCheck::MinecraftLoadAndCheck(MinecraftInstance *inst, QObject *p void MinecraftLoadAndCheck::executeTask() { // add offline metadata load task - auto components = m_inst->getComponentList(); + auto components = m_inst->getPackProfile(); components->reload(Net::Mode::Offline); m_task = components->getCurrentTask(); diff --git a/api/logic/minecraft/MinecraftUpdate.cpp b/api/logic/minecraft/MinecraftUpdate.cpp index f9ff114d..ca3e7617 100644 --- a/api/logic/minecraft/MinecraftUpdate.cpp +++ b/api/logic/minecraft/MinecraftUpdate.cpp @@ -23,7 +23,7 @@ #include <QDataStream> #include "BaseInstance.h" -#include "minecraft/ComponentList.h" +#include "minecraft/PackProfile.h" #include "minecraft/Library.h" #include "net/URLConstants.h" #include <FileSystem.h> @@ -50,7 +50,7 @@ void MinecraftUpdate::executeTask() // add metadata update task if necessary { - auto components = m_inst->getComponentList(); + auto components = m_inst->getPackProfile(); components->reload(Net::Mode::Online); auto task = components->getCurrentTask(); if(task) diff --git a/api/logic/minecraft/OneSixVersionFormat.h b/api/logic/minecraft/OneSixVersionFormat.h index 6bbebca0..14ae385c 100644 --- a/api/logic/minecraft/OneSixVersionFormat.h +++ b/api/logic/minecraft/OneSixVersionFormat.h @@ -1,7 +1,7 @@ #pragma once #include <minecraft/VersionFile.h> -#include <minecraft/ComponentList.h> +#include <minecraft/PackProfile.h> #include <minecraft/Library.h> #include <QJsonDocument> diff --git a/api/logic/minecraft/ComponentList.cpp b/api/logic/minecraft/PackProfile.cpp index 51fe214d..15f2f55d 100644 --- a/api/logic/minecraft/ComponentList.cpp +++ b/api/logic/minecraft/PackProfile.cpp @@ -32,23 +32,23 @@ #include <QTimer> #include <Json.h> -#include "ComponentList.h" -#include "ComponentList_p.h" +#include "PackProfile.h" +#include "PackProfile_p.h" #include "ComponentUpdateTask.h" -ComponentList::ComponentList(MinecraftInstance * instance) +PackProfile::PackProfile(MinecraftInstance * instance) : QAbstractListModel() { - d.reset(new ComponentListData); + d.reset(new PackProfileData); d->m_instance = instance; d->m_saveTimer.setSingleShot(true); d->m_saveTimer.setInterval(5000); d->interactionDisabled = instance->isRunning(); - connect(d->m_instance, &BaseInstance::runningStatusChanged, this, &ComponentList::disableInteraction); - connect(&d->m_saveTimer, &QTimer::timeout, this, &ComponentList::save_internal); + connect(d->m_instance, &BaseInstance::runningStatusChanged, this, &PackProfile::disableInteraction); + connect(&d->m_saveTimer, &QTimer::timeout, this, &PackProfile::save_internal); } -ComponentList::~ComponentList() +PackProfile::~PackProfile() { saveNow(); } @@ -97,7 +97,7 @@ static QJsonObject componentToJsonV1(ComponentPtr component) return obj; } -static ComponentPtr componentFromJsonV1(ComponentList * parent, const QString & componentJsonPattern, const QJsonObject &obj) +static ComponentPtr componentFromJsonV1(PackProfile * parent, const QString & componentJsonPattern, const QJsonObject &obj) { // critical auto uid = Json::requireString(obj.value("uid")); @@ -120,7 +120,7 @@ static ComponentPtr componentFromJsonV1(ComponentList * parent, const QString & } // Save the given component container data to a file -static bool saveComponentList(const QString & filename, const ComponentContainer & container) +static bool savePackProfile(const QString & filename, const ComponentContainer & container) { QJsonObject obj; obj.insert("formatVersion", currentComponentsFileVersion); @@ -153,7 +153,7 @@ static bool saveComponentList(const QString & filename, const ComponentContainer } // Read the given file into component containers -static bool loadComponentList(ComponentList * parent, const QString & filename, const QString & componentJsonPattern, ComponentContainer & container) +static bool loadPackProfile(PackProfile * parent, const QString & filename, const QString & componentJsonPattern, ComponentContainer & container) { QFile componentsFile(filename); if (!componentsFile.exists()) @@ -210,7 +210,7 @@ static bool loadComponentList(ComponentList * parent, const QString & filename, // BEGIN: save/load logic -void ComponentList::saveNow() +void PackProfile::saveNow() { if(saveIsScheduled()) { @@ -219,18 +219,18 @@ void ComponentList::saveNow() } } -bool ComponentList::saveIsScheduled() const +bool PackProfile::saveIsScheduled() const { return d->dirty; } -void ComponentList::buildingFromScratch() +void PackProfile::buildingFromScratch() { d->loaded = true; d->dirty = true; } -void ComponentList::scheduleSave() +void PackProfile::scheduleSave() { if(!d->loaded) { @@ -245,30 +245,30 @@ void ComponentList::scheduleSave() d->m_saveTimer.start(); } -QString ComponentList::componentsFilePath() const +QString PackProfile::componentsFilePath() const { return FS::PathCombine(d->m_instance->instanceRoot(), "mmc-pack.json"); } -QString ComponentList::patchesPattern() const +QString PackProfile::patchesPattern() const { return FS::PathCombine(d->m_instance->instanceRoot(), "patches", "%1.json"); } -QString ComponentList::patchFilePathForUid(const QString& uid) const +QString PackProfile::patchFilePathForUid(const QString& uid) const { return patchesPattern().arg(uid); } -void ComponentList::save_internal() +void PackProfile::save_internal() { qDebug() << "Component list save performed now for" << d->m_instance->name(); auto filename = componentsFilePath(); - saveComponentList(filename, d->components); + savePackProfile(filename, d->components); d->dirty = false; } -bool ComponentList::load() +bool PackProfile::load() { auto filename = componentsFilePath(); QFile componentsFile(filename); @@ -286,7 +286,7 @@ bool ComponentList::load() // load the new component list and swap it with the current one... ComponentContainer newComponents; - if(!loadComponentList(this, filename, patchesPattern(), newComponents)) + if(!loadPackProfile(this, filename, patchesPattern(), newComponents)) { qCritical() << "Failed to load the component config for instance" << d->m_instance->name(); return false; @@ -298,7 +298,7 @@ bool ComponentList::load() // disconnect all the old components for(auto component: d->components) { - disconnect(component.get(), &Component::dataChanged, this, &ComponentList::componentDataChanged); + disconnect(component.get(), &Component::dataChanged, this, &PackProfile::componentDataChanged); } d->components.clear(); d->componentIndex.clear(); @@ -309,7 +309,7 @@ bool ComponentList::load() qWarning() << "Ignoring duplicate component entry" << component->m_uid; continue; } - connect(component.get(), &Component::dataChanged, this, &ComponentList::componentDataChanged); + connect(component.get(), &Component::dataChanged, this, &PackProfile::componentDataChanged); d->components.append(component); d->componentIndex[component->m_uid] = component; } @@ -319,7 +319,7 @@ bool ComponentList::load() } } -void ComponentList::reload(Net::Mode netmode) +void PackProfile::reload(Net::Mode netmode) { // Do not reload when the update/resolve task is running. It is in control. if(d->m_updateTask) @@ -339,29 +339,29 @@ void ComponentList::reload(Net::Mode netmode) } } -shared_qobject_ptr<Task> ComponentList::getCurrentTask() +shared_qobject_ptr<Task> PackProfile::getCurrentTask() { return d->m_updateTask; } -void ComponentList::resolve(Net::Mode netmode) +void PackProfile::resolve(Net::Mode netmode) { auto updateTask = new ComponentUpdateTask(ComponentUpdateTask::Mode::Resolution, netmode, this); d->m_updateTask.reset(updateTask); - connect(updateTask, &ComponentUpdateTask::succeeded, this, &ComponentList::updateSucceeded); - connect(updateTask, &ComponentUpdateTask::failed, this, &ComponentList::updateFailed); + connect(updateTask, &ComponentUpdateTask::succeeded, this, &PackProfile::updateSucceeded); + connect(updateTask, &ComponentUpdateTask::failed, this, &PackProfile::updateFailed); d->m_updateTask->start(); } -void ComponentList::updateSucceeded() +void PackProfile::updateSucceeded() { qDebug() << "Component list update/resolve task succeeded for" << d->m_instance->name(); d->m_updateTask.reset(); invalidateLaunchProfile(); } -void ComponentList::updateFailed(const QString& error) +void PackProfile::updateFailed(const QString& error) { qDebug() << "Component list update/resolve task failed for" << d->m_instance->name() << "Reason:" << error; d->m_updateTask.reset(); @@ -431,7 +431,7 @@ static void upgradeDeprecatedFiles(QString root, QString instanceName) * - Part is taken from the old order.json file. * - Part is loaded from loose json files in the instance's `patches` directory. */ -bool ComponentList::migratePreComponentConfig() +bool PackProfile::migratePreComponentConfig() { // upgrade the very old files from the beginnings of MultiMC 5 upgradeDeprecatedFiles(d->m_instance->instanceRoot(), d->m_instance->name()); @@ -598,17 +598,17 @@ bool ComponentList::migratePreComponentConfig() } } // new we have a complete list of components... - return saveComponentList(componentsFilePath(), components); + return savePackProfile(componentsFilePath(), components); } // END: save/load -void ComponentList::appendComponent(ComponentPtr component) +void PackProfile::appendComponent(ComponentPtr component) { insertComponent(d->components.size(), component); } -void ComponentList::insertComponent(size_t index, ComponentPtr component) +void PackProfile::insertComponent(size_t index, ComponentPtr component) { auto id = component->getID(); if(id.isEmpty()) @@ -625,16 +625,16 @@ void ComponentList::insertComponent(size_t index, ComponentPtr component) d->components.insert(index, component); d->componentIndex[id] = component; endInsertRows(); - connect(component.get(), &Component::dataChanged, this, &ComponentList::componentDataChanged); + connect(component.get(), &Component::dataChanged, this, &PackProfile::componentDataChanged); scheduleSave(); } -void ComponentList::componentDataChanged() +void PackProfile::componentDataChanged() { auto objPtr = qobject_cast<Component *>(sender()); if(!objPtr) { - qWarning() << "ComponentList got dataChenged signal from a non-Component!"; + qWarning() << "PackProfile got dataChenged signal from a non-Component!"; return; } if(objPtr->getID() == "net.minecraft") { @@ -652,10 +652,10 @@ void ComponentList::componentDataChanged() } index++; } - qWarning() << "ComponentList got dataChenged signal from a Component which does not belong to it!"; + qWarning() << "PackProfile got dataChenged signal from a Component which does not belong to it!"; } -bool ComponentList::remove(const int index) +bool PackProfile::remove(const int index) { auto patch = getComponent(index); if (!patch->isRemovable()) @@ -679,7 +679,7 @@ bool ComponentList::remove(const int index) return true; } -bool ComponentList::remove(const QString id) +bool PackProfile::remove(const QString id) { int i = 0; for (auto patch : d->components) @@ -693,7 +693,7 @@ bool ComponentList::remove(const QString id) return false; } -bool ComponentList::customize(int index) +bool PackProfile::customize(int index) { auto patch = getComponent(index); if (!patch->isCustomizable()) @@ -711,7 +711,7 @@ bool ComponentList::customize(int index) return true; } -bool ComponentList::revertToBase(int index) +bool PackProfile::revertToBase(int index) { auto patch = getComponent(index); if (!patch->isRevertible()) @@ -729,7 +729,7 @@ bool ComponentList::revertToBase(int index) return true; } -Component * ComponentList::getComponent(const QString &id) +Component * PackProfile::getComponent(const QString &id) { auto iter = d->componentIndex.find(id); if (iter == d->componentIndex.end()) @@ -739,7 +739,7 @@ Component * ComponentList::getComponent(const QString &id) return (*iter).get(); } -Component * ComponentList::getComponent(int index) +Component * PackProfile::getComponent(int index) { if(index < 0 || index >= d->components.size()) { @@ -748,7 +748,7 @@ Component * ComponentList::getComponent(int index) return d->components[index].get(); } -QVariant ComponentList::data(const QModelIndex &index, int role) const +QVariant PackProfile::data(const QModelIndex &index, int role) const { if (!index.isValid()) return QVariant(); @@ -822,7 +822,7 @@ QVariant ComponentList::data(const QModelIndex &index, int role) const return QVariant(); } -bool ComponentList::setData(const QModelIndex& index, const QVariant& value, int role) +bool PackProfile::setData(const QModelIndex& index, const QVariant& value, int role) { if (!index.isValid() || index.row() < 0 || index.row() >= rowCount(index)) { @@ -840,7 +840,7 @@ bool ComponentList::setData(const QModelIndex& index, const QVariant& value, int return false; } -QVariant ComponentList::headerData(int section, Qt::Orientation orientation, int role) const +QVariant PackProfile::headerData(int section, Qt::Orientation orientation, int role) const { if (orientation == Qt::Horizontal) { @@ -861,7 +861,7 @@ QVariant ComponentList::headerData(int section, Qt::Orientation orientation, int } // FIXME: zero precision mess -Qt::ItemFlags ComponentList::flags(const QModelIndex &index) const +Qt::ItemFlags PackProfile::flags(const QModelIndex &index) const { if (!index.isValid()) { return Qt::NoItemFlags; @@ -884,17 +884,17 @@ Qt::ItemFlags ComponentList::flags(const QModelIndex &index) const return outFlags; } -int ComponentList::rowCount(const QModelIndex &parent) const +int PackProfile::rowCount(const QModelIndex &parent) const { return d->components.size(); } -int ComponentList::columnCount(const QModelIndex &parent) const +int PackProfile::columnCount(const QModelIndex &parent) const { return NUM_COLUMNS; } -void ComponentList::move(const int index, const MoveDirection direction) +void PackProfile::move(const int index, const MoveDirection direction) { int theirIndex; if (direction == MoveUp) @@ -930,22 +930,22 @@ void ComponentList::move(const int index, const MoveDirection direction) scheduleSave(); } -void ComponentList::invalidateLaunchProfile() +void PackProfile::invalidateLaunchProfile() { d->m_profile.reset(); } -void ComponentList::installJarMods(QStringList selectedFiles) +void PackProfile::installJarMods(QStringList selectedFiles) { installJarMods_internal(selectedFiles); } -void ComponentList::installCustomJar(QString selectedFile) +void PackProfile::installCustomJar(QString selectedFile) { installCustomJar_internal(selectedFile); } -bool ComponentList::installEmpty(const QString& uid, const QString& name) +bool PackProfile::installEmpty(const QString& uid, const QString& name) { QString patchDir = FS::PathCombine(d->m_instance->instanceRoot(), "patches"); if(!FS::ensureFolderPathExists(patchDir)) @@ -973,7 +973,7 @@ bool ComponentList::installEmpty(const QString& uid, const QString& name) return true; } -bool ComponentList::removeComponent_internal(ComponentPtr patch) +bool PackProfile::removeComponent_internal(ComponentPtr patch) { bool ok = true; // first, remove the patch file. this ensures it's not used anymore @@ -1023,7 +1023,7 @@ bool ComponentList::removeComponent_internal(ComponentPtr patch) return ok; } -bool ComponentList::installJarMods_internal(QStringList filepaths) +bool PackProfile::installJarMods_internal(QStringList filepaths) { QString patchDir = FS::PathCombine(d->m_instance->instanceRoot(), "patches"); if(!FS::ensureFolderPathExists(patchDir)) @@ -1085,7 +1085,7 @@ bool ComponentList::installJarMods_internal(QStringList filepaths) return true; } -bool ComponentList::installCustomJar_internal(QString filepath) +bool PackProfile::installCustomJar_internal(QString filepath) { QString patchDir = FS::PathCombine(d->m_instance->instanceRoot(), "patches"); if(!FS::ensureFolderPathExists(patchDir)) @@ -1146,7 +1146,7 @@ bool ComponentList::installCustomJar_internal(QString filepath) return true; } -std::shared_ptr<LaunchProfile> ComponentList::getProfile() const +std::shared_ptr<LaunchProfile> PackProfile::getProfile() const { if(!d->m_profile) { @@ -1168,7 +1168,7 @@ std::shared_ptr<LaunchProfile> ComponentList::getProfile() const return d->m_profile; } -void ComponentList::setOldConfigVersion(const QString& uid, const QString& version) +void PackProfile::setOldConfigVersion(const QString& uid, const QString& version) { if(version.isEmpty()) { @@ -1177,7 +1177,7 @@ void ComponentList::setOldConfigVersion(const QString& uid, const QString& versi d->m_oldConfigVersions[uid] = version; } -bool ComponentList::setComponentVersion(const QString& uid, const QString& version, bool important) +bool PackProfile::setComponentVersion(const QString& uid, const QString& version, bool important) { auto iter = d->componentIndex.find(uid); if(iter != d->componentIndex.end()) @@ -1203,7 +1203,7 @@ bool ComponentList::setComponentVersion(const QString& uid, const QString& versi } } -QString ComponentList::getComponentVersion(const QString& uid) const +QString PackProfile::getComponentVersion(const QString& uid) const { const auto iter = d->componentIndex.find(uid); if (iter != d->componentIndex.end()) @@ -1213,7 +1213,7 @@ QString ComponentList::getComponentVersion(const QString& uid) const return QString(); } -void ComponentList::disableInteraction(bool disable) +void PackProfile::disableInteraction(bool disable) { if(d->interactionDisabled != disable) { d->interactionDisabled = disable; diff --git a/api/logic/minecraft/ComponentList.h b/api/logic/minecraft/PackProfile.h index 7b5e1385..66cd5e3e 100644 --- a/api/logic/minecraft/ComponentList.h +++ b/api/logic/minecraft/PackProfile.h @@ -31,10 +31,10 @@ #include "net/Mode.h" class MinecraftInstance; -struct ComponentListData; +struct PackProfileData; class ComponentUpdateTask; -class MULTIMC_LOGIC_EXPORT ComponentList : public QAbstractListModel +class MULTIMC_LOGIC_EXPORT PackProfile : public QAbstractListModel { Q_OBJECT friend ComponentUpdateTask; @@ -46,8 +46,8 @@ public: NUM_COLUMNS }; - explicit ComponentList(MinecraftInstance * instance); - virtual ~ComponentList(); + explicit PackProfile(MinecraftInstance * instance); + virtual ~PackProfile(); virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override; @@ -146,5 +146,5 @@ private: private: /* data */ - std::unique_ptr<ComponentListData> d; + std::unique_ptr<PackProfileData> d; }; diff --git a/api/logic/minecraft/ComponentList_p.h b/api/logic/minecraft/PackProfile_p.h index 7a3d498b..2f7cc3d7 100644 --- a/api/logic/minecraft/ComponentList_p.h +++ b/api/logic/minecraft/PackProfile_p.h @@ -11,7 +11,7 @@ using ComponentContainer = QList<ComponentPtr>; using ComponentIndex = QMap<QString, ComponentPtr>; using ConnectionList = QList<QMetaObject::Connection>; -struct ComponentListData +struct PackProfileData { // the instance this belongs to MinecraftInstance *m_instance; diff --git a/api/logic/minecraft/VersionFile.cpp b/api/logic/minecraft/VersionFile.cpp index 5bad57e9..d0a1a507 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/ComponentList.h" +#include "minecraft/PackProfile.h" #include "ParseUtils.h" #include <Version.h> diff --git a/api/logic/minecraft/VersionFile.h b/api/logic/minecraft/VersionFile.h index 29ddd0bc..b79fcd4f 100644 --- a/api/logic/minecraft/VersionFile.h +++ b/api/logic/minecraft/VersionFile.h @@ -12,7 +12,7 @@ #include "Library.h" #include <meta/JsonFormat.h> -class ComponentList; +class PackProfile; class VersionFile; class LaunchProfile; struct MojangDownloadInfo; diff --git a/api/logic/minecraft/launch/ModMinecraftJar.cpp b/api/logic/minecraft/launch/ModMinecraftJar.cpp index ceaad175..ba43a68d 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/ComponentList.h" +#include "minecraft/PackProfile.h" void ModMinecraftJar::executeTask() { @@ -43,7 +43,7 @@ void ModMinecraftJar::executeTask() } // create temporary modded jar, if needed - auto components = m_inst->getComponentList(); + auto components = m_inst->getPackProfile(); auto profile = components->getProfile(); auto jarMods = m_inst->getJarMods(); if(jarMods.size()) diff --git a/api/logic/minecraft/launch/ReconstructAssets.cpp b/api/logic/minecraft/launch/ReconstructAssets.cpp index af9af127..3ac320bd 100644 --- a/api/logic/minecraft/launch/ReconstructAssets.cpp +++ b/api/logic/minecraft/launch/ReconstructAssets.cpp @@ -15,7 +15,7 @@ #include "ReconstructAssets.h" #include "minecraft/MinecraftInstance.h" -#include "minecraft/ComponentList.h" +#include "minecraft/PackProfile.h" #include "minecraft/AssetsUtils.h" #include "launch/LaunchTask.h" @@ -23,7 +23,7 @@ void ReconstructAssets::executeTask() { auto instance = m_parent->instance(); std::shared_ptr<MinecraftInstance> minecraftInstance = std::dynamic_pointer_cast<MinecraftInstance>(instance); - auto components = minecraftInstance->getComponentList(); + auto components = minecraftInstance->getPackProfile(); auto profile = components->getProfile(); auto assets = profile->getMinecraftAssets(); diff --git a/api/logic/minecraft/legacy/LegacyUpgradeTask.cpp b/api/logic/minecraft/legacy/LegacyUpgradeTask.cpp index 9d86a7b5..a4ea60cd 100644 --- a/api/logic/minecraft/legacy/LegacyUpgradeTask.cpp +++ b/api/logic/minecraft/legacy/LegacyUpgradeTask.cpp @@ -6,7 +6,7 @@ #include <QtConcurrentRun> #include "LegacyInstance.h" #include "minecraft/MinecraftInstance.h" -#include "minecraft/ComponentList.h" +#include "minecraft/PackProfile.h" #include "LegacyModList.h" #include "classparser.h" @@ -84,7 +84,7 @@ void LegacyUpgradeTask::copyFinished() } } } - auto components = inst.getComponentList(); + auto components = inst.getPackProfile(); components->buildingFromScratch(); components->setComponentVersion("net.minecraft", preferredVersionNumber, true); diff --git a/api/logic/minecraft/update/AssetUpdateTask.cpp b/api/logic/minecraft/update/AssetUpdateTask.cpp index 051b1279..e26ab4ef 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/ComponentList.h" +#include "minecraft/PackProfile.h" #include "net/ChecksumValidator.h" #include "minecraft/AssetsUtils.h" @@ -17,7 +17,7 @@ AssetUpdateTask::~AssetUpdateTask() void AssetUpdateTask::executeTask() { setStatus(tr("Updating assets index...")); - auto components = m_inst->getComponentList(); + auto components = m_inst->getPackProfile(); auto profile = components->getProfile(); auto assets = profile->getMinecraftAssets(); QUrl indexUrl = assets->url; @@ -54,7 +54,7 @@ void AssetUpdateTask::assetIndexFinished() AssetsIndex index; qDebug() << m_inst->name() << ": Finished asset index download"; - auto components = m_inst->getComponentList(); + auto components = m_inst->getPackProfile(); auto profile = components->getProfile(); auto assets = profile->getMinecraftAssets(); diff --git a/api/logic/minecraft/update/FMLLibrariesTask.cpp b/api/logic/minecraft/update/FMLLibrariesTask.cpp index 52a8375b..850130a1 100644 --- a/api/logic/minecraft/update/FMLLibrariesTask.cpp +++ b/api/logic/minecraft/update/FMLLibrariesTask.cpp @@ -3,7 +3,7 @@ #include <minecraft/VersionFilterData.h> #include "FMLLibrariesTask.h" #include "minecraft/MinecraftInstance.h" -#include "minecraft/ComponentList.h" +#include "minecraft/PackProfile.h" FMLLibrariesTask::FMLLibrariesTask(MinecraftInstance * inst) { @@ -13,7 +13,7 @@ void FMLLibrariesTask::executeTask() { // Get the mod list MinecraftInstance *inst = (MinecraftInstance *)m_inst; - auto components = inst->getComponentList(); + auto components = inst->getPackProfile(); auto profile = components->getProfile(); if (!profile->hasTrait("legacyFML")) diff --git a/api/logic/minecraft/update/LibrariesTask.cpp b/api/logic/minecraft/update/LibrariesTask.cpp index a000f77f..7f66a651 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/ComponentList.h" +#include "minecraft/PackProfile.h" LibrariesTask::LibrariesTask(MinecraftInstance * inst) { @@ -15,7 +15,7 @@ void LibrariesTask::executeTask() MinecraftInstance *inst = (MinecraftInstance *)m_inst; // Build a list of URLs that will need to be downloaded. - auto components = inst->getComponentList(); + auto components = inst->getPackProfile(); auto profile = components->getProfile(); auto job = new NetJob(tr("Libraries for instance %1").arg(inst->name())); diff --git a/api/logic/modplatform/legacy_ftb/PackInstallTask.cpp b/api/logic/modplatform/legacy_ftb/PackInstallTask.cpp index ea7e2c0c..a3f35154 100644 --- a/api/logic/modplatform/legacy_ftb/PackInstallTask.cpp +++ b/api/logic/modplatform/legacy_ftb/PackInstallTask.cpp @@ -7,7 +7,7 @@ #include "FileSystem.h" #include "settings/INISettingsObject.h" #include "minecraft/MinecraftInstance.h" -#include "minecraft/ComponentList.h" +#include "minecraft/PackProfile.h" #include "minecraft/GradleSpecifier.h" #include "net/URLConstants.h" @@ -125,7 +125,7 @@ void PackInstallTask::install() instanceSettings->set("InstanceType", "OneSix"); MinecraftInstance instance(m_globalSettings, instanceSettings, m_stagingPath); - auto components = instance.getComponentList(); + auto components = instance.getPackProfile(); components->buildingFromScratch(); components->setComponentVersion("net.minecraft", m_pack.mcVersion, true); diff --git a/application/pages/instance/ModFolderPage.cpp b/application/pages/instance/ModFolderPage.cpp index ec4bf3c9..2981ea13 100644 --- a/application/pages/instance/ModFolderPage.cpp +++ b/application/pages/instance/ModFolderPage.cpp @@ -28,7 +28,7 @@ #include "minecraft/mod/ModFolderModel.h" #include "minecraft/mod/Mod.h" #include "minecraft/VersionFilterData.h" -#include "minecraft/ComponentList.h" +#include "minecraft/PackProfile.h" #include <DesktopServices.h> #include <QSortFilterProxyModel> @@ -244,7 +244,7 @@ bool CoreModFolderPage::shouldDisplay() const auto inst = dynamic_cast<MinecraftInstance *>(m_inst); if (!inst) return true; - auto version = inst->getComponentList(); + auto version = inst->getPackProfile(); if (!version) return true; if(!version->getComponent("net.minecraftforge")) diff --git a/application/pages/instance/VersionPage.cpp b/application/pages/instance/VersionPage.cpp index c7a8dc30..c4a7cb44 100644 --- a/application/pages/instance/VersionPage.cpp +++ b/application/pages/instance/VersionPage.cpp @@ -37,7 +37,7 @@ #include <QString> #include <QUrl> -#include "minecraft/ComponentList.h" +#include "minecraft/PackProfile.h" #include "minecraft/auth/MojangAccountList.h" #include "minecraft/mod/Mod.h" #include "icons/IconList.h" @@ -114,9 +114,9 @@ VersionPage::VersionPage(MinecraftInstance *inst, QWidget *parent) ui->toolBar->insertSpacer(ui->actionReload); - m_profile = m_inst->getComponentList(); + m_profile = m_inst->getPackProfile(); - reloadComponentList(); + reloadPackProfile(); auto proxy = new IconProxy(ui->packageView); proxy->setSourceModel(m_profile.get()); @@ -129,7 +129,7 @@ VersionPage::VersionPage(MinecraftInstance *inst, QWidget *parent) auto smodel = ui->packageView->selectionModel(); connect(smodel, &QItemSelectionModel::currentChanged, this, &VersionPage::packageCurrent); - connect(m_profile.get(), &ComponentList::minecraftChanged, this, &VersionPage::updateVersionControls); + connect(m_profile.get(), &PackProfile::minecraftChanged, this, &VersionPage::updateVersionControls); controlsEnabled = !m_inst->isRunning(); updateVersionControls(); preselect(0); @@ -232,7 +232,7 @@ void VersionPage::updateButtons(int row) ui->actionAdd_to_Minecraft_jar->setEnabled(controlsEnabled); } -bool VersionPage::reloadComponentList() +bool VersionPage::reloadPackProfile() { try { @@ -255,7 +255,7 @@ bool VersionPage::reloadComponentList() void VersionPage::on_actionReload_triggered() { - reloadComponentList(); + reloadPackProfile(); m_container->refreshContainer(); } @@ -270,7 +270,7 @@ void VersionPage::on_actionRemove_triggered() } } updateButtons(); - reloadComponentList(); + reloadPackProfile(); m_container->refreshContainer(); } @@ -306,7 +306,7 @@ void VersionPage::on_actionMove_up_triggered() { try { - m_profile->move(currentRow(), ComponentList::MoveUp); + m_profile->move(currentRow(), PackProfile::MoveUp); } catch (const Exception &e) { @@ -319,7 +319,7 @@ void VersionPage::on_actionMove_down_triggered() { try { - m_profile->move(currentRow(), ComponentList::MoveDown); + m_profile->move(currentRow(), PackProfile::MoveDown); } catch (const Exception &e) { diff --git a/application/pages/instance/VersionPage.h b/application/pages/instance/VersionPage.h index 769fe997..c95a0084 100644 --- a/application/pages/instance/VersionPage.h +++ b/application/pages/instance/VersionPage.h @@ -18,7 +18,7 @@ #include <QMainWindow> #include "minecraft/MinecraftInstance.h" -#include "minecraft/ComponentList.h" +#include "minecraft/PackProfile.h" #include "pages/BasePage.h" namespace Ui @@ -82,11 +82,11 @@ protected: QMenu * createPopupMenu() override; /// FIXME: this shouldn't be necessary! - bool reloadComponentList(); + bool reloadPackProfile(); private: Ui::VersionPage *ui; - std::shared_ptr<ComponentList> m_profile; + std::shared_ptr<PackProfile> m_profile; MinecraftInstance *m_inst; int currentIdx = 0; bool controlsEnabled = false; |