diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2019-11-30 05:23:22 -0500 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2019-11-30 05:23:22 -0500 |
| commit | 7f4fce35f97f262c36e4c00dad55c1b078cf3758 (patch) | |
| tree | 5f737852d30176fc31bf64b0028d13350112d2ea /src/modlistsortproxy.cpp | |
| parent | 38d56ef8310674bc5a2f8b304ee17a6b7e1c5798 (diff) | |
fixed separators option being used even without filters
changed filter list to use tristate items without selection
Diffstat (limited to 'src/modlistsortproxy.cpp')
| -rw-r--r-- | src/modlistsortproxy.cpp | 26 |
1 files changed, 21 insertions, 5 deletions
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<ModInfo::EFlag> &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;
|
