propagate side as enum instead of Qstring
Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
parent
178965676e
commit
be963764ea
18 changed files with 89 additions and 131 deletions
|
@ -7,6 +7,7 @@
|
|||
#include "minecraft/MinecraftInstance.h"
|
||||
#include "minecraft/PackProfile.h"
|
||||
#include "minecraft/mod/ModFolderModel.h"
|
||||
#include "modplatform/ModIndex.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <algorithm>
|
||||
|
@ -101,9 +102,10 @@ QVariant ModModel::getInstalledPackVersion(ModPlatform::IndexedPack::Ptr pack) c
|
|||
return {};
|
||||
}
|
||||
|
||||
bool checkSide(QString filter, QString value)
|
||||
bool checkSide(ModPlatform::Side filter, ModPlatform::Side value)
|
||||
{
|
||||
return filter.isEmpty() || value.isEmpty() || filter == "both" || value == "both" || filter == value;
|
||||
return filter == ModPlatform::Side::NoSide || value == ModPlatform::Side::NoSide || filter == ModPlatform::Side::UniversalSide ||
|
||||
value == ModPlatform::Side::UniversalSide || filter == value;
|
||||
}
|
||||
|
||||
bool ModModel::checkFilters(ModPlatform::IndexedPack::Ptr pack)
|
||||
|
|
|
@ -186,8 +186,9 @@ void ListModel::performPaginatedSearch()
|
|||
sort.index = currentSort + 1;
|
||||
|
||||
auto netJob = makeShared<NetJob>("Flame::Search", APPLICATION->network());
|
||||
auto searchUrl = FlameAPI().getSearchURL({ ModPlatform::ResourceType::MODPACK, nextSearchOffset, currentSearchTerm, sort,
|
||||
m_filter->loaders, m_filter->versions, "", m_filter->categoryIds, m_filter->openSource });
|
||||
auto searchUrl =
|
||||
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));
|
||||
jobPtr = netJob;
|
||||
|
|
|
@ -152,8 +152,9 @@ void ModpackListModel::performPaginatedSearch()
|
|||
} // TODO: Move to standalone API
|
||||
ResourceAPI::SortingMethod sort{};
|
||||
sort.name = currentSort;
|
||||
auto searchUrl = ModrinthAPI().getSearchURL({ ModPlatform::ResourceType::MODPACK, nextSearchOffset, currentSearchTerm, sort,
|
||||
m_filter->loaders, m_filter->versions, "", m_filter->categoryIds, m_filter->openSource });
|
||||
auto searchUrl =
|
||||
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());
|
||||
netJob->addNetAction(Net::ApiDownload::makeByteArray(QUrl(searchUrl.value()), m_allResponse));
|
||||
|
|
|
@ -218,7 +218,7 @@ void ModFilterWidget::prepareBasicFilter()
|
|||
m_filter->openSource = false;
|
||||
if (m_instance) {
|
||||
m_filter->hideInstalled = false;
|
||||
m_filter->side = ""; // or "both"
|
||||
m_filter->side = ModPlatform::Side::NoSide; // or "both"
|
||||
ModPlatform::ModLoaderTypes loaders;
|
||||
if (m_instance->settings()->get("OverrideModDownloadLoaders").toBool()) {
|
||||
for (auto loader : Json::toStringList(m_instance->settings()->get("ModDownloadLoaders").toString())) {
|
||||
|
@ -287,16 +287,16 @@ void ModFilterWidget::onLoadersFilterChanged()
|
|||
|
||||
void ModFilterWidget::onSideFilterChanged()
|
||||
{
|
||||
QString side;
|
||||
ModPlatform::Side side;
|
||||
|
||||
if (ui->clientSide->isChecked() && !ui->serverSide->isChecked()) {
|
||||
side = "client";
|
||||
side = ModPlatform::Side::ClientSide;
|
||||
} else if (!ui->clientSide->isChecked() && ui->serverSide->isChecked()) {
|
||||
side = "server";
|
||||
side = ModPlatform::Side::ServerSide;
|
||||
} else if (ui->clientSide->isChecked() && ui->serverSide->isChecked()) {
|
||||
side = "both";
|
||||
side = ModPlatform::Side::UniversalSide;
|
||||
} else {
|
||||
side = "";
|
||||
side = ModPlatform::Side::NoSide;
|
||||
}
|
||||
|
||||
m_filter_changed = side != m_filter->side;
|
||||
|
|
|
@ -61,7 +61,7 @@ class ModFilterWidget : public QTabWidget {
|
|||
std::list<Version> versions;
|
||||
std::list<ModPlatform::IndexedVersionType> releases;
|
||||
ModPlatform::ModLoaderTypes loaders;
|
||||
QString side;
|
||||
ModPlatform::Side side;
|
||||
bool hideInstalled;
|
||||
QStringList categoryIds;
|
||||
bool openSource;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue