summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2019-11-27 17:05:20 -0500
committerisanae <14251494+isanae@users.noreply.github.com>2019-11-27 17:05:20 -0500
commitd5e38fca6b3a8c7bf90c5a3d8ec779752a22c61d (patch)
tree739a30efabfb7c3777f9781c8a735f4e53bec02d
parentfb3c15094fded829b120274189b0b331a68b2afa (diff)
added not filter, not functional yet
fixed no mods being displayed for OR with no conditions
-rw-r--r--src/mainwindow.cpp5
-rw-r--r--src/mainwindow.h1
-rw-r--r--src/mainwindow.ui7
-rw-r--r--src/modlistsortproxy.cpp17
-rw-r--r--src/modlistsortproxy.h4
5 files changed, 27 insertions, 7 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index e134d64a..21606fa9 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -6552,6 +6552,11 @@ void MainWindow::on_categoriesOrBtn_toggled(bool checked)
}
}
+void MainWindow::on_categoriesNotBtn_toggled(bool checked)
+{
+ m_ModListSortProxy->setFilterNot(checked);
+}
+
void MainWindow::on_managedArchiveLabel_linkHovered(const QString&)
{
QToolTip::showText(QCursor::pos(),
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 0c96c15d..cbf45635 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -659,6 +659,7 @@ private slots: // ui slots
void on_saveModsButton_clicked();
void on_categoriesAndBtn_toggled(bool checked);
void on_categoriesOrBtn_toggled(bool checked);
+ void on_categoriesNotBtn_toggled(bool checked);
void on_managedArchiveLabel_linkHovered(const QString &link);
void storeSettings();
diff --git a/src/mainwindow.ui b/src/mainwindow.ui
index 723b42fe..cd9cbc4b 100644
--- a/src/mainwindow.ui
+++ b/src/mainwindow.ui
@@ -152,6 +152,13 @@
</property>
</widget>
</item>
+ <item>
+ <widget class="QCheckBox" name="categoriesNotBtn">
+ <property name="text">
+ <string>Not</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
diff --git a/src/modlistsortproxy.cpp b/src/modlistsortproxy.cpp
index a9ff6463..805e77f4 100644
--- a/src/modlistsortproxy.cpp
+++ b/src/modlistsortproxy.cpp
@@ -36,10 +36,9 @@ using namespace MOBase;
ModListSortProxy::ModListSortProxy(Profile* profile, QObject *parent)
: QSortFilterProxyModel(parent)
, m_Profile(profile)
- , m_CategoryFilter()
- , m_CurrentFilter()
, m_FilterActive(false)
, m_FilterMode(FILTER_AND)
+ , m_FilterNot(false)
{
setDynamicSortFilter(true); // this seems to work without dynamicsortfilter
// but I don't know why. This should be necessary
@@ -312,8 +311,8 @@ bool ModListSortProxy::filterMatchesModAnd(ModInfo::Ptr info, bool enabled) cons
if (!info->hasFlag(ModInfo::FLAG_INVALID)) return false;
} break;
case CategoryFactory::CATEGORY_SPECIAL_NONEXUSID: {
- if (!(info->getNexusID() == -1 && !info->hasFlag(ModInfo::FLAG_FOREIGN) &&
- !info->hasFlag(ModInfo::FLAG_BACKUP) &&
+ if (!(info->getNexusID() == -1 && !info->hasFlag(ModInfo::FLAG_FOREIGN) &&
+ !info->hasFlag(ModInfo::FLAG_BACKUP) &&
!info->hasFlag(ModInfo::FLAG_SEPARATOR) &&
!info->hasFlag(ModInfo::FLAG_OVERWRITE))) return false;
} break;
@@ -381,7 +380,7 @@ bool ModListSortProxy::filterMatchesModOr(ModInfo::Ptr info, bool enabled) const
if (info->hasContent(static_cast<ModInfo::EContent>(content))) return true;
}
- return false;
+ return m_CategoryFilter.empty() && m_ContentFilter.empty();
}
bool ModListSortProxy::filterMatchesMod(ModInfo::Ptr info, bool enabled) const
@@ -487,6 +486,14 @@ void ModListSortProxy::setFilterMode(ModListSortProxy::FilterMode mode)
}
}
+void ModListSortProxy::setFilterNot(bool b)
+{
+ if (b != m_FilterNot) {
+ m_FilterNot = 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 5fe8d9d6..2e3e5709 100644
--- a/src/modlistsortproxy.h
+++ b/src/modlistsortproxy.h
@@ -85,6 +85,7 @@ public:
bool isFilterActive() const { return m_FilterActive; }
void setFilterMode(FilterMode mode);
+ void setFilterNot(bool b);
/**
* @brief tests if the specified index has child nodes
@@ -129,9 +130,7 @@ private slots:
void postDataChanged();
private:
-
Profile *m_Profile;
-
std::vector<int> m_CategoryFilter;
std::vector<int> m_ContentFilter;
std::bitset<ModList::COL_LASTCOLUMN + 1> m_EnabledColumns;
@@ -139,6 +138,7 @@ private:
bool m_FilterActive;
FilterMode m_FilterMode;
+ bool m_FilterNot;
std::vector<int> m_PreChangeFilters;