2023-01-23 19:33:55 +05:30
|
|
|
// SPDX-FileCopyrightText: 2023 flowln <flowlnlnln@gmail.com>
|
|
|
|
//
|
2022-05-15 16:50:05 +05:30
|
|
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
|
|
/*
|
|
|
|
* PolyMC - Minecraft Launcher
|
|
|
|
* Copyright (C) 2022 Sefa Eyeoglu <contact@scrumplex.net>
|
|
|
|
*
|
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, version 3.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2022-01-14 14:13:42 +05:30
|
|
|
#pragma once
|
|
|
|
|
2022-11-25 17:53:46 +05:30
|
|
|
#include "ui/pages/modplatform/ModModel.h"
|
2022-12-17 04:56:10 +05:30
|
|
|
#include "ui/pages/modplatform/ResourcePackModel.h"
|
2022-12-19 00:11:46 +05:30
|
|
|
#include "ui/pages/modplatform/modrinth/ModrinthResourcePages.h"
|
2022-11-25 17:53:46 +05:30
|
|
|
|
2022-12-17 03:33:52 +05:30
|
|
|
namespace ResourceDownload {
|
2022-11-25 17:53:46 +05:30
|
|
|
|
2022-12-17 03:33:52 +05:30
|
|
|
class ModrinthModModel : public ModModel {
|
2022-01-14 14:13:42 +05:30
|
|
|
Q_OBJECT
|
|
|
|
|
2022-03-03 05:47:10 +05:30
|
|
|
public:
|
2022-12-19 00:11:46 +05:30
|
|
|
ModrinthModModel(const BaseInstance&);
|
2022-12-17 03:33:52 +05:30
|
|
|
~ModrinthModModel() override = default;
|
2022-03-03 07:31:23 +05:30
|
|
|
|
|
|
|
private:
|
2022-12-19 00:11:46 +05:30
|
|
|
[[nodiscard]] QString debugName() const override { return Modrinth::debugName() + " (Model)"; }
|
|
|
|
[[nodiscard]] QString metaEntryBase() const override { return Modrinth::metaEntryBase(); }
|
|
|
|
|
2022-03-08 03:59:59 +05:30
|
|
|
void loadIndexedPack(ModPlatform::IndexedPack& m, QJsonObject& obj) override;
|
2022-05-24 18:08:48 +05:30
|
|
|
void loadExtraPackInfo(ModPlatform::IndexedPack& m, QJsonObject& obj) override;
|
2022-03-08 03:59:59 +05:30
|
|
|
void loadIndexedPackVersions(ModPlatform::IndexedPack& m, QJsonArray& arr) override;
|
2022-12-17 03:33:52 +05:30
|
|
|
|
2022-03-08 19:42:35 +05:30
|
|
|
auto documentToArray(QJsonDocument& obj) const -> QJsonArray override;
|
2022-01-14 14:13:42 +05:30
|
|
|
};
|
|
|
|
|
2022-12-17 04:56:10 +05:30
|
|
|
class ModrinthResourcePackModel : public ResourcePackResourceModel {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
ModrinthResourcePackModel(const BaseInstance&);
|
|
|
|
~ModrinthResourcePackModel() override = default;
|
|
|
|
|
|
|
|
private:
|
|
|
|
[[nodiscard]] QString debugName() const override { return Modrinth::debugName() + " (Model)"; }
|
|
|
|
[[nodiscard]] QString metaEntryBase() const override { return Modrinth::metaEntryBase(); }
|
|
|
|
|
|
|
|
void loadIndexedPack(ModPlatform::IndexedPack& m, QJsonObject& obj) override;
|
|
|
|
void loadExtraPackInfo(ModPlatform::IndexedPack& m, QJsonObject& obj) override;
|
|
|
|
void loadIndexedPackVersions(ModPlatform::IndexedPack& m, QJsonArray& arr) override;
|
|
|
|
|
|
|
|
auto documentToArray(QJsonDocument& obj) const -> QJsonArray override;
|
|
|
|
};
|
|
|
|
|
2022-12-30 22:36:07 +05:30
|
|
|
class ModrinthShaderPackModel : public ShaderPackResourceModel {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
ModrinthShaderPackModel(const BaseInstance&);
|
|
|
|
~ModrinthShaderPackModel() override = default;
|
|
|
|
|
|
|
|
private:
|
|
|
|
[[nodiscard]] QString debugName() const override { return Modrinth::debugName() + " (Model)"; }
|
|
|
|
[[nodiscard]] QString metaEntryBase() const override { return Modrinth::metaEntryBase(); }
|
|
|
|
|
|
|
|
void loadIndexedPack(ModPlatform::IndexedPack& m, QJsonObject& obj) override;
|
|
|
|
void loadExtraPackInfo(ModPlatform::IndexedPack& m, QJsonObject& obj) override;
|
|
|
|
void loadIndexedPackVersions(ModPlatform::IndexedPack& m, QJsonArray& arr) override;
|
|
|
|
|
|
|
|
auto documentToArray(QJsonDocument& obj) const -> QJsonArray override;
|
|
|
|
};
|
|
|
|
|
2022-12-17 03:33:52 +05:30
|
|
|
} // namespace ResourceDownload
|