aboutsummaryrefslogtreecommitdiff
path: root/launcher
diff options
context:
space:
mode:
authorflow <flowlnlnln@gmail.com>2022-10-12 10:26:14 -0300
committerflow <flowlnlnln@gmail.com>2022-10-12 10:26:14 -0300
commitb2a5d8daf4e006e11c9bc67b10a88f9f5f51ba54 (patch)
tree113e32f8a930790c00514994e3bc46c0e2814a80 /launcher
parent19ee736e1d117a5da5f06740ee502d741fe01aa4 (diff)
downloadPrismLauncher-b2a5d8daf4e006e11c9bc67b10a88f9f5f51ba54.tar.gz
PrismLauncher-b2a5d8daf4e006e11c9bc67b10a88f9f5f51ba54.tar.bz2
PrismLauncher-b2a5d8daf4e006e11c9bc67b10a88f9f5f51ba54.zip
fix: don't include opted out versions with the 'Any' filter on the MD
Signed-off-by: flow <flowlnlnln@gmail.com>
Diffstat (limited to 'launcher')
-rw-r--r--launcher/ui/pages/modplatform/ModPage.cpp4
-rw-r--r--launcher/ui/pages/modplatform/ModPage.h1
-rw-r--r--launcher/ui/pages/modplatform/flame/FlameModPage.cpp5
-rw-r--r--launcher/ui/pages/modplatform/flame/FlameModPage.h1
4 files changed, 10 insertions, 1 deletions
diff --git a/launcher/ui/pages/modplatform/ModPage.cpp b/launcher/ui/pages/modplatform/ModPage.cpp
index 4fce0242..2af9a10a 100644
--- a/launcher/ui/pages/modplatform/ModPage.cpp
+++ b/launcher/ui/pages/modplatform/ModPage.cpp
@@ -265,7 +265,9 @@ void ModPage::updateModVersions(int prev_count)
break;
}
}
- if(valid || m_filter->versions.size() == 0)
+
+ // Only add the version if it's valid or using the 'Any' filter, but never if the version is opted out
+ if ((valid || m_filter->versions.empty()) && !optedOut(version))
ui->versionSelectionBox->addItem(version.version, QVariant(i));
}
if (ui->versionSelectionBox->count() == 0 && prev_count != 0) {
diff --git a/launcher/ui/pages/modplatform/ModPage.h b/launcher/ui/pages/modplatform/ModPage.h
index 3f31651c..ae3d7e77 100644
--- a/launcher/ui/pages/modplatform/ModPage.h
+++ b/launcher/ui/pages/modplatform/ModPage.h
@@ -51,6 +51,7 @@ class ModPage : public QWidget, public BasePage {
auto shouldDisplay() const -> bool override = 0;
virtual auto validateVersion(ModPlatform::IndexedVersion& ver, QString mineVer, ModAPI::ModLoaderTypes loaders = ModAPI::Unspecified) const -> bool = 0;
+ virtual bool optedOut(ModPlatform::IndexedVersion& ver) const { return false; };
auto apiProvider() -> ModAPI* { return api.get(); };
auto getFilter() const -> const std::shared_ptr<ModFilterWidget::Filter> { return m_filter; }
diff --git a/launcher/ui/pages/modplatform/flame/FlameModPage.cpp b/launcher/ui/pages/modplatform/flame/FlameModPage.cpp
index 772fd2e0..54a7be04 100644
--- a/launcher/ui/pages/modplatform/flame/FlameModPage.cpp
+++ b/launcher/ui/pages/modplatform/flame/FlameModPage.cpp
@@ -67,6 +67,11 @@ auto FlameModPage::validateVersion(ModPlatform::IndexedVersion& ver, QString min
return ver.mcVersion.contains(mineVer) && !ver.downloadUrl.isEmpty();
}
+bool FlameModPage::optedOut(ModPlatform::IndexedVersion& ver) const
+{
+ return ver.downloadUrl.isEmpty();
+}
+
// I don't know why, but doing this on the parent class makes it so that
// other mod providers start loading before being selected, at least with
// my Qt, so we need to implement this in every derived class...
diff --git a/launcher/ui/pages/modplatform/flame/FlameModPage.h b/launcher/ui/pages/modplatform/flame/FlameModPage.h
index 2cd484cb..50dedd6f 100644
--- a/launcher/ui/pages/modplatform/flame/FlameModPage.h
+++ b/launcher/ui/pages/modplatform/flame/FlameModPage.h
@@ -61,6 +61,7 @@ class FlameModPage : public ModPage {
inline auto metaEntryBase() const -> QString override { return "FlameMods"; };
auto validateVersion(ModPlatform::IndexedVersion& ver, QString mineVer, ModAPI::ModLoaderTypes loaders = ModAPI::Unspecified) const -> bool override;
+ bool optedOut(ModPlatform::IndexedVersion& ver) const override;
auto shouldDisplay() const -> bool override;
};