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