NOISSUE stop referring to the minecraft profile as 'version'

This commit is contained in:
Petr Mrázek 2016-03-13 20:57:01 +01:00
parent 010e07eb45
commit fb9dfcb951
11 changed files with 87 additions and 85 deletions

View File

@ -114,11 +114,11 @@ VersionPage::VersionPage(OneSixInstance *inst, QWidget *parent)
reloadMinecraftProfile(); reloadMinecraftProfile();
m_version = m_inst->getMinecraftProfile(); m_profile = m_inst->getMinecraftProfile();
if (m_version) if (m_profile)
{ {
auto proxy = new IconProxy(ui->packageView); auto proxy = new IconProxy(ui->packageView);
proxy->setSourceModel(m_version.get()); proxy->setSourceModel(m_profile.get());
ui->packageView->setModel(proxy); ui->packageView->setModel(proxy);
ui->packageView->installEventFilter(this); ui->packageView->installEventFilter(this);
ui->packageView->setSelectionMode(QAbstractItemView::SingleSelection); ui->packageView->setSelectionMode(QAbstractItemView::SingleSelection);
@ -151,7 +151,7 @@ void VersionPage::packageCurrent(const QModelIndex &current, const QModelIndex &
return; return;
} }
int row = current.row(); int row = current.row();
auto patch = m_version->versionPatch(row); auto patch = m_profile->versionPatch(row);
auto severity = patch->getProblemSeverity(); auto severity = patch->getProblemSeverity();
switch(severity) switch(severity)
{ {
@ -232,7 +232,7 @@ void VersionPage::on_removeBtn_clicked()
if (ui->packageView->currentIndex().isValid()) if (ui->packageView->currentIndex().isValid())
{ {
// FIXME: use actual model, not reloading. // FIXME: use actual model, not reloading.
if (!m_version->remove(ui->packageView->currentIndex().row())) if (!m_profile->remove(ui->packageView->currentIndex().row()))
{ {
QMessageBox::critical(this, tr("Error"), tr("Couldn't remove file")); QMessageBox::critical(this, tr("Error"), tr("Couldn't remove file"));
} }
@ -251,7 +251,7 @@ void VersionPage::on_modBtn_clicked()
void VersionPage::on_jarmodBtn_clicked() void VersionPage::on_jarmodBtn_clicked()
{ {
bool nagShown = false; bool nagShown = false;
if (!m_version->hasTrait("legacyLaunch") && !m_version->hasTrait("alphaLaunch")) if (!m_profile->hasTrait("legacyLaunch") && !m_profile->hasTrait("alphaLaunch"))
{ {
// not legacy launch... nag // not legacy launch... nag
auto seenNag = MMC->settings()->get("JarModNagSeen").toBool(); auto seenNag = MMC->settings()->get("JarModNagSeen").toBool();
@ -273,7 +273,7 @@ void VersionPage::on_jarmodBtn_clicked()
auto list = GuiUtil::BrowseForFiles("jarmod", tr("Select jar mods"), tr("Minecraft.jar mods (*.zip *.jar)"), MMC->settings()->get("CentralModsDir").toString(), this->parentWidget()); auto list = GuiUtil::BrowseForFiles("jarmod", tr("Select jar mods"), tr("Minecraft.jar mods (*.zip *.jar)"), MMC->settings()->get("CentralModsDir").toString(), this->parentWidget());
if(!list.empty()) if(!list.empty())
{ {
m_version->installJarMods(list); m_profile->installJarMods(list);
if(nagShown) if(nagShown)
{ {
MMC->settings()->set("JarModNagSeen", QVariant(true)); MMC->settings()->set("JarModNagSeen", QVariant(true));
@ -286,7 +286,7 @@ void VersionPage::on_resetOrderBtn_clicked()
{ {
try try
{ {
m_version->resetOrder(); m_profile->resetOrder();
} }
catch (Exception &e) catch (Exception &e)
{ {
@ -299,7 +299,7 @@ void VersionPage::on_moveUpBtn_clicked()
{ {
try try
{ {
m_version->move(currentRow(), MinecraftProfile::MoveUp); m_profile->move(currentRow(), MinecraftProfile::MoveUp);
} }
catch (Exception &e) catch (Exception &e)
{ {
@ -312,7 +312,7 @@ void VersionPage::on_moveDownBtn_clicked()
{ {
try try
{ {
m_version->move(currentRow(), MinecraftProfile::MoveDown); m_profile->move(currentRow(), MinecraftProfile::MoveDown);
} }
catch (Exception &e) catch (Exception &e)
{ {
@ -338,7 +338,7 @@ void VersionPage::on_changeVersionBtn_clicked()
return; return;
} }
if (!m_version->isVanilla()) if (!m_profile->isVanilla())
{ {
auto result = CustomMessageBox::selectable( auto result = CustomMessageBox::selectable(
this, tr("Are you sure?"), this, tr("Are you sure?"),
@ -349,7 +349,7 @@ void VersionPage::on_changeVersionBtn_clicked()
if (result != QMessageBox::Ok) if (result != QMessageBox::Ok)
return; return;
m_version->revertToVanilla(); m_profile->revertToVanilla();
reloadMinecraftProfile(); reloadMinecraftProfile();
} }
m_inst->setIntendedVersionId(vselect.selectedVersion()->descriptor()); m_inst->setIntendedVersionId(vselect.selectedVersion()->descriptor());
@ -382,7 +382,7 @@ void VersionPage::on_forgeBtn_clicked()
ProgressDialog dialog(this); ProgressDialog dialog(this);
dialog.execWithTask( dialog.execWithTask(
ForgeInstaller().createInstallTask(m_inst, vselect.selectedVersion(), this)); ForgeInstaller().createInstallTask(m_inst, vselect.selectedVersion(), this));
preselect(m_version->rowCount(QModelIndex())-1); preselect(m_profile->rowCount(QModelIndex())-1);
} }
} }
@ -399,7 +399,7 @@ void VersionPage::on_liteloaderBtn_clicked()
ProgressDialog dialog(this); ProgressDialog dialog(this);
dialog.execWithTask( dialog.execWithTask(
LiteLoaderInstaller().createInstallTask(m_inst, vselect.selectedVersion(), this)); LiteLoaderInstaller().createInstallTask(m_inst, vselect.selectedVersion(), this));
preselect(m_version->rowCount(QModelIndex())-1); preselect(m_profile->rowCount(QModelIndex())-1);
} }
} }
@ -415,15 +415,15 @@ void VersionPage::preselect(int row)
{ {
row = 0; row = 0;
} }
if(row >= m_version->rowCount(QModelIndex())) if(row >= m_profile->rowCount(QModelIndex()))
{ {
row = m_version->rowCount(QModelIndex()) - 1; row = m_profile->rowCount(QModelIndex()) - 1;
} }
if(row < 0) if(row < 0)
{ {
return; return;
} }
auto model_index = m_version->index(row); auto model_index = m_profile->index(row);
ui->packageView->selectionModel()->select(model_index, QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows); ui->packageView->selectionModel()->select(model_index, QItemSelectionModel::SelectCurrent | QItemSelectionModel::Rows);
updateButtons(row); updateButtons(row);
} }
@ -432,7 +432,7 @@ void VersionPage::updateButtons(int row)
{ {
if(row == -1) if(row == -1)
row = currentRow(); row = currentRow();
auto patch = m_version->versionPatch(row); auto patch = m_profile->versionPatch(row);
if (!patch) if (!patch)
{ {
ui->removeBtn->setDisabled(true); ui->removeBtn->setDisabled(true);
@ -468,7 +468,7 @@ ProfilePatchPtr VersionPage::current()
{ {
return nullptr; return nullptr;
} }
return m_version->versionPatch(row); return m_profile->versionPatch(row);
} }
int VersionPage::currentRow() int VersionPage::currentRow()
@ -488,7 +488,7 @@ void VersionPage::on_customizeBtn_clicked()
return; return;
} }
//HACK HACK remove, this is dumb //HACK HACK remove, this is dumb
auto patch = m_version->versionPatch(version); auto patch = m_profile->versionPatch(version);
auto mc = std::dynamic_pointer_cast<MinecraftVersion>(patch); auto mc = std::dynamic_pointer_cast<MinecraftVersion>(patch);
if(mc && mc->needsUpdate()) if(mc && mc->needsUpdate())
{ {
@ -497,7 +497,7 @@ void VersionPage::on_customizeBtn_clicked()
return; return;
} }
} }
if(!m_version->customize(version)) if(!m_profile->customize(version))
{ {
// TODO: some error box here // TODO: some error box here
} }
@ -537,7 +537,7 @@ void VersionPage::on_revertBtn_clicked()
return; return;
} }
} }
if(!m_version->revertToBase(version)) if(!m_profile->revertToBase(version))
{ {
// TODO: some error box here // TODO: some error box here
} }

View File

@ -80,7 +80,7 @@ protected:
private: private:
Ui::VersionPage *ui; Ui::VersionPage *ui;
std::shared_ptr<MinecraftProfile> m_version; std::shared_ptr<MinecraftProfile> m_profile;
OneSixInstance *m_inst; OneSixInstance *m_inst;
int currentIdx = 0; int currentIdx = 0;
BasePageContainer * m_container = nullptr; BasePageContainer * m_container = nullptr;

View File

@ -58,11 +58,11 @@ bool MinecraftVersion::isMinecraftVersion()
return true; return true;
} }
void MinecraftVersion::applyFileTo(MinecraftProfile *version) void MinecraftVersion::applyFileTo(MinecraftProfile *profile)
{ {
if(m_versionSource == Local && getVersionFile()) if(m_versionSource == Local && getVersionFile())
{ {
getVersionFile()->applyTo(version); getVersionFile()->applyTo(profile);
} }
else else
{ {
@ -149,12 +149,12 @@ ProblemSeverity MinecraftVersion::getProblemSeverity()
return ProfilePatch::getProblemSeverity(); return ProfilePatch::getProblemSeverity();
} }
void MinecraftVersion::applyTo(MinecraftProfile *version) void MinecraftVersion::applyTo(MinecraftProfile *profile)
{ {
// do we have this one cached? // do we have this one cached?
if (m_versionSource == Local) if (m_versionSource == Local)
{ {
applyFileTo(version); applyFileTo(profile);
return; return;
} }
// if not builtin, do not proceed any further. // if not builtin, do not proceed any further.
@ -163,12 +163,12 @@ void MinecraftVersion::applyTo(MinecraftProfile *version)
throw VersionIncomplete(QObject::tr( throw VersionIncomplete(QObject::tr(
"Minecraft version %1 could not be applied: version files are missing.").arg(m_descriptor)); "Minecraft version %1 could not be applied: version files are missing.").arg(m_descriptor));
} }
version->applyMinecraftVersion(m_descriptor); profile->applyMinecraftVersion(m_descriptor);
version->applyMainClass(m_mainClass); profile->applyMainClass(m_mainClass);
version->applyAppletClass(m_appletClass); profile->applyAppletClass(m_appletClass);
version->applyMinecraftArguments(" ${auth_player_name} ${auth_session}"); // all builtin versions are legacy profile->applyMinecraftArguments(" ${auth_player_name} ${auth_session}"); // all builtin versions are legacy
version->applyMinecraftVersionType(m_type); profile->applyMinecraftVersionType(m_type);
version->applyTraits(m_traits); profile->applyTraits(m_traits);
} }
int MinecraftVersion::getOrder() int MinecraftVersion::getOrder()

View File

@ -40,7 +40,7 @@ public: /* methods */
virtual QString typeString() const override; virtual QString typeString() const override;
virtual bool hasJarMods() override; virtual bool hasJarMods() override;
virtual bool isMinecraftVersion() override; virtual bool isMinecraftVersion() override;
virtual void applyTo(MinecraftProfile *version) override; virtual void applyTo(MinecraftProfile *profile) override;
virtual int getOrder() override; virtual int getOrder() override;
virtual void setOrder(int order) override; virtual void setOrder(int order) override;
virtual QList<JarmodPtr> getJarMods() override; virtual QList<JarmodPtr> getJarMods() override;
@ -86,7 +86,7 @@ public: /* methods */
virtual ProblemSeverity getProblemSeverity() override; virtual ProblemSeverity getProblemSeverity() override;
private: /* methods */ private: /* methods */
void applyFileTo(MinecraftProfile *version); void applyFileTo(MinecraftProfile *profile);
protected: /* data */ protected: /* data */
VersionSource m_versionSource = Builtin; VersionSource m_versionSource = Builtin;

View File

@ -47,7 +47,7 @@ class ProfilePatch
{ {
public: public:
virtual ~ProfilePatch(){}; virtual ~ProfilePatch(){};
virtual void applyTo(MinecraftProfile *version) = 0; virtual void applyTo(MinecraftProfile *profile) = 0;
virtual bool isMinecraftVersion() = 0; virtual bool isMinecraftVersion() = 0;
virtual bool hasJarMods() = 0; virtual bool hasJarMods() = 0;

View File

@ -22,9 +22,9 @@ bool VersionFile::hasJarMods()
return !jarMods.isEmpty(); return !jarMods.isEmpty();
} }
void VersionFile::applyTo(MinecraftProfile *version) void VersionFile::applyTo(MinecraftProfile *profile)
{ {
auto theirVersion = version->getMinecraftVersion(); auto theirVersion = profile->getMinecraftVersion();
if (!theirVersion.isNull() && !mcVersion.isNull()) if (!theirVersion.isNull() && !mcVersion.isNull())
{ {
if (QRegExp(mcVersion, Qt::CaseInsensitive, QRegExp::Wildcard).indexIn(theirVersion) == -1) if (QRegExp(mcVersion, Qt::CaseInsensitive, QRegExp::Wildcard).indexIn(theirVersion) == -1)
@ -32,22 +32,22 @@ void VersionFile::applyTo(MinecraftProfile *version)
throw MinecraftVersionMismatch(fileId, mcVersion, theirVersion); throw MinecraftVersionMismatch(fileId, mcVersion, theirVersion);
} }
} }
version->applyMinecraftVersion(id); profile->applyMinecraftVersion(id);
version->applyMainClass(mainClass); profile->applyMainClass(mainClass);
version->applyAppletClass(appletClass); profile->applyAppletClass(appletClass);
version->applyMinecraftArguments(minecraftArguments); profile->applyMinecraftArguments(minecraftArguments);
if (isMinecraftVersion()) if (isMinecraftVersion())
{ {
version->applyMinecraftVersionType(type); profile->applyMinecraftVersionType(type);
} }
version->applyMinecraftAssets(assets); profile->applyMinecraftAssets(assets);
version->applyTweakers(addTweakers); profile->applyTweakers(addTweakers);
version->applyJarMods(jarMods); profile->applyJarMods(jarMods);
version->applyTraits(traits); profile->applyTraits(traits);
for (auto library : libraries) for (auto library : libraries)
{ {
version->applyLibrary(library); profile->applyLibrary(library);
} }
} }

View File

@ -23,7 +23,7 @@ class VersionFile : public ProfilePatch
friend class MojangVersionFormat; friend class MojangVersionFormat;
friend class OneSixVersionFormat; friend class OneSixVersionFormat;
public: /* methods */ public: /* methods */
virtual void applyTo(MinecraftProfile *version) override; virtual void applyTo(MinecraftProfile *profile) override;
virtual bool isMinecraftVersion() override; virtual bool isMinecraftVersion() override;
virtual bool hasJarMods() override; virtual bool hasJarMods() override;
virtual int getOrder() override virtual int getOrder() override

View File

@ -122,7 +122,7 @@ bool OneSixFTBInstance::providesVersionFile() const
void OneSixFTBInstance::createProfile() void OneSixFTBInstance::createProfile()
{ {
m_version.reset(new MinecraftProfile(new FTBProfileStrategy(this))); m_profile.reset(new MinecraftProfile(new FTBProfileStrategy(this)));
} }
std::shared_ptr<Task> OneSixFTBInstance::createUpdateTask() std::shared_ptr<Task> OneSixFTBInstance::createUpdateTask()

View File

@ -50,7 +50,7 @@ void OneSixInstance::init()
void OneSixInstance::createProfile() void OneSixInstance::createProfile()
{ {
m_version.reset(new MinecraftProfile(new OneSixProfileStrategy(this))); m_profile.reset(new MinecraftProfile(new OneSixProfileStrategy(this)));
} }
QSet<QString> OneSixInstance::traits() QSet<QString> OneSixInstance::traits()
@ -61,7 +61,9 @@ QSet<QString> OneSixInstance::traits()
return {"version-incomplete"}; return {"version-incomplete"};
} }
else else
{
return version->getTraits(); return version->getTraits();
}
} }
std::shared_ptr<Task> OneSixInstance::createUpdateTask() std::shared_ptr<Task> OneSixInstance::createUpdateTask()
@ -95,8 +97,8 @@ QString replaceTokensIn(QString text, QMap<QString, QString> with)
QStringList OneSixInstance::processMinecraftArgs(AuthSessionPtr session) QStringList OneSixInstance::processMinecraftArgs(AuthSessionPtr session)
{ {
QString args_pattern = m_version->getMinecraftArguments(); QString args_pattern = m_profile->getMinecraftArguments();
for (auto tweaker : m_version->getTweakers()) for (auto tweaker : m_profile->getTweakers())
{ {
args_pattern += " --tweakClass " + tweaker; args_pattern += " --tweakClass " + tweaker;
} }
@ -111,9 +113,9 @@ QStringList OneSixInstance::processMinecraftArgs(AuthSessionPtr session)
// blatant self-promotion. // blatant self-promotion.
token_mapping["profile_name"] = token_mapping["version_name"] = "MultiMC5"; token_mapping["profile_name"] = token_mapping["version_name"] = "MultiMC5";
if(m_version->isVanilla()) if(m_profile->isVanilla())
{ {
token_mapping["version_type"] = m_version->getMinecraftVersionType(); token_mapping["version_type"] = m_profile->getMinecraftVersionType();
} }
else else
{ {
@ -123,14 +125,14 @@ QStringList OneSixInstance::processMinecraftArgs(AuthSessionPtr session)
QString absRootDir = QDir(minecraftRoot()).absolutePath(); QString absRootDir = QDir(minecraftRoot()).absolutePath();
token_mapping["game_directory"] = absRootDir; token_mapping["game_directory"] = absRootDir;
QString absAssetsDir = QDir("assets/").absolutePath(); QString absAssetsDir = QDir("assets/").absolutePath();
token_mapping["game_assets"] = AssetsUtils::reconstructAssets(m_version->getMinecraftAssets()).absolutePath(); token_mapping["game_assets"] = AssetsUtils::reconstructAssets(m_profile->getMinecraftAssets()).absolutePath();
token_mapping["user_properties"] = session->serializeUserProperties(); token_mapping["user_properties"] = session->serializeUserProperties();
token_mapping["user_type"] = session->user_type; token_mapping["user_type"] = session->user_type;
// 1.7.3+ assets tokens // 1.7.3+ assets tokens
token_mapping["assets_root"] = absAssetsDir; token_mapping["assets_root"] = absAssetsDir;
token_mapping["assets_index_name"] = m_version->getMinecraftAssets(); token_mapping["assets_index_name"] = m_profile->getMinecraftAssets();
QStringList parts = args_pattern.split(' ', QString::SkipEmptyParts); QStringList parts = args_pattern.split(' ', QString::SkipEmptyParts);
for (int i = 0; i < parts.length(); i++) for (int i = 0; i < parts.length(); i++)
@ -147,7 +149,7 @@ QString OneSixInstance::createLaunchScript(AuthSessionPtr session)
auto pixmap = icon.pixmap(128, 128); auto pixmap = icon.pixmap(128, 128);
pixmap.save(FS::PathCombine(minecraftRoot(), "icon.png"), "PNG"); pixmap.save(FS::PathCombine(minecraftRoot(), "icon.png"), "PNG");
if (!m_version) if (!m_profile)
return nullptr; return nullptr;
for(auto & mod: loaderModList()->allMods()) for(auto & mod: loaderModList()->allMods())
@ -172,14 +174,14 @@ QString OneSixInstance::createLaunchScript(AuthSessionPtr session)
launchScript += "coremod " + coremod.filename().completeBaseName() + "\n";; launchScript += "coremod " + coremod.filename().completeBaseName() + "\n";;
} }
for(auto & jarmod: m_version->getJarMods()) for(auto & jarmod: m_profile->getJarMods())
{ {
launchScript += "jarmod " + jarmod->originalName + " (" + jarmod->name + ")\n"; launchScript += "jarmod " + jarmod->originalName + " (" + jarmod->name + ")\n";
} }
// libraries and class path. // libraries and class path.
{ {
auto libs = m_version->getLibraries(); auto libs = m_profile->getLibraries();
for (auto lib : libs) for (auto lib : libs)
{ {
launchScript += "cp " + QFileInfo(lib->storagePath()).absoluteFilePath() + "\n"; launchScript += "cp " + QFileInfo(lib->storagePath()).absoluteFilePath() + "\n";
@ -191,16 +193,16 @@ QString OneSixInstance::createLaunchScript(AuthSessionPtr session)
} }
else else
{ {
QString relpath = m_version->getMinecraftVersion() + "/" + m_version->getMinecraftVersion() + ".jar"; QString relpath = m_profile->getMinecraftVersion() + "/" + m_profile->getMinecraftVersion() + ".jar";
launchScript += "cp " + versionsPath().absoluteFilePath(relpath) + "\n"; launchScript += "cp " + versionsPath().absoluteFilePath(relpath) + "\n";
} }
} }
auto mainClass = m_version->getMainClass(); auto mainClass = m_profile->getMainClass();
if (!mainClass.isEmpty()) if (!mainClass.isEmpty())
{ {
launchScript += "mainClass " + mainClass + "\n"; launchScript += "mainClass " + mainClass + "\n";
} }
auto appletClass = m_version->getAppletClass(); auto appletClass = m_profile->getAppletClass();
if (!appletClass.isEmpty()) if (!appletClass.isEmpty())
{ {
launchScript += "appletClass " + appletClass + "\n"; launchScript += "appletClass " + appletClass + "\n";
@ -234,7 +236,7 @@ QString OneSixInstance::createLaunchScript(AuthSessionPtr session)
// native libraries (mostly LWJGL) // native libraries (mostly LWJGL)
{ {
QDir natives_dir(FS::PathCombine(instanceRoot(), "natives/")); QDir natives_dir(FS::PathCombine(instanceRoot(), "natives/"));
for (auto native : m_version->getNativeLibraries()) for (auto native : m_profile->getNativeLibraries())
{ {
QFileInfo finfo(native->storagePath()); QFileInfo finfo(native->storagePath());
launchScript += "ext " + finfo.absoluteFilePath() + "\n"; launchScript += "ext " + finfo.absoluteFilePath() + "\n";
@ -243,7 +245,7 @@ QString OneSixInstance::createLaunchScript(AuthSessionPtr session)
} }
// traits. including legacyLaunch and others ;) // traits. including legacyLaunch and others ;)
for (auto trait : m_version->getTraits()) for (auto trait : m_profile->getTraits())
{ {
launchScript += "traits " + trait + "\n"; launchScript += "traits " + trait + "\n";
} }
@ -313,9 +315,9 @@ std::shared_ptr<Task> OneSixInstance::createJarModdingTask()
} }
virtual void executeTask() virtual void executeTask()
{ {
std::shared_ptr<MinecraftProfile> version = m_inst->getMinecraftProfile(); auto profile = m_inst->getMinecraftProfile();
// nuke obsolete stripped jar(s) if needed // nuke obsolete stripped jar(s) if needed
QString version_id = version->getMinecraftVersion(); QString version_id = profile->getMinecraftVersion();
QString strippedPath = version_id + "/" + version_id + "-stripped.jar"; QString strippedPath = version_id + "/" + version_id + "-stripped.jar";
QFile strippedJar(strippedPath); QFile strippedJar(strippedPath);
if(strippedJar.exists()) if(strippedJar.exists())
@ -431,7 +433,7 @@ bool OneSixInstance::setIntendedVersionId(QString version)
QList< Mod > OneSixInstance::getJarMods() const QList< Mod > OneSixInstance::getJarMods() const
{ {
QList<Mod> mods; QList<Mod> mods;
for (auto jarmod : m_version->getJarMods()) for (auto jarmod : m_profile->getJarMods())
{ {
QString filePath = jarmodsPath().absoluteFilePath(jarmod->name); QString filePath = jarmodsPath().absoluteFilePath(jarmod->name);
mods.push_back(Mod(QFileInfo(filePath))); mods.push_back(Mod(QFileInfo(filePath)));
@ -463,7 +465,7 @@ void OneSixInstance::reloadProfile()
{ {
try try
{ {
m_version->reload(); m_profile->reload();
unsetFlag(VersionBrokenFlag); unsetFlag(VersionBrokenFlag);
emit versionReloaded(); emit versionReloaded();
} }
@ -472,7 +474,7 @@ void OneSixInstance::reloadProfile()
} }
catch (Exception &error) catch (Exception &error)
{ {
m_version->clear(); m_profile->clear();
setFlag(VersionBrokenFlag); setFlag(VersionBrokenFlag);
// TODO: rethrow to show some error message(s)? // TODO: rethrow to show some error message(s)?
emit versionReloaded(); emit versionReloaded();
@ -482,13 +484,13 @@ void OneSixInstance::reloadProfile()
void OneSixInstance::clearProfile() void OneSixInstance::clearProfile()
{ {
m_version->clear(); m_profile->clear();
emit versionReloaded(); emit versionReloaded();
} }
std::shared_ptr<MinecraftProfile> OneSixInstance::getMinecraftProfile() const std::shared_ptr<MinecraftProfile> OneSixInstance::getMinecraftProfile() const
{ {
return m_version; return m_profile;
} }
QDir OneSixInstance::librariesPath() const QDir OneSixInstance::librariesPath() const

View File

@ -101,7 +101,7 @@ private:
QStringList processMinecraftArgs(AuthSessionPtr account); QStringList processMinecraftArgs(AuthSessionPtr account);
protected: protected:
std::shared_ptr<MinecraftProfile> m_version; std::shared_ptr<MinecraftProfile> m_profile;
mutable std::shared_ptr<ModList> m_loader_mod_list; mutable std::shared_ptr<ModList> m_loader_mod_list;
mutable std::shared_ptr<ModList> m_core_mod_list; mutable std::shared_ptr<ModList> m_core_mod_list;
mutable std::shared_ptr<ModList> m_resource_pack_list; mutable std::shared_ptr<ModList> m_resource_pack_list;

View File

@ -87,8 +87,8 @@ void OneSixUpdate::assetIndexStart()
{ {
setStatus(tr("Updating assets index...")); setStatus(tr("Updating assets index..."));
OneSixInstance *inst = (OneSixInstance *)m_inst; OneSixInstance *inst = (OneSixInstance *)m_inst;
std::shared_ptr<MinecraftProfile> version = inst->getMinecraftProfile(); auto profile = inst->getMinecraftProfile();
QString assetName = version->getMinecraftAssets(); QString assetName = profile->getMinecraftAssets();
QUrl indexUrl = "http://" + URLConstants::AWS_DOWNLOAD_INDEXES + assetName + ".json"; QUrl indexUrl = "http://" + URLConstants::AWS_DOWNLOAD_INDEXES + assetName + ".json";
QString localPath = assetName + ".json"; QString localPath = assetName + ".json";
auto job = new NetJob(tr("Asset index for %1").arg(inst->name())); auto job = new NetJob(tr("Asset index for %1").arg(inst->name()));
@ -113,8 +113,8 @@ void OneSixUpdate::assetIndexFinished()
qDebug() << m_inst->name() << ": Finished asset index download"; qDebug() << m_inst->name() << ": Finished asset index download";
OneSixInstance *inst = (OneSixInstance *)m_inst; OneSixInstance *inst = (OneSixInstance *)m_inst;
std::shared_ptr<MinecraftProfile> version = inst->getMinecraftProfile(); auto profile = inst->getMinecraftProfile();
QString assetName = version->getMinecraftAssets(); QString assetName = profile->getMinecraftAssets();
QString asset_fname = "assets/indexes/" + assetName + ".json"; QString asset_fname = "assets/indexes/" + assetName + ".json";
if (!AssetsUtils::loadAssetsIndexJson(asset_fname, &index)) if (!AssetsUtils::loadAssetsIndexJson(asset_fname, &index))
@ -190,10 +190,10 @@ void OneSixUpdate::jarlibStart()
} }
// Build a list of URLs that will need to be downloaded. // Build a list of URLs that will need to be downloaded.
std::shared_ptr<MinecraftProfile> version = inst->getMinecraftProfile(); std::shared_ptr<MinecraftProfile> profile = inst->getMinecraftProfile();
// minecraft.jar for this version // minecraft.jar for this version
{ {
QString version_id = version->getMinecraftVersion(); QString version_id = profile->getMinecraftVersion();
QString localPath = version_id + "/" + version_id + ".jar"; QString localPath = version_id + "/" + version_id + ".jar";
QString urlstr = "http://" + URLConstants::AWS_DOWNLOAD_VERSIONS + localPath; QString urlstr = "http://" + URLConstants::AWS_DOWNLOAD_VERSIONS + localPath;
@ -207,8 +207,8 @@ void OneSixUpdate::jarlibStart()
jarlibDownloadJob.reset(job); jarlibDownloadJob.reset(job);
} }
auto libs = version->getNativeLibraries(); auto libs = profile->getNativeLibraries();
libs.append(version->getLibraries()); libs.append(profile->getLibraries());
auto metacache = ENV.metacache(); auto metacache = ENV.metacache();
QList<ForgeXzDownloadPtr> ForgeLibs; QList<ForgeXzDownloadPtr> ForgeLibs;
@ -289,9 +289,9 @@ void OneSixUpdate::jarlibStart()
void OneSixUpdate::jarlibFinished() void OneSixUpdate::jarlibFinished()
{ {
OneSixInstance *inst = (OneSixInstance *)m_inst; OneSixInstance *inst = (OneSixInstance *)m_inst;
std::shared_ptr<MinecraftProfile> version = inst->getMinecraftProfile(); std::shared_ptr<MinecraftProfile> profile = inst->getMinecraftProfile();
if (version->hasTrait("legacyFML")) if (profile->hasTrait("legacyFML"))
{ {
fmllibsStart(); fmllibsStart();
} }
@ -313,7 +313,7 @@ void OneSixUpdate::fmllibsStart()
{ {
// Get the mod list // Get the mod list
OneSixInstance *inst = (OneSixInstance *)m_inst; OneSixInstance *inst = (OneSixInstance *)m_inst;
std::shared_ptr<MinecraftProfile> fullversion = inst->getMinecraftProfile(); std::shared_ptr<MinecraftProfile> profile = inst->getMinecraftProfile();
bool forge_present = false; bool forge_present = false;
QString version = inst->intendedVersionId(); QString version = inst->intendedVersionId();
@ -328,7 +328,7 @@ void OneSixUpdate::fmllibsStart()
// determine if we need some libs for FML or forge // determine if we need some libs for FML or forge
setStatus(tr("Checking for FML libraries...")); setStatus(tr("Checking for FML libraries..."));
forge_present = (fullversion->versionPatch("net.minecraftforge") != nullptr); forge_present = (profile->versionPatch("net.minecraftforge") != nullptr);
// we don't... // we don't...
if (!forge_present) if (!forge_present)
{ {