2023-01-29 23:40:55 +00:00
|
|
|
// SPDX-FileCopyrightText: 2023 flowln <flowlnlnln@gmail.com>
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
|
2022-12-30 17:06:07 +00:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ui/pages/modplatform/ResourcePage.h"
|
|
|
|
#include "ui/pages/modplatform/ShaderPackModel.h"
|
|
|
|
|
|
|
|
namespace Ui {
|
|
|
|
class ResourcePage;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace ResourceDownload {
|
|
|
|
|
|
|
|
class ShaderPackDownloadDialog;
|
|
|
|
|
|
|
|
class ShaderPackResourcePage : public ResourcePage {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
template <typename T>
|
|
|
|
static T* create(ShaderPackDownloadDialog* dialog, BaseInstance& instance)
|
|
|
|
{
|
|
|
|
auto page = new T(dialog, instance);
|
|
|
|
auto model = static_cast<ShaderPackResourceModel*>(page->getModel());
|
|
|
|
|
|
|
|
connect(model, &ResourceModel::versionListUpdated, page, &ResourcePage::updateVersionList);
|
|
|
|
connect(model, &ResourceModel::projectInfoUpdated, page, &ResourcePage::updateUi);
|
|
|
|
|
|
|
|
return page;
|
|
|
|
}
|
|
|
|
|
|
|
|
//: The plural version of 'shader pack'
|
|
|
|
[[nodiscard]] inline QString resourcesString() const override { return tr("shader packs"); }
|
|
|
|
//: The singular version of 'shader packs'
|
|
|
|
[[nodiscard]] inline QString resourceString() const override { return tr("shader pack"); }
|
|
|
|
|
|
|
|
[[nodiscard]] bool supportsFiltering() const override { return false; };
|
|
|
|
|
2023-05-28 15:44:23 +01:00
|
|
|
void addResourceToPage(ModPlatform::IndexedPack::Ptr,
|
|
|
|
ModPlatform::IndexedVersion&,
|
|
|
|
const std::shared_ptr<ResourceFolderModel>) override;
|
2022-12-30 17:06:07 +00:00
|
|
|
|
|
|
|
[[nodiscard]] QMap<QString, QString> urlHandlers() const override;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
ShaderPackResourcePage(ShaderPackDownloadDialog* dialog, BaseInstance& instance);
|
|
|
|
|
|
|
|
protected slots:
|
|
|
|
void triggerSearch() override;
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace ResourceDownload
|