made side and loaders visible to user

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97
2023-10-15 12:46:23 +03:00
parent ab725eeb18
commit 749975e8ef
8 changed files with 79 additions and 10 deletions

View File

@ -45,6 +45,7 @@
#include "MetadataHandler.h"
#include "Version.h"
#include "minecraft/mod/ModDetails.h"
#include "minecraft/mod/Resource.h"
#include "minecraft/mod/tasks/LocalModParseTask.h"
static ModPlatform::ProviderCapabilities ProviderCaps;
@ -109,6 +110,20 @@ std::pair<int, bool> Mod::compare(const Resource& other, SortType type) const
return { compare_result, type == SortType::PROVIDER };
break;
}
case SortType::SIDE: {
if (side() > cast_other->side())
return { 1, type == SortType::SIDE };
else if (side() < cast_other->side())
return { -1, type == SortType::SIDE };
break;
}
case SortType::LOADERS: {
if (loaders() > cast_other->loaders())
return { 1, type == SortType::LOADERS };
else if (loaders() < cast_other->loaders())
return { -1, type == SortType::LOADERS };
break;
}
}
return { 0, false };
}
@ -232,6 +247,20 @@ auto Mod::provider() const -> std::optional<QString>
return {};
}
auto Mod::side() const -> Metadata::ModSide
{
if (metadata())
return metadata()->side;
return Metadata::ModSide::UniversalSide;
}
auto Mod::loaders() const -> ModPlatform::ModLoaderTypes
{
if (metadata())
return metadata()->loaders;
return {};
}
auto Mod::licenses() const -> const QList<ModLicense>&
{
return details().licenses;