diff options
author | flow <flowlnlnln@gmail.com> | 2023-01-29 18:07:49 -0300 |
---|---|---|
committer | flow <flowlnlnln@gmail.com> | 2023-02-05 17:02:56 -0300 |
commit | ada5e88eb933a41691121316c78cd2e564965fa0 (patch) | |
tree | 05cbf24f0e42e2a673ac8fafcd04de434b9d1b0d /launcher/ui/dialogs | |
parent | b724607e31d102c50cb42225b4a31f2932b2eb61 (diff) | |
download | PrismLauncher-ada5e88eb933a41691121316c78cd2e564965fa0.tar.gz PrismLauncher-ada5e88eb933a41691121316c78cd2e564965fa0.tar.bz2 PrismLauncher-ada5e88eb933a41691121316c78cd2e564965fa0.zip |
feat(RD): add texture pack downloader
This extends the resource pack downloader, with the custom behavior of
filtering the versions that shows up, to those <= 1.6. As always, Flame
is funky and requires a bit more workarounds than average.
This will also get a nice improvement when the Version parsing and
comparison PR gets merged! :D
Signed-off-by: flow <flowlnlnln@gmail.com>
Diffstat (limited to 'launcher/ui/dialogs')
-rw-r--r-- | launcher/ui/dialogs/ResourceDownloadDialog.cpp | 27 | ||||
-rw-r--r-- | launcher/ui/dialogs/ResourceDownloadDialog.h | 20 |
2 files changed, 47 insertions, 0 deletions
diff --git a/launcher/ui/dialogs/ResourceDownloadDialog.cpp b/launcher/ui/dialogs/ResourceDownloadDialog.cpp index 98a2eb88..edb7d063 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/TexturePackFolderModel.h" #include "minecraft/mod/ShaderPackFolderModel.h" #include "ui/dialogs/ReviewMessageBox.h" @@ -258,6 +259,32 @@ QList<BasePage*> ResourcePackDownloadDialog::getPages() } +TexturePackDownloadDialog::TexturePackDownloadDialog(QWidget* parent, + const std::shared_ptr<TexturePackFolderModel>& resource_packs, + BaseInstance* instance) + : ResourceDownloadDialog(parent, resource_packs), m_instance(instance) +{ + setWindowTitle(dialogTitle()); + + initializeContainer(); + connectButtons(); + + if (!geometrySaveKey().isEmpty()) + restoreGeometry(QByteArray::fromBase64(APPLICATION->settings()->get(geometrySaveKey()).toByteArray())); +} + +QList<BasePage*> TexturePackDownloadDialog::getPages() +{ + QList<BasePage*> pages; + + pages.append(ModrinthTexturePackPage::create(this, *m_instance)); + if (APPLICATION->capabilities() & Application::SupportsFlame) + pages.append(FlameTexturePackPage::create(this, *m_instance)); + + return pages; +} + + ShaderPackDownloadDialog::ShaderPackDownloadDialog(QWidget* parent, const std::shared_ptr<ShaderPackFolderModel>& shaders, BaseInstance* instance) diff --git a/launcher/ui/dialogs/ResourceDownloadDialog.h b/launcher/ui/dialogs/ResourceDownloadDialog.h index 203bac66..5678dc8b 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 TexturePackFolderModel; class ShaderPackFolderModel; namespace ResourceDownload { @@ -129,6 +130,25 @@ class ResourcePackDownloadDialog final : public ResourceDownloadDialog { BaseInstance* m_instance; }; +class TexturePackDownloadDialog final : public ResourceDownloadDialog { + Q_OBJECT + + public: + explicit TexturePackDownloadDialog(QWidget* parent, + const std::shared_ptr<TexturePackFolderModel>& resource_packs, + BaseInstance* instance); + ~TexturePackDownloadDialog() override = default; + + //: String that gets appended to the texture pack download dialog title ("Download " + resourcesString()) + [[nodiscard]] QString resourcesString() const override { return tr("texture packs"); } + [[nodiscard]] QString geometrySaveKey() const override { return "TPDownloadGeometry"; } + + QList<BasePage*> getPages() override; + + private: + BaseInstance* m_instance; +}; + class ShaderPackDownloadDialog final : public ResourceDownloadDialog { Q_OBJECT |