From c730fd6e5f125cde324d110282ed33ea4b9df136 Mon Sep 17 00:00:00 2001 From: flow Date: Sat, 2 Apr 2022 18:34:26 -0300 Subject: feat: Use version filter when searching mods --- launcher/ui/pages/modplatform/ModModel.cpp | 8 +++----- launcher/ui/pages/modplatform/ModModel.h | 3 ++- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'launcher/ui/pages/modplatform') diff --git a/launcher/ui/pages/modplatform/ModModel.cpp b/launcher/ui/pages/modplatform/ModModel.cpp index f75d2847..1998fe99 100644 --- a/launcher/ui/pages/modplatform/ModModel.cpp +++ b/launcher/ui/pages/modplatform/ModModel.cpp @@ -72,7 +72,7 @@ void ListModel::performPaginatedSearch() auto profile = (dynamic_cast((dynamic_cast(parent()))->m_instance))->getPackProfile(); m_parent->apiProvider()->searchMods(this, - { nextSearchOffset, currentSearchTerm, getSorts()[currentSort], profile->getModLoader(), getMineVersions().at(0) }); + { nextSearchOffset, currentSearchTerm, getSorts()[currentSort], profile->getModLoader(), getMineVersions() }); } void ListModel::searchWithTerm(const QString& term, const int sort) @@ -223,9 +223,7 @@ void ListModel::versionRequestSucceeded(QJsonDocument doc, QString addonId) /******** Helpers ********/ -auto ModPlatform::ListModel::getMineVersions() const -> QList +auto ModPlatform::ListModel::getMineVersions() const -> std::list { - return { (dynamic_cast((dynamic_cast(parent()))->m_instance)) - ->getPackProfile() - ->getComponentVersion("net.minecraft") }; + return m_parent->getFilter()->versions; } diff --git a/launcher/ui/pages/modplatform/ModModel.h b/launcher/ui/pages/modplatform/ModModel.h index dbadbeee..1b7601c2 100644 --- a/launcher/ui/pages/modplatform/ModModel.h +++ b/launcher/ui/pages/modplatform/ModModel.h @@ -7,6 +7,7 @@ #include "net/NetJob.h" class ModPage; +class Version; namespace ModPlatform { @@ -62,7 +63,7 @@ class ListModel : public QAbstractListModel { void requestLogo(QString file, QString url); - inline auto getMineVersions() const -> QList; + inline auto getMineVersions() const -> std::list; protected: ModPage* m_parent; -- cgit