feat(RD): add resource pack downloader
Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
@ -25,6 +25,7 @@
|
||||
#include "ResourceDownloadTask.h"
|
||||
|
||||
#include "minecraft/mod/ModFolderModel.h"
|
||||
#include "minecraft/mod/ResourcePackFolderModel.h"
|
||||
|
||||
#include "ui/dialogs/ReviewMessageBox.h"
|
||||
|
||||
@ -229,4 +230,30 @@ QList<BasePage*> ModDownloadDialog::getPages()
|
||||
return pages;
|
||||
}
|
||||
|
||||
|
||||
ResourcePackDownloadDialog::ResourcePackDownloadDialog(QWidget* parent,
|
||||
const std::shared_ptr<ResourcePackFolderModel>& 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*> ResourcePackDownloadDialog::getPages()
|
||||
{
|
||||
QList<BasePage*> pages;
|
||||
|
||||
pages.append(ModrinthResourcePackPage::create(this, *m_instance));
|
||||
if (APPLICATION->capabilities() & Application::SupportsFlame)
|
||||
pages.append(FlameResourcePackPage::create(this, *m_instance));
|
||||
|
||||
return pages;
|
||||
}
|
||||
|
||||
} // namespace ResourceDownload
|
||||
|
@ -35,6 +35,7 @@ class QVBoxLayout;
|
||||
class QDialogButtonBox;
|
||||
class ResourceDownloadTask;
|
||||
class ResourceFolderModel;
|
||||
class ResourcePackFolderModel;
|
||||
|
||||
namespace ResourceDownload {
|
||||
|
||||
@ -108,4 +109,23 @@ class ModDownloadDialog final : public ResourceDownloadDialog {
|
||||
BaseInstance* m_instance;
|
||||
};
|
||||
|
||||
class ResourcePackDownloadDialog final : public ResourceDownloadDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ResourcePackDownloadDialog(QWidget* parent,
|
||||
const std::shared_ptr<ResourcePackFolderModel>& resource_packs,
|
||||
BaseInstance* instance);
|
||||
~ResourcePackDownloadDialog() override = default;
|
||||
|
||||
//: String that gets appended to the resource pack download dialog title ("Download " + resourcesString())
|
||||
[[nodiscard]] QString resourcesString() const override { return tr("resource packs"); }
|
||||
[[nodiscard]] QString geometrySaveKey() const override { return "RPDownloadGeometry"; }
|
||||
|
||||
QList<BasePage*> getPages() override;
|
||||
|
||||
private:
|
||||
BaseInstance* m_instance;
|
||||
};
|
||||
|
||||
} // namespace ResourceDownload
|
||||
|
Reference in New Issue
Block a user