diff options
| author | Tannin <devnull@localhost> | 2014-08-18 23:00:25 +0200 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2014-08-18 23:00:25 +0200 |
| commit | 4b1e6683d258412dd6e02c55618ff158c749ab4a (patch) | |
| tree | 799ba86e4fabc44363ccc6dc14c4602b2b9e2919 /src/modlistsortproxy.cpp | |
| parent | 06701856f8eaed0f6bf802308c07952f0f0dd92e (diff) | |
- can now filter by mod content
- all files/directories that require write access can now be placed in AppData instead of the MO directory
Diffstat (limited to 'src/modlistsortproxy.cpp')
| -rw-r--r-- | src/modlistsortproxy.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/modlistsortproxy.cpp b/src/modlistsortproxy.cpp index ecd1755d..da5d99d5 100644 --- a/src/modlistsortproxy.cpp +++ b/src/modlistsortproxy.cpp @@ -51,7 +51,7 @@ void ModListSortProxy::setProfile(Profile *profile) void ModListSortProxy::updateFilterActive()
{
- m_FilterActive = (m_CategoryFilter.size() > 0) || !m_CurrentFilter.isEmpty();
+ m_FilterActive = (m_CategoryFilter.size() > 0) || (m_ContentFilter.size() > 0) || !m_CurrentFilter.isEmpty();
emit filterActive(m_FilterActive);
}
@@ -62,6 +62,13 @@ void ModListSortProxy::setCategoryFilter(const std::vector<int> &categories) this->invalidate();
}
+void ModListSortProxy::setContentFilter(const std::vector<int> &content)
+{
+ m_ContentFilter = content;
+ updateFilterActive();
+ this->invalidate();
+}
+
Qt::ItemFlags ModListSortProxy::flags(const QModelIndex &modelIndex) const
{
Qt::ItemFlags flags = sourceModel()->flags(mapToSource(modelIndex));
@@ -262,6 +269,11 @@ bool ModListSortProxy::filterMatchesModAnd(ModInfo::Ptr info, bool enabled) cons } break;
}
}
+
+ foreach (int content, m_ContentFilter) {
+ if (!info->hasContent(static_cast<ModInfo::EContent>(content))) return false;
+ }
+
return true;
}
@@ -299,6 +311,11 @@ bool ModListSortProxy::filterMatchesModOr(ModInfo::Ptr info, bool enabled) const } break;
}
}
+
+ foreach (int content, m_ContentFilter) {
+ if (info->hasContent(static_cast<ModInfo::EContent>(content))) return true;
+ }
+
return false;
}
@@ -312,7 +329,7 @@ bool ModListSortProxy::filterMatchesMod(ModInfo::Ptr info, bool enabled) const if (m_FilterMode == FILTER_AND) {
return filterMatchesModAnd(info, enabled);
} else {
- return (m_CategoryFilter.size() == 0) || filterMatchesModOr(info, enabled);
+ return filterMatchesModOr(info, enabled);
}
}
|
