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 | |
| parent | ecaf75c4531a79b1bdfe65eb60f257ac04422956 (diff) | |
added separators filter
changed notendorsed filter to include anything else than true
| -rw-r--r-- | src/mainwindow.cpp | 5 | ||||
| -rw-r--r-- | src/mainwindow.h | 1 | ||||
| -rw-r--r-- | src/mainwindow.ui | 7 | ||||
| -rw-r--r-- | src/modlistsortproxy.cpp | 20 | ||||
| -rw-r--r-- | src/modlistsortproxy.h | 2 |
5 files changed, 33 insertions, 2 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 21606fa9..d5636ab9 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -6557,6 +6557,11 @@ void MainWindow::on_categoriesNotBtn_toggled(bool checked) m_ModListSortProxy->setFilterNot(checked); } +void MainWindow::on_categoriesSeparators_toggled(bool checked) +{ + m_ModListSortProxy->setFilterSeparators(checked); +} + void MainWindow::on_managedArchiveLabel_linkHovered(const QString&) { QToolTip::showText(QCursor::pos(), diff --git a/src/mainwindow.h b/src/mainwindow.h index cbf45635..c99c724b 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -660,6 +660,7 @@ private slots: // ui slots void on_categoriesAndBtn_toggled(bool checked); void on_categoriesOrBtn_toggled(bool checked); void on_categoriesNotBtn_toggled(bool checked); + void on_categoriesSeparators_toggled(bool checked); void on_managedArchiveLabel_linkHovered(const QString &link); void storeSettings(); diff --git a/src/mainwindow.ui b/src/mainwindow.ui index cd9cbc4b..9648a586 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -159,6 +159,13 @@ </property> </widget> </item> + <item> + <widget class="QCheckBox" name="categoriesSeparators"> + <property name="text"> + <string>Separators</string> + </property> + </widget> + </item> </layout> </widget> </item> 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) {
diff --git a/src/modlistsortproxy.h b/src/modlistsortproxy.h index 17888ae6..2ebfbcf0 100644 --- a/src/modlistsortproxy.h +++ b/src/modlistsortproxy.h @@ -86,6 +86,7 @@ public: void setFilterMode(FilterMode mode);
void setFilterNot(bool b);
+ void setFilterSeparators(bool b);
/**
* @brief tests if the specified index has child nodes
@@ -139,6 +140,7 @@ private: bool m_FilterActive;
FilterMode m_FilterMode;
bool m_FilterNot;
+ bool m_FilterSeparators;
std::vector<int> m_PreChangeFilters;
|
