Added Dependency API

Signed-off-by: Trial97 <alexandru.tripon97@gmail.com>
This commit is contained in:
Trial97
2023-04-14 18:59:31 +03:00
parent 11f8d25d94
commit 5655a33515
5 changed files with 93 additions and 32 deletions

View File

@ -111,6 +111,24 @@ class ResourceAPI {
std::function<void(QJsonDocument&, ModPlatform::IndexedPack)> on_succeed;
};
struct DependencySearchArgs {
ModPlatform::Dependency dependency;
Version mcVersion;
ModLoaderTypes loader;
DependencySearchArgs(DependencySearchArgs const&) = default;
void operator=(DependencySearchArgs other)
{
dependency = other.dependency;
mcVersion = other.mcVersion;
loader = other.loader;
}
};
struct DependencySearchCallbacks {
std::function<void(QJsonDocument&, ModPlatform::Dependency)> on_succeed;
};
public:
/** Gets a list of available sorting methods for this API. */
[[nodiscard]] virtual auto getSortingMethods() const -> QList<SortingMethod> = 0;
@ -143,6 +161,12 @@ class ResourceAPI {
return nullptr;
}
[[nodiscard]] virtual Task::Ptr getDependencyVersion(DependencySearchArgs&&, DependencySearchCallbacks&&) const
{
qWarning() << "TODO";
return nullptr;
}
static auto getModLoaderString(ModLoaderType type) -> const QString
{
switch (type) {