diff options
author | Petr Mrázek <peterix@gmail.com> | 2014-06-08 20:11:09 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2014-06-09 01:38:31 +0200 |
commit | bf7b07050873770bd0b2ed5d73965b5a88d7a351 (patch) | |
tree | f29a06ac56d9197ac7bbd1df19faa7824e9d6cc5 /logic | |
parent | 223a7aba7bfa6019d8a2cfa5e8f8a4791a96d136 (diff) | |
download | MultiMC-bf7b07050873770bd0b2ed5d73965b5a88d7a351.tar MultiMC-bf7b07050873770bd0b2ed5d73965b5a88d7a351.tar.gz MultiMC-bf7b07050873770bd0b2ed5d73965b5a88d7a351.tar.lz MultiMC-bf7b07050873770bd0b2ed5d73965b5a88d7a351.tar.xz MultiMC-bf7b07050873770bd0b2ed5d73965b5a88d7a351.zip |
Show texture/resource packs when appropriate.
Diffstat (limited to 'logic')
-rw-r--r-- | logic/BaseInstance.h | 14 | ||||
-rw-r--r-- | logic/LegacyInstance.cpp | 3 | ||||
-rw-r--r-- | logic/LegacyInstance.h | 5 | ||||
-rw-r--r-- | logic/OneSixInstance.cpp | 29 | ||||
-rw-r--r-- | logic/OneSixInstance.h | 6 |
5 files changed, 45 insertions, 12 deletions
diff --git a/logic/BaseInstance.h b/logic/BaseInstance.h index bdd2f1be..2eba1fff 100644 --- a/logic/BaseInstance.h +++ b/logic/BaseInstance.h @@ -25,6 +25,7 @@ #include "logic/BaseVersionList.h" #include "logic/auth/MojangAccount.h" +class ModList; class QDialog; class QDir; class Task; @@ -110,6 +111,19 @@ public: virtual bool shouldUpdate() const = 0; virtual void setShouldUpdate(bool val) = 0; + ////// Mod Lists ////// + virtual std::shared_ptr<ModList> resourcePackList() + { + return nullptr; + } + virtual std::shared_ptr<ModList> texturePackList() + { + return nullptr; + } + + /// Traits. Normally inside the version, depends on instance implementation. + virtual QSet <QString> traits() = 0; + /// Get the curent base jar of this instance. By default, it's the /// versions/$version/$version.jar QString baseJar() const; diff --git a/logic/LegacyInstance.cpp b/logic/LegacyInstance.cpp index 8603022a..15332c41 100644 --- a/logic/LegacyInstance.cpp +++ b/logic/LegacyInstance.cpp @@ -31,6 +31,7 @@ #include "gui/pages/LegacyUpgradePage.h" #include "gui/pages/ModFolderPage.h" #include "gui/pages/LegacyJarModPage.h" +#include <gui/pages/TexturePackPage.h> LegacyInstance::LegacyInstance(const QString &rootDir, SettingsObject *settings, QObject *parent) @@ -50,7 +51,7 @@ QList<BasePage *> LegacyInstance::getPages() values.append(new LegacyJarModPage(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(texturePackList(), "texturepacks", "viewfolder", tr("Texture Packs"))); + values.append(new TexturePackPage(this)); return values; } diff --git a/logic/LegacyInstance.h b/logic/LegacyInstance.h index 82dd4fee..d367b990 100644 --- a/logic/LegacyInstance.h +++ b/logic/LegacyInstance.h @@ -80,6 +80,11 @@ public: return false; } + virtual QSet<QString> traits() + { + return {"legacy-instance", "texturepacks"}; + }; + virtual bool shouldUpdate() const override; virtual void setShouldUpdate(bool val) override; virtual std::shared_ptr<Task> doUpdate() override; diff --git a/logic/OneSixInstance.cpp b/logic/OneSixInstance.cpp index 58781c15..d306470c 100644 --- a/logic/OneSixInstance.cpp +++ b/logic/OneSixInstance.cpp @@ -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"); diff --git a/logic/OneSixInstance.h b/logic/OneSixInstance.h index fa98ccf0..405cfe97 100644 --- a/logic/OneSixInstance.h +++ b/logic/OneSixInstance.h @@ -38,9 +38,11 @@ public: ////// Mod Lists ////// std::shared_ptr<ModList> loaderModList(); std::shared_ptr<ModList> coreModList(); - std::shared_ptr<ModList> resourcePackList(); - std::shared_ptr<ModList> texturePackList(); + std::shared_ptr<ModList> resourcePackList() override; + std::shared_ptr<ModList> texturePackList() override; + virtual QSet<QString> traits(); + ////// Directories and files ////// QString jarModsDir() const; QString resourcePacksDir() const; |