From 791221e923586bb717396ecf18bd13e57034df99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Tue, 27 Jan 2015 22:31:07 +0100 Subject: NOISSUE Refactors and moving of things --- logic/LegacyInstance.cpp | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'logic/LegacyInstance.cpp') diff --git a/logic/LegacyInstance.cpp b/logic/LegacyInstance.cpp index 38010f77..3d2a83b2 100644 --- a/logic/LegacyInstance.cpp +++ b/logic/LegacyInstance.cpp @@ -24,9 +24,9 @@ #include "LegacyInstance.h" -#include "logic/MinecraftProcess.h" #include "logic/LegacyUpdate.h" #include "logic/icons/IconList.h" +#include "logic/minecraft/MinecraftProcess.h" #include "gui/pages/LegacyUpgradePage.h" #include "gui/pages/ModFolderPage.h" #include "gui/pages/LegacyJarModPage.h" @@ -36,7 +36,7 @@ #include LegacyInstance::LegacyInstance(const QString &rootDir, SettingsObject *settings, QObject *parent) - : BaseInstance(rootDir, settings, parent) + : MinecraftInstance(rootDir, settings, parent) { settings->registerSetting("NeedsRebuild", true); settings->registerSetting("ShouldUpdate", false); @@ -66,7 +66,7 @@ QList LegacyInstance::getPages() "Loader-mods")); values.append(new TexturePackPage(this)); values.append(new NotesPage(this)); - values.append(new ScreenshotsPage(this)); + values.append(new ScreenshotsPage(PathCombine(minecraftRoot(), "screenshots"))); values.append(new InstanceSettingsPage(this)); return values; } @@ -124,8 +124,9 @@ std::shared_ptr LegacyInstance::doUpdate() return std::shared_ptr(new LegacyUpdate(this, this)); } -bool LegacyInstance::prepareForLaunch(AuthSessionPtr account, QString &launchScript) +BaseProcess *LegacyInstance::prepareForLaunch(AuthSessionPtr account) { + QString launchScript; QIcon icon = MMC->icons()->getIcon(iconKey()); auto pixmap = icon.pixmap(128, 128); pixmap.save(PathCombine(minecraftRoot(), "icon.png"), "PNG"); @@ -150,7 +151,11 @@ bool LegacyInstance::prepareForLaunch(AuthSessionPtr account, QString &launchScr launchScript += "lwjgl " + lwjgl + "\n"; launchScript += "launcher legacy\n"; } - return true; + auto process = MinecraftProcess::create(std::dynamic_pointer_cast(getSharedPtr())); + process->setLaunchScript(launchScript); + process->setWorkdir(minecraftRoot()); + process->setLogin(account); + return process; } void LegacyInstance::cleanupAfterRun() @@ -158,7 +163,7 @@ void LegacyInstance::cleanupAfterRun() // FIXME: delete the launcher and icons and whatnot. } -std::shared_ptr LegacyInstance::coreModList() +std::shared_ptr LegacyInstance::coreModList() const { if (!core_mod_list) { @@ -168,7 +173,7 @@ std::shared_ptr LegacyInstance::coreModList() return core_mod_list; } -std::shared_ptr LegacyInstance::jarModList() +std::shared_ptr LegacyInstance::jarModList() const { if (!jar_mod_list) { @@ -180,13 +185,18 @@ std::shared_ptr LegacyInstance::jarModList() return jar_mod_list; } +QList LegacyInstance::getJarMods() const +{ + return jarModList()->allMods(); +} + void LegacyInstance::jarModsChanged() { QLOG_INFO() << "Jar mods of instance " << name() << " have changed. Jar will be rebuilt."; setShouldRebuild(true); } -std::shared_ptr LegacyInstance::loaderModList() +std::shared_ptr LegacyInstance::loaderModList() const { if (!loader_mod_list) { @@ -196,7 +206,7 @@ std::shared_ptr LegacyInstance::loaderModList() return loader_mod_list; } -std::shared_ptr LegacyInstance::texturePackList() +std::shared_ptr LegacyInstance::texturePackList() const { if (!texture_pack_list) { -- cgit v1.2.3