NOISSUE rename ComponentList to PackProfile

It's not just components, so the naming needed cleaning up.
This commit is contained in:
Petr Mrázek 2020-06-27 12:02:31 +02:00
parent 4ca62916f5
commit a0ef20a264
29 changed files with 145 additions and 145 deletions

View File

@ -259,8 +259,8 @@ set(MINECRAFT_SOURCES
minecraft/LaunchProfile.h minecraft/LaunchProfile.h
minecraft/Component.cpp minecraft/Component.cpp
minecraft/Component.h minecraft/Component.h
minecraft/ComponentList.cpp minecraft/PackProfile.cpp
minecraft/ComponentList.h minecraft/PackProfile.h
minecraft/ComponentUpdateTask.cpp minecraft/ComponentUpdateTask.cpp
minecraft/ComponentUpdateTask.h minecraft/ComponentUpdateTask.h
minecraft/MinecraftLoadAndCheck.h minecraft/MinecraftLoadAndCheck.h

View File

@ -4,7 +4,7 @@
//FIXME: remove this //FIXME: remove this
#include "minecraft/MinecraftInstance.h" #include "minecraft/MinecraftInstance.h"
#include "minecraft/ComponentList.h" #include "minecraft/PackProfile.h"
InstanceCreationTask::InstanceCreationTask(BaseVersionPtr version) InstanceCreationTask::InstanceCreationTask(BaseVersionPtr version)
{ {
@ -20,7 +20,7 @@ void InstanceCreationTask::executeTask()
instanceSettings->registerSetting("InstanceType", "Legacy"); instanceSettings->registerSetting("InstanceType", "Legacy");
instanceSettings->set("InstanceType", "OneSix"); instanceSettings->set("InstanceType", "OneSix");
MinecraftInstance inst(m_globalSettings, instanceSettings, m_stagingPath); MinecraftInstance inst(m_globalSettings, instanceSettings, m_stagingPath);
auto components = inst.getComponentList(); auto components = inst.getPackProfile();
components->buildingFromScratch(); components->buildingFromScratch();
components->setComponentVersion("net.minecraft", m_version->descriptor(), true); components->setComponentVersion("net.minecraft", m_version->descriptor(), true);
inst.setName(m_instName); inst.setName(m_instName);

View File

@ -11,7 +11,7 @@
// FIXME: this does not belong here, it's Minecraft/Flame specific // FIXME: this does not belong here, it's Minecraft/Flame specific
#include "minecraft/MinecraftInstance.h" #include "minecraft/MinecraftInstance.h"
#include "minecraft/ComponentList.h" #include "minecraft/PackProfile.h"
#include "modplatform/flame/FileResolvingTask.h" #include "modplatform/flame/FileResolvingTask.h"
#include "modplatform/flame/PackManifest.h" #include "modplatform/flame/PackManifest.h"
#include "Json.h" #include "Json.h"
@ -236,7 +236,7 @@ void InstanceImportTask::processFlame()
mcVersion.remove(QRegExp("[.]+$")); mcVersion.remove(QRegExp("[.]+$"));
logWarning(tr("Mysterious trailing dots removed from Minecraft version while importing pack.")); logWarning(tr("Mysterious trailing dots removed from Minecraft version while importing pack."));
} }
auto components = instance.getComponentList(); auto components = instance.getPackProfile();
components->buildingFromScratch(); components->buildingFromScratch();
components->setComponentVersion("net.minecraft", mcVersion, true); components->setComponentVersion("net.minecraft", mcVersion, true);
if(!forgeVersion.isEmpty()) if(!forgeVersion.isEmpty())
@ -288,7 +288,7 @@ void InstanceImportTask::processFlame()
qDebug() << info.fileName(); qDebug() << info.fileName();
jarMods.push_back(info.absoluteFilePath()); jarMods.push_back(info.absoluteFilePath());
} }
auto profile = instance.getComponentList(); auto profile = instance.getPackProfile();
profile->installJarMods(jarMods); profile->installJarMods(jarMods);
// nuke the original files // nuke the original files
FS::deletePath(jarmodsPath); FS::deletePath(jarmodsPath);

View File

@ -18,7 +18,7 @@
#include <QDateTime> #include <QDateTime>
#include "JsonFormat.h" #include "JsonFormat.h"
#include "minecraft/ComponentList.h" #include "minecraft/PackProfile.h"
Meta::Version::Version(const QString &uid, const QString &version) Meta::Version::Version(const QString &uid, const QString &version)
: BaseVersion(), m_uid(uid), m_version(version) : BaseVersion(), m_uid(uid), m_version(version)

View File

