fix: don't include opted out versions with the 'Any' filter on the MD

Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
flow 2022-10-12 10:26:14 -03:00
parent 19ee736e1d
commit b2a5d8daf4
No known key found for this signature in database
GPG Key ID: 8D0F221F0A59F469
4 changed files with 10 additions and 1 deletions

View File

@ -265,7 +265,9 @@ void ModPage::updateModVersions(int prev_count)
break; 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)); ui->versionSelectionBox->addItem(version.version, QVariant(i));
} }
if (ui->versionSelectionBox->count() == 0 && prev_count != 0) { if (ui->versionSelectionBox->count() == 0 && prev_count != 0) {

View File

@ -51,6 +51,7 @@ class ModPage : public QWidget, public BasePage {
auto shouldDisplay() const -> bool override = 0; auto shouldDisplay() const -> bool override = 0;
virtual auto validateVersion(ModPlatform::IndexedVersion& ver, QString mineVer, ModAPI::ModLoaderTypes loaders = ModAPI::Unspecified) const -> bool = 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 apiProvider() -> ModAPI* { return api.get(); };
auto getFilter() const -> const std::shared_ptr<ModFilterWidget::Filter> { return m_filter; } auto getFilter() const -> const std::shared_ptr<ModFilterWidget::Filter> { return m_filter; }

View File

@ -67,6 +67,11 @@ auto FlameModPage::validateVersion(ModPlatform::IndexedVersion& ver, QString min
return ver.mcVersion.contains(mineVer) && !ver.downloadUrl.isEmpty(); 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 // 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 // other mod providers start loading before being selected, at least with
// my Qt, so we need to implement this in every derived class... // my Qt, so we need to implement this in every derived class...

View File

@ -61,6 +61,7 @@ class FlameModPage : public ModPage {
inline auto metaEntryBase() const -> QString override { return "FlameMods"; }; inline auto metaEntryBase() const -> QString override { return "FlameMods"; };
auto validateVersion(ModPlatform::IndexedVersion& ver, QString mineVer, ModAPI::ModLoaderTypes loaders = ModAPI::Unspecified) const -> bool override; 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; auto shouldDisplay() const -> bool override;
}; };