diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2019-11-27 17:30:30 -0500 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2019-11-27 17:30:30 -0500 |
| commit | 17452071c9b72a48498e7578d65b9b52729f914f (patch) | |
| tree | b072d8d364852ab047329cb89add1ad7b78d8208 /src/modlistsortproxy.cpp | |
| parent | ecaf75c4531a79b1bdfe65eb60f257ac04422956 (diff) | |
added separators filter
changed notendorsed filter to include anything else than true
Diffstat (limited to 'src/modlistsortproxy.cpp')
| -rw-r--r-- | src/modlistsortproxy.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
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<ModInfo::EFlag> &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) {
|
