diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index c29ee3e1a..14704905e 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -653,6 +653,7 @@ SET(MULTIMC_SOURCES pages/instance/VersionPage.h pages/instance/TexturePackPage.h pages/instance/ResourcePackPage.h + pages/instance/ShaderPackPage.h pages/instance/ModFolderPage.cpp pages/instance/ModFolderPage.h pages/instance/NotesPage.cpp diff --git a/launcher/InstancePageProvider.h b/launcher/InstancePageProvider.h index 3cb723c40..d45b3f2e6 100644 --- a/launcher/InstancePageProvider.h +++ b/launcher/InstancePageProvider.h @@ -9,6 +9,7 @@ #include "pages/instance/ModFolderPage.h" #include "pages/instance/ResourcePackPage.h" #include "pages/instance/TexturePackPage.h" +#include "pages/instance/ShaderPackPage.h" #include "pages/instance/NotesPage.h" #include "pages/instance/ScreenshotsPage.h" #include "pages/instance/InstanceSettingsPage.h" @@ -44,6 +45,7 @@ public: values.append(new CoreModFolderPage(onesix.get(), onesix->coreModList(), "coremods", "coremods", tr("Core mods"), "Core-mods")); values.append(new ResourcePackPage(onesix.get())); values.append(new TexturePackPage(onesix.get())); + values.append(new ShaderPackPage(onesix.get())); values.append(new NotesPage(onesix.get())); values.append(new WorldListPage(onesix.get(), onesix->worldList())); values.append(new ServersPage(onesix)); diff --git a/launcher/minecraft/MinecraftInstance.cpp b/launcher/minecraft/MinecraftInstance.cpp index 5f3c72443..f86269f0d 100644 --- a/launcher/minecraft/MinecraftInstance.cpp +++ b/launcher/minecraft/MinecraftInstance.cpp @@ -222,6 +222,11 @@ QString MinecraftInstance::texturePacksDir() const return FS::PathCombine(gameRoot(), "texturepacks"); } +QString MinecraftInstance::shaderPacksDir() const +{ + return FS::PathCombine(gameRoot(), "shaderpacks"); +} + QString MinecraftInstance::instanceConfigFolder() const { return FS::PathCombine(gameRoot(), "config"); @@ -1010,6 +1015,17 @@ std::shared_ptr MinecraftInstance::texturePackList() const return m_texture_pack_list; } +std::shared_ptr MinecraftInstance::shaderPackList() const +{ + if (!m_shader_pack_list) + { + m_shader_pack_list.reset(new ResourcePackFolderModel(shaderPacksDir())); + m_shader_pack_list->disableInteraction(isRunning()); + connect(this, &BaseInstance::runningStatusChanged, m_shader_pack_list.get(), &ModFolderModel::disableInteraction); + } + return m_shader_pack_list; +} + std::shared_ptr MinecraftInstance::worldList() const { if (!m_world_list) diff --git a/launcher/minecraft/MinecraftInstance.h b/launcher/minecraft/MinecraftInstance.h index b55a27762..cdfd350b9 100644 --- a/launcher/minecraft/MinecraftInstance.h +++ b/launcher/minecraft/MinecraftInstance.h @@ -39,6 +39,7 @@ public: QString jarModsDir() const; QString resourcePacksDir() const; QString texturePacksDir() const; + QString shaderPacksDir() const; QString loaderModsDir() const; QString coreModsDir() const; QString modsCacheLocation() const; @@ -71,6 +72,7 @@ public: std::shared_ptr coreModList() const; std::shared_ptr resourcePackList() const; std::shared_ptr texturePackList() const; + std::shared_ptr shaderPackList() const; std::shared_ptr worldList() const; std::shared_ptr gameOptionsModel() const; @@ -124,6 +126,7 @@ protected: // data mutable std::shared_ptr m_loader_mod_list; mutable std::shared_ptr m_core_mod_list; mutable std::shared_ptr m_resource_pack_list; + mutable std::shared_ptr m_shader_pack_list; mutable std::shared_ptr m_texture_pack_list; mutable std::shared_ptr m_world_list; mutable std::shared_ptr m_game_options; diff --git a/launcher/pages/instance/ShaderPackPage.h b/launcher/pages/instance/ShaderPackPage.h new file mode 100644 index 000000000..367249923 --- /dev/null +++ b/launcher/pages/instance/ShaderPackPage.h @@ -0,0 +1,22 @@ +#pragma once + +#include "ModFolderPage.h" +#include "ui_ModFolderPage.h" + +class ShaderPackPage : public ModFolderPage +{ + Q_OBJECT +public: + explicit ShaderPackPage(MinecraftInstance *instance, QWidget *parent = 0) + : ModFolderPage(instance, instance->shaderPackList(), "shaderpacks", + "shaderpacks", tr("Shader packs"), "Resource-packs", parent) + { + ui->actionView_configs->setVisible(false); + } + virtual ~ShaderPackPage() {} + + virtual bool shouldDisplay() const override + { + return true; + } +}; diff --git a/launcher/resources/pe_colored/pe_colored.qrc b/launcher/resources/pe_colored/pe_colored.qrc index 4472f5e01..e95d65794 100644 --- a/launcher/resources/pe_colored/pe_colored.qrc +++ b/launcher/resources/pe_colored/pe_colored.qrc @@ -30,6 +30,7 @@ scalable/resourcepacks.svg scalable/screenshots.svg scalable/settings.svg + scalable/shaderpacks.svg scalable/status-bad.svg scalable/status-good.svg scalable/status-yellow.svg diff --git a/launcher/resources/pe_colored/scalable/shaderpacks.svg b/launcher/resources/pe_colored/scalable/shaderpacks.svg new file mode 100644 index 000000000..9400b9335 --- /dev/null +++ b/launcher/resources/pe_colored/scalable/shaderpacks.svg @@ -0,0 +1,83 @@ + +image/svg+xml + + + + + +