diff options
author | flow <flowlnlnln@gmail.com> | 2022-12-30 14:06:07 -0300 |
---|---|---|
committer | flow <flowlnlnln@gmail.com> | 2023-02-05 17:02:56 -0300 |
commit | b724607e31d102c50cb42225b4a31f2932b2eb61 (patch) | |
tree | f0423b42963792de93716d20815f1cf792962629 /launcher/ui/dialogs | |
parent | c3ea303a3742c886aae9e05d2e5f5fbb497260a1 (diff) | |
download | PrismLauncher-b724607e31d102c50cb42225b4a31f2932b2eb61.tar.gz PrismLauncher-b724607e31d102c50cb42225b4a31f2932b2eb61.tar.bz2 PrismLauncher-b724607e31d102c50cb42225b4a31f2932b2eb61.zip |
feat(RD): add shader pack downloader
Signed-off-by: flow <flowlnlnln@gmail.com>
Diffstat (limited to 'launcher/ui/dialogs')
-rw-r--r-- | launcher/ui/dialogs/ResourceDownloadDialog.cpp | 25 | ||||
-rw-r--r-- | launcher/ui/dialogs/ResourceDownloadDialog.h | 20 |
2 files changed, 45 insertions, 0 deletions
diff --git a/launcher/ui/dialogs/ResourceDownloadDialog.cpp b/launcher/ui/dialogs/ResourceDownloadDialog.cpp index edcd642e..98a2eb88 100644 --- a/launcher/ui/dialogs/ResourceDownloadDialog.cpp +++ b/launcher/ui/dialogs/ResourceDownloadDialog.cpp @@ -26,6 +26,7 @@ #include "minecraft/mod/ModFolderModel.h" #include "minecraft/mod/ResourcePackFolderModel.h" +#include "minecraft/mod/ShaderPackFolderModel.h" #include "ui/dialogs/ReviewMessageBox.h" @@ -256,4 +257,28 @@ QList<BasePage*> ResourcePackDownloadDialog::getPages() return pages; } + +ShaderPackDownloadDialog::ShaderPackDownloadDialog(QWidget* parent, + const std::shared_ptr<ShaderPackFolderModel>& shaders, + BaseInstance* instance) + : ResourceDownloadDialog(parent, shaders), m_instance(instance) +{ + setWindowTitle(dialogTitle()); + + initializeContainer(); + connectButtons(); + + if (!geometrySaveKey().isEmpty()) + restoreGeometry(QByteArray::fromBase64(APPLICATION->settings()->get(geometrySaveKey()).toByteArray())); +} + +QList<BasePage*> ShaderPackDownloadDialog::getPages() +{ + QList<BasePage*> pages; + + pages.append(ModrinthShaderPackPage::create(this, *m_instance)); + + return pages; +} + } // namespace ResourceDownload diff --git a/launcher/ui/dialogs/ResourceDownloadDialog.h b/launcher/ui/dialogs/ResourceDownloadDialog.h index f534cccc..203bac66 100644 --- a/launcher/ui/dialogs/ResourceDownloadDialog.h +++ b/launcher/ui/dialogs/ResourceDownloadDialog.h @@ -36,6 +36,7 @@ class QDialogButtonBox; class ResourceDownloadTask; class ResourceFolderModel; class ResourcePackFolderModel; +class ShaderPackFolderModel; namespace ResourceDownload { @@ -128,4 +129,23 @@ class ResourcePackDownloadDialog final : public ResourceDownloadDialog { BaseInstance* m_instance; }; +class ShaderPackDownloadDialog final : public ResourceDownloadDialog { + Q_OBJECT + + public: + explicit ShaderPackDownloadDialog(QWidget* parent, + const std::shared_ptr<ShaderPackFolderModel>& shader_packs, + BaseInstance* instance); + ~ShaderPackDownloadDialog() override = default; + + //: String that gets appended to the shader pack download dialog title ("Download " + resourcesString()) + [[nodiscard]] QString resourcesString() const override { return tr("shader packs"); } + [[nodiscard]] QString geometrySaveKey() const override { return "ShaderDownloadGeometry"; } + + QList<BasePage*> getPages() override; + + private: + BaseInstance* m_instance; +}; + } // namespace ResourceDownload |