2022-08-10 18:48:34 +01:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "ResourceFolderModel.h"
|
2023-09-25 20:33:36 +01:00
|
|
|
#include "minecraft/mod/ShaderPack.h"
|
|
|
|
#include "minecraft/mod/tasks/BasicFolderLoadTask.h"
|
|
|
|
#include "minecraft/mod/tasks/LocalShaderPackParseTask.h"
|
2022-08-10 18:48:34 +01:00
|
|
|
|
|
|
|
class ShaderPackFolderModel : public ResourceFolderModel {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
2023-08-02 17:35:35 +01:00
|
|
|
explicit ShaderPackFolderModel(const QString& dir, BaseInstance* instance) : ResourceFolderModel(QDir(dir), instance) {}
|
|
|
|
|
2023-05-25 04:15:34 +01:00
|
|
|
virtual QString id() const override { return "shaderpacks"; }
|
2023-09-25 20:33:36 +01:00
|
|
|
|
|
|
|
[[nodiscard]] Task* createUpdateTask() override
|
|
|
|
{
|
|
|
|
return new BasicFolderLoadTask(m_dir, [](QFileInfo const& entry) { return makeShared<ShaderPack>(entry); });
|
|
|
|
}
|
|
|
|
|
|
|
|
[[nodiscard]] Task* createParseTask(Resource& resource) override
|
|
|
|
{
|
|
|
|
return new LocalShaderPackParseTask(m_next_resolution_ticket, static_cast<ShaderPack&>(resource));
|
|
|
|
}
|
2022-08-10 18:48:34 +01:00
|
|
|
};
|