mirror of
https://github.com/UltimMC/Launcher.git
synced 2025-12-24 12:32:42 +00:00
Merge pull request #3 from MultiMC/develop
Update cracked version with latest upstream
This commit is contained in:
@@ -69,6 +69,9 @@ set(MultiMC_CHANLIST_URL "" CACHE STRING "URL for the channel list.")
|
||||
# Notification URL
|
||||
set(MultiMC_NOTIFICATION_URL "" CACHE STRING "URL for checking for notifications.")
|
||||
|
||||
# The metadata server
|
||||
set(MultiMC_META_URL "https://meta.multimc.org/v1/" CACHE STRING "URL to fetch MultiMC's meta files from.")
|
||||
|
||||
# paste.ee API key
|
||||
set(MultiMC_PASTE_EE_API_KEY "utLvciUouSURFzfjPxLBf5W4ISsUX4pwBDF7N1AfZ" CACHE STRING "API key you can get from paste.ee when you register an account")
|
||||
|
||||
@@ -264,6 +267,7 @@ add_subdirectory(libraries/classparser) # google analytics library
|
||||
|
||||
############################### Built Artifacts ###############################
|
||||
|
||||
add_subdirectory(buildconfig)
|
||||
add_subdirectory(api/logic)
|
||||
add_subdirectory(api/gui)
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "Env.h"
|
||||
|
||||
#include <QFile>
|
||||
#include <QPainter>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonArray>
|
||||
@@ -35,10 +36,14 @@ QPixmap getFaceFromCache(QString username, int height, int width)
|
||||
|
||||
if (fskin.exists())
|
||||
{
|
||||
QPixmap skin(fskin.fileName());
|
||||
if(!skin.isNull())
|
||||
QPixmap skinTexture(fskin.fileName());
|
||||
if(!skinTexture.isNull())
|
||||
{
|
||||
return skin.copy(8, 8, 8, 8).scaled(height, width, Qt::KeepAspectRatio);
|
||||
QPixmap skin = QPixmap(8, 8);
|
||||
QPainter painter(&skin);
|
||||
painter.drawPixmap(0, 0, skinTexture.copy(8, 8, 8, 8));
|
||||
painter.drawPixmap(0, 0, skinTexture.copy(40, 8, 8, 8));
|
||||
return skin.scaled(height, width, Qt::KeepAspectRatio);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -119,8 +119,6 @@ set(NET_SOURCES
|
||||
net/PasteUpload.cpp
|
||||
net/PasteUpload.h
|
||||
net/Sink.h
|
||||
net/URLConstants.cpp
|
||||
net/URLConstants.h
|
||||
net/Validator.h
|
||||
)
|
||||
|
||||
@@ -259,8 +257,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
|
||||
@@ -491,7 +489,7 @@ set_target_properties(MultiMC_logic PROPERTIES CXX_VISIBILITY_PRESET hidden VISI
|
||||
generate_export_header(MultiMC_logic)
|
||||
|
||||
# Link
|
||||
target_link_libraries(MultiMC_logic systeminfo MultiMC_quazip MultiMC_classparser ${NBT_NAME} ${ZLIB_LIBRARIES})
|
||||
target_link_libraries(MultiMC_logic systeminfo MultiMC_quazip MultiMC_classparser ${NBT_NAME} ${ZLIB_LIBRARIES} BuildConfig)
|
||||
target_link_libraries(MultiMC_logic Qt5::Core Qt5::Xml Qt5::Network Qt5::Concurrent)
|
||||
|
||||
# Mark and export headers
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -24,6 +24,8 @@
|
||||
#include "Env.h"
|
||||
#include "Json.h"
|
||||
|
||||
#include "BuildConfig.h"
|
||||
|
||||
class ParsingValidator : public Net::Validator
|
||||
{
|
||||
public: /* con/des */
|
||||
@@ -53,7 +55,9 @@ public: /* methods */
|
||||
auto fname = m_entity->localFilename();
|
||||
try
|
||||
{
|
||||
m_entity->parse(Json::requireObject(Json::requireDocument(data, fname), fname));
|
||||
auto doc = Json::requireDocument(data, fname);
|
||||
auto obj = Json::requireObject(doc, fname);
|
||||
m_entity->parse(obj);
|
||||
return true;
|
||||
}
|
||||
catch (const Exception &e)
|
||||
@@ -74,7 +78,7 @@ Meta::BaseEntity::~BaseEntity()
|
||||
|
||||
QUrl Meta::BaseEntity::url() const
|
||||
{
|
||||
return QUrl("https://meta.multimc.org/v1/").resolved(localFilename());
|
||||
return QUrl(BuildConfig.META_URL).resolved(localFilename());
|
||||
}
|
||||
|
||||
bool Meta::BaseEntity::loadLocalFile()
|
||||
@@ -87,7 +91,9 @@ bool Meta::BaseEntity::loadLocalFile()
|
||||
// TODO: check if the file has the expected checksum
|
||||
try
|
||||
{
|
||||
parse(Json::requireObject(Json::requireDocument(fname, fname), fname));
|
||||
auto doc = Json::requireDocument(fname, fname);
|
||||
auto obj = Json::requireObject(doc, fname);
|
||||
parse(obj);
|
||||
return true;
|
||||
}
|
||||
catch (const Exception &e)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "FileSystem.h"
|
||||
#include "net/Download.h"
|
||||
#include "net/ChecksumValidator.h"
|
||||
#include "net/URLConstants.h"
|
||||
#include "BuildConfig.h"
|
||||
|
||||
namespace {
|
||||
QSet<QString> collectPathsFromDir(QString dirPath)
|
||||
@@ -308,7 +308,7 @@ QString AssetObject::getLocalPath()
|
||||
|
||||
QUrl AssetObject::getUrl()
|
||||
{
|
||||
return URLConstants::RESOURCE_BASE + getRelPath();
|
||||
return BuildConfig.RESOURCE_BASE + getRelPath();
|
||||
}
|
||||
|
||||
QString AssetObject::getRelPath()
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
#include <net/ChecksumValidator.h>
|
||||
#include <Env.h>
|
||||
#include <FileSystem.h>
|
||||
#include <BuildConfig.h>
|
||||
|
||||
|
||||
void Library::getApplicableFiles(OpSys system, QStringList& jar, QStringList& native, QStringList& native32,
|
||||
@@ -171,7 +172,7 @@ QList< std::shared_ptr< NetAction > > Library::getDownloads(
|
||||
|
||||
if (m_repositoryURL.isEmpty())
|
||||
{
|
||||
return URLConstants::LIBRARY_BASE + raw_storage;
|
||||
return BuildConfig.LIBRARY_BASE + raw_storage;
|
||||
}
|
||||
|
||||
if(m_repositoryURL.endsWith('/'))
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
#include "Rule.h"
|
||||
#include "minecraft/OpSys.h"
|
||||
#include "GradleSpecifier.h"
|
||||
#include "net/URLConstants.h"
|
||||
#include "MojangDownloadInfo.h"
|
||||
|
||||
#include "multimc_logic_export.h"
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -23,9 +23,8 @@
|
||||
#include <QDataStream>
|
||||
|
||||
#include "BaseInstance.h"
|
||||
#include "minecraft/ComponentList.h"
|
||||
#include "minecraft/PackProfile.h"
|
||||
#include "minecraft/Library.h"
|
||||
#include "net/URLConstants.h"
|
||||
#include <FileSystem.h>
|
||||
|
||||
#include "update/FoldersTask.h"
|
||||
@@ -50,7 +49,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)
|
||||
|
||||
@@ -198,7 +198,10 @@ VersionFilePtr OneSixVersionFormat::versionFileFromJson(const QJsonDocument &doc
|
||||
// FIXME: this will eventually break...
|
||||
else
|
||||
{
|
||||
lib->setAbsoluteUrl(URLConstants::getLegacyJarUrl(out->minecraftVersion));
|
||||
out->addProblem(
|
||||
ProblemSeverity::Error,
|
||||
QObject::tr("URL for the main jar could not be determined - Mojang removed the server that we used as fallback.")
|
||||
);
|
||||
}
|
||||
out->mainJar = lib;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <minecraft/VersionFile.h>
|
||||
#include <minecraft/ComponentList.h>
|
||||
#include <minecraft/PackProfile.h>
|
||||
#include <minecraft/Library.h>
|
||||
#include <QJsonDocument>
|
||||
|
||||
|
||||
@@ -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;
|
||||
@@ -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;
|
||||
};
|
||||
@@ -9,9 +9,8 @@
|
||||
class MinecraftInstance;
|
||||
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;
|
||||
@@ -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>
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "Library.h"
|
||||
#include <meta/JsonFormat.h>
|
||||
|
||||
class ComponentList;
|
||||
class PackProfile;
|
||||
class VersionFile;
|
||||
class LaunchProfile;
|
||||
struct MojangDownloadInfo;
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
#include <Env.h>
|
||||
|
||||
#include <net/URLConstants.h>
|
||||
#include <BuildConfig.h>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
@@ -42,7 +42,7 @@ void YggdrasilTask::executeTask()
|
||||
// Get the content of the request we're going to send to the server.
|
||||
QJsonDocument doc(getRequestContent());
|
||||
|
||||
QUrl reqUrl(URLConstants::AUTH_BASE + getEndpoint());
|
||||
QUrl reqUrl(BuildConfig.AUTH_BASE + getEndpoint());
|
||||
QNetworkRequest netRequest(reqUrl);
|
||||
netRequest.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
#include <minecraft/VersionFilterData.h>
|
||||
#include "FMLLibrariesTask.h"
|
||||
#include "minecraft/MinecraftInstance.h"
|
||||
#include "minecraft/ComponentList.h"
|
||||
#include "minecraft/PackProfile.h"
|
||||
#include "BuildConfig.h"
|
||||
|
||||
FMLLibrariesTask::FMLLibrariesTask(MinecraftInstance * inst)
|
||||
{
|
||||
@@ -13,7 +14,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"))
|
||||
@@ -63,7 +64,7 @@ void FMLLibrariesTask::executeTask()
|
||||
for (auto &lib : fmlLibsToProcess)
|
||||
{
|
||||
auto entry = metacache->resolveEntry("fmllibs", lib.filename);
|
||||
QString urlString = (lib.ours ? URLConstants::FMLLIBS_OUR_BASE_URL : URLConstants::FMLLIBS_FORGE_BASE_URL) + lib.filename;
|
||||
QString urlString = (lib.ours ? BuildConfig.FMLLIBS_OUR_BASE_URL : BuildConfig.FMLLIBS_FORGE_BASE_URL) + lib.filename;
|
||||
dljob->addNetAction(Net::Download::makeCached(QUrl(urlString), entry));
|
||||
}
|
||||
|
||||
|
||||
@@ -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()));
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
#include "PrivatePackManager.h"
|
||||
|
||||
#include <QDomDocument>
|
||||
#include "net/URLConstants.h"
|
||||
#include <BuildConfig.h>
|
||||
|
||||
namespace LegacyFTB {
|
||||
|
||||
@@ -13,11 +13,11 @@ void PackFetchTask::fetch()
|
||||
|
||||
NetJob *netJob = new NetJob("LegacyFTB::ModpackFetch");
|
||||
|
||||
QUrl publicPacksUrl = QUrl(URLConstants::LEGACY_FTB_CDN_BASE_URL + "static/modpacks.xml");
|
||||
QUrl publicPacksUrl = QUrl(BuildConfig.LEGACY_FTB_CDN_BASE_URL + "static/modpacks.xml");
|
||||
qDebug() << "Downloading public version info from" << publicPacksUrl.toString();
|
||||
netJob->addNetAction(Net::Download::makeByteArray(publicPacksUrl, &publicModpacksXmlFileData));
|
||||
|
||||
QUrl thirdPartyUrl = QUrl(URLConstants::LEGACY_FTB_CDN_BASE_URL + "static/thirdparty.xml");
|
||||
QUrl thirdPartyUrl = QUrl(BuildConfig.LEGACY_FTB_CDN_BASE_URL + "static/thirdparty.xml");
|
||||
qDebug() << "Downloading thirdparty version info from" << thirdPartyUrl.toString();
|
||||
netJob->addNetAction(Net::Download::makeByteArray(thirdPartyUrl, &thirdPartyModpacksXmlFileData));
|
||||
|
||||
@@ -30,7 +30,7 @@ void PackFetchTask::fetch()
|
||||
|
||||
void PackFetchTask::fetchPrivate(const QStringList & toFetch)
|
||||
{
|
||||
QString privatePackBaseUrl = URLConstants::LEGACY_FTB_CDN_BASE_URL + "static/%1.xml";
|
||||
QString privatePackBaseUrl = BuildConfig.LEGACY_FTB_CDN_BASE_URL + "static/%1.xml";
|
||||
|
||||
for (auto &packCode: toFetch)
|
||||
{
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
#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"
|
||||
#include "BuildConfig.h"
|
||||
|
||||
#include <QtConcurrent>
|
||||
|
||||
@@ -38,11 +38,11 @@ void PackInstallTask::downloadPack()
|
||||
QString url;
|
||||
if(m_pack.type == PackType::Private)
|
||||
{
|
||||
url = QString(URLConstants::LEGACY_FTB_CDN_BASE_URL + "privatepacks/%1").arg(packoffset);
|
||||
url = QString(BuildConfig.LEGACY_FTB_CDN_BASE_URL + "privatepacks/%1").arg(packoffset);
|
||||
}
|
||||
else
|
||||
{
|
||||
url = QString(URLConstants::LEGACY_FTB_CDN_BASE_URL + "modpacks/%1").arg(packoffset);
|
||||
url = QString(BuildConfig.LEGACY_FTB_CDN_BASE_URL + "modpacks/%1").arg(packoffset);
|
||||
}
|
||||
job->addNetAction(Net::Download::makeCached(url, entry));
|
||||
archivePath = entry->getFullPath();
|
||||
@@ -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);
|
||||
|
||||
@@ -210,4 +210,4 @@ bool PackInstallTask::abort()
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,16 +0,0 @@
|
||||
#include "URLConstants.h"
|
||||
|
||||
namespace URLConstants {
|
||||
|
||||
QString getLegacyJarUrl(QString version)
|
||||
{
|
||||
return AWS_DOWNLOAD_VERSIONS + getJarPath(version);
|
||||
}
|
||||
|
||||
QString getJarPath(QString version)
|
||||
{
|
||||
return version + "/" + version + ".jar";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
/* Copyright 2013-2019 MultiMC Contributors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QString>
|
||||
|
||||
namespace URLConstants
|
||||
{
|
||||
const QString AWS_DOWNLOAD_VERSIONS("https://s3.amazonaws.com/Minecraft.Download/versions/");
|
||||
const QString RESOURCE_BASE("https://resources.download.minecraft.net/");
|
||||
const QString LIBRARY_BASE("https://libraries.minecraft.net/");
|
||||
const QString SKINS_BASE("https://crafatar.com/skins/");
|
||||
const QString AUTH_BASE("https://authserver.mojang.com/");
|
||||
const QString MOJANG_STATUS_URL("https://status.mojang.com/check");
|
||||
const QString IMGUR_BASE_URL("https://api.imgur.com/3/");
|
||||
const QString FMLLIBS_OUR_BASE_URL("https://files.multimc.org/fmllibs/");
|
||||
const QString FMLLIBS_FORGE_BASE_URL("https://files.minecraftforge.net/fmllibs/");
|
||||
const QString TRANSLATIONS_BASE_URL("https://files.multimc.org/translations/");
|
||||
|
||||
const QString LEGACY_FTB_CDN_BASE_URL("https://dist.creeper.host/FTB2/");
|
||||
|
||||
QString getJarPath(QString version);
|
||||
QString getLegacyJarUrl(QString version);
|
||||
}
|
||||
@@ -6,13 +6,13 @@
|
||||
#include <QUrl>
|
||||
#include <QStringList>
|
||||
|
||||
#include "net/URLConstants.h"
|
||||
#include "BuildConfig.h"
|
||||
#include "Env.h"
|
||||
#include <QDebug>
|
||||
|
||||
ImgurAlbumCreation::ImgurAlbumCreation(QList<ScreenshotPtr> screenshots) : NetAction(), m_screenshots(screenshots)
|
||||
{
|
||||
m_url = URLConstants::IMGUR_BASE_URL + "album.json";
|
||||
m_url = BuildConfig.IMGUR_BASE_URL + "album.json";
|
||||
m_status = Job_NotStarted;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,13 +8,13 @@
|
||||
#include <QFile>
|
||||
#include <QUrl>
|
||||
|
||||
#include "net/URLConstants.h"
|
||||
#include "BuildConfig.h"
|
||||
#include "Env.h"
|
||||
#include <QDebug>
|
||||
|
||||
ImgurUpload::ImgurUpload(ScreenshotPtr shot) : NetAction(), m_shot(shot)
|
||||
{
|
||||
m_url = URLConstants::IMGUR_BASE_URL + "upload.json";
|
||||
m_url = BuildConfig.IMGUR_BASE_URL + "upload.json";
|
||||
m_status = Job_NotStarted;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,12 +15,12 @@
|
||||
|
||||
#include "StatusChecker.h"
|
||||
|
||||
#include <net/URLConstants.h>
|
||||
|
||||
#include <QByteArray>
|
||||
|
||||
#include <QDebug>
|
||||
|
||||
#include <BuildConfig.h>
|
||||
|
||||
StatusChecker::StatusChecker()
|
||||
{
|
||||
|
||||
@@ -43,7 +43,7 @@ void StatusChecker::reloadStatus()
|
||||
// qDebug() << "Reloading status.";
|
||||
|
||||
NetJob* job = new NetJob("Status JSON");
|
||||
job->addNetAction(Net::Download::makeByteArray(URLConstants::MOJANG_STATUS_URL, &dataSink));
|
||||
job->addNetAction(Net::Download::makeByteArray(BuildConfig.MOJANG_STATUS_URL, &dataSink));
|
||||
QObject::connect(job, &NetJob::succeeded, this, &StatusChecker::statusDownloadFinished);
|
||||
QObject::connect(job, &NetJob::failed, this, &StatusChecker::statusDownloadFailed);
|
||||
m_statusNetJob.reset(job);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <net/NetJob.h>
|
||||
#include <net/ChecksumValidator.h>
|
||||
#include <Env.h>
|
||||
#include <net/URLConstants.h>
|
||||
#include <BuildConfig.h>
|
||||
#include "Json.h"
|
||||
|
||||
#include "POTranslator.h"
|
||||
@@ -184,7 +184,8 @@ void readIndex(const QString & path, QMap<QString, Language>& languages)
|
||||
int index = 1;
|
||||
try
|
||||
{
|
||||
auto doc = Json::requireObject(Json::requireDocument(data));
|
||||
auto toplevel_doc = Json::requireDocument(data);
|
||||
auto doc = Json::requireObject(toplevel_doc);
|
||||
auto file_type = Json::requireString(doc, "file_type");
|
||||
if(file_type != "MMC-TRANSLATION-INDEX")
|
||||
{
|
||||
@@ -605,7 +606,7 @@ void TranslationsModel::downloadTranslation(QString key)
|
||||
MetaEntryPtr entry = ENV.metacache()->resolveEntry("translations", "mmc_" + key + ".qm");
|
||||
entry->setStale(true);
|
||||
|
||||
auto dl = Net::Download::makeCached(QUrl(URLConstants::TRANSLATIONS_BASE_URL + lang->file_name), entry);
|
||||
auto dl = Net::Download::makeCached(QUrl(BuildConfig.TRANSLATIONS_BASE_URL + lang->file_name), entry);
|
||||
auto rawHash = QByteArray::fromHex(lang->file_sha1.toLatin1());
|
||||
dl->addValidator(new Net::ChecksumValidator(QCryptographicHash::Sha1, rawHash));
|
||||
dl->m_total_progress = lang->file_size;
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
project(application)
|
||||
|
||||
######## Configure the file with build properties ########
|
||||
configure_file("${PROJECT_SOURCE_DIR}/BuildConfig.cpp.in" "${PROJECT_BINARY_DIR}/BuildConfig.cpp")
|
||||
|
||||
################################ FILES ################################
|
||||
|
||||
######## Sources and headers ########
|
||||
@@ -11,8 +8,6 @@ SET(MULTIMC_SOURCES
|
||||
main.cpp
|
||||
MultiMC.h
|
||||
MultiMC.cpp
|
||||
BuildConfig.h
|
||||
${PROJECT_BINARY_DIR}/BuildConfig.cpp
|
||||
UpdateController.cpp
|
||||
UpdateController.h
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
#include <launch/LaunchTask.h>
|
||||
#include <minecraft/auth/MojangAccountList.h>
|
||||
#include <SkinUtils.h>
|
||||
#include <net/URLConstants.h>
|
||||
#include <BuildConfig.h>
|
||||
#include <net/NetJob.h>
|
||||
#include <net/Download.h>
|
||||
#include <news/NewsChecker.h>
|
||||
@@ -772,7 +772,7 @@ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new MainWindow
|
||||
for (auto profile : account->profiles())
|
||||
{
|
||||
auto meta = Env::getInstance().metacache()->resolveEntry("skins", profile.id + ".png");
|
||||
auto action = Net::Download::makeCached(QUrl(URLConstants::SKINS_BASE + profile.id + ".png"), meta);
|
||||
auto action = Net::Download::makeCached(QUrl(BuildConfig.SKINS_BASE + profile.id + ".png"), meta);
|
||||
skin_dls.append(action);
|
||||
meta->setStale(true);
|
||||
}
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
#include <minecraft/auth/MojangAccountList.h>
|
||||
#include "icons/IconList.h"
|
||||
#include "net/HttpMetaCache.h"
|
||||
#include "net/URLConstants.h"
|
||||
#include "Env.h"
|
||||
|
||||
#include "java/JavaUtils.h"
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include <QDebug>
|
||||
|
||||
#include "net/NetJob.h"
|
||||
#include "net/URLConstants.h"
|
||||
#include "Env.h"
|
||||
|
||||
#include "dialogs/ProgressDialog.h"
|
||||
@@ -34,6 +33,8 @@
|
||||
|
||||
#include "MultiMC.h"
|
||||
|
||||
#include "BuildConfig.h"
|
||||
|
||||
AccountListPage::AccountListPage(QWidget *parent)
|
||||
: QMainWindow(parent), ui(new Ui::AccountListPage)
|
||||
{
|
||||
@@ -170,7 +171,7 @@ void AccountListPage::addAccount(const QString &errMsg)
|
||||
for (AccountProfile profile : account->profiles())
|
||||
{
|
||||
auto meta = Env::getInstance().metacache()->resolveEntry("skins", profile.id + ".png");
|
||||
auto action = Net::Download::makeCached(QUrl(URLConstants::SKINS_BASE + profile.id + ".png"), meta);
|
||||
auto action = Net::Download::makeCached(QUrl(BuildConfig.SKINS_BASE + profile.id + ".png"), meta);
|
||||
job->addNetAction(action);
|
||||
meta->setStale(true);
|
||||
}
|
||||
|
||||
@@ -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"))
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
@@ -357,8 +357,8 @@ void VersionPage::on_actionChange_version_triggered()
|
||||
VersionSelectDialog vselect(list.get(), tr("Change %1 version").arg(name), this);
|
||||
if (uid == "net.fabricmc.intermediary")
|
||||
{
|
||||
vselect.setEmptyString(tr("No Fabric Loader versions are currently available."));
|
||||
vselect.setEmptyErrorString(tr("Couldn't load or download the Fabric Loader version lists!"));
|
||||
vselect.setEmptyString(tr("No intermediary mappings versions are currently available."));
|
||||
vselect.setEmptyErrorString(tr("Couldn't load or download the intermediary mappings version lists!"));
|
||||
vselect.setExactFilter(BaseVersionList::ParentVersionRole, m_profile->getComponentVersion("net.minecraft"));
|
||||
}
|
||||
auto currentVersion = patch->getVersion();
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include <RWStorage.h>
|
||||
#include <Env.h>
|
||||
|
||||
#include "net/URLConstants.h"
|
||||
#include <BuildConfig.h>
|
||||
|
||||
namespace LegacyFTB {
|
||||
|
||||
@@ -218,7 +218,7 @@ void ListModel::requestLogo(QString file)
|
||||
|
||||
MetaEntryPtr entry = ENV.metacache()->resolveEntry("FTBPacks", QString("logos/%1").arg(file.section(".", 0, 0)));
|
||||
NetJob *job = new NetJob(QString("FTB Icon Download for %1").arg(file));
|
||||
job->addNetAction(Net::Download::makeCached(QUrl(QString(URLConstants::LEGACY_FTB_CDN_BASE_URL + "static/%1").arg(file)), entry));
|
||||
job->addNetAction(Net::Download::makeCached(QUrl(QString(BuildConfig.LEGACY_FTB_CDN_BASE_URL + "static/%1").arg(file)), entry));
|
||||
|
||||
auto fullPath = entry->getFullPath();
|
||||
QObject::connect(job, &NetJob::finished, this, [this, file, fullPath]
|
||||
|
||||
@@ -10,8 +10,6 @@
|
||||
#include <RWStorage.h>
|
||||
#include <Env.h>
|
||||
|
||||
#include "net/URLConstants.h"
|
||||
|
||||
namespace Twitch {
|
||||
|
||||
ListModel::ListModel(QObject *parent) : QAbstractListModel(parent)
|
||||
|
||||
@@ -21,37 +21,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QTreeView" name="packView">
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>48</width>
|
||||
<height>48</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="rootIsDecorated">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="uniformRowHeights">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="itemsExpandable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="allColumnsShowFocus">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="headerVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="MCModInfoFrame" name="frame">
|
||||
<property name="sizePolicy">
|
||||
@@ -68,6 +37,22 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" colspan="2">
|
||||
<widget class="QListView" name="packView">
|
||||
<property name="horizontalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOff</enum>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<size>
|
||||
<width>48</width>
|
||||
<height>48</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "BuildConfig.h"
|
||||
#include <QObject>
|
||||
|
||||
Config BuildConfig;
|
||||
const Config BuildConfig;
|
||||
|
||||
Config::Config()
|
||||
{
|
||||
@@ -33,6 +33,7 @@ Config::Config()
|
||||
VERSION_STR = "@MultiMC_VERSION_STRING@";
|
||||
NEWS_RSS_URL = "@MultiMC_NEWS_RSS_URL@";
|
||||
PASTE_EE_KEY = "@MultiMC_PASTE_EE_API_KEY@";
|
||||
META_URL = "@MultiMC_META_URL@";
|
||||
}
|
||||
|
||||
QString Config::printableVersionString() const
|
||||
@@ -60,6 +60,23 @@ public:
|
||||
*/
|
||||
QString PASTE_EE_KEY;
|
||||
|
||||
/**
|
||||
* MultiMC Metadata repository URL prefix
|
||||
*/
|
||||
QString META_URL;
|
||||
|
||||
QString RESOURCE_BASE = "https://resources.download.minecraft.net/";
|
||||
QString LIBRARY_BASE = "https://libraries.minecraft.net/";
|
||||
QString SKINS_BASE = "https://crafatar.com/skins/";
|
||||
QString AUTH_BASE = "https://authserver.mojang.com/";
|
||||
QString MOJANG_STATUS_URL = "https://status.mojang.com/check";
|
||||
QString IMGUR_BASE_URL = "https://api.imgur.com/3/";
|
||||
QString FMLLIBS_OUR_BASE_URL = "https://files.multimc.org/fmllibs/";
|
||||
QString FMLLIBS_FORGE_BASE_URL = "https://files.minecraftforge.net/fmllibs/";
|
||||
QString TRANSLATIONS_BASE_URL = "https://files.multimc.org/translations/";
|
||||
|
||||
QString LEGACY_FTB_CDN_BASE_URL = "https://dist.creeper.host/FTB2/";
|
||||
|
||||
/**
|
||||
* \brief Converts the Version to a string.
|
||||
* \return The version number in string format (major.minor.revision.build).
|
||||
@@ -67,4 +84,4 @@ public:
|
||||
QString printableVersionString() const;
|
||||
};
|
||||
|
||||
extern Config BuildConfig;
|
||||
extern const Config BuildConfig;
|
||||
11
buildconfig/CMakeLists.txt
Normal file
11
buildconfig/CMakeLists.txt
Normal file
@@ -0,0 +1,11 @@
|
||||
######## Configure the file with build properties ########
|
||||
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/BuildConfig.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/BuildConfig.cpp")
|
||||
|
||||
add_library(BuildConfig STATIC
|
||||
BuildConfig.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/BuildConfig.cpp
|
||||
)
|
||||
|
||||
target_link_libraries(BuildConfig Qt5::Core)
|
||||
target_include_directories(BuildConfig PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
Submodule libraries/libnbtplusplus updated: 92f8d57227...dc72a20b7e
Reference in New Issue
Block a user