diff options
Diffstat (limited to 'logic')
-rw-r--r-- | logic/BaseInstance.h | 3 | ||||
-rw-r--r-- | logic/LegacyInstance.cpp | 5 | ||||
-rw-r--r-- | logic/LegacyInstance.h | 1 | ||||
-rw-r--r-- | logic/ModList.cpp | 1 | ||||
-rw-r--r-- | logic/OneSixInstance.cpp | 35 | ||||
-rw-r--r-- | logic/OneSixInstance.h | 13 | ||||
-rw-r--r-- | logic/OneSixInstance_p.h | 1 | ||||
-rw-r--r-- | logic/minecraft/VersionBuilder.cpp | 2 |
8 files changed, 45 insertions, 16 deletions
diff --git a/logic/BaseInstance.h b/logic/BaseInstance.h index d272dc71..bdd2f1be 100644 --- a/logic/BaseInstance.h +++ b/logic/BaseInstance.h @@ -169,9 +169,6 @@ public: /// 'prepareForLaunch' virtual void cleanupAfterRun() = 0; - /// create a mod edit dialog for the instance - virtual QDialog *createModEditDialog(QWidget *parent) = 0; - /// is a particular action enabled with this instance selected? virtual bool menuActionEnabled(QString action_name) const = 0; diff --git a/logic/LegacyInstance.cpp b/logic/LegacyInstance.cpp index 279282e3..5bc8bc34 100644 --- a/logic/LegacyInstance.cpp +++ b/logic/LegacyInstance.cpp @@ -135,11 +135,6 @@ std::shared_ptr<ModList> LegacyInstance::texturePackList() return d->texture_pack_list; } -QDialog *LegacyInstance::createModEditDialog(QWidget *parent) -{ - return new LegacyModEditDialog(this, parent); -} - QString LegacyInstance::jarModsDir() const { return PathCombine(instanceRoot(), "instMods"); diff --git a/logic/LegacyInstance.h b/logic/LegacyInstance.h index aa80968e..3d426601 100644 --- a/logic/LegacyInstance.h +++ b/logic/LegacyInstance.h @@ -81,7 +81,6 @@ public: virtual bool prepareForLaunch(AuthSessionPtr account, QString & launchScript) override; virtual void cleanupAfterRun() override; - virtual QDialog *createModEditDialog(QWidget *parent) override; virtual QString defaultBaseJar() const override; virtual QString defaultCustomBaseJar() const override; diff --git a/logic/ModList.cpp b/logic/ModList.cpp index 79b56986..f7770920 100644 --- a/logic/ModList.cpp +++ b/logic/ModList.cpp @@ -26,6 +26,7 @@ ModList::ModList(const QString &dir, const QString &list_file) : QAbstractListModel(), m_dir(dir), m_list_file(list_file) { + ensureFolderPathExists(m_dir.absolutePath()); m_dir.setFilter(QDir::Readable | QDir::NoDotAndDotDot | QDir::Files | QDir::Dirs | QDir::NoSymLinks); m_dir.setSorting(QDir::Name | QDir::IgnoreCase | QDir::LocaleAware); diff --git a/logic/OneSixInstance.cpp b/logic/OneSixInstance.cpp index e2d5ef0a..4fd7999a 100644 --- a/logic/OneSixInstance.cpp +++ b/logic/OneSixInstance.cpp @@ -30,6 +30,9 @@ #include "icons/IconList.h" #include "logic/MinecraftProcess.h" #include "gui/dialogs/InstanceEditDialog.h" +#include "gui/pagedialog/PageDialog.h" +#include "gui/pages/VersionPage.h" +#include <gui/pages/ModFolderPage.h> OneSixInstance::OneSixInstance(const QString &rootDir, SettingsObject *settings, QObject *parent) @@ -52,6 +55,22 @@ void OneSixInstance::init() } } +QList<BasePage *> OneSixInstance::getPages() +{ + QList<BasePage *> values; + values.append(new VersionPage(this)); + values.append(new ModFolderPage(loaderModList(), "mods", "centralmods", tr("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"))); + return values; +} + +QString OneSixInstance::dialogTitle() +{ + return tr("Edit Instance (%1)").arg(name()); +} + std::shared_ptr<Task> OneSixInstance::doUpdate() { return std::shared_ptr<Task>(new OneSixUpdate(this)); @@ -310,9 +329,15 @@ std::shared_ptr<ModList> OneSixInstance::resourcePackList() return d->resource_pack_list; } -QDialog *OneSixInstance::createModEditDialog(QWidget *parent) +std::shared_ptr<ModList> OneSixInstance::texturePackList() { - return new InstanceEditDialog(this, parent); + I_D(OneSixInstance); + if (!d->texture_pack_list) + { + d->texture_pack_list.reset(new ModList(texturePacksDir())); + } + d->texture_pack_list->update(); + return d->texture_pack_list; } bool OneSixInstance::setIntendedVersionId(QString version) @@ -503,6 +528,12 @@ QString OneSixInstance::resourcePacksDir() const return PathCombine(minecraftRoot(), "resourcepacks"); } +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 98ce1ce8..fae38095 100644 --- a/logic/OneSixInstance.h +++ b/logic/OneSixInstance.h @@ -19,8 +19,9 @@ #include "logic/minecraft/InstanceVersion.h" #include "logic/ModList.h" +#include "gui/pages/BasePageProvider.h" -class OneSixInstance : public BaseInstance +class OneSixInstance : public BaseInstance, public BasePageProvider { Q_OBJECT public: @@ -29,15 +30,21 @@ public: virtual ~OneSixInstance(){}; virtual void init() override; + + ////// Edit Instance Dialog stuff ////// + virtual QList<BasePage *> getPages(); + virtual QString dialogTitle(); ////// Mod Lists ////// std::shared_ptr<ModList> loaderModList(); std::shared_ptr<ModList> coreModList(); std::shared_ptr<ModList> resourcePackList(); + std::shared_ptr<ModList> texturePackList(); ////// Directories and files ////// QString jarModsDir() const; QString resourcePacksDir() const; + QString texturePacksDir() const; QString loaderModsDir() const; QString coreModsDir() const; QString libDir() const; @@ -56,10 +63,8 @@ public: virtual bool shouldUpdate() const override; virtual void setShouldUpdate(bool val) override; - virtual QDialog *createModEditDialog(QWidget *parent) override; - /** - * reload the full version json files. return true on success! + * reload the full version json files. * * throws various exceptions :3 */ diff --git a/logic/OneSixInstance_p.h b/logic/OneSixInstance_p.h index 2797cc45..3c4ef324 100644 --- a/logic/OneSixInstance_p.h +++ b/logic/OneSixInstance_p.h @@ -29,4 +29,5 @@ public: std::shared_ptr<ModList> loader_mod_list; std::shared_ptr<ModList> core_mod_list; std::shared_ptr<ModList> resource_pack_list; + std::shared_ptr<ModList> texture_pack_list; }; diff --git a/logic/minecraft/VersionBuilder.cpp b/logic/minecraft/VersionBuilder.cpp index 6e96191f..29418fe3 100644 --- a/logic/minecraft/VersionBuilder.cpp +++ b/logic/minecraft/VersionBuilder.cpp @@ -185,7 +185,7 @@ void VersionBuilder::buildFromMultilayer() minecraftPatch->setOrder(-2); m_version->VersionPatches.append(minecraftPatch); - QResource LWJGL(":/versions/LWJGL/2.9.1.json"); + QResource LWJGL(":/versions/LWJGL/2.9.0.json"); auto lwjgl = parseJsonFile(LWJGL.absoluteFilePath(), false, false); auto lwjglPatch = std::dynamic_pointer_cast<VersionPatch>(lwjgl); if (!lwjglPatch) |