mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2025-08-03 11:27:33 -04:00
make universal resource type (#3541)
This commit is contained in:
commit
078de50951
@ -494,6 +494,8 @@ set(META_SOURCES
|
||||
set(API_SOURCES
|
||||
modplatform/ModIndex.h
|
||||
modplatform/ModIndex.cpp
|
||||
modplatform/ResourceType.h
|
||||
modplatform/ResourceType.cpp
|
||||
|
||||
modplatform/ResourceAPI.h
|
||||
|
||||
|
@ -28,50 +28,38 @@
|
||||
#include "LocalShaderPackParseTask.h"
|
||||
#include "LocalTexturePackParseTask.h"
|
||||
#include "LocalWorldSaveParseTask.h"
|
||||
|
||||
static const QMap<PackedResourceType, QString> s_packed_type_names = { { PackedResourceType::ResourcePack, QObject::tr("resource pack") },
|
||||
{ PackedResourceType::TexturePack, QObject::tr("texture pack") },
|
||||
{ PackedResourceType::DataPack, QObject::tr("data pack") },
|
||||
{ PackedResourceType::ShaderPack, QObject::tr("shader pack") },
|
||||
{ PackedResourceType::WorldSave, QObject::tr("world save") },
|
||||
{ PackedResourceType::Mod, QObject::tr("mod") },
|
||||
{ PackedResourceType::UNKNOWN, QObject::tr("unknown") } };
|
||||
#include "modplatform/ResourceType.h"
|
||||
|
||||
namespace ResourceUtils {
|
||||
PackedResourceType identify(QFileInfo file)
|
||||
ModPlatform::ResourceType identify(QFileInfo file)
|
||||
{
|
||||
if (file.exists() && file.isFile()) {
|
||||
if (ModUtils::validate(file)) {
|
||||
// mods can contain resource and data packs so they must be tested first
|
||||
qDebug() << file.fileName() << "is a mod";
|
||||
return PackedResourceType::Mod;
|
||||
return ModPlatform::ResourceType::Mod;
|
||||
} else if (DataPackUtils::validateResourcePack(file)) {
|
||||
qDebug() << file.fileName() << "is a resource pack";
|
||||
return PackedResourceType::ResourcePack;
|
||||
return ModPlatform::ResourceType::ResourcePack;
|
||||
} else if (TexturePackUtils::validate(file)) {
|
||||
qDebug() << file.fileName() << "is a pre 1.6 texture pack";
|
||||
return PackedResourceType::TexturePack;
|
||||
return ModPlatform::ResourceType::TexturePack;
|
||||
} else if (DataPackUtils::validate(file)) {
|
||||
qDebug() << file.fileName() << "is a data pack";
|
||||
return PackedResourceType::DataPack;
|
||||
return ModPlatform::ResourceType::DataPack;
|
||||
} else if (WorldSaveUtils::validate(file)) {
|
||||
qDebug() << file.fileName() << "is a world save";
|
||||
return PackedResourceType::WorldSave;
|
||||
return ModPlatform::ResourceType::World;
|
||||
} else if (ShaderPackUtils::validate(file)) {
|
||||
qDebug() << file.fileName() << "is a shader pack";
|
||||
return PackedResourceType::ShaderPack;
|
||||
return ModPlatform::ResourceType::ShaderPack;
|
||||
} else {
|
||||
qDebug() << "Can't Identify" << file.fileName();
|
||||
}
|
||||
} else {
|
||||
qDebug() << "Can't find" << file.absolutePath();
|
||||
}
|
||||
return PackedResourceType::UNKNOWN;
|
||||
}
|
||||
|
||||
QString getPackedTypeName(PackedResourceType type)
|
||||
{
|
||||
return s_packed_type_names.constFind(type).value();
|
||||
return ModPlatform::ResourceType::Unknown;
|
||||
}
|
||||
|
||||
} // namespace ResourceUtils
|
||||
|
@ -21,17 +21,9 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <set>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QFileInfo>
|
||||
#include <QObject>
|
||||
#include "modplatform/ResourceType.h"
|
||||
|
||||
enum class PackedResourceType { DataPack, ResourcePack, TexturePack, ShaderPack, WorldSave, Mod, UNKNOWN };
|
||||
namespace ResourceUtils {
|
||||
static const std::set<PackedResourceType> ValidResourceTypes = { PackedResourceType::DataPack, PackedResourceType::ResourcePack,
|
||||
PackedResourceType::TexturePack, PackedResourceType::ShaderPack,
|
||||
PackedResourceType::WorldSave, PackedResourceType::Mod };
|
||||
PackedResourceType identify(QFileInfo file);
|
||||
QString getPackedTypeName(PackedResourceType type);
|
||||
ModPlatform::ResourceType identify(QFileInfo file);
|
||||
} // namespace ResourceUtils
|
||||
|
@ -45,8 +45,6 @@ QList<ModLoaderType> modLoaderTypesToList(ModLoaderTypes flags);
|
||||
|
||||
enum class ResourceProvider { MODRINTH, FLAME };
|
||||
|
||||
enum class ResourceType { MOD, RESOURCE_PACK, SHADER_PACK, MODPACK, DATA_PACK };
|
||||
|
||||
enum class DependencyType { REQUIRED, OPTIONAL, INCOMPATIBLE, EMBEDDED, TOOL, INCLUDE, UNKNOWN };
|
||||
|
||||
enum class Side { NoSide = 0, ClientSide = 1 << 0, ServerSide = 1 << 1, UniversalSide = ClientSide | ServerSide };
|
||||
|
@ -48,6 +48,7 @@
|
||||
#include "../Version.h"
|
||||
|
||||
#include "modplatform/ModIndex.h"
|
||||
#include "modplatform/ResourceType.h"
|
||||
#include "tasks/Task.h"
|
||||
|
||||
/* Simple class with a common interface for interacting with APIs */
|
||||
|
41
launcher/modplatform/ResourceType.cpp
Normal file
41
launcher/modplatform/ResourceType.cpp
Normal file
@ -0,0 +1,41 @@
|
||||
// SPDX-FileCopyrightText: 2022 Rachel Powers <508861+Ryex@users.noreply.github.com>
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
/*
|
||||
* Prism Launcher - Minecraft Launcher
|
||||
* Copyright (C) 2022 Rachel Powers <508861+Ryex@users.noreply.github.com>
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include "ResourceType.h"
|
||||
|
||||
namespace ModPlatform {
|
||||
static const QMap<ResourceType, QString> s_packedTypeNames = { { ResourceType::ResourcePack, QObject::tr("resource pack") },
|
||||
{ ResourceType::TexturePack, QObject::tr("texture pack") },
|
||||
{ ResourceType::DataPack, QObject::tr("data pack") },
|
||||
{ ResourceType::ShaderPack, QObject::tr("shader pack") },
|
||||
{ ResourceType::World, QObject::tr("world save") },
|
||||
{ ResourceType::Mod, QObject::tr("mod") },
|
||||
{ ResourceType::Unknown, QObject::tr("unknown") } };
|
||||
|
||||
namespace ResourceTypeUtils {
|
||||
|
||||
QString getName(ResourceType type)
|
||||
{
|
||||
return s_packedTypeNames.constFind(type).value();
|
||||
}
|
||||
|
||||
} // namespace ResourceTypeUtils
|
||||
} // namespace ModPlatform
|
39
launcher/modplatform/ResourceType.h
Normal file
39
launcher/modplatform/ResourceType.h
Normal file
@ -0,0 +1,39 @@
|
||||
// SPDX-FileCopyrightText: 2022 Rachel Powers <508861+Ryex@users.noreply.github.com>
|
||||
//
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
/*
|
||||
* Prism Launcher - Minecraft Launcher
|
||||
* Copyright (C) 2022 Rachel Powers <508861+Ryex@users.noreply.github.com>
|
||||
*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <set>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QFileInfo>
|
||||
#include <QObject>
|
||||
|
||||
namespace ModPlatform {
|
||||
|
||||
enum class ResourceType { Mod, ResourcePack, ShaderPack, Modpack, DataPack, World, Screenshots, TexturePack, Unknown };
|
||||
|
||||
namespace ResourceTypeUtils {
|
||||
static const std::set<ResourceType> VALID_RESOURCES = { ResourceType::DataPack, ResourceType::ResourcePack, ResourceType::TexturePack,
|
||||
ResourceType::ShaderPack, ResourceType::World, ResourceType::Mod };
|
||||
QString getName(ResourceType type);
|
||||
} // namespace ResourceTypeUtils
|
||||
} // namespace ModPlatform
|
@ -84,18 +84,18 @@ void Flame::FileResolvingTask::executeTask()
|
||||
m_task->start();
|
||||
}
|
||||
|
||||
PackedResourceType getResourceType(int classId)
|
||||
ModPlatform::ResourceType getResourceType(int classId)
|
||||
{
|
||||
switch (classId) {
|
||||
case 17: // Worlds
|
||||
return PackedResourceType::WorldSave;
|
||||
return ModPlatform::ResourceType::World;
|
||||
case 6: // Mods
|
||||
return PackedResourceType::Mod;
|
||||
return ModPlatform::ResourceType::Mod;
|
||||
case 12: // Resource Packs
|
||||
// return PackedResourceType::ResourcePack; // not really a resourcepack
|
||||
// return ModPlatform::ResourceType::ResourcePack; // not really a resourcepack
|
||||
/* fallthrough */
|
||||
case 4546: // Customization
|
||||
// return PackedResourceType::ShaderPack; // not really a shaderPack
|
||||
// return ModPlatform::ResourceType::ShaderPack; // not really a shaderPack
|
||||
/* fallthrough */
|
||||
case 4471: // Modpacks
|
||||
/* fallthrough */
|
||||
@ -104,7 +104,7 @@ PackedResourceType getResourceType(int classId)
|
||||
case 4559: // Addons
|
||||
/* fallthrough */
|
||||
default:
|
||||
return PackedResourceType::UNKNOWN;
|
||||
return ModPlatform::ResourceType::Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
@ -256,7 +256,7 @@ void Flame::FileResolvingTask::getFlameProjects()
|
||||
setStatus(tr("Parsing API response from CurseForge for '%1'...").arg(file->version.fileName));
|
||||
FlameMod::loadIndexedPack(file->pack, entry_obj);
|
||||
file->resourceType = getResourceType(Json::requireInteger(entry_obj, "classId", "modClassId"));
|
||||
if (file->resourceType == PackedResourceType::WorldSave) {
|
||||
if (file->resourceType == ModPlatform::ResourceType::World) {
|
||||
file->targetFolder = "saves";
|
||||
}
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ Task::Ptr FlameAPI::getCategories(std::shared_ptr<QByteArray> response, ModPlatf
|
||||
|
||||
Task::Ptr FlameAPI::getModCategories(std::shared_ptr<QByteArray> response)
|
||||
{
|
||||
return getCategories(response, ModPlatform::ResourceType::MOD);
|
||||
return getCategories(response, ModPlatform::ResourceType::Mod);
|
||||
}
|
||||
|
||||
QList<ModPlatform::Category> FlameAPI::loadModCategories(std::shared_ptr<QByteArray> response)
|
||||
|
@ -41,15 +41,15 @@ class FlameAPI : public NetworkResourceAPI {
|
||||
{
|
||||
switch (type) {
|
||||
default:
|
||||
case ModPlatform::ResourceType::MOD:
|
||||
case ModPlatform::ResourceType::Mod:
|
||||
return 6;
|
||||
case ModPlatform::ResourceType::RESOURCE_PACK:
|
||||
case ModPlatform::ResourceType::ResourcePack:
|
||||
return 12;
|
||||
case ModPlatform::ResourceType::SHADER_PACK:
|
||||
case ModPlatform::ResourceType::ShaderPack:
|
||||
return 6552;
|
||||
case ModPlatform::ResourceType::MODPACK:
|
||||
case ModPlatform::ResourceType::Modpack:
|
||||
return 4471;
|
||||
case ModPlatform::ResourceType::DATA_PACK:
|
||||
case ModPlatform::ResourceType::DataPack:
|
||||
return 6945;
|
||||
}
|
||||
}
|
||||
|
@ -517,7 +517,7 @@ void FlameCreationTask::idResolverSucceeded(QEventLoop& loop)
|
||||
QList<BlockedMod> blocked_mods;
|
||||
auto anyBlocked = false;
|
||||
for (const auto& result : results.values()) {
|
||||
if (result.resourceType != PackedResourceType::Mod) {
|
||||
if (result.resourceType != ModPlatform::ResourceType::Mod) {
|
||||
m_otherResources.append(std::make_pair(result.version.fileName, result.targetFolder));
|
||||
}
|
||||
|
||||
@ -687,29 +687,29 @@ void FlameCreationTask::validateOtherResources(QEventLoop& loop)
|
||||
QString worldPath;
|
||||
|
||||
switch (type) {
|
||||
case PackedResourceType::Mod:
|
||||
case ModPlatform::ResourceType::Mod:
|
||||
validatePath(fileName, targetFolder, "mods");
|
||||
zipMods.push_back(fileName);
|
||||
break;
|
||||
case PackedResourceType::ResourcePack:
|
||||
case ModPlatform::ResourceType::ResourcePack:
|
||||
validatePath(fileName, targetFolder, "resourcepacks");
|
||||
break;
|
||||
case PackedResourceType::TexturePack:
|
||||
case ModPlatform::ResourceType::TexturePack:
|
||||
validatePath(fileName, targetFolder, "texturepacks");
|
||||
break;
|
||||
case PackedResourceType::DataPack:
|
||||
case ModPlatform::ResourceType::DataPack:
|
||||
validatePath(fileName, targetFolder, "datapacks");
|
||||
break;
|
||||
case PackedResourceType::ShaderPack:
|
||||
case ModPlatform::ResourceType::ShaderPack:
|
||||
// in theory flame API can't do this but who knows, that *may* change ?
|
||||
// better to handle it if it *does* occur in the future
|
||||
validatePath(fileName, targetFolder, "shaderpacks");
|
||||
break;
|
||||
case PackedResourceType::WorldSave:
|
||||
case ModPlatform::ResourceType::World:
|
||||
worldPath = validatePath(fileName, targetFolder, "saves");
|
||||
installWorld(worldPath);
|
||||
break;
|
||||
case PackedResourceType::UNKNOWN:
|
||||
case ModPlatform::ResourceType::Unknown:
|
||||
/* fallthrough */
|
||||
default:
|
||||
qDebug() << "Can't Identify" << fileName << "at" << localPath << ", leaving it where it is.";
|
||||
|
@ -40,8 +40,8 @@
|
||||
#include <QMap>
|
||||
#include <QString>
|
||||
#include <QUrl>
|
||||
#include "minecraft/mod/tasks/LocalResourceParse.h"
|
||||
#include "modplatform/ModIndex.h"
|
||||
#include "modplatform/ResourceType.h"
|
||||
|
||||
namespace Flame {
|
||||
struct File {
|
||||
@ -55,7 +55,7 @@ struct File {
|
||||
|
||||
// our
|
||||
QString targetFolder = QStringLiteral("mods");
|
||||
PackedResourceType resourceType;
|
||||
ModPlatform::ResourceType resourceType;
|
||||
};
|
||||
|
||||
struct Modloader {
|
||||
|
@ -104,15 +104,15 @@ class ModrinthAPI : public NetworkResourceAPI {
|
||||
static QString resourceTypeParameter(ModPlatform::ResourceType type)
|
||||
{
|
||||
switch (type) {
|
||||
case ModPlatform::ResourceType::MOD:
|
||||
case ModPlatform::ResourceType::Mod:
|
||||
return "mod";
|
||||
case ModPlatform::ResourceType::RESOURCE_PACK:
|
||||
case ModPlatform::ResourceType::ResourcePack:
|
||||
return "resourcepack";
|
||||
case ModPlatform::ResourceType::SHADER_PACK:
|
||||
case ModPlatform::ResourceType::ShaderPack:
|
||||
return "shader";
|
||||
case ModPlatform::ResourceType::DATA_PACK:
|
||||
case ModPlatform::ResourceType::DataPack:
|
||||
return "datapack";
|
||||
case ModPlatform::ResourceType::MODPACK:
|
||||
case ModPlatform::ResourceType::Modpack:
|
||||
return "modpack";
|
||||
default:
|
||||
qWarning() << "Invalid resource type for Modrinth API!";
|
||||
|
@ -1041,7 +1041,7 @@ void MainWindow::processURLs(QList<QUrl> urls)
|
||||
|
||||
auto type = ResourceUtils::identify(localFileInfo);
|
||||
|
||||
if (ResourceUtils::ValidResourceTypes.count(type) == 0) { // probably instance/modpack
|
||||
if (ModPlatform::ResourceTypeUtils::VALID_RESOURCES.count(type) == 0) { // probably instance/modpack
|
||||
addInstance(localFileName, extra_info);
|
||||
continue;
|
||||
}
|
||||
@ -1065,25 +1065,25 @@ void MainWindow::processURLs(QList<QUrl> urls)
|
||||
auto minecraftInst = std::dynamic_pointer_cast<MinecraftInstance>(inst);
|
||||
|
||||
switch (type) {
|
||||
case PackedResourceType::ResourcePack:
|
||||
case ModPlatform::ResourceType::ResourcePack:
|
||||
minecraftInst->resourcePackList()->installResourceWithFlameMetadata(localFileName, version);
|
||||
break;
|
||||
case PackedResourceType::TexturePack:
|
||||
case ModPlatform::ResourceType::TexturePack:
|
||||
minecraftInst->texturePackList()->installResourceWithFlameMetadata(localFileName, version);
|
||||
break;
|
||||
case PackedResourceType::DataPack:
|
||||
case ModPlatform::ResourceType::DataPack:
|
||||
qWarning() << "Importing of Data Packs not supported at this time. Ignoring" << localFileName;
|
||||
break;
|
||||
case PackedResourceType::Mod:
|
||||
case ModPlatform::ResourceType::Mod:
|
||||
minecraftInst->loaderModList()->installResourceWithFlameMetadata(localFileName, version);
|
||||
break;
|
||||
case PackedResourceType::ShaderPack:
|
||||
case ModPlatform::ResourceType::ShaderPack:
|
||||
minecraftInst->shaderPackList()->installResourceWithFlameMetadata(localFileName, version);
|
||||
break;
|
||||
case PackedResourceType::WorldSave:
|
||||
case ModPlatform::ResourceType::World:
|
||||
minecraftInst->worldList()->installWorld(localFileInfo);
|
||||
break;
|
||||
case PackedResourceType::UNKNOWN:
|
||||
case ModPlatform::ResourceType::Unknown:
|
||||
default:
|
||||
qDebug() << "Can't Identify" << localFileName << "Ignoring it.";
|
||||
break;
|
||||
|
@ -8,10 +8,11 @@
|
||||
#include "InstanceList.h"
|
||||
|
||||
#include <InstanceList.h>
|
||||
#include "modplatform/ResourceType.h"
|
||||
#include "ui/instanceview/InstanceDelegate.h"
|
||||
#include "ui/instanceview/InstanceProxyModel.h"
|
||||
|
||||
ImportResourceDialog::ImportResourceDialog(QString file_path, PackedResourceType type, QWidget* parent)
|
||||
ImportResourceDialog::ImportResourceDialog(QString file_path, ModPlatform::ResourceType type, QWidget* parent)
|
||||
: QDialog(parent), ui(new Ui::ImportResourceDialog), m_resource_type(type), m_file_path(file_path)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
@ -42,7 +43,7 @@ ImportResourceDialog::ImportResourceDialog(QString file_path, PackedResourceType
|
||||
connect(contentsWidget->selectionModel(), &QItemSelectionModel::selectionChanged, this, &ImportResourceDialog::selectionChanged);
|
||||
|
||||
ui->label->setText(
|
||||
tr("Choose the instance you would like to import this %1 to.").arg(ResourceUtils::getPackedTypeName(m_resource_type)));
|
||||
tr("Choose the instance you would like to import this %1 to.").arg(ModPlatform::ResourceTypeUtils::getName(m_resource_type)));
|
||||
ui->label_file_path->setText(tr("File: %1").arg(m_file_path));
|
||||
|
||||
ui->buttonBox->button(QDialogButtonBox::Cancel)->setText(tr("Cancel"));
|
||||
|
@ -3,7 +3,7 @@
|
||||
#include <QDialog>
|
||||
#include <QItemSelection>
|
||||
|
||||
#include "minecraft/mod/tasks/LocalResourceParse.h"
|
||||
#include "modplatform/ResourceType.h"
|
||||
#include "ui/instanceview/InstanceProxyModel.h"
|
||||
|
||||
namespace Ui {
|
||||
@ -14,13 +14,13 @@ class ImportResourceDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ImportResourceDialog(QString file_path, PackedResourceType type, QWidget* parent = nullptr);
|
||||
explicit ImportResourceDialog(QString file_path, ModPlatform::ResourceType type, QWidget* parent = nullptr);
|
||||
~ImportResourceDialog() override;
|
||||
QString selectedInstanceKey;
|
||||
|
||||
private:
|
||||
Ui::ImportResourceDialog* ui;
|
||||
PackedResourceType m_resource_type;
|
||||
ModPlatform::ResourceType m_resource_type;
|
||||
QString m_file_path;
|
||||
InstanceProxyModel* proxyModel;
|
||||
|
||||
|
@ -18,7 +18,7 @@ DataPackResourceModel::DataPackResourceModel(BaseInstance const& base_inst, Reso
|
||||
ResourceAPI::SearchArgs DataPackResourceModel::createSearchArguments()
|
||||
{
|
||||
auto sort = getCurrentSortingMethodByIndex();
|
||||
return { ModPlatform::ResourceType::DATA_PACK, m_next_search_offset, m_search_term, sort, ModPlatform::ModLoaderType::DataPack };
|
||||
return { ModPlatform::ResourceType::DataPack, m_next_search_offset, m_search_term, sort, ModPlatform::ModLoaderType::DataPack };
|
||||
}
|
||||
|
||||
ResourceAPI::VersionSearchArgs DataPackResourceModel::createVersionsArguments(const QModelIndex& entry)
|
||||
|
@ -41,7 +41,7 @@ ResourceAPI::SearchArgs ModModel::createSearchArguments()
|
||||
auto sort = getCurrentSortingMethodByIndex();
|
||||
|
||||
return {
|
||||
ModPlatform::ResourceType::MOD, m_next_search_offset, m_search_term, sort, loaders, versions, side, categories, m_filter->openSource
|
||||
ModPlatform::ResourceType::Mod, m_next_search_offset, m_search_term, sort, loaders, versions, side, categories, m_filter->openSource
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ ResourcePackResourceModel::ResourcePackResourceModel(BaseInstance const& base_in
|
||||
ResourceAPI::SearchArgs ResourcePackResourceModel::createSearchArguments()
|
||||
{
|
||||
auto sort = getCurrentSortingMethodByIndex();
|
||||
return { ModPlatform::ResourceType::RESOURCE_PACK, m_next_search_offset, m_search_term, sort };
|
||||
return { ModPlatform::ResourceType::ResourcePack, m_next_search_offset, m_search_term, sort };
|
||||
}
|
||||
|
||||
ResourceAPI::VersionSearchArgs ResourcePackResourceModel::createVersionsArguments(const QModelIndex& entry)
|
||||
|
@ -17,7 +17,7 @@ ShaderPackResourceModel::ShaderPackResourceModel(BaseInstance const& base_inst,
|
||||
ResourceAPI::SearchArgs ShaderPackResourceModel::createSearchArguments()
|
||||
{
|
||||
auto sort = getCurrentSortingMethodByIndex();
|
||||
return { ModPlatform::ResourceType::SHADER_PACK, m_next_search_offset, m_search_term, sort };
|
||||
return { ModPlatform::ResourceType::ShaderPack, m_next_search_offset, m_search_term, sort };
|
||||
}
|
||||
|
||||
ResourceAPI::VersionSearchArgs ShaderPackResourceModel::createVersionsArguments(const QModelIndex& entry)
|
||||
|
@ -188,7 +188,7 @@ void ListModel::performPaginatedSearch()
|
||||
|
||||
auto netJob = makeShared<NetJob>("Flame::Search", APPLICATION->network());
|
||||
auto searchUrl =
|
||||
FlameAPI().getSearchURL({ ModPlatform::ResourceType::MODPACK, nextSearchOffset, currentSearchTerm, sort, m_filter->loaders,
|
||||
FlameAPI().getSearchURL({ ModPlatform::ResourceType::Modpack, nextSearchOffset, currentSearchTerm, sort, m_filter->loaders,
|
||||
m_filter->versions, ModPlatform::Side::NoSide, m_filter->categoryIds, m_filter->openSource });
|
||||
|
||||
netJob->addNetAction(Net::ApiDownload::makeByteArray(QUrl(searchUrl.value()), response));
|
||||
|
@ -350,7 +350,7 @@ void FlamePage::createFilterWidget()
|
||||
|
||||
connect(m_filterWidget.get(), &ModFilterWidget::filterChanged, this, &FlamePage::triggerSearch);
|
||||
auto response = std::make_shared<QByteArray>();
|
||||
m_categoriesTask = FlameAPI::getCategories(response, ModPlatform::ResourceType::MODPACK);
|
||||
m_categoriesTask = FlameAPI::getCategories(response, ModPlatform::ResourceType::Modpack);
|
||||
connect(m_categoriesTask.get(), &Task::succeeded, [this, response]() {
|
||||
auto categories = FlameAPI::loadModCategories(response);
|
||||
m_filterWidget->setCategories(categories);
|
||||
|
@ -154,7 +154,7 @@ void ModpackListModel::performPaginatedSearch()
|
||||
ResourceAPI::SortingMethod sort{};
|
||||
sort.name = currentSort;
|
||||
auto searchUrl =
|
||||
ModrinthAPI().getSearchURL({ ModPlatform::ResourceType::MODPACK, nextSearchOffset, currentSearchTerm, sort, m_filter->loaders,
|
||||
ModrinthAPI().getSearchURL({ ModPlatform::ResourceType::Modpack, nextSearchOffset, currentSearchTerm, sort, m_filter->loaders,
|
||||
m_filter->versions, ModPlatform::Side::NoSide, m_filter->categoryIds, m_filter->openSource });
|
||||
|
||||
auto netJob = makeShared<NetJob>("Modrinth::SearchModpack", APPLICATION->network());
|
||||
|
Loading…
x
Reference in New Issue
Block a user