aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui/pages/modplatform
diff options
context:
space:
mode:
authorflow <thiagodonato300@gmail.com>2022-04-02 19:21:02 -0300
committerflow <thiagodonato300@gmail.com>2022-04-15 08:49:41 -0300
commit5cb0e750936f09513b98a8b0fd57746ca18dc8bc (patch)
tree97f044a7a899cc0ecb2189af95b86132ba71031f /launcher/ui/pages/modplatform
parentc730fd6e5f125cde324d110282ed33ea4b9df136 (diff)
downloadPrismLauncher-5cb0e750936f09513b98a8b0fd57746ca18dc8bc.tar.gz
PrismLauncher-5cb0e750936f09513b98a8b0fd57746ca18dc8bc.tar.bz2
PrismLauncher-5cb0e750936f09513b98a8b0fd57746ca18dc8bc.zip
fix(ui): Refresh mod list when changing filtering options
Diffstat (limited to 'launcher/ui/pages/modplatform')
-rw-r--r--launcher/ui/pages/modplatform/ModModel.cpp14
-rw-r--r--launcher/ui/pages/modplatform/ModModel.h1
-rw-r--r--launcher/ui/pages/modplatform/ModPage.cpp7
3 files changed, 18 insertions, 4 deletions
diff --git a/launcher/ui/pages/modplatform/ModModel.cpp b/launcher/ui/pages/modplatform/ModModel.cpp
index 1998fe99..0ff784db 100644
--- a/launcher/ui/pages/modplatform/ModModel.cpp
+++ b/launcher/ui/pages/modplatform/ModModel.cpp
@@ -75,11 +75,8 @@ void ListModel::performPaginatedSearch()
{ nextSearchOffset, currentSearchTerm, getSorts()[currentSort], profile->getModLoader(), getMineVersions() });
}
-void ListModel::searchWithTerm(const QString& term, const int sort)
+void ListModel::refresh()
{
- if (currentSearchTerm == term && currentSearchTerm.isNull() == term.isNull() && currentSort == sort) { return; }
- currentSearchTerm = term;
- currentSort = sort;
if (jobPtr) {
jobPtr->abort();
searchState = ResetRequested;
@@ -94,6 +91,15 @@ void ListModel::searchWithTerm(const QString& term, const int sort)
performPaginatedSearch();
}
+void ListModel::searchWithTerm(const QString& term, const int sort)
+{
+ if (currentSearchTerm == term && currentSearchTerm.isNull() == term.isNull() && currentSort == sort) { return; }
+ currentSearchTerm = term;
+ currentSort = sort;
+
+ refresh();
+}
+
void ListModel::getLogo(const QString& logo, const QString& logoUrl, LogoCallback callback)
{
if (m_logoMap.contains(logo)) {
diff --git a/launcher/ui/pages/modplatform/ModModel.h b/launcher/ui/pages/modplatform/ModModel.h
index 1b7601c2..d4dc872d 100644
--- a/launcher/ui/pages/modplatform/ModModel.h
+++ b/launcher/ui/pages/modplatform/ModModel.h
@@ -34,6 +34,7 @@ class ListModel : public QAbstractListModel {
/* Ask the API for more information */
void fetchMore(const QModelIndex& parent) override;
+ void refresh();
void searchWithTerm(const QString& term, const int sort);
void requestModVersions(const ModPlatform::IndexedPack& current);
diff --git a/launcher/ui/pages/modplatform/ModPage.cpp b/launcher/ui/pages/modplatform/ModPage.cpp
index 16e44c0d..ece97ef2 100644
--- a/launcher/ui/pages/modplatform/ModPage.cpp
+++ b/launcher/ui/pages/modplatform/ModPage.cpp
@@ -62,6 +62,13 @@ void ModPage::filterMods()
filter_dialog.execWithInstance(static_cast<MinecraftInstance*>(m_instance));
m_filter = filter_dialog.getFilter();
+
+ listModel->refresh();
+
+ if(ui->versionSelectionBox->count() > 0){
+ ui->versionSelectionBox->clear();
+ updateModVersions();
+ }
}
void ModPage::triggerSearch()