@ -5,13 +5,13 @@
#include "meta/Version.h" #include "meta/Version.h"
#include "VersionFile.h" #include "VersionFile.h"
#include "minecraft/ComponentList.h" #include "minecraft/PackProfile.h"
#include <FileSystem.h> #include <FileSystem.h>
#include <QSaveFile> #include <QSaveFile>
#include "OneSixVersionFormat.h" #include "OneSixVersionFormat.h"
#include <assert.h> #include <assert.h>
Component::Component(ComponentList * parent, const QString& uid) Component::Component(PackProfile * parent, const QString& uid)
{ {
assert(parent); assert(parent);
m_parent = parent; m_parent = parent;
@ -19,7 +19,7 @@ Component::Component(ComponentList * parent, const QString& uid)
m_uid = 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); assert(parent);
m_parent = parent; m_parent = parent;
@ -31,7 +31,7 @@ Component::Component(ComponentList * parent, std::shared_ptr<Meta::Version> vers
m_loaded = version->isLoaded(); 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); assert(parent);
m_parent = parent; m_parent = parent;

View File

@ -9,7 +9,7 @@
#include "QObjectPtr.h" #include "QObjectPtr.h"
#include "multimc_logic_export.h" #include "multimc_logic_export.h"
class ComponentList; class PackProfile;
class LaunchProfile; class LaunchProfile;
namespace Meta namespace Meta
{ {
@ -22,11 +22,11 @@ class MULTIMC_LOGIC_EXPORT Component : public QObject, public ProblemProvider
{ {
Q_OBJECT Q_OBJECT
public: public:
Component(ComponentList * parent, const QString &uid); Component(PackProfile * parent, const QString &uid);
// DEPRECATED: remove these constructors? // DEPRECATED: remove these constructors?
Component(ComponentList * parent, std::shared_ptr<Meta::Version> version); Component(PackProfile * parent, std::shared_ptr<Meta::Version> version);
Component(ComponentList * parent, const QString & uid, std::shared_ptr<VersionFile> file); Component(PackProfile * parent, const QString & uid, std::shared_ptr<VersionFile> file);
virtual ~Component(){}; virtual ~Component(){};
void applyTo(LaunchProfile *profile); void applyTo(LaunchProfile *profile);
@ -73,7 +73,7 @@ signals:
void dataChanged(); void dataChanged();
public: /* data */ public: /* data */
ComponentList * m_parent; PackProfile * m_parent;
// BEGIN: persistent component list properties // BEGIN: persistent component list properties
/// ID of the component /// ID of the component

View File

@ -1,7 +1,7 @@
#include "ComponentUpdateTask.h" #include "ComponentUpdateTask.h"
#include "ComponentList_p.h" #include "PackProfile_p.h"
#include "ComponentList.h" #include "PackProfile.h"
#include "Component.h" #include "Component.h"
#include <Env.h> #include <Env.h>
#include <meta/Index.h> #include <meta/Index.h>
@ -22,16 +22,16 @@
* Really, it should be a reactor/state machine that receives input from the application * Really, it should be a reactor/state machine that receives input from the application
* and dynamically adapts to changing requirements... * 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 * 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. * 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) : Task(parent)
{ {
d.reset(new ComponentUpdateTaskData); 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? // 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) if(component->m_loaded)
{ {
@ -217,7 +217,7 @@ void ComponentUpdateTask::loadComponents()
} }
case Mode::Resolution: case Mode::Resolution:
{ {
singleResult = loadComponentList(component, loadTask, d->netmode); singleResult = loadPackProfile(component, loadTask, d->netmode);
loadType = RemoteLoadStatus::Type::List; loadType = RemoteLoadStatus::Type::List;
break; break;
} }
@ -244,7 +244,7 @@ void ComponentUpdateTask::loadComponents()
}); });
RemoteLoadStatus status; RemoteLoadStatus status;
status.type = loadType; status.type = loadType;
status.componentListIndex = componentIndex; status.PackProfileIndex = componentIndex;
d->remoteLoadStatusList.append(status); d->remoteLoadStatusList.append(status);
taskIndex++; taskIndex++;
} }
@ -495,7 +495,7 @@ static bool getTrivialComponentChanges(const ComponentIndex & index, const Requi
} }
// FIXME, TODO: decouple dependency resolution from loading // 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 // FIXME: throw all this away and use a graph
void ComponentUpdateTask::resolveDependencies(bool checkOnly) 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. // update the cached data of the component from the downloaded version file.
if (taskSlot.type == RemoteLoadStatus::Type::Version) 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->m_loaded = true;
component->updateCachedData(); component->updateCachedData();
} }

View File

@ -4,7 +4,7 @@
#include "net/Mode.h" #include "net/Mode.h"
#include <memory> #include <memory>
class ComponentList; class PackProfile;
struct ComponentUpdateTaskData; struct ComponentUpdateTaskData;
class ComponentUpdateTask : public Task class ComponentUpdateTask : public Task
@ -18,7 +18,7 @@ public:
}; };
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(); virtual ~ComponentUpdateTask();
protected: protected:

View File

