Small cleanup
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
63c4469475
commit
ffaa47bf54
@ -51,6 +51,4 @@ class Metadata {
|
|||||||
static auto get(QDir& index_dir, QString mod_slug) -> ModStruct { return Packwiz::V1::getIndexForMod(index_dir, mod_slug); }
|
static auto get(QDir& index_dir, QString mod_slug) -> ModStruct { return Packwiz::V1::getIndexForMod(index_dir, mod_slug); }
|
||||||
|
|
||||||
static auto get(QDir& index_dir, QVariant& mod_id) -> ModStruct { return Packwiz::V1::getIndexForMod(index_dir, mod_id); }
|
static auto get(QDir& index_dir, QVariant& mod_id) -> ModStruct { return Packwiz::V1::getIndexForMod(index_dir, mod_id); }
|
||||||
|
|
||||||
static auto getAll(QDir& index_dir) -> QList<ModStruct> { return Packwiz::V1::getAllMods(index_dir); }
|
|
||||||
};
|
};
|
||||||
|
@ -48,12 +48,15 @@ GetModDependenciesTask::GetModDependenciesTask(QObject* parent,
|
|||||||
BaseInstance* instance,
|
BaseInstance* instance,
|
||||||
ModFolderModel* folder,
|
ModFolderModel* folder,
|
||||||
QList<std::shared_ptr<PackDependecny>> selected)
|
QList<std::shared_ptr<PackDependecny>> selected)
|
||||||
: SequentialTask(parent, "Get dependencies"), m_selected(selected), m_version(mcVersions(instance)), m_loaderType(mcLoaders(instance))
|
: SequentialTask(parent, "Get dependencies")
|
||||||
|
, m_selected(selected)
|
||||||
|
, m_flame_provider{ ModPlatform::ResourceProvider::FLAME, std::make_shared<ResourceDownload::FlameModModel>(*instance),
|
||||||
|
std::make_shared<FlameAPI>() }
|
||||||
|
, m_modrinth_provider{ ModPlatform::ResourceProvider::MODRINTH, std::make_shared<ResourceDownload::ModrinthModModel>(*instance),
|
||||||
|
std::make_shared<ModrinthAPI>() }
|
||||||
|
, m_version(mcVersions(instance))
|
||||||
|
, m_loaderType(mcLoaders(instance))
|
||||||
{
|
{
|
||||||
m_providers.append(Provider{ ModPlatform::ResourceProvider::FLAME, std::make_shared<ResourceDownload::FlameModModel>(*instance),
|
|
||||||
std::make_shared<FlameAPI>() });
|
|
||||||
m_providers.append(Provider{ ModPlatform::ResourceProvider::MODRINTH, std::make_shared<ResourceDownload::ModrinthModModel>(*instance),
|
|
||||||
std::make_shared<ModrinthAPI>() });
|
|
||||||
for (auto mod : folder->allMods())
|
for (auto mod : folder->allMods())
|
||||||
m_mods.append(mod->metadata());
|
m_mods.append(mod->metadata());
|
||||||
prepare();
|
prepare();
|
||||||
@ -104,17 +107,12 @@ Task::Ptr GetModDependenciesTask::prepareDependencyTask(const ModPlatform::Depen
|
|||||||
pDep->dependency = dep;
|
pDep->dependency = dep;
|
||||||
pDep->pack = { dep.addonId, providerName };
|
pDep->pack = { dep.addonId, providerName };
|
||||||
m_pack_dependencies.append(pDep);
|
m_pack_dependencies.append(pDep);
|
||||||
auto provider =
|
auto provider = providerName == m_flame_provider.name ? m_flame_provider : m_modrinth_provider;
|
||||||
std::find_if(m_providers.begin(), m_providers.end(), [providerName](const Provider& p) { return p.name == providerName; });
|
|
||||||
// if (provider == m_providers.end()) {
|
|
||||||
// qWarning() << "Unsuported provider for dependency check";
|
|
||||||
// return nullptr;
|
|
||||||
// }
|
|
||||||
|
|
||||||
auto tasks = makeShared<SequentialTask>(this, QString("DependencyInfo: %1").arg(dep.addonId.toString()));
|
auto tasks = makeShared<SequentialTask>(this, QString("DependencyInfo: %1").arg(dep.addonId.toString()));
|
||||||
|
|
||||||
auto responseInfo = new QByteArray();
|
auto responseInfo = new QByteArray();
|
||||||
auto info = provider->api->getProject(dep.addonId.toString(), responseInfo);
|
auto info = provider.api->getProject(dep.addonId.toString(), responseInfo);
|
||||||
QObject::connect(info.get(), &NetJob::succeeded, [responseInfo, provider, pDep] {
|
QObject::connect(info.get(), &NetJob::succeeded, [responseInfo, provider, pDep] {
|
||||||
QJsonParseError parse_error{};
|
QJsonParseError parse_error{};
|
||||||
QJsonDocument doc = QJsonDocument::fromJson(*responseInfo, &parse_error);
|
QJsonDocument doc = QJsonDocument::fromJson(*responseInfo, &parse_error);
|
||||||
@ -125,9 +123,9 @@ Task::Ptr GetModDependenciesTask::prepareDependencyTask(const ModPlatform::Depen
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
auto obj = provider->name == ModPlatform::ResourceProvider::FLAME ? Json::requireObject(Json::requireObject(doc), "data")
|
auto obj = provider.name == ModPlatform::ResourceProvider::FLAME ? Json::requireObject(Json::requireObject(doc), "data")
|
||||||
: Json::requireObject(doc);
|
: Json::requireObject(doc);
|
||||||
provider->mod->loadIndexedPack(pDep->pack, obj);
|
provider.mod->loadIndexedPack(pDep->pack, obj);
|
||||||
} catch (const JSONValidationError& e) {
|
} catch (const JSONValidationError& e) {
|
||||||
qDebug() << doc;
|
qDebug() << doc;
|
||||||
qWarning() << "Error while reading mod info: " << e.cause();
|
qWarning() << "Error while reading mod info: " << e.cause();
|
||||||
@ -146,7 +144,7 @@ Task::Ptr GetModDependenciesTask::prepareDependencyTask(const ModPlatform::Depen
|
|||||||
} else {
|
} else {
|
||||||
arr = doc.isObject() ? Json::ensureArray(doc.object(), "data") : doc.array();
|
arr = doc.isObject() ? Json::ensureArray(doc.object(), "data") : doc.array();
|
||||||
}
|
}
|
||||||
pDep->version = provider->mod->loadDependencyVersions(dep, arr);
|
pDep->version = provider.mod->loadDependencyVersions(dep, arr);
|
||||||
if (!pDep->version.addonId.isValid()) {
|
if (!pDep->version.addonId.isValid()) {
|
||||||
qWarning() << "Error while reading mod version empty ";
|
qWarning() << "Error while reading mod version empty ";
|
||||||
qDebug() << doc;
|
qDebug() << doc;
|
||||||
@ -164,12 +162,12 @@ Task::Ptr GetModDependenciesTask::prepareDependencyTask(const ModPlatform::Depen
|
|||||||
qWarning() << "Dependency cycle exeeded";
|
qWarning() << "Dependency cycle exeeded";
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (auto dep : getDependenciesForVersion(pDep->version, provider->name)) {
|
for (auto dep : getDependenciesForVersion(pDep->version, provider.name)) {
|
||||||
addTask(prepareDependencyTask(dep, provider->name, level - 1));
|
addTask(prepareDependencyTask(dep, provider.name, level - 1));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
auto version = provider->api->getDependencyVersion(std::move(args), std::move(callbacks));
|
auto version = provider.api->getDependencyVersion(std::move(args), std::move(callbacks));
|
||||||
tasks->addTask(version);
|
tasks->addTask(version);
|
||||||
return tasks;
|
return tasks;
|
||||||
};
|
};
|
||||||
|
@ -18,11 +18,10 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <qlist.h>
|
|
||||||
#include <qvariant.h>
|
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QEventLoop>
|
#include <QEventLoop>
|
||||||
#include <QList>
|
#include <QList>
|
||||||
|
#include <QVariant>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@ -74,7 +73,8 @@ class GetModDependenciesTask : public SequentialTask {
|
|||||||
QList<std::shared_ptr<PackDependecny>> m_pack_dependencies;
|
QList<std::shared_ptr<PackDependecny>> m_pack_dependencies;
|
||||||
QList<std::shared_ptr<Metadata::ModStruct>> m_mods;
|
QList<std::shared_ptr<Metadata::ModStruct>> m_mods;
|
||||||
QList<std::shared_ptr<PackDependecny>> m_selected;
|
QList<std::shared_ptr<PackDependecny>> m_selected;
|
||||||
QList<Provider> m_providers;
|
Provider m_flame_provider;
|
||||||
|
Provider m_modrinth_provider;
|
||||||
|
|
||||||
Version m_version;
|
Version m_version;
|
||||||
ResourceAPI::ModLoaderTypes m_loaderType;
|
ResourceAPI::ModLoaderTypes m_loaderType;
|
||||||
|
@ -21,8 +21,6 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <algorithm>
|
|
||||||
#include <iterator>
|
|
||||||
|
|
||||||
#include "FileSystem.h"
|
#include "FileSystem.h"
|
||||||
#include "StringUtils.h"
|
#include "StringUtils.h"
|
||||||
@ -313,13 +311,4 @@ auto V1::getIndexForMod(QDir& index_dir, QVariant& mod_id) -> Mod
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
auto V1::getAllMods(QDir& index_dir) -> QList<Mod>
|
|
||||||
{
|
|
||||||
auto files = index_dir.entryList(QDir::Filter::Files);
|
|
||||||
auto mods = QList<Mod>();
|
|
||||||
std::transform(files.begin(), files.end(), std::back_inserter(mods),
|
|
||||||
[&index_dir](auto file_name) { return getIndexForMod(index_dir, file_name); });
|
|
||||||
return mods;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace Packwiz
|
} // namespace Packwiz
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
// SPDX-License-Identifier: GPL-3.0-only
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
/*
|
/*
|
||||||
* PolyMC - Minecraft Launcher
|
* PolyMC - Minecraft Launcher
|
||||||
* Copyright (c) 2022 flowln <flowlnlnln@gmail.com>
|
* Copyright (c) 2022 flowln <flowlnlnln@gmail.com>
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
* the Free Software Foundation, version 3.
|
* the Free Software Foundation, version 3.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful,
|
* This program is distributed in the hope that it will be useful,
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU General Public License for more details.
|
* GNU General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
@ -36,22 +36,22 @@ auto getRealIndexName(QDir& index_dir, QString normalized_index_name, bool shoul
|
|||||||
class V1 {
|
class V1 {
|
||||||
public:
|
public:
|
||||||
struct Mod {
|
struct Mod {
|
||||||
QString slug{};
|
QString slug {};
|
||||||
QString name{};
|
QString name {};
|
||||||
QString filename{};
|
QString filename {};
|
||||||
// FIXME: make side an enum
|
// FIXME: make side an enum
|
||||||
QString side{ "both" };
|
QString side {"both"};
|
||||||
|
|
||||||
// [download]
|
// [download]
|
||||||
QString mode{};
|
QString mode {};
|
||||||
QUrl url{};
|
QUrl url {};
|
||||||
QString hash_format{};
|
QString hash_format {};
|
||||||
QString hash{};
|
QString hash {};
|
||||||
|
|
||||||
// [update]
|
// [update]
|
||||||
ModPlatform::ResourceProvider provider{};
|
ModPlatform::ResourceProvider provider {};
|
||||||
QVariant file_id{};
|
QVariant file_id {};
|
||||||
QVariant project_id{};
|
QVariant project_id {};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// This is a totally heuristic, but should work for now.
|
// This is a totally heuristic, but should work for now.
|
||||||
@ -93,9 +93,6 @@ class V1 {
|
|||||||
* If the mod doesn't have a metadata, it simply returns an empty Mod object.
|
* If the mod doesn't have a metadata, it simply returns an empty Mod object.
|
||||||
* */
|
* */
|
||||||
static auto getIndexForMod(QDir& index_dir, QVariant& mod_id) -> Mod;
|
static auto getIndexForMod(QDir& index_dir, QVariant& mod_id) -> Mod;
|
||||||
|
|
||||||
/* Gets the metadata for all the mods */
|
|
||||||
static auto getAllMods(QDir& index_dir) -> QList<Mod>;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Packwiz
|
} // namespace Packwiz
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "QObjectPtr.h"
|
|
||||||
#include "ResourceDownloadTask.h"
|
#include "ResourceDownloadTask.h"
|
||||||
|
|
||||||
#include "minecraft/mod/ModFolderModel.h"
|
#include "minecraft/mod/ModFolderModel.h"
|
||||||
|
@ -27,7 +27,6 @@
|
|||||||
#include "QObjectPtr.h"
|
#include "QObjectPtr.h"
|
||||||
#include "minecraft/mod/tasks/GetModDependenciesTask.h"
|
#include "minecraft/mod/tasks/GetModDependenciesTask.h"
|
||||||
#include "modplatform/ModIndex.h"
|
#include "modplatform/ModIndex.h"
|
||||||
#include "tasks/Task.h"
|
|
||||||
#include "ui/pages/BasePageProvider.h"
|
#include "ui/pages/BasePageProvider.h"
|
||||||
|
|
||||||
class BaseInstance;
|
class BaseInstance;
|
||||||
|
@ -49,20 +49,6 @@ ResourceAPI::VersionSearchArgs ModModel::createVersionsArguments(QModelIndex& en
|
|||||||
return { pack, versions, profile->getModLoaders() };
|
return { pack, versions, profile->getModLoaders() };
|
||||||
}
|
}
|
||||||
|
|
||||||
ResourceAPI::DependencySearchArgs ModModel::createDependecyArguments(const ModPlatform::Dependency& dep)
|
|
||||||
{
|
|
||||||
auto profile = static_cast<MinecraftInstance const&>(m_base_instance).getPackProfile();
|
|
||||||
|
|
||||||
Q_ASSERT(profile);
|
|
||||||
Q_ASSERT(m_filter);
|
|
||||||
|
|
||||||
std::optional<std::list<Version>> versions{};
|
|
||||||
if (!m_filter->versions.empty())
|
|
||||||
versions = m_filter->versions;
|
|
||||||
|
|
||||||
return { dep, versions->front(), profile->getModLoaders().value() };
|
|
||||||
};
|
|
||||||
|
|
||||||
ResourceAPI::ProjectInfoArgs ModModel::createInfoArguments(QModelIndex& entry)
|
ResourceAPI::ProjectInfoArgs ModModel::createInfoArguments(QModelIndex& entry)
|
||||||
{
|
{
|
||||||
auto& pack = m_packs[entry.row()];
|
auto& pack = m_packs[entry.row()];
|
||||||
|
@ -32,7 +32,7 @@ class ModModel : public ResourceModel {
|
|||||||
void loadIndexedPack(ModPlatform::IndexedPack& m, QJsonObject& obj) override = 0;
|
void loadIndexedPack(ModPlatform::IndexedPack& m, QJsonObject& obj) override = 0;
|
||||||
void loadExtraPackInfo(ModPlatform::IndexedPack& m, QJsonObject& obj) override = 0;
|
void loadExtraPackInfo(ModPlatform::IndexedPack& m, QJsonObject& obj) override = 0;
|
||||||
void loadIndexedPackVersions(ModPlatform::IndexedPack& m, QJsonArray& arr) override = 0;
|
void loadIndexedPackVersions(ModPlatform::IndexedPack& m, QJsonArray& arr) override = 0;
|
||||||
ModPlatform::IndexedVersion loadDependencyVersions(const ModPlatform::Dependency& m, QJsonArray& arr) override = 0;
|
virtual ModPlatform::IndexedVersion loadDependencyVersions(const ModPlatform::Dependency& m, QJsonArray& arr) = 0;
|
||||||
|
|
||||||
void setFilter(std::shared_ptr<ModFilterWidget::Filter> filter) { m_filter = filter; }
|
void setFilter(std::shared_ptr<ModFilterWidget::Filter> filter) { m_filter = filter; }
|
||||||
|
|
||||||
@ -40,7 +40,6 @@ class ModModel : public ResourceModel {
|
|||||||
ResourceAPI::SearchArgs createSearchArguments() override;
|
ResourceAPI::SearchArgs createSearchArguments() override;
|
||||||
ResourceAPI::VersionSearchArgs createVersionsArguments(QModelIndex&) override;
|
ResourceAPI::VersionSearchArgs createVersionsArguments(QModelIndex&) override;
|
||||||
ResourceAPI::ProjectInfoArgs createInfoArguments(QModelIndex&) override;
|
ResourceAPI::ProjectInfoArgs createInfoArguments(QModelIndex&) override;
|
||||||
ResourceAPI::DependencySearchArgs createDependecyArguments(const ModPlatform::Dependency&) override;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
auto documentToArray(QJsonDocument& obj) const -> QJsonArray override = 0;
|
auto documentToArray(QJsonDocument& obj) const -> QJsonArray override = 0;
|
||||||
|
@ -324,11 +324,6 @@ void ResourceModel::loadIndexedPackVersions(ModPlatform::IndexedPack&, QJsonArra
|
|||||||
{
|
{
|
||||||
NEED_FOR_CALLBACK_ASSERT("loadIndexedPackVersions");
|
NEED_FOR_CALLBACK_ASSERT("loadIndexedPackVersions");
|
||||||
}
|
}
|
||||||
ModPlatform::IndexedVersion ResourceModel::loadDependencyVersions(const ModPlatform::Dependency& m, QJsonArray& arr)
|
|
||||||
{
|
|
||||||
NEED_FOR_CALLBACK_ASSERT("loadDependencyVersions");
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Default callbacks */
|
/* Default callbacks */
|
||||||
|
|
||||||
|
@ -70,9 +70,6 @@ class ResourceModel : public QAbstractListModel {
|
|||||||
virtual ResourceAPI::ProjectInfoArgs createInfoArguments(QModelIndex&) = 0;
|
virtual ResourceAPI::ProjectInfoArgs createInfoArguments(QModelIndex&) = 0;
|
||||||
virtual ResourceAPI::ProjectInfoCallbacks createInfoCallbacks(QModelIndex&) { return {}; }
|
virtual ResourceAPI::ProjectInfoCallbacks createInfoCallbacks(QModelIndex&) { return {}; }
|
||||||
|
|
||||||
virtual ResourceAPI::DependencySearchArgs createDependecyArguments(const ModPlatform::Dependency&) { return {}; };
|
|
||||||
virtual ResourceAPI::DependencySearchCallbacks createDependecyCallbacks() { return {}; }
|
|
||||||
|
|
||||||
/** Requests the API for more entries. */
|
/** Requests the API for more entries. */
|
||||||
virtual void search();
|
virtual void search();
|
||||||
|
|
||||||
@ -109,7 +106,6 @@ class ResourceModel : public QAbstractListModel {
|
|||||||
virtual void loadIndexedPack(ModPlatform::IndexedPack&, QJsonObject&);
|
virtual void loadIndexedPack(ModPlatform::IndexedPack&, QJsonObject&);
|
||||||
virtual void loadExtraPackInfo(ModPlatform::IndexedPack&, QJsonObject&);
|
virtual void loadExtraPackInfo(ModPlatform::IndexedPack&, QJsonObject&);
|
||||||
virtual void loadIndexedPackVersions(ModPlatform::IndexedPack&, QJsonArray&);
|
virtual void loadIndexedPackVersions(ModPlatform::IndexedPack&, QJsonArray&);
|
||||||
virtual ModPlatform::IndexedVersion loadDependencyVersions(const ModPlatform::Dependency& m, QJsonArray& arr);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/* Basic search parameters */
|
/* Basic search parameters */
|
||||||
|
@ -28,7 +28,6 @@ class ResourcePackResourceModel : public ResourceModel {
|
|||||||
void loadIndexedPack(ModPlatform::IndexedPack&, QJsonObject&) override = 0;
|
void loadIndexedPack(ModPlatform::IndexedPack&, QJsonObject&) override = 0;
|
||||||
void loadExtraPackInfo(ModPlatform::IndexedPack&, QJsonObject&) override = 0;
|
void loadExtraPackInfo(ModPlatform::IndexedPack&, QJsonObject&) override = 0;
|
||||||
void loadIndexedPackVersions(ModPlatform::IndexedPack&, QJsonArray&) override = 0;
|
void loadIndexedPackVersions(ModPlatform::IndexedPack&, QJsonArray&) override = 0;
|
||||||
ModPlatform::IndexedVersion loadDependencyVersions(const ModPlatform::Dependency& m, QJsonArray& arr) override = 0;
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
ResourceAPI::SearchArgs createSearchArguments() override;
|
ResourceAPI::SearchArgs createSearchArguments() override;
|
||||||
|
@ -43,6 +43,9 @@
|
|||||||
#include <QKeyEvent>
|
#include <QKeyEvent>
|
||||||
|
|
||||||
#include "Markdown.h"
|
#include "Markdown.h"
|
||||||
|
#include "ResourceDownloadTask.h"
|
||||||
|
|
||||||
|
#include "minecraft/MinecraftInstance.h"
|
||||||
|
|
||||||
#include "ui/dialogs/ResourceDownloadDialog.h"
|
#include "ui/dialogs/ResourceDownloadDialog.h"
|
||||||
#include "ui/pages/modplatform/ResourceModel.h"
|
#include "ui/pages/modplatform/ResourceModel.h"
|
||||||
|
@ -4,11 +4,11 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <QDir>
|
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
#include "modplatform/ModIndex.h"
|
#include "modplatform/ModIndex.h"
|
||||||
|
#include "modplatform/ResourceAPI.h"
|
||||||
|
|
||||||
#include "ui/pages/BasePage.h"
|
#include "ui/pages/BasePage.h"
|
||||||
#include "ui/widgets/ProgressWidget.h"
|
#include "ui/widgets/ProgressWidget.h"
|
||||||
|
@ -28,7 +28,6 @@ class ShaderPackResourceModel : public ResourceModel {
|
|||||||
void loadIndexedPack(ModPlatform::IndexedPack&, QJsonObject&) override = 0;
|
void loadIndexedPack(ModPlatform::IndexedPack&, QJsonObject&) override = 0;
|
||||||
void loadExtraPackInfo(ModPlatform::IndexedPack&, QJsonObject&) override = 0;
|
void loadExtraPackInfo(ModPlatform::IndexedPack&, QJsonObject&) override = 0;
|
||||||
void loadIndexedPackVersions(ModPlatform::IndexedPack&, QJsonArray&) override = 0;
|
void loadIndexedPackVersions(ModPlatform::IndexedPack&, QJsonArray&) override = 0;
|
||||||
ModPlatform::IndexedVersion loadDependencyVersions(const ModPlatform::Dependency& m, QJsonArray& arr) override = 0;
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
ResourceAPI::SearchArgs createSearchArguments() override;
|
ResourceAPI::SearchArgs createSearchArguments() override;
|
||||||
|
@ -57,11 +57,6 @@ void FlameResourcePackModel::loadIndexedPackVersions(ModPlatform::IndexedPack& m
|
|||||||
FlameMod::loadIndexedPackVersions(m, arr, APPLICATION->network(), &m_base_instance);
|
FlameMod::loadIndexedPackVersions(m, arr, APPLICATION->network(), &m_base_instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto FlameResourcePackModel::loadDependencyVersions(const ModPlatform::Dependency& m, QJsonArray& arr) -> ModPlatform::IndexedVersion
|
|
||||||
{
|
|
||||||
return FlameMod::loadDependencyVersions(m, arr);
|
|
||||||
};
|
|
||||||
|
|
||||||
auto FlameResourcePackModel::documentToArray(QJsonDocument& obj) const -> QJsonArray
|
auto FlameResourcePackModel::documentToArray(QJsonDocument& obj) const -> QJsonArray
|
||||||
{
|
{
|
||||||
return Json::ensureArray(obj.object(), "data");
|
return Json::ensureArray(obj.object(), "data");
|
||||||
@ -98,11 +93,6 @@ void FlameTexturePackModel::loadIndexedPackVersions(ModPlatform::IndexedPack& m,
|
|||||||
m.versions = filtered_versions;
|
m.versions = filtered_versions;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto FlameTexturePackModel::loadDependencyVersions(const ModPlatform::Dependency& m, QJsonArray& arr) -> ModPlatform::IndexedVersion
|
|
||||||
{
|
|
||||||
return FlameMod::loadDependencyVersions(m, arr);
|
|
||||||
};
|
|
||||||
|
|
||||||
ResourceAPI::SearchArgs FlameTexturePackModel::createSearchArguments()
|
ResourceAPI::SearchArgs FlameTexturePackModel::createSearchArguments()
|
||||||
{
|
{
|
||||||
auto args = TexturePackResourceModel::createSearchArguments();
|
auto args = TexturePackResourceModel::createSearchArguments();
|
||||||
|
@ -43,7 +43,6 @@ class FlameResourcePackModel : public ResourcePackResourceModel {
|
|||||||
void loadIndexedPack(ModPlatform::IndexedPack& m, QJsonObject& obj) override;
|
void loadIndexedPack(ModPlatform::IndexedPack& m, QJsonObject& obj) override;
|
||||||
void loadExtraPackInfo(ModPlatform::IndexedPack& m, QJsonObject& obj) override;
|
void loadExtraPackInfo(ModPlatform::IndexedPack& m, QJsonObject& obj) override;
|
||||||
void loadIndexedPackVersions(ModPlatform::IndexedPack& m, QJsonArray& arr) override;
|
void loadIndexedPackVersions(ModPlatform::IndexedPack& m, QJsonArray& arr) override;
|
||||||
auto loadDependencyVersions(const ModPlatform::Dependency& m, QJsonArray& arr) -> ModPlatform::IndexedVersion override;
|
|
||||||
|
|
||||||
auto documentToArray(QJsonDocument& obj) const -> QJsonArray override;
|
auto documentToArray(QJsonDocument& obj) const -> QJsonArray override;
|
||||||
};
|
};
|
||||||
@ -62,7 +61,6 @@ class FlameTexturePackModel : public TexturePackResourceModel {
|
|||||||
void loadIndexedPack(ModPlatform::IndexedPack& m, QJsonObject& obj) override;
|
void loadIndexedPack(ModPlatform::IndexedPack& m, QJsonObject& obj) override;
|
||||||
void loadExtraPackInfo(ModPlatform::IndexedPack& m, QJsonObject& obj) override;
|
void loadExtraPackInfo(ModPlatform::IndexedPack& m, QJsonObject& obj) override;
|
||||||
void loadIndexedPackVersions(ModPlatform::IndexedPack& m, QJsonArray& arr) override;
|
void loadIndexedPackVersions(ModPlatform::IndexedPack& m, QJsonArray& arr) override;
|
||||||
auto loadDependencyVersions(const ModPlatform::Dependency& m, QJsonArray& arr) -> ModPlatform::IndexedVersion override;
|
|
||||||
|
|
||||||
ResourceAPI::SearchArgs createSearchArguments() override;
|
ResourceAPI::SearchArgs createSearchArguments() override;
|
||||||
ResourceAPI::VersionSearchArgs createVersionsArguments(QModelIndex&) override;
|
ResourceAPI::VersionSearchArgs createVersionsArguments(QModelIndex&) override;
|
||||||
|
@ -69,11 +69,6 @@ void ModrinthResourcePackModel::loadIndexedPackVersions(ModPlatform::IndexedPack
|
|||||||
::Modrinth::loadIndexedPackVersions(m, arr, APPLICATION->network(), &m_base_instance);
|
::Modrinth::loadIndexedPackVersions(m, arr, APPLICATION->network(), &m_base_instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto ModrinthResourcePackModel::loadDependencyVersions(const ModPlatform::Dependency& m, QJsonArray& arr) -> ModPlatform::IndexedVersion
|
|
||||||
{
|
|
||||||
return ::Modrinth::loadDependencyVersions(m, arr);
|
|
||||||
};
|
|
||||||
|
|
||||||
auto ModrinthResourcePackModel::documentToArray(QJsonDocument& obj) const -> QJsonArray
|
auto ModrinthResourcePackModel::documentToArray(QJsonDocument& obj) const -> QJsonArray
|
||||||
{
|
{
|
||||||
return obj.object().value("hits").toArray();
|
return obj.object().value("hits").toArray();
|
||||||
@ -96,11 +91,6 @@ void ModrinthTexturePackModel::loadIndexedPackVersions(ModPlatform::IndexedPack&
|
|||||||
::Modrinth::loadIndexedPackVersions(m, arr, APPLICATION->network(), &m_base_instance);
|
::Modrinth::loadIndexedPackVersions(m, arr, APPLICATION->network(), &m_base_instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto ModrinthTexturePackModel::loadDependencyVersions(const ModPlatform::Dependency& m, QJsonArray& arr) -> ModPlatform::IndexedVersion
|
|
||||||
{
|
|
||||||
return ::Modrinth::loadDependencyVersions(m, arr);
|
|
||||||
};
|
|
||||||
|
|
||||||
auto ModrinthTexturePackModel::documentToArray(QJsonDocument& obj) const -> QJsonArray
|
auto ModrinthTexturePackModel::documentToArray(QJsonDocument& obj) const -> QJsonArray
|
||||||
{
|
{
|
||||||
return obj.object().value("hits").toArray();
|
return obj.object().value("hits").toArray();
|
||||||
@ -123,11 +113,6 @@ void ModrinthShaderPackModel::loadIndexedPackVersions(ModPlatform::IndexedPack&
|
|||||||
::Modrinth::loadIndexedPackVersions(m, arr, APPLICATION->network(), &m_base_instance);
|
::Modrinth::loadIndexedPackVersions(m, arr, APPLICATION->network(), &m_base_instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto ModrinthShaderPackModel::loadDependencyVersions(const ModPlatform::Dependency& m, QJsonArray& arr) -> ModPlatform::IndexedVersion
|
|
||||||
{
|
|
||||||
return ::Modrinth::loadDependencyVersions(m, arr);
|
|
||||||
};
|
|
||||||
|
|
||||||
auto ModrinthShaderPackModel::documentToArray(QJsonDocument& obj) const -> QJsonArray
|
auto ModrinthShaderPackModel::documentToArray(QJsonDocument& obj) const -> QJsonArray
|
||||||
{
|
{
|
||||||
return obj.object().value("hits").toArray();
|
return obj.object().value("hits").toArray();
|
||||||
|
@ -59,7 +59,6 @@ class ModrinthResourcePackModel : public ResourcePackResourceModel {
|
|||||||
void loadIndexedPack(ModPlatform::IndexedPack& m, QJsonObject& obj) override;
|
void loadIndexedPack(ModPlatform::IndexedPack& m, QJsonObject& obj) override;
|
||||||
void loadExtraPackInfo(ModPlatform::IndexedPack& m, QJsonObject& obj) override;
|
void loadExtraPackInfo(ModPlatform::IndexedPack& m, QJsonObject& obj) override;
|
||||||
void loadIndexedPackVersions(ModPlatform::IndexedPack& m, QJsonArray& arr) override;
|
void loadIndexedPackVersions(ModPlatform::IndexedPack& m, QJsonArray& arr) override;
|
||||||
auto loadDependencyVersions(const ModPlatform::Dependency& m, QJsonArray& arr) -> ModPlatform::IndexedVersion override;
|
|
||||||
|
|
||||||
auto documentToArray(QJsonDocument& obj) const -> QJsonArray override;
|
auto documentToArray(QJsonDocument& obj) const -> QJsonArray override;
|
||||||
};
|
};
|
||||||
@ -78,7 +77,6 @@ class ModrinthTexturePackModel : public TexturePackResourceModel {
|
|||||||
void loadIndexedPack(ModPlatform::IndexedPack& m, QJsonObject& obj) override;
|
void loadIndexedPack(ModPlatform::IndexedPack& m, QJsonObject& obj) override;
|
||||||
void loadExtraPackInfo(ModPlatform::IndexedPack& m, QJsonObject& obj) override;
|
void loadExtraPackInfo(ModPlatform::IndexedPack& m, QJsonObject& obj) override;
|
||||||
void loadIndexedPackVersions(ModPlatform::IndexedPack& m, QJsonArray& arr) override;
|
void loadIndexedPackVersions(ModPlatform::IndexedPack& m, QJsonArray& arr) override;
|
||||||
auto loadDependencyVersions(const ModPlatform::Dependency& m, QJsonArray& arr) -> ModPlatform::IndexedVersion override;
|
|
||||||
|
|
||||||
auto documentToArray(QJsonDocument& obj) const -> QJsonArray override;
|
auto documentToArray(QJsonDocument& obj) const -> QJsonArray override;
|
||||||
};
|
};
|
||||||
@ -97,7 +95,6 @@ class ModrinthShaderPackModel : public ShaderPackResourceModel {
|
|||||||
void loadIndexedPack(ModPlatform::IndexedPack& m, QJsonObject& obj) override;
|
void loadIndexedPack(ModPlatform::IndexedPack& m, QJsonObject& obj) override;
|
||||||
void loadExtraPackInfo(ModPlatform::IndexedPack& m, QJsonObject& obj) override;
|
void loadExtraPackInfo(ModPlatform::IndexedPack& m, QJsonObject& obj) override;
|
||||||
void loadIndexedPackVersions(ModPlatform::IndexedPack& m, QJsonArray& arr) override;
|
void loadIndexedPackVersions(ModPlatform::IndexedPack& m, QJsonArray& arr) override;
|
||||||
auto loadDependencyVersions(const ModPlatform::Dependency& m, QJsonArray& arr) -> ModPlatform::IndexedVersion override;
|
|
||||||
|
|
||||||
auto documentToArray(QJsonDocument& obj) const -> QJsonArray override;
|
auto documentToArray(QJsonDocument& obj) const -> QJsonArray override;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user