From 17452071c9b72a48498e7578d65b9b52729f914f Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Wed, 27 Nov 2019 17:30:30 -0500 Subject: added separators filter changed notendorsed filter to include anything else than true --- src/modlistsortproxy.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'src/modlistsortproxy.cpp') diff --git a/src/modlistsortproxy.cpp b/src/modlistsortproxy.cpp index 0984d415..ddae675c 100644 --- a/src/modlistsortproxy.cpp +++ b/src/modlistsortproxy.cpp @@ -39,6 +39,7 @@ ModListSortProxy::ModListSortProxy(Profile* profile, QObject *parent) , m_FilterActive(false) , m_FilterMode(FILTER_AND) , m_FilterNot(false) + , m_FilterSeparators(false) { setDynamicSortFilter(true); // this seems to work without dynamicsortfilter // but I don't know why. This should be necessary @@ -278,6 +279,10 @@ bool ModListSortProxy::hasConflictFlag(const std::vector &flags) bool ModListSortProxy::filterMatchesModAnd(ModInfo::Ptr info, bool enabled) const { for (auto iter = m_CategoryFilter.begin(); iter != m_CategoryFilter.end(); ++iter) { + if (info->hasFlag(ModInfo::FLAG_SEPARATOR) && !m_FilterSeparators) { + return false; + } + if (!categoryMatchesMod(info, enabled, *iter)) { return false; } @@ -295,6 +300,10 @@ bool ModListSortProxy::filterMatchesModAnd(ModInfo::Ptr info, bool enabled) cons bool ModListSortProxy::filterMatchesModOr(ModInfo::Ptr info, bool enabled) const { for (auto iter = m_CategoryFilter.begin(); iter != m_CategoryFilter.end(); ++iter) { + if (info->hasFlag(ModInfo::FLAG_SEPARATOR) && !m_FilterSeparators) { + return false; + } + if (categoryMatchesMod(info, enabled, *iter)) { return true; } @@ -332,7 +341,7 @@ bool ModListSortProxy::categoryMatchesMod( case CategoryFactory::CATEGORY_SPECIAL_NOTENDORSED: { ModInfo::EEndorsedState state = info->endorsedState(); - return ((state == ModInfo::ENDORSED_FALSE) || (state == ModInfo::ENDORSED_NEVER)); + return (state != ModInfo::ENDORSED_TRUE); } case CategoryFactory::CATEGORY_SPECIAL_BACKUP: @@ -353,7 +362,6 @@ bool ModListSortProxy::categoryMatchesMod( info->getNexusID() == -1 && !info->hasFlag(ModInfo::FLAG_FOREIGN) && !info->hasFlag(ModInfo::FLAG_BACKUP) && - !info->hasFlag(ModInfo::FLAG_SEPARATOR) && !info->hasFlag(ModInfo::FLAG_OVERWRITE)); } @@ -480,6 +488,14 @@ void ModListSortProxy::setFilterNot(bool b) } } +void ModListSortProxy::setFilterSeparators(bool b) +{ + if (b != m_FilterSeparators) { + m_FilterSeparators = b; + this->invalidate(); + } +} + bool ModListSortProxy::filterAcceptsRow(int row, const QModelIndex &parent) const { if (m_Profile == nullptr) { -- cgit v1.3.1