@ -5,7 +5,7 @@
#include <QList> #include <QList>
#include "net/Mode.h" #include "net/Mode.h"
class ComponentList; class PackProfile;
struct RemoteLoadStatus struct RemoteLoadStatus
{ {
@ -15,7 +15,7 @@ struct RemoteLoadStatus
List, List,
Version Version
} type = Type::Version; } type = Type::Version;
size_t componentListIndex = 0; size_t PackProfileIndex = 0;
bool finished = false; bool finished = false;
bool succeeded = false; bool succeeded = false;
QString error; QString error;
@ -23,7 +23,7 @@ struct RemoteLoadStatus
struct ComponentUpdateTaskData struct ComponentUpdateTaskData
{ {
ComponentList * m_list = nullptr; PackProfile * m_list = nullptr;
QList<RemoteLoadStatus> remoteLoadStatusList; QList<RemoteLoadStatus> remoteLoadStatusList;
bool remoteLoadSuccessful = true; bool remoteLoadSuccessful = true;
size_t remoteTasksInProgress = 0; size_t remoteTasksInProgress = 0;

View File

@ -33,7 +33,7 @@
#include "icons/IIconList.h" #include "icons/IIconList.h"
#include <QCoreApplication> #include <QCoreApplication>
#include "ComponentList.h" #include "PackProfile.h"
#include "AssetsUtils.h" #include "AssetsUtils.h"
#include "MinecraftUpdate.h" #include "MinecraftUpdate.h"
#include "MinecraftLoadAndCheck.h" #include "MinecraftLoadAndCheck.h"
@ -106,7 +106,7 @@ MinecraftInstance::MinecraftInstance(SettingsObjectPtr globalSettings, SettingsO
m_settings->registerSetting("ForgeVersion", ""); m_settings->registerSetting("ForgeVersion", "");
m_settings->registerSetting("LiteloaderVersion", ""); 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()); m_components->setOldConfigVersion("net.minecraft", m_settings->get("IntendedVersion").toString());
auto setting = m_settings->getSetting("LWJGLVersion"); auto setting = m_settings->getSetting("LWJGLVersion");
m_components->setOldConfigVersion("org.lwjgl", m_settings->get("LWJGLVersion").toString()); m_components->setOldConfigVersion("org.lwjgl", m_settings->get("LWJGLVersion").toString());
@ -124,14 +124,14 @@ QString MinecraftInstance::typeName() const
return "Minecraft"; return "Minecraft";
} }
std::shared_ptr<ComponentList> MinecraftInstance::getComponentList() const std::shared_ptr<PackProfile> MinecraftInstance::getPackProfile() const
{ {
return m_components; return m_components;
} }
QSet<QString> MinecraftInstance::traits() const QSet<QString> MinecraftInstance::traits() const
{ {
auto components = getComponentList(); auto components = getPackProfile();
if (!components) if (!components)
{ {
return {"version-incomplete"}; return {"version-incomplete"};
@ -265,7 +265,7 @@ QStringList MinecraftInstance::getNativeJars() const
QStringList MinecraftInstance::extraArguments() const QStringList MinecraftInstance::extraArguments() const
{ {
auto list = BaseInstance::extraArguments(); auto list = BaseInstance::extraArguments();
auto version = getComponentList(); auto version = getPackProfile();
if (!version) if (!version)
return list; return list;
auto jarMods = getJarMods(); auto jarMods = getJarMods();

View File

@ -10,7 +10,7 @@ class ModFolderModel;
class WorldList; class WorldList;
class GameOptions; class GameOptions;
class LaunchStep; class LaunchStep;
class ComponentList; class PackProfile;
class MULTIMC_LOGIC_EXPORT MinecraftInstance: public BaseInstance class MULTIMC_LOGIC_EXPORT MinecraftInstance: public BaseInstance
{ {
@ -64,7 +64,7 @@ public:
////// Profile management ////// ////// Profile management //////
std::shared_ptr<ComponentList> getComponentList() const; std::shared_ptr<PackProfile> getPackProfile() const;
////// Mod Lists ////// ////// Mod Lists //////
std::shared_ptr<ModFolderModel> loaderModList() const; std::shared_ptr<ModFolderModel> loaderModList() const;
@ -120,7 +120,7 @@ private:
QString prettifyTimeDuration(int64_t duration); QString prettifyTimeDuration(int64_t duration);
protected: // data 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_loader_mod_list;
mutable std::shared_ptr<ModFolderModel> m_core_mod_list; mutable std::shared_ptr<ModFolderModel> m_core_mod_list;
mutable std::shared_ptr<ModFolderModel> m_resource_pack_list; mutable std::shared_ptr<ModFolderModel> m_resource_pack_list;

View File

@ -1,6 +1,6 @@
#include "MinecraftLoadAndCheck.h" #include "MinecraftLoadAndCheck.h"
#include "MinecraftInstance.h" #include "MinecraftInstance.h"
#include "ComponentList.h" #include "PackProfile.h"
MinecraftLoadAndCheck::MinecraftLoadAndCheck(MinecraftInstance *inst, QObject *parent) : Task(parent), m_inst(inst) MinecraftLoadAndCheck::MinecraftLoadAndCheck(MinecraftInstance *inst, QObject *parent) : Task(parent), m_inst(inst)
{ {
@ -9,7 +9,7 @@ MinecraftLoadAndCheck::MinecraftLoadAndCheck(MinecraftInstance *inst, QObject *p
void MinecraftLoadAndCheck::executeTask() void MinecraftLoadAndCheck::executeTask()
{ {
// add offline metadata load task // add offline metadata load task
auto components = m_inst->getComponentList(); auto components = m_inst->getPackProfile();
components->reload(Net::Mode::Offline); components->reload(Net::Mode::Offline);
m_task = components->getCurrentTask(); m_task = components->getCurrentTask();

View File

@ -23,7 +23,7 @@
#include <QDataStream> #include <QDataStream>
#include "BaseInstance.h" #include "BaseInstance.h"
#include "minecraft/ComponentList.h" #include "minecraft/PackProfile.h"
#include "minecraft/Library.h" #include "minecraft/Library.h"
#include "net/URLConstants.h" #include "net/URLConstants.h"
#include <FileSystem.h> #include <FileSystem.h>
@ -50,7 +50,7 @@ void MinecraftUpdate::executeTask()
// add metadata update task if necessary // add metadata update task if necessary
{ {
auto components = m_inst->getComponentList(); auto components = m_inst->getPackProfile();
components->reload(Net::Mode::Online); components->reload(Net::Mode::Online);
auto task = components->getCurrentTask(); auto task = components->getCurrentTask();
if(task) if(task)

View File

@ -1,7 +1,7 @@
#pragma once #pragma once
#include <minecraft/VersionFile.h> #include <minecraft/VersionFile.h>
#include <minecraft/ComponentList.h> #include <minecraft/PackProfile.h>
#include <minecraft/Library.h> #include <minecraft/Library.h>
#include <QJsonDocument> #include <QJsonDocument>

View File

@ -32,23 +32,23 @@
#include <QTimer> #include <QTimer>
#include <Json.h> #include <Json.h>
#include "ComponentList.h" #include "PackProfile.h"
#include "ComponentList_p.h" #include "PackProfile_p.h"
#include "ComponentUpdateTask.h" #include "ComponentUpdateTask.h"
ComponentList::ComponentList(MinecraftInstance * instance) PackProfile::PackProfile(MinecraftInstance * instance)
: QAbstractListModel() : QAbstractListModel()
{ {
d.reset(new ComponentListData); d.reset(new PackProfileData);
d->m_instance = instance; d->m_instance = instance;
d->m_saveTimer.setSingleShot(true); d->m_saveTimer.setSingleShot(true);
d->m_saveTimer.setInterval(5000); d->m_saveTimer.setInterval(5000);
d->interactionDisabled = instance->isRunning(); d->interactionDisabled = instance->isRunning();
connect(d->m_instance, &BaseInstance::runningStatusChanged, this, &ComponentList::disableInteraction); connect(d->m_instance, &BaseInstance::runningStatusChanged, this, &PackProfile::disableInteraction);
connect(&d->m_saveTimer, &QTimer::timeout, this, &ComponentList::save_internal); connect(&d->m_saveTimer, &QTimer::timeout, this, &PackProfile::save_internal);
} }
ComponentList::~ComponentList() PackProfile::~PackProfile()
{ {
saveNow(); saveNow();
} }
@ -97,7 +97,7 @@ static QJsonObject componentToJsonV1(ComponentPtr component)
return obj; 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 // critical
auto uid = Json::requireString(obj.value("uid")); 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 // 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; QJsonObject obj;
obj.insert("formatVersion", currentComponentsFileVersion); obj.insert("formatVersion", currentComponentsFileVersion);
@ -153,7 +153,7 @@ static bool saveComponentList(const QString & filename, const ComponentContainer
} }
// Read the given file into component containers // 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); QFile componentsFile(filename);
if (!componentsFile.exists()) if (!componentsFile.exists())
@ -210,7 +210,7 @@ static bool loadComponentList(ComponentList * parent, const QString & filename,
// BEGIN: save/load logic // BEGIN: save/load logic
void ComponentList::saveNow() void PackProfile::saveNow()
{ {
if(saveIsScheduled()) if(saveIsScheduled())
{ {
@ -219,18 +219,18 @@ void ComponentList::saveNow()
} }
} }
bool ComponentList::saveIsScheduled() const bool PackProfile::saveIsScheduled() const
{ {
return d->dirty; return d->dirty;
} }
void ComponentList::buildingFromScratch() void PackProfile::buildingFromScratch()
{ {
d->loaded = true; d->loaded = true;
d->dirty = true; d->dirty = true;
} }
void ComponentList::scheduleSave() void PackProfile::scheduleSave()
{ {
if(!d->loaded) if(!d->loaded)
{ {
@ -245,30 +245,30 @@ void ComponentList::scheduleSave()
d->m_saveTimer.start(); d->m_saveTimer.start();
} }
QString ComponentList::componentsFilePath() const QString PackProfile::componentsFilePath() const
{ {
return FS::PathCombine(d->m_instance->instanceRoot(), "mmc-pack.json"); 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"); 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); return patchesPattern().arg(uid);
} }
void ComponentList::save_internal() void PackProfile::save_internal()
{ {
qDebug() << "Component list save performed now for" << d->m_instance->name(); qDebug() << "Component list save performed now for" << d->m_instance->name();
auto filename = componentsFilePath(); auto filename = componentsFilePath();
saveComponentList(filename, d->components); savePackProfile(filename, d->components);
d->dirty = false; d->dirty = false;
} }
bool ComponentList::load() bool PackProfile::load()
{ {
auto filename = componentsFilePath(); auto filename = componentsFilePath();
QFile componentsFile(filename); QFile componentsFile(filename);
@ -286,7 +286,7 @@ bool ComponentList::load()
// load the new component list and swap it with the current one... // load the new component list and swap it with the current one...
ComponentContainer newComponents; 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(); qCritical() << "Failed to load the component config for instance" << d->m_instance->name();
return false; return false;
@ -298,7 +298,7 @@ bool ComponentList::load()
// disconnect all the old components // disconnect all the old components
for(auto component: d->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->components.clear();
d->componentIndex.clear(); d->componentIndex.clear();
@ -309,7 +309,7 @@ bool ComponentList::load()
qWarning() << "Ignoring duplicate component entry" << component->m_uid; qWarning() << "Ignoring duplicate component entry" << component->m_uid;
continue; continue;
} }
connect(component.get(), &Component::dataChanged, this, &ComponentList::componentDataChanged); connect(component.get(), &Component::dataChanged, this, &PackProfile::componentDataChanged);
d->components.append(component); d->components.append(component);
d->componentIndex[component->m_uid] = 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. // Do not reload when the update/resolve task is running. It is in control.
if(d->m_updateTask) 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; 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); auto updateTask = new ComponentUpdateTask(ComponentUpdateTask::Mode::Resolution, netmode, this);
d->m_updateTask.reset(updateTask); d->m_updateTask.reset(updateTask);
connect(updateTask, &ComponentUpdateTask::succeeded, this, &ComponentList::updateSucceeded); connect(updateTask, &ComponentUpdateTask::succeeded, this, &PackProfile::updateSucceeded);
connect(updateTask, &ComponentUpdateTask::failed, this, &ComponentList::updateFailed); connect(updateTask, &ComponentUpdateTask::failed, this, &PackProfile::updateFailed);
d->m_updateTask->start(); d->m_updateTask->start();
} }
void ComponentList::updateSucceeded() void PackProfile::updateSucceeded()
{ {
qDebug() << "Component list update/resolve task succeeded for" << d->m_instance->name(); qDebug() << "Component list update/resolve task succeeded for" << d->m_instance->name();
d->m_updateTask.reset(); d->m_updateTask.reset();
invalidateLaunchProfile(); 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; qDebug() << "Component list update/resolve task failed for" << d->m_instance->name() << "Reason:" << error;
d->m_updateTask.reset(); 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 taken from the old order.json file.
* - Part is loaded from loose json files in the instance's `patches` directory. * - 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 // upgrade the very old files from the beginnings of MultiMC 5
upgradeDeprecatedFiles(d->m_instance->instanceRoot(), d->m_instance->name()); upgradeDeprecatedFiles(d->m_instance->instanceRoot(), d->m_instance->name());
@ -598,17 +598,17 @@ bool ComponentList::migratePreComponentConfig()
} }
} }
// new we have a complete list of components... // new we have a complete list of components...
return saveComponentList(componentsFilePath(), components); return savePackProfile(componentsFilePath(), components);
} }
// END: save/load // END: save/load
void ComponentList::appendComponent(ComponentPtr component) void PackProfile::appendComponent(ComponentPtr component)
{ {
insertComponent(d->components.size(), 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(); auto id = component->getID();
if(id.isEmpty()) if(id.isEmpty())
@ -625,16 +625,16 @@ void ComponentList::insertComponent(size_t index, ComponentPtr component)
d->components.insert(index, component); d->components.insert(index, component);
d->componentIndex[id] = component; d->componentIndex[id] = component;
endInsertRows(); endInsertRows();
connect(component.get(), &Component::dataChanged, this, &ComponentList::componentDataChanged); connect(component.get(), &Component::dataChanged, this, &PackProfile::componentDataChanged);
scheduleSave(); scheduleSave();
} }
void ComponentList::componentDataChanged() void PackProfile::componentDataChanged()
{ {
auto objPtr = qobject_cast<Component *>(sender()); auto objPtr = qobject_cast<Component *>(sender());
if(!objPtr) if(!objPtr)
{ {
qWarning() << "ComponentList got dataChenged signal from a non-Component!"; qWarning() << "PackProfile got dataChenged signal from a non-Component!";
return; return;
} }
if(objPtr->getID() == "net.minecraft") { if(objPtr->getID() == "net.minecraft") {
@ -652,10 +652,10 @@ void ComponentList::componentDataChanged()
} }
index++; 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); auto patch = getComponent(index);
if (!patch->isRemovable()) if (!patch->isRemovable())
@ -679,7 +679,7 @@ bool ComponentList::remove(const int index)
return true; return true;
} }
bool ComponentList::remove(const QString id) bool PackProfile::remove(const QString id)
{ {
int i = 0; int i = 0;
for (auto patch : d->components) for (auto patch : d->components)
@ -693,7 +693,7 @@ bool ComponentList::remove(const QString id)
return false; return false;
} }
bool ComponentList::customize(int index) bool PackProfile::customize(int index)
{ {
auto patch = getComponent(index); auto patch = getComponent(index);
if (!patch->isCustomizable()) if (!patch->isCustomizable())
@ -711,7 +711,7 @@ bool ComponentList::customize(int index)
return true; return true;
} }
bool ComponentList::revertToBase(int index) bool PackProfile::revertToBase(int index)
{ {
auto patch = getComponent(index); auto patch = getComponent(index);
if (!patch->isRevertible()) if (!patch->isRevertible())
@ -729,7 +729,7 @@ bool ComponentList::revertToBase(int index)
return true; return true;
} }
Component * ComponentList::getComponent(const QString &id) Component * PackProfile::getComponent(const QString &id)
{ {
auto iter = d->componentIndex.find(id); auto iter = d->componentIndex.find(id);
if (iter == d->componentIndex.end()) if (iter == d->componentIndex.end())
@ -739,7 +739,7 @@ Component * ComponentList::getComponent(const QString &id)
return (*iter).get(); return (*iter).get();
} }
Component * ComponentList::getComponent(int index) Component * PackProfile::getComponent(int index)
{ {
if(index < 0 || index >= d->components.size()) if(index < 0 || index >= d->components.size())
{ {
@ -748,7 +748,7 @@ Component * ComponentList::getComponent(int index)
return d->components[index].get(); 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()) if (!index.isValid())
return QVariant(); return QVariant();
@ -822,7 +822,7 @@ QVariant ComponentList::data(const QModelIndex &index, int role) const
return QVariant(); 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)) 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; 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) if (orientation == Qt::Horizontal)
{ {
@ -861,7 +861,7 @@ QVariant ComponentList::headerData(int section, Qt::Orientation orientation, int
} }
// FIXME: zero precision mess // FIXME: zero precision mess
Qt::ItemFlags ComponentList::flags(const QModelIndex &index) const Qt::ItemFlags PackProfile::flags(const QModelIndex &index) const
{ {
if (!index.isValid()) { if (!index.isValid()) {
return Qt::NoItemFlags; return Qt::NoItemFlags;
@ -884,17 +884,17 @@ Qt::ItemFlags ComponentList::flags(const QModelIndex &index) const
return outFlags; return outFlags;
} }
int ComponentList::rowCount(const QModelIndex &parent) const int PackProfile::rowCount(const QModelIndex &parent) const
{ {
return d->components.size(); return d->components.size();
} }
int ComponentList::columnCount(const QModelIndex &parent) const int PackProfile::columnCount(const QModelIndex &parent) const
{ {
return NUM_COLUMNS; return NUM_COLUMNS;
} }
void ComponentList::move(const int index, const MoveDirection direction) void PackProfile::move(const int index, const MoveDirection direction)
{ {
int theirIndex; int theirIndex;
if (direction == MoveUp) if (direction == MoveUp)
@ -930,22 +930,22 @@ void ComponentList::move(const int index, const MoveDirection direction)
scheduleSave(); scheduleSave();
} }
void ComponentList::invalidateLaunchProfile() void PackProfile::invalidateLaunchProfile()
{ {
d->m_profile.reset(); d->m_profile.reset();
} }
void ComponentList::installJarMods(QStringList selectedFiles) void PackProfile::installJarMods(QStringList selectedFiles)
{ {
installJarMods_internal(selectedFiles); installJarMods_internal(selectedFiles);
} }
void ComponentList::installCustomJar(QString selectedFile) void PackProfile::installCustomJar(QString selectedFile)
{ {
installCustomJar_internal(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"); QString patchDir = FS::PathCombine(d->m_instance->instanceRoot(), "patches");
if(!FS::ensureFolderPathExists(patchDir)) if(!FS::ensureFolderPathExists(patchDir))
@ -973,7 +973,7 @@ bool ComponentList::installEmpty(const QString& uid, const QString& name)
return true; return true;
} }
bool ComponentList::removeComponent_internal(ComponentPtr patch) bool PackProfile::removeComponent_internal(ComponentPtr patch)
{ {
bool ok = true; bool ok = true;
// first, remove the patch file. this ensures it's not used anymore // first, remove the patch file. this ensures it's not used anymore
@ -1023,7 +1023,7 @@ bool ComponentList::removeComponent_internal(ComponentPtr patch)
return ok; return ok;
} }
bool ComponentList::installJarMods_internal(QStringList filepaths) bool PackProfile::installJarMods_internal(QStringList filepaths)
{ {
QString patchDir = FS::PathCombine(d->m_instance->instanceRoot(), "patches"); QString patchDir = FS::PathCombine(d->m_instance->instanceRoot(), "patches");
if(!FS::ensureFolderPathExists(patchDir)) if(!FS::ensureFolderPathExists(patchDir))
@ -1085,7 +1085,7 @@ bool ComponentList::installJarMods_internal(QStringList filepaths)
return true; return true;
} }
bool ComponentList::installCustomJar_internal(QString filepath) bool PackProfile::installCustomJar_internal(QString filepath)
{ {
QString patchDir = FS::PathCombine(d->m_instance->instanceRoot(), "patches"); QString patchDir = FS::PathCombine(d->m_instance->instanceRoot(), "patches");
if(!FS::ensureFolderPathExists(patchDir)) if(!FS::ensureFolderPathExists(patchDir))
@ -1146,7 +1146,7 @@ bool ComponentList::installCustomJar_internal(QString filepath)
return true; return true;
} }
std::shared_ptr<LaunchProfile> ComponentList::getProfile() const std::shared_ptr<LaunchProfile> PackProfile::getProfile() const
{ {
if(!d->m_profile) if(!d->m_profile)
{ {
@ -1168,7 +1168,7 @@ std::shared_ptr<LaunchProfile> ComponentList::getProfile() const
return d->m_profile; 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()) if(version.isEmpty())
{ {
@ -1177,7 +1177,7 @@ void ComponentList::setOldConfigVersion(const QString& uid, const QString& versi
d->m_oldConfigVersions[uid] = version; 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); auto iter = d->componentIndex.find(uid);
if(iter != d->componentIndex.end()) 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); const auto iter = d->componentIndex.find(uid);
if (iter != d->componentIndex.end()) if (iter != d->componentIndex.end())
@ -1213,7 +1213,7 @@ QString ComponentList::getComponentVersion(const QString& uid) const
return QString(); return QString();
} }
void ComponentList::disableInteraction(bool disable) void PackProfile::disableInteraction(bool disable)
{ {
if(d->interactionDisabled != disable) { if(d->interactionDisabled != disable) {
d->interactionDisabled = disable; d->interactionDisabled = disable;

View File

@ -31,10 +31,10 @@
#include "net/Mode.h" #include "net/Mode.h"
class MinecraftInstance; class MinecraftInstance;
struct ComponentListData; struct PackProfileData;
class ComponentUpdateTask; class ComponentUpdateTask;
class MULTIMC_LOGIC_EXPORT ComponentList : public QAbstractListModel class MULTIMC_LOGIC_EXPORT PackProfile : public QAbstractListModel
{ {
Q_OBJECT Q_OBJECT
friend ComponentUpdateTask; friend ComponentUpdateTask;
@ -46,8 +46,8 @@ public:
NUM_COLUMNS NUM_COLUMNS
}; };
explicit ComponentList(MinecraftInstance * instance); explicit PackProfile(MinecraftInstance * instance);
virtual ~ComponentList(); virtual ~PackProfile();
virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; 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; virtual bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
@ -146,5 +146,5 @@ private:
private: /* data */ private: /* data */
std::unique_ptr<ComponentListData> d; std::unique_ptr<PackProfileData> d;
}; };

View File

@ -11,7 +11,7 @@ using ComponentContainer = QList<ComponentPtr>;
using ComponentIndex = QMap<QString, ComponentPtr>; using ComponentIndex = QMap<QString, ComponentPtr>;
using ConnectionList = QList<QMetaObject::Connection>; using ConnectionList = QList<QMetaObject::Connection>;
struct ComponentListData struct PackProfileData
{ {
// the instance this belongs to // the instance this belongs to
MinecraftInstance *m_instance; MinecraftInstance *m_instance;

View File

@ -5,7 +5,7 @@
#include "minecraft/VersionFile.h" #include "minecraft/VersionFile.h"
#include "minecraft/Library.h" #include "minecraft/Library.h"
#include "minecraft/ComponentList.h" #include "minecraft/PackProfile.h"
#include "ParseUtils.h" #include "ParseUtils.h"
#include <Version.h> #include <Version.h>

View File

@ -12,7 +12,7 @@
#include "Library.h" #include "Library.h"
#include <meta/JsonFormat.h> #include <meta/JsonFormat.h>
class ComponentList; class PackProfile;
class VersionFile; class VersionFile;
class LaunchProfile; class LaunchProfile;
struct MojangDownloadInfo; struct MojangDownloadInfo;

View File

@ -19,7 +19,7 @@
#include "minecraft/OpSys.h" #include "minecraft/OpSys.h"
#include "FileSystem.h" #include "FileSystem.h"
#include "minecraft/MinecraftInstance.h" #include "minecraft/MinecraftInstance.h"
#include "minecraft/ComponentList.h" #include "minecraft/PackProfile.h"
void ModMinecraftJar::executeTask() void ModMinecraftJar::executeTask()
{ {
@ -43,7 +43,7 @@ void ModMinecraftJar::executeTask()
} }
// create temporary modded jar, if needed // create temporary modded jar, if needed
auto components = m_inst->getComponentList(); auto components = m_inst->getPackProfile();
auto profile = components->getProfile(); auto profile = components->getProfile();
auto jarMods = m_inst->getJarMods(); auto jarMods = m_inst->getJarMods();
if(jarMods.size()) if(jarMods.size())

View File

@ -15,7 +15,7 @@
#include "ReconstructAssets.h" #include "ReconstructAssets.h"
#include "minecraft/MinecraftInstance.h" #include "minecraft/MinecraftInstance.h"
#include "minecraft/ComponentList.h" #include "minecraft/PackProfile.h"
#include "minecraft/AssetsUtils.h" #include "minecraft/AssetsUtils.h"
#include "launch/LaunchTask.h" #include "launch/LaunchTask.h"
@ -23,7 +23,7 @@ void ReconstructAssets::executeTask()
{ {
auto instance = m_parent->instance(); auto instance = m_parent->instance();
std::shared_ptr<MinecraftInstance> minecraftInstance = std::dynamic_pointer_cast<MinecraftInstance>(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 profile = components->getProfile();
auto assets = profile->getMinecraftAssets(); auto assets = profile->getMinecraftAssets();

View File

@ -6,7 +6,7 @@
#include <QtConcurrentRun> #include <QtConcurrentRun>
#include "LegacyInstance.h" #include "LegacyInstance.h"
#include "minecraft/MinecraftInstance.h" #include "minecraft/MinecraftInstance.h"
#include "minecraft/ComponentList.h" #include "minecraft/PackProfile.h"
#include "LegacyModList.h" #include "LegacyModList.h"
#include "classparser.h" #include "classparser.h"
@ -84,7 +84,7 @@ void LegacyUpgradeTask::copyFinished()
} }
} }
} }
auto components = inst.getComponentList(); auto components = inst.getPackProfile();
components->buildingFromScratch(); components->buildingFromScratch();
components->setComponentVersion("net.minecraft", preferredVersionNumber, true); components->setComponentVersion("net.minecraft", preferredVersionNumber, true);

View File

@ -1,7 +1,7 @@
#include "Env.h" #include "Env.h"
#include "AssetUpdateTask.h" #include "AssetUpdateTask.h"
#include "minecraft/MinecraftInstance.h" #include "minecraft/MinecraftInstance.h"
#include "minecraft/ComponentList.h" #include "minecraft/PackProfile.h"
#include "net/ChecksumValidator.h" #include "net/ChecksumValidator.h"
#include "minecraft/AssetsUtils.h" #include "minecraft/AssetsUtils.h"
@ -17,7 +17,7 @@ AssetUpdateTask::~AssetUpdateTask()
void AssetUpdateTask::executeTask() void AssetUpdateTask::executeTask()
{ {
setStatus(tr("Updating assets index...")); setStatus(tr("Updating assets index..."));
auto components = m_inst->getComponentList(); auto components = m_inst->getPackProfile();
auto profile = components->getProfile(); auto profile = components->getProfile();
auto assets = profile->getMinecraftAssets(); auto assets = profile->getMinecraftAssets();
QUrl indexUrl = assets->url; QUrl indexUrl = assets->url;
@ -54,7 +54,7 @@ void AssetUpdateTask::assetIndexFinished()
AssetsIndex index; AssetsIndex index;
qDebug() << m_inst->name() << ": Finished asset index download"; qDebug() << m_inst->name() << ": Finished asset index download";
auto components = m_inst->getComponentList(); auto components = m_inst->getPackProfile();
auto profile = components->getProfile(); auto profile = components->getProfile();
auto assets = profile->getMinecraftAssets(); auto assets = profile->getMinecraftAssets();

View File

@ -3,7 +3,7 @@
#include <minecraft/VersionFilterData.h> #include <minecraft/VersionFilterData.h>
#include "FMLLibrariesTask.h" #include "FMLLibrariesTask.h"
#include "minecraft/MinecraftInstance.h" #include "minecraft/MinecraftInstance.h"
#include "minecraft/ComponentList.h" #include "minecraft/PackProfile.h"
FMLLibrariesTask::FMLLibrariesTask(MinecraftInstance * inst) FMLLibrariesTask::FMLLibrariesTask(MinecraftInstance * inst)
{ {
@ -13,7 +13,7 @@ void FMLLibrariesTask::executeTask()
{ {
// Get the mod list // Get the mod list
MinecraftInstance *inst = (MinecraftInstance *)m_inst; MinecraftInstance *inst = (MinecraftInstance *)m_inst;
auto components = inst->getComponentList(); auto components = inst->getPackProfile();
auto profile = components->getProfile(); auto profile = components->getProfile();
if (!profile->hasTrait("legacyFML")) if (!profile->hasTrait("legacyFML"))

View File

@ -1,7 +1,7 @@
#include "Env.h" #include "Env.h"
#include "LibrariesTask.h" #include "LibrariesTask.h"
#include "minecraft/MinecraftInstance.h" #include "minecraft/MinecraftInstance.h"
#include "minecraft/ComponentList.h" #include "minecraft/PackProfile.h"
LibrariesTask::LibrariesTask(MinecraftInstance * inst) LibrariesTask::LibrariesTask(MinecraftInstance * inst)
{ {
@ -15,7 +15,7 @@ void LibrariesTask::executeTask()
MinecraftInstance *inst = (MinecraftInstance *)m_inst; MinecraftInstance *inst = (MinecraftInstance *)m_inst;
// Build a list of URLs that will need to be downloaded. // Build a list of URLs that will need to be downloaded.
auto components = inst->getComponentList(); auto components = inst->getPackProfile();
auto profile = components->getProfile(); auto profile = components->getProfile();
auto job = new NetJob(tr("Libraries for instance %1").arg(inst->name())); auto job = new NetJob(tr("Libraries for instance %1").arg(inst->name()));

View File

@ -7,7 +7,7 @@
#include "FileSystem.h" #include "FileSystem.h"
#include "settings/INISettingsObject.h" #include "settings/INISettingsObject.h"
#include "minecraft/MinecraftInstance.h" #include "minecraft/MinecraftInstance.h"
#include "minecraft/ComponentList.h" #include "minecraft/PackProfile.h"
#include "minecraft/GradleSpecifier.h" #include "minecraft/GradleSpecifier.h"
#include "net/URLConstants.h" #include "net/URLConstants.h"
@ -125,7 +125,7 @@ void PackInstallTask::install()
instanceSettings->set("InstanceType", "OneSix"); instanceSettings->set("InstanceType", "OneSix");
MinecraftInstance instance(m_globalSettings, instanceSettings, m_stagingPath); MinecraftInstance instance(m_globalSettings, instanceSettings, m_stagingPath);
auto components = instance.getComponentList(); auto components = instance.getPackProfile();
components->buildingFromScratch(); components->buildingFromScratch();
components->setComponentVersion("net.minecraft", m_pack.mcVersion, true); components->setComponentVersion("net.minecraft", m_pack.mcVersion, true);

View File

@ -28,7 +28,7 @@
#include "minecraft/mod/ModFolderModel.h" #include "minecraft/mod/ModFolderModel.h"
#include "minecraft/mod/Mod.h" #include "minecraft/mod/Mod.h"
#include "minecraft/VersionFilterData.h" #include "minecraft/VersionFilterData.h"
#include "minecraft/ComponentList.h" #include "minecraft/PackProfile.h"
#include <DesktopServices.h> #include <DesktopServices.h>
#include <QSortFilterProxyModel> #include <QSortFilterProxyModel>
@ -244,7 +244,7 @@ bool CoreModFolderPage::shouldDisplay() const
auto inst = dynamic_cast<MinecraftInstance *>(m_inst); auto inst = dynamic_cast<MinecraftInstance *>(m_inst);
if (!inst) if (!inst)
return true; return true;
auto version = inst->getComponentList(); auto version = inst->getPackProfile();
if (!version) if (!version)
return true; return true;
if(!version->getComponent("net.minecraftforge")) if(!version->getComponent("net.minecraftforge"))

View File

@ -37,7 +37,7 @@
#include <QString> #include <QString>
#include <QUrl> #include <QUrl>
#include "minecraft/ComponentList.h" #include "minecraft/PackProfile.h"
#include "minecraft/auth/MojangAccountList.h" #include "minecraft/auth/MojangAccountList.h"
#include "minecraft/mod/Mod.h" #include "minecraft/mod/Mod.h"
#include "icons/IconList.h" #include "icons/IconList.h"
@ -114,9 +114,9 @@ VersionPage::VersionPage(MinecraftInstance *inst, QWidget *parent)
ui->toolBar->insertSpacer(ui->actionReload); ui->toolBar->insertSpacer(ui->actionReload);
m_profile = m_inst->getComponentList(); m_profile = m_inst->getPackProfile();
reloadComponentList(); reloadPackProfile();
auto proxy = new IconProxy(ui->packageView); auto proxy = new IconProxy(ui->packageView);
proxy->setSourceModel(m_profile.get()); proxy->setSourceModel(m_profile.get());
@ -129,7 +129,7 @@ VersionPage::VersionPage(MinecraftInstance *inst, QWidget *parent)
auto smodel = ui->packageView->selectionModel(); auto smodel = ui->packageView->selectionModel();
connect(smodel, &QItemSelectionModel::currentChanged, this, &VersionPage::packageCurrent); 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(); controlsEnabled = !m_inst->isRunning();
updateVersionControls(); updateVersionControls();
preselect(0); preselect(0);
@ -232,7 +232,7 @@ void VersionPage::updateButtons(int row)
ui->actionAdd_to_Minecraft_jar->setEnabled(controlsEnabled); ui->actionAdd_to_Minecraft_jar->setEnabled(controlsEnabled);
} }
bool VersionPage::reloadComponentList() bool VersionPage::reloadPackProfile()
{ {
try try
{ {
@ -255,7 +255,7 @@ bool VersionPage::reloadComponentList()
void VersionPage::on_actionReload_triggered() void VersionPage::on_actionReload_triggered()
{ {
reloadComponentList(); reloadPackProfile();
m_container->refreshContainer(); m_container->refreshContainer();
} }
@ -270,7 +270,7 @@ void VersionPage::on_actionRemove_triggered()
} }
} }
updateButtons(); updateButtons();
reloadComponentList(); reloadPackProfile();
m_container->refreshContainer(); m_container->refreshContainer();
} }
@ -306,7 +306,7 @@ void VersionPage::on_actionMove_up_triggered()
{ {
try try
{ {
m_profile->move(currentRow(), ComponentList::MoveUp); m_profile->move(currentRow(), PackProfile::MoveUp);
} }
catch (const Exception &e) catch (const Exception &e)
{ {
@ -319,7 +319,7 @@ void VersionPage::on_actionMove_down_triggered()
{ {
try try
{ {
m_profile->move(currentRow(), ComponentList::MoveDown); m_profile->move(currentRow(), PackProfile::MoveDown);
} }
catch (const Exception &e) catch (const Exception &e)
{ {

View File

@ -18,7 +18,7 @@
#include <QMainWindow> #include <QMainWindow>
#include "minecraft/MinecraftInstance.h" #include "minecraft/MinecraftInstance.h"
#include "minecraft/ComponentList.h" #include "minecraft/PackProfile.h"
#include "pages/BasePage.h" #include "pages/BasePage.h"
namespace Ui namespace Ui
@ -82,11 +82,11 @@ protected:
QMenu * createPopupMenu() override; QMenu * createPopupMenu() override;
/// FIXME: this shouldn't be necessary! /// FIXME: this shouldn't be necessary!
bool reloadComponentList(); bool reloadPackProfile();
private: private:
Ui::VersionPage *ui; Ui::VersionPage *ui;
std::shared_ptr<ComponentList> m_profile; std::shared_ptr<PackProfile> m_profile;
MinecraftInstance *m_inst; MinecraftInstance *m_inst;
int currentIdx = 0; int currentIdx = 0;
bool controlsEnabled = false; bool controlsEnabled = false;