Show texture/resource packs when appropriate.

This commit is contained in:
Petr Mrázek 2014-06-08 20:11:09 +02:00
parent 223a7aba7b
commit bf7b070508
10 changed files with 141 additions and 102 deletions

View file

@ -32,6 +32,8 @@
#include "gui/pagedialog/PageDialog.h"
#include "gui/pages/VersionPage.h"
#include <gui/pages/ModFolderPage.h>
#include <gui/pages/ResourcePackPage.h>
#include <gui/pages/TexturePackPage.h>
OneSixInstance::OneSixInstance(const QString &rootDir, SettingsObject *settings,
QObject *parent)
@ -60,8 +62,8 @@ QList<BasePage *> OneSixInstance::getPages()
values.append(new VersionPage(this));
values.append(new ModFolderPage(loaderModList(), "mods", "centralmods", tr("Loader Mods")));
values.append(new ModFolderPage(coreModList(), "coremods", "viewfolder", tr("Core Mods")));
values.append(new ModFolderPage(resourcePackList(), "resourcepacks", "viewfolder", tr("Resource Packs")));
values.append(new ModFolderPage(texturePackList(), "texturepacks", "viewfolder", tr("Texture Packs")));
values.append(new ResourcePackPage(this));
values.append(new TexturePackPage(this));
return values;
}
@ -70,6 +72,17 @@ QString OneSixInstance::dialogTitle()
return tr("Edit Instance (%1)").arg(name());
}
QSet<QString> OneSixInstance::traits()
{
auto version = getFullVersion();
if (!version)
{
return {"version-incomplete"};
}
else
return version->traits;
}
std::shared_ptr<Task> OneSixInstance::doUpdate()
{
return std::shared_ptr<Task>(new OneSixUpdate(this));
@ -234,11 +247,11 @@ bool OneSixInstance::prepareForLaunch(AuthSessionPtr session, QString &launchScr
}
launchScript += "cp " + versionsPath().absoluteFilePath(minecraftjarpath) + "\n";
}
if(!version->mainClass.isEmpty())
if (!version->mainClass.isEmpty())
{
launchScript += "mainClass " + version->mainClass + "\n";
}
if(!version->appletClass.isEmpty())
if (!version->appletClass.isEmpty())
{
launchScript += "appletClass " + version->appletClass + "\n";
}
@ -261,7 +274,7 @@ bool OneSixInstance::prepareForLaunch(AuthSessionPtr session, QString &launchScr
launchScript += "windowTitle " + windowTitle() + "\n";
launchScript += "windowParams " + windowParams + "\n";
}
// legacy auth
{
launchScript += "userName " + session->player_name + "\n";
@ -278,7 +291,7 @@ bool OneSixInstance::prepareForLaunch(AuthSessionPtr session, QString &launchScr
}
launchScript += "natives " + natives_dir.absolutePath() + "\n";
}
// traits. including legacyLaunch and others ;)
for (auto trait : version->traits)
{
@ -398,9 +411,8 @@ void OneSixInstance::reloadVersion()
d->m_flags.remove(VersionBrokenFlag);
emit versionReloaded();
}
catch (VersionIncomplete & error)
catch (VersionIncomplete &error)
{
}
catch (MMCError &error)
{
@ -532,7 +544,6 @@ QString OneSixInstance::texturePacksDir() const
return PathCombine(minecraftRoot(), "texturepacks");
}
QString OneSixInstance::instanceConfigFolder() const
{
return PathCombine(minecraftRoot(), "config");