From 7f4fce35f97f262c36e4c00dad55c1b078cf3758 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Sat, 30 Nov 2019 05:23:22 -0500 Subject: fixed separators option being used even without filters changed filter list to use tristate items without selection --- src/modlistsortproxy.cpp | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'src/modlistsortproxy.cpp') diff --git a/src/modlistsortproxy.cpp b/src/modlistsortproxy.cpp index 36dcae59..e6bed49c 100644 --- a/src/modlistsortproxy.cpp +++ b/src/modlistsortproxy.cpp @@ -269,12 +269,12 @@ bool ModListSortProxy::hasConflictFlag(const std::vector &flags) bool ModListSortProxy::filterMatchesModAnd(ModInfo::Ptr info, bool enabled) const { - if (info->hasFlag(ModInfo::FLAG_SEPARATOR) && !m_FilterSeparators) { + if (!optionsMatchMod(info, enabled)) { return false; } for (auto&& c : m_Criteria) { - if (!criteriaMatchesMod(info, enabled, c)) { + if (!criteriaMatchMod(info, enabled, c)) { return false; } } @@ -284,12 +284,12 @@ bool ModListSortProxy::filterMatchesModAnd(ModInfo::Ptr info, bool enabled) cons bool ModListSortProxy::filterMatchesModOr(ModInfo::Ptr info, bool enabled) const { - if (info->hasFlag(ModInfo::FLAG_SEPARATOR) && !m_FilterSeparators) { + if (!optionsMatchMod(info, enabled)) { return false; } for (auto&& c : m_Criteria) { - if (criteriaMatchesMod(info, enabled, c)) { + if (criteriaMatchMod(info, enabled, c)) { return true; } } @@ -302,7 +302,23 @@ bool ModListSortProxy::filterMatchesModOr(ModInfo::Ptr info, bool enabled) const return true; } -bool ModListSortProxy::criteriaMatchesMod( +bool ModListSortProxy::optionsMatchMod(ModInfo::Ptr info, bool) const +{ + // don't check options if there are no filters selected + if (!m_FilterActive) { + return true; + } + + if (!m_FilterSeparators) { + if (info->hasFlag(ModInfo::FLAG_SEPARATOR)) { + return false; + } + } + + return true; +} + +bool ModListSortProxy::criteriaMatchMod( ModInfo::Ptr info, bool enabled, const Criteria& c) const { bool b = false; -- cgit v1.3.1