aboutsummaryrefslogtreecommitdiff
path: root/launcher/minecraft/mod/Mod.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/minecraft/mod/Mod.cpp')
-rw-r--r--launcher/minecraft/mod/Mod.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/launcher/minecraft/mod/Mod.cpp b/launcher/minecraft/mod/Mod.cpp
index 39023f69..9cd0056c 100644
--- a/launcher/minecraft/mod/Mod.cpp
+++ b/launcher/minecraft/mod/Mod.cpp
@@ -44,6 +44,8 @@
#include "MetadataHandler.h"
#include "Version.h"
+static ModPlatform::ProviderCapabilities ProviderCaps;
+
Mod::Mod(const QFileInfo& file) : Resource(file), m_local_details()
{
m_enabled = (file.suffix() != "disabled");
@@ -91,6 +93,11 @@ std::pair<int, bool> Mod::compare(const Resource& other, SortType type) const
if (this_ver < other_ver)
return { -1, type == SortType::VERSION };
}
+ case SortType::PROVIDER: {
+ auto compare_result = QString::compare(provider().value_or("Unknown"), cast_other->provider().value_or("Unknown"), Qt::CaseInsensitive);
+ if (compare_result != 0)
+ return { compare_result, type == SortType::PROVIDER };
+ }
}
return { 0, false };
}
@@ -189,4 +196,11 @@ void Mod::finishResolvingWithDetails(ModDetails&& details)
m_local_details = std::move(details);
if (metadata)
setMetadata(std::move(metadata));
+};
+
+auto Mod::provider() const -> std::optional<QString>
+{
+ if (metadata())
+ return ProviderCaps.readableName(metadata()->provider);
+ return {};
}