From d5e38fca6b3a8c7bf90c5a3d8ec779752a22c61d Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Wed, 27 Nov 2019 17:05:20 -0500 Subject: added not filter, not functional yet fixed no mods being displayed for OR with no conditions --- src/modlistsortproxy.cpp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src/modlistsortproxy.cpp') 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(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) { -- cgit v1.3.1 From ecaf75c4531a79b1bdfe65eb60f257ac04422956 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Wed, 27 Nov 2019 17:14:44 -0500 Subject: refactored matching into one function instead of repeating them for OR and AND --- src/modlistsortproxy.cpp | 154 +++++++++++++++++++++-------------------------- src/modlistsortproxy.h | 2 + 2 files changed, 72 insertions(+), 84 deletions(-) (limited to 'src/modlistsortproxy.cpp') diff --git a/src/modlistsortproxy.cpp b/src/modlistsortproxy.cpp index 805e77f4..0984d415 100644 --- a/src/modlistsortproxy.cpp +++ b/src/modlistsortproxy.cpp @@ -278,52 +278,15 @@ 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) { - switch (*iter) { - case CategoryFactory::CATEGORY_SPECIAL_CHECKED: { - if (!enabled && !info->alwaysEnabled() && !info->hasFlag(ModInfo::FLAG_SEPARATOR)) return false; - } break; - case CategoryFactory::CATEGORY_SPECIAL_UNCHECKED: { - if (enabled || info->alwaysEnabled()) return false; - } break; - case CategoryFactory::CATEGORY_SPECIAL_UPDATEAVAILABLE: { - if (!info->updateAvailable() && !info->downgradeAvailable()) return false; - } break; - case CategoryFactory::CATEGORY_SPECIAL_NOCATEGORY: { - if (info->getCategories().size() > 0) return false; - } break; - case CategoryFactory::CATEGORY_SPECIAL_CONFLICT: { - if (!hasConflictFlag(info->getFlags())) return false; - } break; - case CategoryFactory::CATEGORY_SPECIAL_NOTENDORSED: { - ModInfo::EEndorsedState state = info->endorsedState(); - if (state != ModInfo::ENDORSED_FALSE) return false; - } break; - case CategoryFactory::CATEGORY_SPECIAL_BACKUP: { - if (!info->hasFlag(ModInfo::FLAG_BACKUP)) return false; - } break; - case CategoryFactory::CATEGORY_SPECIAL_MANAGED: { - if (info->hasFlag(ModInfo::FLAG_FOREIGN)) return false; - } break; - case CategoryFactory::CATEGORY_SPECIAL_UNMANAGED: { - if (!info->hasFlag(ModInfo::FLAG_FOREIGN)) return false; - } break; - case CategoryFactory::CATEGORY_SPECIAL_NOGAMEDATA: { - 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) && - !info->hasFlag(ModInfo::FLAG_SEPARATOR) && - !info->hasFlag(ModInfo::FLAG_OVERWRITE))) return false; - } break; - default: { - if (!info->categorySet(*iter)) return false; - } break; + if (!categoryMatchesMod(info, enabled, *iter)) { + return false; } } foreach (int content, m_ContentFilter) { - if (!info->hasContent(static_cast(content))) return false; + if (!contentMatchesMod(info, enabled, content)) { + return false; + } } return true; @@ -332,57 +295,80 @@ 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) { - switch (*iter) { - case CategoryFactory::CATEGORY_SPECIAL_CHECKED: { - if (enabled || info->alwaysEnabled()) return true; - } break; - case CategoryFactory::CATEGORY_SPECIAL_UNCHECKED: { - if (!enabled && !info->alwaysEnabled()) return true; - } break; - case CategoryFactory::CATEGORY_SPECIAL_UPDATEAVAILABLE: { - if (info->updateAvailable() || info->downgradeAvailable()) return true; - } break; - case CategoryFactory::CATEGORY_SPECIAL_NOCATEGORY: { - if (info->getCategories().size() == 0) return true; - } break; - case CategoryFactory::CATEGORY_SPECIAL_CONFLICT: { - if (hasConflictFlag(info->getFlags())) return true; - } break; - case CategoryFactory::CATEGORY_SPECIAL_NOTENDORSED: { - ModInfo::EEndorsedState state = info->endorsedState(); - if ((state == ModInfo::ENDORSED_FALSE) || (state == ModInfo::ENDORSED_NEVER)) return true; - } break; - case CategoryFactory::CATEGORY_SPECIAL_BACKUP: { - if (info->hasFlag(ModInfo::FLAG_BACKUP)) return true; - } break; - case CategoryFactory::CATEGORY_SPECIAL_MANAGED: { - if (!info->hasFlag(ModInfo::FLAG_FOREIGN)) return true; - } break; - case CategoryFactory::CATEGORY_SPECIAL_UNMANAGED: { - if (info->hasFlag(ModInfo::FLAG_FOREIGN)) return true; - } break; - case CategoryFactory::CATEGORY_SPECIAL_NOGAMEDATA: { - if (info->hasFlag(ModInfo::FLAG_INVALID)) return true; - } break; - case CategoryFactory::CATEGORY_SPECIAL_NONEXUSID: { - 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 true; - } break; - default: { - if (info->categorySet(*iter)) return true; - } break; + if (categoryMatchesMod(info, enabled, *iter)) { + return true; } } foreach (int content, m_ContentFilter) { - if (info->hasContent(static_cast(content))) return true; + if (contentMatchesMod(info, enabled, content)) { + return true; + } } return m_CategoryFilter.empty() && m_ContentFilter.empty(); } +bool ModListSortProxy::categoryMatchesMod( + ModInfo::Ptr info, bool enabled, int category) const +{ + switch (category) + { + case CategoryFactory::CATEGORY_SPECIAL_CHECKED: + return (enabled || info->alwaysEnabled()); + + case CategoryFactory::CATEGORY_SPECIAL_UNCHECKED: + return (!enabled && !info->alwaysEnabled()); + + case CategoryFactory::CATEGORY_SPECIAL_UPDATEAVAILABLE: + return (info->updateAvailable() || info->downgradeAvailable()); + + case CategoryFactory::CATEGORY_SPECIAL_NOCATEGORY: + return (info->getCategories().size() == 0); + + case CategoryFactory::CATEGORY_SPECIAL_CONFLICT: + return (hasConflictFlag(info->getFlags())); + + case CategoryFactory::CATEGORY_SPECIAL_NOTENDORSED: + { + ModInfo::EEndorsedState state = info->endorsedState(); + return ((state == ModInfo::ENDORSED_FALSE) || (state == ModInfo::ENDORSED_NEVER)); + } + + case CategoryFactory::CATEGORY_SPECIAL_BACKUP: + return (info->hasFlag(ModInfo::FLAG_BACKUP)); + + case CategoryFactory::CATEGORY_SPECIAL_MANAGED: + return (!info->hasFlag(ModInfo::FLAG_FOREIGN)); + + case CategoryFactory::CATEGORY_SPECIAL_UNMANAGED: + return (info->hasFlag(ModInfo::FLAG_FOREIGN)); + + case CategoryFactory::CATEGORY_SPECIAL_NOGAMEDATA: + return (info->hasFlag(ModInfo::FLAG_INVALID)); + + case CategoryFactory::CATEGORY_SPECIAL_NONEXUSID: + { + return ( + info->getNexusID() == -1 && + !info->hasFlag(ModInfo::FLAG_FOREIGN) && + !info->hasFlag(ModInfo::FLAG_BACKUP) && + !info->hasFlag(ModInfo::FLAG_SEPARATOR) && + !info->hasFlag(ModInfo::FLAG_OVERWRITE)); + } + + default: + { + return (info->categorySet(category)); + } + } +} + +bool ModListSortProxy::contentMatchesMod(ModInfo::Ptr info, bool enabled, int content) const +{ + return info->hasContent(static_cast(content)); +} + bool ModListSortProxy::filterMatchesMod(ModInfo::Ptr info, bool enabled) const { if (!m_CurrentFilter.isEmpty()) { diff --git a/src/modlistsortproxy.h b/src/modlistsortproxy.h index 2e3e5709..17888ae6 100644 --- a/src/modlistsortproxy.h +++ b/src/modlistsortproxy.h @@ -142,6 +142,8 @@ private: std::vector m_PreChangeFilters; + bool categoryMatchesMod(ModInfo::Ptr info, bool enabled, int category) const; + bool contentMatchesMod(ModInfo::Ptr info, bool enabled, int content) const; }; #endif // MODLISTSORTPROXY_H -- cgit v1.3.1 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/mainwindow.cpp | 5 +++++ src/mainwindow.h | 1 + src/mainwindow.ui | 7 +++++++ src/modlistsortproxy.cpp | 20 ++++++++++++++++++-- src/modlistsortproxy.h | 2 ++ 5 files changed, 33 insertions(+), 2 deletions(-) (limited to 'src/modlistsortproxy.cpp') 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 @@ + + + + Separators + + + 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) { 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 m_PreChangeFilters; -- cgit v1.3.1 From 9134ae6111f0d357428b8a15abc26a727fe465a4 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Wed, 27 Nov 2019 17:41:04 -0500 Subject: implemented not filter --- src/modlistsortproxy.cpp | 99 +++++++++++++++++++++++++++++++++++++----------- 1 file changed, 77 insertions(+), 22 deletions(-) (limited to 'src/modlistsortproxy.cpp') diff --git a/src/modlistsortproxy.cpp b/src/modlistsortproxy.cpp index ddae675c..d2a5e258 100644 --- a/src/modlistsortproxy.cpp +++ b/src/modlistsortproxy.cpp @@ -278,11 +278,11 @@ 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 (info->hasFlag(ModInfo::FLAG_SEPARATOR) && !m_FilterSeparators) { + return false; + } + for (auto iter = m_CategoryFilter.begin(); iter != m_CategoryFilter.end(); ++iter) { if (!categoryMatchesMod(info, enabled, *iter)) { return false; } @@ -299,82 +299,137 @@ 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 (info->hasFlag(ModInfo::FLAG_SEPARATOR) && !m_FilterSeparators) { + return false; + } + for (auto iter = m_CategoryFilter.begin(); iter != m_CategoryFilter.end(); ++iter) { if (categoryMatchesMod(info, enabled, *iter)) { return true; } } + if (!m_CategoryFilter.empty()) { + // nothing matched + return false; + } + foreach (int content, m_ContentFilter) { if (contentMatchesMod(info, enabled, content)) { return true; } } - return m_CategoryFilter.empty() && m_ContentFilter.empty(); + if (!m_ContentFilter.empty()) { + // nothing matched + return false; + } + + return true; } bool ModListSortProxy::categoryMatchesMod( ModInfo::Ptr info, bool enabled, int category) const { + bool b = false; + switch (category) { case CategoryFactory::CATEGORY_SPECIAL_CHECKED: - return (enabled || info->alwaysEnabled()); + { + b = (enabled || info->alwaysEnabled()); + break; + } case CategoryFactory::CATEGORY_SPECIAL_UNCHECKED: - return (!enabled && !info->alwaysEnabled()); + { + b = (!enabled && !info->alwaysEnabled()); + break; + } case CategoryFactory::CATEGORY_SPECIAL_UPDATEAVAILABLE: - return (info->updateAvailable() || info->downgradeAvailable()); + { + b = (info->updateAvailable() || info->downgradeAvailable()); + break; + } case CategoryFactory::CATEGORY_SPECIAL_NOCATEGORY: - return (info->getCategories().size() == 0); + { + b = (info->getCategories().size() == 0); + break; + } case CategoryFactory::CATEGORY_SPECIAL_CONFLICT: - return (hasConflictFlag(info->getFlags())); + { + b = (hasConflictFlag(info->getFlags())); + break; + } case CategoryFactory::CATEGORY_SPECIAL_NOTENDORSED: { ModInfo::EEndorsedState state = info->endorsedState(); - return (state != ModInfo::ENDORSED_TRUE); + b = (state != ModInfo::ENDORSED_TRUE); + break; } case CategoryFactory::CATEGORY_SPECIAL_BACKUP: - return (info->hasFlag(ModInfo::FLAG_BACKUP)); + { + b = (info->hasFlag(ModInfo::FLAG_BACKUP)); + break; + } case CategoryFactory::CATEGORY_SPECIAL_MANAGED: - return (!info->hasFlag(ModInfo::FLAG_FOREIGN)); + { + b = (!info->hasFlag(ModInfo::FLAG_FOREIGN)); + break; + } case CategoryFactory::CATEGORY_SPECIAL_UNMANAGED: - return (info->hasFlag(ModInfo::FLAG_FOREIGN)); + { + b = (info->hasFlag(ModInfo::FLAG_FOREIGN)); + break; + } case CategoryFactory::CATEGORY_SPECIAL_NOGAMEDATA: - return (info->hasFlag(ModInfo::FLAG_INVALID)); + { + b = (info->hasFlag(ModInfo::FLAG_INVALID)); + break; + } case CategoryFactory::CATEGORY_SPECIAL_NONEXUSID: { - return ( + b = ( info->getNexusID() == -1 && !info->hasFlag(ModInfo::FLAG_FOREIGN) && !info->hasFlag(ModInfo::FLAG_BACKUP) && !info->hasFlag(ModInfo::FLAG_OVERWRITE)); + + break; } default: { - return (info->categorySet(category)); + b = (info->categorySet(category)); + break; } } + + if (m_FilterNot) { + b = !b; + } + + return b; } bool ModListSortProxy::contentMatchesMod(ModInfo::Ptr info, bool enabled, int content) const { - return info->hasContent(static_cast(content)); + bool b = info->hasContent(static_cast(content)); + + if (m_FilterNot) { + b = !b; + } + + return b; } bool ModListSortProxy::filterMatchesMod(ModInfo::Ptr info, bool enabled) const -- cgit v1.3.1 From e99dfe153c62f914ada0605430305fca81a332a9 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Sat, 30 Nov 2019 01:53:09 -0500 Subject: renamed filters to criteria merged categories and content, they can be distinguished using the type added a not flag for criteria, not used yet --- src/filterlist.cpp | 116 +++++++++++++++++++++++++-------------------- src/filterlist.h | 14 +++--- src/mainwindow.cpp | 50 +++++++++----------- src/mainwindow.h | 4 +- src/mainwindow.ui | 38 +++++++-------- src/modlistsortproxy.cpp | 120 +++++++++++++++++------------------------------ src/modlistsortproxy.h | 42 +++++++++++------ 7 files changed, 182 insertions(+), 202 deletions(-) (limited to 'src/modlistsortproxy.cpp') diff --git a/src/filterlist.cpp b/src/filterlist.cpp index 5562736d..9e5437b3 100644 --- a/src/filterlist.cpp +++ b/src/filterlist.cpp @@ -6,6 +6,9 @@ using namespace MOBase; +const int CategoryIDRole = Qt::UserRole; +const int CategoryTypeRole = Qt::UserRole + 1; + FilterList::FilterList(Ui::MainWindow* ui, CategoryFactory& factory) : ui(ui), m_factory(factory) { @@ -29,61 +32,76 @@ FilterList::FilterList(Ui::MainWindow* ui, CategoryFactory& factory) ui->filtersOr, &QCheckBox::toggled, [&]{ onCriteriaChanged(); }); - connect( - ui->filtersNot, &QCheckBox::toggled, - [&]{ onCriteriaChanged(); }); - connect( ui->filtersSeparators, &QCheckBox::toggled, [&]{ onCriteriaChanged(); }); + + ui->filters->header()->setSectionResizeMode(0, QHeaderView::Stretch); + ui->filters->header()->resizeSection(1, 50); } -QTreeWidgetItem* FilterList::addFilterItem( +QTreeWidgetItem* FilterList::addCriteriaItem( QTreeWidgetItem *root, const QString &name, int categoryID, - ModListSortProxy::FilterType type) + ModListSortProxy::CriteriaType type) { QTreeWidgetItem *item = new QTreeWidgetItem(QStringList(name)); + item->setData(0, Qt::ToolTipRole, name); - item->setData(0, Qt::UserRole, categoryID); - item->setData(0, Qt::UserRole + 1, type); + item->setData(0, CategoryIDRole, categoryID); + item->setData(0, CategoryTypeRole, type); + if (root != nullptr) { root->addChild(item); } else { ui->filters->addTopLevelItem(item); } + + auto* w = new QWidget; + w->setStyleSheet("background-color: rgba(0,0,0,0)"); + + auto* ly = new QVBoxLayout(w); + ly->setAlignment(Qt::AlignCenter); + ly->setContentsMargins(0, 0, 0, 0); + + auto* cb = new QCheckBox; + connect(cb, &QCheckBox::toggled, [&]{ onSelection(); }); + ly->addWidget(cb); + + ui->filters->setItemWidget(item, 1, w); + return item; } -void FilterList::addContentFilters() +void FilterList::addContentCriteria() { for (unsigned i = 0; i < ModInfo::NUM_CONTENT_TYPES; ++i) { - addFilterItem( + addCriteriaItem( nullptr, tr("").arg(ModInfo::getContentTypeName(i)), i, ModListSortProxy::TYPE_CONTENT); } } -void FilterList::addCategoryFilters(QTreeWidgetItem *root, const std::set &categoriesUsed, int targetID) +void FilterList::addCategoryCriteria(QTreeWidgetItem *root, const std::set &categoriesUsed, int targetID) { - for (unsigned int i = 1; - i < static_cast(m_factory.numCategories()); ++i) { - if ((m_factory.getParentID(i) == targetID)) { + const auto count = static_cast(m_factory.numCategories()); + for (unsigned int i = 1; i < count; ++i) { + if (m_factory.getParentID(i) == targetID) { int categoryID = m_factory.getCategoryID(i); if (categoriesUsed.find(categoryID) != categoriesUsed.end()) { QTreeWidgetItem *item = - addFilterItem(root, m_factory.getCategoryName(i), + addCriteriaItem(root, m_factory.getCategoryName(i), categoryID, ModListSortProxy::TYPE_CATEGORY); if (m_factory.hasChildren(i)) { - addCategoryFilters(item, categoriesUsed, categoryID); + addCategoryCriteria(item, categoriesUsed, categoryID); } } } } } -void FilterList::addSpecialFilterItem(int type) +void FilterList::addSpecialCriteria(int type) { - addFilterItem( + addCriteriaItem( nullptr, m_factory.getSpecialCategoryName(type), type, ModListSortProxy::TYPE_SPECIAL); } @@ -98,19 +116,19 @@ void FilterList::refresh() ui->filters->clear(); using F = CategoryFactory; - addSpecialFilterItem(F::CATEGORY_SPECIAL_CHECKED); - addSpecialFilterItem(F::CATEGORY_SPECIAL_UNCHECKED); - addSpecialFilterItem(F::CATEGORY_SPECIAL_UPDATEAVAILABLE); - addSpecialFilterItem(F::CATEGORY_SPECIAL_BACKUP); - addSpecialFilterItem(F::CATEGORY_SPECIAL_MANAGED); - addSpecialFilterItem(F::CATEGORY_SPECIAL_UNMANAGED); - addSpecialFilterItem(F::CATEGORY_SPECIAL_NOCATEGORY); - addSpecialFilterItem(F::CATEGORY_SPECIAL_CONFLICT); - addSpecialFilterItem(F::CATEGORY_SPECIAL_NOTENDORSED); - addSpecialFilterItem(F::CATEGORY_SPECIAL_NONEXUSID); - addSpecialFilterItem(F::CATEGORY_SPECIAL_NOGAMEDATA); - - addContentFilters(); + addSpecialCriteria(F::CATEGORY_SPECIAL_CHECKED); + addSpecialCriteria(F::CATEGORY_SPECIAL_UNCHECKED); + addSpecialCriteria(F::CATEGORY_SPECIAL_UPDATEAVAILABLE); + addSpecialCriteria(F::CATEGORY_SPECIAL_BACKUP); + addSpecialCriteria(F::CATEGORY_SPECIAL_MANAGED); + addSpecialCriteria(F::CATEGORY_SPECIAL_UNMANAGED); + addSpecialCriteria(F::CATEGORY_SPECIAL_NOCATEGORY); + addSpecialCriteria(F::CATEGORY_SPECIAL_CONFLICT); + addSpecialCriteria(F::CATEGORY_SPECIAL_NOTENDORSED); + addSpecialCriteria(F::CATEGORY_SPECIAL_NONEXUSID); + addSpecialCriteria(F::CATEGORY_SPECIAL_NOGAMEDATA); + + addContentCriteria(); std::set categoriesUsed; for (unsigned int modIdx = 0; modIdx < ModInfo::getNumMods(); ++modIdx) { @@ -130,7 +148,7 @@ void FilterList::refresh() } } - addCategoryFilters(nullptr, categoriesUsed, 0); + addCategoryCriteria(nullptr, categoriesUsed, 0); for (const QString &item : selectedItems) { QList matches = ui->filters->findItems( @@ -145,7 +163,7 @@ void FilterList::refresh() void FilterList::setSelection(std::vector categories) { for (int i = 0; i < ui->filters->topLevelItemCount(); ++i) { - if (ui->filters->topLevelItem(i)->data(0, Qt::UserRole) == CategoryFactory::CATEGORY_SPECIAL_UPDATEAVAILABLE) { + if (ui->filters->topLevelItem(i)->data(0, CategoryIDRole) == CategoryFactory::CATEGORY_SPECIAL_UPDATEAVAILABLE) { ui->filters->setCurrentItem(ui->filters->topLevelItem(i)); break; } @@ -159,27 +177,24 @@ void FilterList::clearSelection() void FilterList::onSelection() { - QModelIndexList indices = ui->filters->selectionModel()->selectedRows(); - std::vector categories; - std::vector content; + const QModelIndexList indices = ui->filters->selectionModel()->selectedRows(); + std::vector criteria; - for (const QModelIndex &index : indices) { - const int filterType = index.data(Qt::UserRole + 1).toInt(); + for (auto* item: ui->filters->selectedItems()) { + const auto type = static_cast( + item->data(0, CategoryTypeRole).toInt()); - if ((filterType == ModListSortProxy::TYPE_CATEGORY) || (filterType == ModListSortProxy::TYPE_SPECIAL)) { - const int categoryId = index.data(Qt::UserRole).toInt(); - if (categoryId != CategoryFactory::CATEGORY_NONE) { - categories.push_back(categoryId); - } - } else if (filterType == ModListSortProxy::TYPE_CONTENT) { - const int contentId = index.data(Qt::UserRole).toInt(); - content.push_back(contentId); - } + const int id = item->data(0, CategoryIDRole).toInt(); + + auto* cb = static_cast(ui->filters->itemWidget(item, 1)); + const bool inverse = cb->isChecked(); + + criteria.push_back({type, id, inverse}); } - ui->filtersClear->setEnabled(categories.size() > 0 || content.size() >0); + ui->filtersClear->setEnabled(!criteria.empty()); - emit filtersChanged(categories, content); + emit criteriaChanged(criteria); } void FilterList::onContextMenu(const QPoint &pos) @@ -205,8 +220,7 @@ void FilterList::onCriteriaChanged() const auto mode = ui->filtersAnd->isChecked() ? ModListSortProxy::FILTER_AND : ModListSortProxy::FILTER_OR; - const bool inverse = ui->filtersNot->isChecked(); const bool separators = ui->filtersSeparators->isChecked(); - emit criteriaChanged(mode, inverse, separators); + emit optionsChanged(mode, separators); } diff --git a/src/filterlist.h b/src/filterlist.h index 85982392..418989e7 100644 --- a/src/filterlist.h +++ b/src/filterlist.h @@ -19,8 +19,8 @@ public: void refresh(); signals: - void filtersChanged(std::vector categories, std::vector content); - void criteriaChanged(ModListSortProxy::FilterMode mode, bool inverse, bool separators); + void criteriaChanged(std::vector criteria); + void optionsChanged(ModListSortProxy::FilterMode mode, bool separators); private: Ui::MainWindow* ui; @@ -32,14 +32,14 @@ private: void editCategories(); - QTreeWidgetItem* addFilterItem( + QTreeWidgetItem* addCriteriaItem( QTreeWidgetItem *root, const QString &name, int categoryID, - ModListSortProxy::FilterType type); + ModListSortProxy::CriteriaType type); - void addContentFilters(); - void addCategoryFilters( + void addContentCriteria(); + void addCategoryCriteria( QTreeWidgetItem *root, const std::set &categoriesUsed, int targetID); - void addSpecialFilterItem(int type); + void addSpecialCriteria(int type); }; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 1319d906..03d61bc6 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -264,12 +264,12 @@ MainWindow::MainWindow(Settings &settings m_Filters.reset(new FilterList(ui, m_CategoryFactory)); connect( - m_Filters.get(), &FilterList::filtersChanged, - [&](auto&& cats, auto&& content) { onFilters(cats, content); }); + m_Filters.get(), &FilterList::criteriaChanged, + [&](auto&& v) { onFiltersCriteria(v); }); connect( - m_Filters.get(), &FilterList::criteriaChanged, - [&](auto mode, bool inv, bool sep) { onFiltersCriteria(mode, inv, sep); }); + m_Filters.get(), &FilterList::optionsChanged, + [&](auto mode, bool sep) { onFiltersOptions(mode, sep); }); ui->logList->setCore(m_OrganizerCore); @@ -4124,7 +4124,12 @@ void MainWindow::checkModsForUpdates() } if (updatesAvailable || checkingModsForUpdate) { - m_ModListSortProxy->setCategoryFilter(boost::assign::list_of(CategoryFactory::CATEGORY_SPECIAL_UPDATEAVAILABLE)); + m_ModListSortProxy->setCriteria({{ + ModListSortProxy::TYPE_SPECIAL, + CategoryFactory::CATEGORY_SPECIAL_UPDATEAVAILABLE, + false} + }); + m_Filters->setSelection({CategoryFactory::CATEGORY_SPECIAL_UPDATEAVAILABLE}); } } @@ -6111,44 +6116,31 @@ void MainWindow::refreshFilters() } } -void MainWindow::onFilters( - const std::vector& categories, const std::vector& content) +void MainWindow::onFiltersCriteria(const std::vector& criteria) { - m_ModListSortProxy->setCategoryFilter(categories); - m_ModListSortProxy->setContentFilter(content); + m_ModListSortProxy->setCriteria(criteria); QString label = "?"; - if ((categories.size() + content.size()) > 1) { - label = tr(""); - } else if (!categories.empty()) { - const int c = categories[0]; - label = m_CategoryFactory.getCategoryNameByID(c); + if (criteria.empty()) { + label = ""; + } else if (criteria.size() == 1) { + const auto& c = criteria[0]; + label = m_CategoryFactory.getCategoryNameByID(c.id); if (label.isEmpty()) { - log::error("category '{}' not found", c); - } - } else if (!content.empty()) { - const int c = content[0]; - try { - label = ModInfo::getContentTypeName(c); - } - catch(std::exception&) { - log::error("content filter '{}' not found", c); + log::error("category '{}' not found", c.id); } } else { - label = ""; + label = tr(""); } ui->currentCategoryLabel->setText(label); ui->modList->reset(); } -void MainWindow::onFiltersCriteria( - ModListSortProxy::FilterMode mode, bool inverse, bool separators) +void MainWindow::onFiltersOptions(ModListSortProxy::FilterMode mode, bool separators) { - m_ModListSortProxy->setFilterMode(mode); - m_ModListSortProxy->setFilterNot(inverse); - m_ModListSortProxy->setFilterSeparators(separators); + m_ModListSortProxy->setOptions(mode, separators); } void MainWindow::updateESPLock(bool locked) diff --git a/src/mainwindow.h b/src/mainwindow.h index 9837378b..0b559300 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -514,8 +514,8 @@ private slots: void deselectFilters(); void refreshFilters(); - void onFilters(const std::vector& categories, const std::vector& content); - void onFiltersCriteria(ModListSortProxy::FilterMode mode, bool inverse, bool separators); + void onFiltersCriteria(const std::vector& filters); + void onFiltersOptions(ModListSortProxy::FilterMode mode, bool separators); void displayModInformation(const QString &modName, ModInfoTabIDs tabID); diff --git a/src/mainwindow.ui b/src/mainwindow.ui index ed35f783..7cc7dca4 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -85,12 +85,26 @@ true + + false + + true + + + true + + false - 1 + Category + + + + + Invert @@ -152,16 +166,6 @@ - - - - Invert each selected category - - - Not - - - @@ -351,9 +355,6 @@ p, li { white-space: pre-wrap; } Qt::CustomContextMenu - - List of available mods. - This is a list of installed mods. Use the checkboxes to activate/deactivate mods and drag & drop mods to change their "installation" orders. @@ -448,14 +449,7 @@ p, li { white-space: pre-wrap; } - - - - 8 - true - - - + diff --git a/src/modlistsortproxy.cpp b/src/modlistsortproxy.cpp index d2a5e258..646401b9 100644 --- a/src/modlistsortproxy.cpp +++ b/src/modlistsortproxy.cpp @@ -38,7 +38,6 @@ ModListSortProxy::ModListSortProxy(Profile* profile, QObject *parent) , m_Profile(profile) , m_FilterActive(false) , m_FilterMode(FILTER_AND) - , m_FilterNot(false) , m_FilterSeparators(false) { setDynamicSortFilter(true); // this seems to work without dynamicsortfilter @@ -52,26 +51,20 @@ void ModListSortProxy::setProfile(Profile *profile) void ModListSortProxy::updateFilterActive() { - m_FilterActive = ((m_CategoryFilter.size() > 0) - || (m_ContentFilter.size() > 0) - || !m_CurrentFilter.isEmpty()); + m_FilterActive = (!m_Criteria.empty() || !m_Filter.isEmpty()); emit filterActive(m_FilterActive); } -void ModListSortProxy::setCategoryFilter(const std::vector &categories) +void ModListSortProxy::setCriteria(const std::vector& criteria) { - //avoid refreshing the filter unless we are checking all mods for update. - if (categories != m_CategoryFilter || (!categories.empty() && categories.at(0) == CategoryFactory::CATEGORY_SPECIAL_UPDATEAVAILABLE)) { - m_CategoryFilter = categories; - updateFilterActive(); - invalidate(); - } -} - -void ModListSortProxy::setContentFilter(const std::vector &content) -{ - if (content != m_ContentFilter) { - m_ContentFilter = content; + // avoid refreshing the filter unless we are checking all mods for update. + const bool changed = (criteria != m_Criteria); + const bool isForUpdates = ( + !criteria.empty() && + criteria[0].id == CategoryFactory::CATEGORY_SPECIAL_UPDATEAVAILABLE); + + if (changed || isForUpdates) { + m_Criteria = criteria; updateFilterActive(); invalidate(); } @@ -248,12 +241,10 @@ bool ModListSortProxy::lessThan(const QModelIndex &left, return lt; } -void ModListSortProxy::updateFilter(const QString &filter) +void ModListSortProxy::updateFilter(const QString& filter) { - m_CurrentFilter = filter; + m_Filter = filter; updateFilterActive(); - // using invalidateFilter here should be enough but that crashes the application? WTF? - // invalidateFilter(); invalidate(); } @@ -282,14 +273,8 @@ bool ModListSortProxy::filterMatchesModAnd(ModInfo::Ptr info, bool enabled) cons return false; } - for (auto iter = m_CategoryFilter.begin(); iter != m_CategoryFilter.end(); ++iter) { - if (!categoryMatchesMod(info, enabled, *iter)) { - return false; - } - } - - foreach (int content, m_ContentFilter) { - if (!contentMatchesMod(info, enabled, content)) { + for (auto&& c : m_Criteria) { + if (!criteriaMatchesMod(info, enabled, c)) { return false; } } @@ -303,29 +288,35 @@ bool ModListSortProxy::filterMatchesModOr(ModInfo::Ptr info, bool enabled) const return false; } - for (auto iter = m_CategoryFilter.begin(); iter != m_CategoryFilter.end(); ++iter) { - if (categoryMatchesMod(info, enabled, *iter)) { + for (auto&& c : m_Criteria) { + if (criteriaMatchesMod(info, enabled, c)) { return true; } } - if (!m_CategoryFilter.empty()) { + if (!m_Criteria.empty()) { // nothing matched return false; } - foreach (int content, m_ContentFilter) { - if (contentMatchesMod(info, enabled, content)) { - return true; - } - } + return true; +} - if (!m_ContentFilter.empty()) { - // nothing matched - return false; - } +bool ModListSortProxy::criteriaMatchesMod( + ModInfo::Ptr info, bool enabled, const Criteria& c) const +{ + switch (c.type) + { + case TYPE_SPECIAL: // fall-through + case TYPE_CATEGORY: + return categoryMatchesMod(info, enabled, c.id); - return true; + case TYPE_CONTENT: + return contentMatchesMod(info, enabled, c.id); + + default: + return false; + } } bool ModListSortProxy::categoryMatchesMod( @@ -414,29 +405,19 @@ bool ModListSortProxy::categoryMatchesMod( } } - if (m_FilterNot) { - b = !b; - } - return b; } bool ModListSortProxy::contentMatchesMod(ModInfo::Ptr info, bool enabled, int content) const { - bool b = info->hasContent(static_cast(content)); - - if (m_FilterNot) { - b = !b; - } - - return b; + return info->hasContent(static_cast(content)); } bool ModListSortProxy::filterMatchesMod(ModInfo::Ptr info, bool enabled) const { - if (!m_CurrentFilter.isEmpty()) { + if (!m_Filter.isEmpty()) { bool display = false; - QString filterCopy = QString(m_CurrentFilter); + QString filterCopy = QString(m_Filter); filterCopy.replace("||", ";").replace("OR", ";").replace("|", ";"); QStringList ORList = filterCopy.split(";", QString::SkipEmptyParts); @@ -527,26 +508,11 @@ void ModListSortProxy::setColumnVisible(int column, bool visible) m_EnabledColumns[column] = visible; } -void ModListSortProxy::setFilterMode(ModListSortProxy::FilterMode mode) +void ModListSortProxy::setOptions(ModListSortProxy::FilterMode mode, bool separators) { - if (m_FilterMode != mode) { + if (m_FilterMode != mode || separators != m_FilterSeparators) { m_FilterMode = mode; - this->invalidate(); - } -} - -void ModListSortProxy::setFilterNot(bool b) -{ - if (b != m_FilterNot) { - m_FilterNot = b; - this->invalidate(); - } -} - -void ModListSortProxy::setFilterSeparators(bool b) -{ - if (b != m_FilterSeparators) { - m_FilterSeparators = b; + m_FilterSeparators = separators; this->invalidate(); } } @@ -623,8 +589,8 @@ void ModListSortProxy::aboutToChangeData() // (at least with some Qt versions) // this may be related to the fact that the item being edited may disappear from the view as a // result of the edit - m_PreChangeFilters = categoryFilter(); - setCategoryFilter(std::vector()); + m_PreChangeCriteria = m_Criteria; + setCriteria({}); } void ModListSortProxy::postDataChanged() @@ -633,8 +599,8 @@ void ModListSortProxy::postDataChanged() // or at least the view continues to think it's being edited. As a result no new editor can be // opened QTimer::singleShot(10, [this] () { - setCategoryFilter(m_PreChangeFilters); - m_PreChangeFilters.clear(); + setCriteria(m_PreChangeCriteria); + m_PreChangeCriteria.clear(); }); } diff --git a/src/modlistsortproxy.h b/src/modlistsortproxy.h index 2ebfbcf0..5aeaccce 100644 --- a/src/modlistsortproxy.h +++ b/src/modlistsortproxy.h @@ -37,22 +37,38 @@ public: FILTER_OR }; - enum FilterType { + enum CriteriaType { TYPE_SPECIAL, TYPE_CATEGORY, TYPE_CONTENT }; + struct Criteria + { + CriteriaType type; + int id; + bool inverse; + + bool operator==(const Criteria& other) const + { + return + (type == other.type) && + (id == other.id) && + (inverse == other.inverse); + } + + bool operator!=(const Criteria& other) const + { + return !(*this == other); + } + }; + public: explicit ModListSortProxy(Profile *profile, QObject *parent = 0); void setProfile(Profile *profile); - void setCategoryFilter(const std::vector &categories); - std::vector categoryFilter() const { return m_CategoryFilter; } - - void setContentFilter(const std::vector &content); virtual Qt::ItemFlags flags(const QModelIndex &modelIndex) const; virtual bool dropMimeData(const QMimeData *data, Qt::DropAction action, @@ -84,9 +100,8 @@ public: */ bool isFilterActive() const { return m_FilterActive; } - void setFilterMode(FilterMode mode); - void setFilterNot(bool b); - void setFilterSeparators(bool b); + void setCriteria(const std::vector& criteria); + void setOptions(FilterMode mode, bool separators); /** * @brief tests if the specified index has child nodes @@ -131,19 +146,18 @@ private slots: void postDataChanged(); private: - Profile *m_Profile; - std::vector m_CategoryFilter; - std::vector m_ContentFilter; + Profile* m_Profile; + std::vector m_Criteria; + QString m_Filter; std::bitset m_EnabledColumns; - QString m_CurrentFilter; bool m_FilterActive; FilterMode m_FilterMode; - bool m_FilterNot; bool m_FilterSeparators; - std::vector m_PreChangeFilters; + std::vector m_PreChangeCriteria; + bool criteriaMatchesMod(ModInfo::Ptr info, bool enabled, const Criteria& c) const; bool categoryMatchesMod(ModInfo::Ptr info, bool enabled, int category) const; bool contentMatchesMod(ModInfo::Ptr info, bool enabled, int content) const; }; -- cgit v1.3.1 From ed14d5510d932362f8e232496b824729e096d3cf Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Sat, 30 Nov 2019 02:20:18 -0500 Subject: implemented not flag moved stuff to CriteriaItem fixed jumbled names in getSpecialCategoryName() --- src/categories.cpp | 16 ++++---- src/filterlist.cpp | 102 +++++++++++++++++++++++++++++++++-------------- src/filterlist.h | 2 + src/modlistsortproxy.cpp | 23 +++++++++-- 4 files changed, 102 insertions(+), 41 deletions(-) (limited to 'src/modlistsortproxy.cpp') diff --git a/src/categories.cpp b/src/categories.cpp index 082b4fbc..b75efefa 100644 --- a/src/categories.cpp +++ b/src/categories.cpp @@ -327,14 +327,14 @@ QString CategoryFactory::getSpecialCategoryName(int type) const case CATEGORY_SPECIAL_CHECKED: return QObject::tr(""); case CATEGORY_SPECIAL_UNCHECKED: return QObject::tr(""); case CATEGORY_SPECIAL_UPDATEAVAILABLE: return QObject::tr(""); - case CATEGORY_SPECIAL_NOCATEGORY: return QObject::tr(""); - case CATEGORY_SPECIAL_CONFLICT: return QObject::tr(""); - case CATEGORY_SPECIAL_NOTENDORSED: return QObject::tr(""); - case CATEGORY_SPECIAL_BACKUP: return QObject::tr(""); - case CATEGORY_SPECIAL_MANAGED: return QObject::tr(""); - case CATEGORY_SPECIAL_UNMANAGED: return QObject::tr(""); - case CATEGORY_SPECIAL_NOGAMEDATA: return QObject::tr(""); - case CATEGORY_SPECIAL_NONEXUSID: return QObject::tr(""); + case CATEGORY_SPECIAL_NOCATEGORY: return QObject::tr(""); + case CATEGORY_SPECIAL_CONFLICT: return QObject::tr(""); + case CATEGORY_SPECIAL_NOTENDORSED: return QObject::tr(""); + case CATEGORY_SPECIAL_BACKUP: return QObject::tr(""); + case CATEGORY_SPECIAL_MANAGED: return QObject::tr(""); + case CATEGORY_SPECIAL_UNMANAGED: return QObject::tr(""); + case CATEGORY_SPECIAL_NOGAMEDATA: return QObject::tr(""); + case CATEGORY_SPECIAL_NONEXUSID: return QObject::tr(""); default: return {}; } } diff --git a/src/filterlist.cpp b/src/filterlist.cpp index 9e5437b3..31783c88 100644 --- a/src/filterlist.cpp +++ b/src/filterlist.cpp @@ -5,9 +5,60 @@ #include using namespace MOBase; +using CriteriaType = ModListSortProxy::CriteriaType; +using Criteria = ModListSortProxy::Criteria; + +class FilterList::CriteriaItem : public QTreeWidgetItem +{ +public: + CriteriaItem(FilterList* list, QString name, CriteriaType type, int id) + : QTreeWidgetItem({name}), m_list(list), m_widget(nullptr), m_checkbox(nullptr) + { + setData(0, Qt::ToolTipRole, name); + setData(0, TypeRole, type); + setData(0, IDRole, id); + + m_widget = new QWidget; + m_widget->setStyleSheet("background-color: rgba(0,0,0,0)"); + + auto* ly = new QVBoxLayout(m_widget); + ly->setAlignment(Qt::AlignCenter); + ly->setContentsMargins(0, 0, 0, 0); + + m_checkbox = new QCheckBox; + QObject::connect(m_checkbox, &QCheckBox::toggled, [&]{ m_list->onSelection(); }); + ly->addWidget(m_checkbox); + } + + QWidget* widget() + { + return m_widget; + } + + CriteriaType type() const + { + return static_cast(data(0, TypeRole).toInt()); + } + + int id() const + { + return data(0, IDRole).toInt(); + } + + bool inverse() const + { + return m_checkbox->isChecked(); + } + +private: + const int IDRole = Qt::UserRole; + const int TypeRole = Qt::UserRole + 1; + + FilterList* m_list; + QWidget* m_widget; + QCheckBox* m_checkbox; +}; -const int CategoryIDRole = Qt::UserRole; -const int CategoryTypeRole = Qt::UserRole + 1; FilterList::FilterList(Ui::MainWindow* ui, CategoryFactory& factory) : ui(ui), m_factory(factory) @@ -42,13 +93,9 @@ FilterList::FilterList(Ui::MainWindow* ui, CategoryFactory& factory) QTreeWidgetItem* FilterList::addCriteriaItem( QTreeWidgetItem *root, const QString &name, int categoryID, - ModListSortProxy::CriteriaType type) + CriteriaType type) { - QTreeWidgetItem *item = new QTreeWidgetItem(QStringList(name)); - - item->setData(0, Qt::ToolTipRole, name); - item->setData(0, CategoryIDRole, categoryID); - item->setData(0, CategoryTypeRole, type); + auto* item = new CriteriaItem(this, name, type, categoryID); if (root != nullptr) { root->addChild(item); @@ -56,18 +103,7 @@ QTreeWidgetItem* FilterList::addCriteriaItem( ui->filters->addTopLevelItem(item); } - auto* w = new QWidget; - w->setStyleSheet("background-color: rgba(0,0,0,0)"); - - auto* ly = new QVBoxLayout(w); - ly->setAlignment(Qt::AlignCenter); - ly->setContentsMargins(0, 0, 0, 0); - - auto* cb = new QCheckBox; - connect(cb, &QCheckBox::toggled, [&]{ onSelection(); }); - ly->addWidget(cb); - - ui->filters->setItemWidget(item, 1, w); + ui->filters->setItemWidget(item, 1, item->widget()); return item; } @@ -163,7 +199,14 @@ void FilterList::refresh() void FilterList::setSelection(std::vector categories) { for (int i = 0; i < ui->filters->topLevelItemCount(); ++i) { - if (ui->filters->topLevelItem(i)->data(0, CategoryIDRole) == CategoryFactory::CATEGORY_SPECIAL_UPDATEAVAILABLE) { + const auto* item = dynamic_cast( + ui->filters->topLevelItem(i)); + + if (!item) { + continue; + } + + if (item->id() == CategoryFactory::CATEGORY_SPECIAL_UPDATEAVAILABLE) { ui->filters->setCurrentItem(ui->filters->topLevelItem(i)); break; } @@ -178,18 +221,17 @@ void FilterList::clearSelection() void FilterList::onSelection() { const QModelIndexList indices = ui->filters->selectionModel()->selectedRows(); - std::vector criteria; + std::vector criteria; for (auto* item: ui->filters->selectedItems()) { - const auto type = static_cast( - item->data(0, CategoryTypeRole).toInt()); - - const int id = item->data(0, CategoryIDRole).toInt(); - - auto* cb = static_cast(ui->filters->itemWidget(item, 1)); - const bool inverse = cb->isChecked(); + const auto* ci = dynamic_cast(item); + if (!ci) { + continue; + } - criteria.push_back({type, id, inverse}); + criteria.push_back({ + ci->type(), ci->id(), ci->inverse() + }); } ui->filtersClear->setEnabled(!criteria.empty()); diff --git a/src/filterlist.h b/src/filterlist.h index 418989e7..72fe3b5f 100644 --- a/src/filterlist.h +++ b/src/filterlist.h @@ -23,6 +23,8 @@ signals: void optionsChanged(ModListSortProxy::FilterMode mode, bool separators); private: + class CriteriaItem; + Ui::MainWindow* ui; CategoryFactory& m_factory; diff --git a/src/modlistsortproxy.cpp b/src/modlistsortproxy.cpp index 646401b9..3bb02c0f 100644 --- a/src/modlistsortproxy.cpp +++ b/src/modlistsortproxy.cpp @@ -305,18 +305,35 @@ bool ModListSortProxy::filterMatchesModOr(ModInfo::Ptr info, bool enabled) const bool ModListSortProxy::criteriaMatchesMod( ModInfo::Ptr info, bool enabled, const Criteria& c) const { + bool b = false; + switch (c.type) { case TYPE_SPECIAL: // fall-through case TYPE_CATEGORY: - return categoryMatchesMod(info, enabled, c.id); + { + b = categoryMatchesMod(info, enabled, c.id); + break; + } case TYPE_CONTENT: - return contentMatchesMod(info, enabled, c.id); + { + b = contentMatchesMod(info, enabled, c.id); + break; + } default: - return false; + { + log::error("bad criteria type {}", c.type); + break; + } } + + if (c.inverse) { + b = !b; + } + + return b; } bool ModListSortProxy::categoryMatchesMod( -- cgit v1.3.1 From a38d1723bffcd20bc7011c0fe635636b936aa78b Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Sat, 30 Nov 2019 03:21:23 -0500 Subject: removed redundant categories now that there's a not filter disabled collapsing for filter, there's already a button to hide it --- src/categories.cpp | 24 +++++++++++------------- src/categories.h | 31 +++++++++++++------------------ src/filterlist.cpp | 28 +++++++++++++++------------- src/mainwindow.cpp | 4 ++-- src/mainwindow.ui | 3 +++ src/modlistsortproxy.cpp | 32 ++++++++++---------------------- 6 files changed, 54 insertions(+), 68 deletions(-) (limited to 'src/modlistsortproxy.cpp') diff --git a/src/categories.cpp b/src/categories.cpp index b75efefa..1bd56f7f 100644 --- a/src/categories.cpp +++ b/src/categories.cpp @@ -320,21 +320,19 @@ QString CategoryFactory::getCategoryName(unsigned int index) const return m_Categories[index].m_Name; } -QString CategoryFactory::getSpecialCategoryName(int type) const +QString CategoryFactory::getSpecialCategoryName(SpecialCategories type) const { switch (type) { - case CATEGORY_SPECIAL_CHECKED: return QObject::tr(""); - case CATEGORY_SPECIAL_UNCHECKED: return QObject::tr(""); - case CATEGORY_SPECIAL_UPDATEAVAILABLE: return QObject::tr(""); - case CATEGORY_SPECIAL_NOCATEGORY: return QObject::tr(""); - case CATEGORY_SPECIAL_CONFLICT: return QObject::tr(""); - case CATEGORY_SPECIAL_NOTENDORSED: return QObject::tr(""); - case CATEGORY_SPECIAL_BACKUP: return QObject::tr(""); - case CATEGORY_SPECIAL_MANAGED: return QObject::tr(""); - case CATEGORY_SPECIAL_UNMANAGED: return QObject::tr(""); - case CATEGORY_SPECIAL_NOGAMEDATA: return QObject::tr(""); - case CATEGORY_SPECIAL_NONEXUSID: return QObject::tr(""); + case Checked: return QObject::tr(""); + case UpdateAvailable: return QObject::tr(""); + case HasNoCategory: return QObject::tr(""); + case Conflict: return QObject::tr(""); + case NotEndorsed: return QObject::tr(""); + case Backup: return QObject::tr(""); + case Managed: return QObject::tr(""); + case NoGameData: return QObject::tr(""); + case NoNexusID: return QObject::tr(""); default: return {}; } } @@ -344,7 +342,7 @@ QString CategoryFactory::getCategoryNameByID(int id) const auto itor = m_IDMap.find(id); if (itor == m_IDMap.end()) { - return getSpecialCategoryName(id); + return getSpecialCategoryName(static_cast(id)); } else { const auto index = itor->second; if (index >= m_Categories.size()) { diff --git a/src/categories.h b/src/categories.h index 2041ce1f..296e7711 100644 --- a/src/categories.h +++ b/src/categories.h @@ -37,25 +37,20 @@ class CategoryFactory { friend class CategoriesDialog; public: - - static const int CATEGORY_NONE = 0; - - static const int CATEGORY_SPECIAL_FIRST = 10000; - static const int CATEGORY_SPECIAL_CHECKED = CATEGORY_SPECIAL_FIRST; - static const int CATEGORY_SPECIAL_UNCHECKED = 10001; - static const int CATEGORY_SPECIAL_UPDATEAVAILABLE = 10002; - static const int CATEGORY_SPECIAL_NOCATEGORY = 10003; - static const int CATEGORY_SPECIAL_CONFLICT = 10004; - static const int CATEGORY_SPECIAL_NOTENDORSED = 10005; - static const int CATEGORY_SPECIAL_BACKUP = 10006; - static const int CATEGORY_SPECIAL_MANAGED = 10007; - static const int CATEGORY_SPECIAL_UNMANAGED = 10008; - static const int CATEGORY_SPECIAL_NOGAMEDATA = 10009; - static const int CATEGORY_SPECIAL_NONEXUSID = 10010; - + enum SpecialCategories + { + Checked = 10000, + UpdateAvailable, + HasNoCategory, + Conflict, + NotEndorsed, + Backup, + Managed, + NoGameData, + NoNexusID + }; public: - struct Category { Category(int sortValue, int id, const QString &name, const std::vector &nexusIDs, int parentID) : m_SortValue(sortValue), m_ID(id), m_Name(name), m_HasChildren(false), @@ -144,7 +139,7 @@ public: * @return QString name of the category **/ QString getCategoryName(unsigned int index) const; - QString getSpecialCategoryName(int type) const; + QString getSpecialCategoryName(SpecialCategories type) const; QString getCategoryNameByID(int id) const; /** diff --git a/src/filterlist.cpp b/src/filterlist.cpp index 8f297af6..36cdacd0 100644 --- a/src/filterlist.cpp +++ b/src/filterlist.cpp @@ -94,6 +94,8 @@ FilterList::FilterList(Ui::MainWindow* ui, CategoryFactory& factory) ui->filters->header()->setSectionResizeMode(0, QHeaderView::Stretch); ui->filters->header()->resizeSection(1, 50); + ui->categoriesSplitter->setCollapsible(0, false); + ui->categoriesSplitter->setCollapsible(1, false); } QTreeWidgetItem* FilterList::addCriteriaItem( @@ -142,8 +144,10 @@ void FilterList::addCategoryCriteria(QTreeWidgetItem *root, const std::set void FilterList::addSpecialCriteria(int type) { + const auto sc = static_cast(type); + addCriteriaItem( - nullptr, m_factory.getSpecialCategoryName(type), + nullptr, m_factory.getSpecialCategoryName(sc), type, ModListSortProxy::TYPE_SPECIAL); } @@ -157,17 +161,15 @@ void FilterList::refresh() ui->filters->clear(); using F = CategoryFactory; - addSpecialCriteria(F::CATEGORY_SPECIAL_CHECKED); - addSpecialCriteria(F::CATEGORY_SPECIAL_UNCHECKED); - addSpecialCriteria(F::CATEGORY_SPECIAL_UPDATEAVAILABLE); - addSpecialCriteria(F::CATEGORY_SPECIAL_BACKUP); - addSpecialCriteria(F::CATEGORY_SPECIAL_MANAGED); - addSpecialCriteria(F::CATEGORY_SPECIAL_UNMANAGED); - addSpecialCriteria(F::CATEGORY_SPECIAL_NOCATEGORY); - addSpecialCriteria(F::CATEGORY_SPECIAL_CONFLICT); - addSpecialCriteria(F::CATEGORY_SPECIAL_NOTENDORSED); - addSpecialCriteria(F::CATEGORY_SPECIAL_NONEXUSID); - addSpecialCriteria(F::CATEGORY_SPECIAL_NOGAMEDATA); + addSpecialCriteria(F::Checked); + addSpecialCriteria(F::UpdateAvailable); + addSpecialCriteria(F::Backup); + addSpecialCriteria(F::Managed); + addSpecialCriteria(F::HasNoCategory); + addSpecialCriteria(F::Conflict); + addSpecialCriteria(F::NotEndorsed); + addSpecialCriteria(F::NoNexusID); + addSpecialCriteria(F::NoGameData); addContentCriteria(); @@ -211,7 +213,7 @@ void FilterList::setSelection(std::vector categories) continue; } - if (item->id() == CategoryFactory::CATEGORY_SPECIAL_UPDATEAVAILABLE) { + if (item->id() == CategoryFactory::UpdateAvailable) { ui->filters->setCurrentItem(ui->filters->topLevelItem(i)); break; } diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 03d61bc6..0ad57803 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -4126,11 +4126,11 @@ void MainWindow::checkModsForUpdates() if (updatesAvailable || checkingModsForUpdate) { m_ModListSortProxy->setCriteria({{ ModListSortProxy::TYPE_SPECIAL, - CategoryFactory::CATEGORY_SPECIAL_UPDATEAVAILABLE, + CategoryFactory::UpdateAvailable, false} }); - m_Filters->setSelection({CategoryFactory::CATEGORY_SPECIAL_UPDATEAVAILABLE}); + m_Filters->setSelection({CategoryFactory::UpdateAvailable}); } } diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 7cc7dca4..6c35d239 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -39,6 +39,9 @@ Qt::Horizontal + + false + diff --git a/src/modlistsortproxy.cpp b/src/modlistsortproxy.cpp index 3bb02c0f..36dcae59 100644 --- a/src/modlistsortproxy.cpp +++ b/src/modlistsortproxy.cpp @@ -61,7 +61,7 @@ void ModListSortProxy::setCriteria(const std::vector& criteria) const bool changed = (criteria != m_Criteria); const bool isForUpdates = ( !criteria.empty() && - criteria[0].id == CategoryFactory::CATEGORY_SPECIAL_UPDATEAVAILABLE); + criteria[0].id == CategoryFactory::UpdateAvailable); if (changed || isForUpdates) { m_Criteria = criteria; @@ -343,68 +343,56 @@ bool ModListSortProxy::categoryMatchesMod( switch (category) { - case CategoryFactory::CATEGORY_SPECIAL_CHECKED: + case CategoryFactory::Checked: { b = (enabled || info->alwaysEnabled()); break; } - case CategoryFactory::CATEGORY_SPECIAL_UNCHECKED: - { - b = (!enabled && !info->alwaysEnabled()); - break; - } - - case CategoryFactory::CATEGORY_SPECIAL_UPDATEAVAILABLE: + case CategoryFactory::UpdateAvailable: { b = (info->updateAvailable() || info->downgradeAvailable()); break; } - case CategoryFactory::CATEGORY_SPECIAL_NOCATEGORY: + case CategoryFactory::HasNoCategory: { b = (info->getCategories().size() == 0); break; } - case CategoryFactory::CATEGORY_SPECIAL_CONFLICT: + case CategoryFactory::Conflict: { b = (hasConflictFlag(info->getFlags())); break; } - case CategoryFactory::CATEGORY_SPECIAL_NOTENDORSED: + case CategoryFactory::NotEndorsed: { ModInfo::EEndorsedState state = info->endorsedState(); b = (state != ModInfo::ENDORSED_TRUE); break; } - case CategoryFactory::CATEGORY_SPECIAL_BACKUP: + case CategoryFactory::Backup: { b = (info->hasFlag(ModInfo::FLAG_BACKUP)); break; } - case CategoryFactory::CATEGORY_SPECIAL_MANAGED: + case CategoryFactory::Managed: { b = (!info->hasFlag(ModInfo::FLAG_FOREIGN)); break; } - case CategoryFactory::CATEGORY_SPECIAL_UNMANAGED: - { - b = (info->hasFlag(ModInfo::FLAG_FOREIGN)); - break; - } - - case CategoryFactory::CATEGORY_SPECIAL_NOGAMEDATA: + case CategoryFactory::NoGameData: { b = (info->hasFlag(ModInfo::FLAG_INVALID)); break; } - case CategoryFactory::CATEGORY_SPECIAL_NONEXUSID: + case CategoryFactory::NoNexusID: { b = ( info->getNexusID() == -1 && -- cgit v1.3.1 From 7f4fce35f97f262c36e4c00dad55c1b078cf3758 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Sat, 30 Nov 2019 05:23:22 -0500 Subject: fixed separators option being used even without filters changed filter list to use tristate items without selection --- src/filterlist.cpp | 232 ++++++++++++++++++++++++++++------------------- src/filterlist.h | 8 +- src/mainwindow.ui | 64 +++++++------ src/modlistsortproxy.cpp | 26 +++++- src/modlistsortproxy.h | 3 +- 5 files changed, 204 insertions(+), 129 deletions(-) (limited to 'src/modlistsortproxy.cpp') diff --git a/src/filterlist.cpp b/src/filterlist.cpp index 81f8b670..0dee8544 100644 --- a/src/filterlist.cpp +++ b/src/filterlist.cpp @@ -11,28 +11,23 @@ using Criteria = ModListSortProxy::Criteria; class FilterList::CriteriaItem : public QTreeWidgetItem { public: - CriteriaItem(FilterList* list, QString name, CriteriaType type, int id) - : QTreeWidgetItem({name}), m_list(list), m_widget(nullptr), m_checkbox(nullptr) + enum States : int { - setData(0, Qt::ToolTipRole, name); - setData(0, TypeRole, type); - setData(0, IDRole, id); - - m_widget = new QWidget; - m_widget->setStyleSheet("background-color: rgba(0,0,0,0)"); + FirstState = 0, - auto* ly = new QVBoxLayout(m_widget); - ly->setAlignment(Qt::AlignCenter); - ly->setContentsMargins(0, 0, 0, 0); + Inactive = FirstState, + Active, + Inverted, - m_checkbox = new QCheckBox; - QObject::connect(m_checkbox, &QCheckBox::toggled, [&]{ m_list->onSelection(); }); - ly->addWidget(m_checkbox); - } + LastState = Inverted + }; - QWidget* widget() + CriteriaItem(FilterList* list, QString name, CriteriaType type, int id) + : QTreeWidgetItem({"", name}), m_list(list), m_state(Inactive) { - return m_widget; + setData(0, Qt::ToolTipRole, name); + setData(0, TypeRole, type); + setData(0, IDRole, id); } CriteriaType type() const @@ -45,14 +40,37 @@ public: return data(0, IDRole).toInt(); } - bool inverse() const + States state() const + { + return m_state; + } + + void setState(States s) { - return m_checkbox->isChecked(); + if (m_state != s) { + m_state = s; + updateState(); + } } - void setInverted(bool b) + void nextState() { - m_checkbox->setChecked(b); + m_state = static_cast(m_state + 1); + if (m_state > LastState) { + m_state = FirstState; + } + + updateState(); + } + + void previousState() + { + m_state = static_cast(m_state - 1); + if (m_state < FirstState) { + m_state = LastState; + } + + updateState(); } private: @@ -60,40 +78,91 @@ private: const int TypeRole = Qt::UserRole + 1; FilterList* m_list; - QWidget* m_widget; - QCheckBox* m_checkbox; + States m_state; + + void updateState() + { + QString s; + + switch (m_state) + { + case Inactive: + { + break; + } + + case Active: + { + // U+2713 CHECK MARK + s = QString::fromUtf8("\xe2\x9c\x93"); + break; + } + + case Inverted: + { + s = tr("Not"); + break; + } + } + + setText(0, s); + } +}; + + +class ClickFilter : public QObject +{ +public: + ClickFilter(std::function f) + : m_f(std::move(f)) + { + } + + bool eventFilter(QObject* o, QEvent* e) override + { + if (e->type() == QEvent::MouseButtonPress || e->type() == QEvent::MouseButtonDblClick) { + if (m_f) { + return m_f(static_cast(e)); + } + } + + return QObject::eventFilter(o, e);; + } + +private: + std::function m_f; }; FilterList::FilterList(Ui::MainWindow* ui, CategoryFactory& factory) : ui(ui), m_factory(factory) { - connect( - ui->filters, &QTreeWidget::customContextMenuRequested, - [&](auto&& pos){ onContextMenu(pos); }); + ui->filters->viewport()->installEventFilter( + new ClickFilter([&](auto* e){ return onClick(e); })); connect( - ui->filters, &QTreeWidget::itemSelectionChanged, - [&]{ onSelection(); }); + ui->filtersClear, &QPushButton::clicked, + [&]{ clearSelection(); }); connect( - ui->filtersClear, &QPushButton::clicked, - [&]{ clear(); }); + ui->filtersEdit, &QPushButton::clicked, + [&]{ editCategories(); }); connect( ui->filtersAnd, &QCheckBox::toggled, - [&]{ onCriteriaChanged(); }); + [&]{ onOptionsChanged(); }); connect( ui->filtersOr, &QCheckBox::toggled, - [&]{ onCriteriaChanged(); }); + [&]{ onOptionsChanged(); }); connect( ui->filtersSeparators, &QCheckBox::toggled, - [&]{ onCriteriaChanged(); }); + [&]{ onOptionsChanged(); }); - ui->filters->header()->setSectionResizeMode(0, QHeaderView::Stretch); - ui->filters->header()->resizeSection(1, 50); + ui->filters->header()->setMinimumSectionSize(0); + ui->filters->header()->setSectionResizeMode(0, QHeaderView::Fixed); + ui->filters->header()->resizeSection(0, 30); ui->categoriesSplitter->setCollapsible(0, false); ui->categoriesSplitter->setCollapsible(1, false); } @@ -110,7 +179,7 @@ QTreeWidgetItem* FilterList::addCriteriaItem( ui->filters->addTopLevelItem(item); } - ui->filters->setItemWidget(item, 1, item->widget()); + item->setTextAlignment(0, Qt::AlignCenter); return item; } @@ -224,91 +293,72 @@ void FilterList::setSelection(const std::vector& criteria) void FilterList::clearSelection() { - ui->filters->clearSelection(); -} - -void FilterList::onSelection() -{ - const QModelIndexList indices = ui->filters->selectionModel()->selectedRows(); - std::vector criteria; - - for (auto* item : ui->filters->selectedItems()) { - const auto* ci = dynamic_cast(item); + for (int i=0; ifilters->topLevelItemCount(); ++i) { + auto* ci = dynamic_cast(ui->filters->topLevelItem(i)); if (!ci) { continue; } - criteria.push_back({ - ci->type(), ci->id(), ci->inverse() - }); + ci->setState(CriteriaItem::Inactive); } - emit criteriaChanged(criteria); + checkCriteria(); } -void FilterList::onContextMenu(const QPoint &pos) +bool FilterList::onClick(QMouseEvent* e) { - QMenu menu; + auto* item = ui->filters->itemAt(e->pos()); + if (!item) { + return false; + } - QAction* set = menu.addAction(tr("Set inverted"), [&]{ toggleInverted(true); }); - QAction* unset = menu.addAction(tr("Unset inverted"), [&]{ toggleInverted(false); }); - menu.addSeparator(); - menu.addAction(tr("Edit Categories..."), [&]{ editCategories(); }); + auto* ci = dynamic_cast(item); + if (!ci) { + return false; + } - if (ui->filters->selectedItems().empty()) { - set->setEnabled(false); - unset->setEnabled(false); + if (e->button() == Qt::LeftButton) { + ci->nextState(); + } else if (e->button() == Qt::RightButton) { + ci->previousState(); + } else { + return false; } - menu.exec(ui->filters->viewport()->mapToGlobal(pos)); + checkCriteria(); + return true; } -void FilterList::editCategories() +void FilterList::checkCriteria() { - CategoriesDialog dialog(qApp->activeWindow()); - - if (dialog.exec() == QDialog::Accepted) { - dialog.commitChanges(); - } -} + std::vector criteria; -void FilterList::clear() -{ - const auto count = ui->filters->topLevelItemCount(); - for (int i=0; i(ui->filters->topLevelItem(i)); + for (int i=0; ifilters->topLevelItemCount(); ++i) { + const auto* ci = dynamic_cast(ui->filters->topLevelItem(i)); if (!ci) { continue; } - ci->setInverted(false); + if (ci->state() != CriteriaItem::Inactive) { + criteria.push_back({ + ci->type(), ci->id(), (ci->state() == CriteriaItem::Inverted) + }); + } } - clearSelection(); + emit criteriaChanged(criteria); } -void FilterList::toggleInverted(bool b) +void FilterList::editCategories() { - bool changed = false; - - for (auto* item : ui->filters->selectedItems()) { - auto* ci = dynamic_cast(item); - if (!ci) { - continue; - } - - if (ci->inverse() != b) { - ci->setInverted(b); - changed = true; - } - } + CategoriesDialog dialog(qApp->activeWindow()); - if (changed) { - onSelection(); + if (dialog.exec() == QDialog::Accepted) { + dialog.commitChanges(); } } -void FilterList::onCriteriaChanged() +void FilterList::onOptionsChanged() { const auto mode = ui->filtersAnd->isChecked() ? ModListSortProxy::FILTER_AND : ModListSortProxy::FILTER_OR; diff --git a/src/filterlist.h b/src/filterlist.h index 52b90ea7..fac1d683 100644 --- a/src/filterlist.h +++ b/src/filterlist.h @@ -28,13 +28,11 @@ private: Ui::MainWindow* ui; CategoryFactory& m_factory; - void onContextMenu(const QPoint &pos); - void onSelection(); - void onCriteriaChanged(); + bool onClick(QMouseEvent* e); + void onOptionsChanged(); - void clear(); - void toggleInverted(bool b); void editCategories(); + void checkCriteria(); QTreeWidgetItem* addCriteriaItem( QTreeWidgetItem *root, const QString &name, int categoryID, diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 5206d797..1a64dfdd 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -76,59 +76,69 @@ 0 - - Qt::CustomContextMenu - - QAbstractItemView::ExtendedSelection + QAbstractItemView::NoSelection 0 + + false + true - false + true - true + false - true - - false - Category + - Invert + Category - - - - 0 - 0 - - - - - 0 - 25 - - - - Clear - + + + + 0 + + + 2 + + + 0 + + + 0 + + + + + Clear + + + + + + + Edit... + + + + diff --git a/src/modlistsortproxy.cpp b/src/modlistsortproxy.cpp index 36dcae59..e6bed49c 100644 --- a/src/modlistsortproxy.cpp +++ b/src/modlistsortproxy.cpp @@ -269,12 +269,12 @@ bool ModListSortProxy::hasConflictFlag(const std::vector &flags) bool ModListSortProxy::filterMatchesModAnd(ModInfo::Ptr info, bool enabled) const { - if (info->hasFlag(ModInfo::FLAG_SEPARATOR) && !m_FilterSeparators) { + if (!optionsMatchMod(info, enabled)) { return false; } for (auto&& c : m_Criteria) { - if (!criteriaMatchesMod(info, enabled, c)) { + if (!criteriaMatchMod(info, enabled, c)) { return false; } } @@ -284,12 +284,12 @@ bool ModListSortProxy::filterMatchesModAnd(ModInfo::Ptr info, bool enabled) cons bool ModListSortProxy::filterMatchesModOr(ModInfo::Ptr info, bool enabled) const { - if (info->hasFlag(ModInfo::FLAG_SEPARATOR) && !m_FilterSeparators) { + if (!optionsMatchMod(info, enabled)) { return false; } for (auto&& c : m_Criteria) { - if (criteriaMatchesMod(info, enabled, c)) { + if (criteriaMatchMod(info, enabled, c)) { return true; } } @@ -302,7 +302,23 @@ bool ModListSortProxy::filterMatchesModOr(ModInfo::Ptr info, bool enabled) const return true; } -bool ModListSortProxy::criteriaMatchesMod( +bool ModListSortProxy::optionsMatchMod(ModInfo::Ptr info, bool) const +{ + // don't check options if there are no filters selected + if (!m_FilterActive) { + return true; + } + + if (!m_FilterSeparators) { + if (info->hasFlag(ModInfo::FLAG_SEPARATOR)) { + return false; + } + } + + return true; +} + +bool ModListSortProxy::criteriaMatchMod( ModInfo::Ptr info, bool enabled, const Criteria& c) const { bool b = false; diff --git a/src/modlistsortproxy.h b/src/modlistsortproxy.h index 5aeaccce..9b533492 100644 --- a/src/modlistsortproxy.h +++ b/src/modlistsortproxy.h @@ -157,7 +157,8 @@ private: std::vector m_PreChangeCriteria; - bool criteriaMatchesMod(ModInfo::Ptr info, bool enabled, const Criteria& c) const; + bool optionsMatchMod(ModInfo::Ptr info, bool enabled) const; + bool criteriaMatchMod(ModInfo::Ptr info, bool enabled, const Criteria& c) const; bool categoryMatchesMod(ModInfo::Ptr info, bool enabled, int category) const; bool contentMatchesMod(ModInfo::Ptr info, bool enabled, int content) const; }; -- cgit v1.3.1 From d2073ef2bd62527034864fd0cacd5537aff33218 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Sat, 30 Nov 2019 05:37:34 -0500 Subject: made all categories positive fixed context menu sometimes appearing --- src/categories.cpp | 16 ++++++++-------- src/categories.h | 8 ++++---- src/filterlist.cpp | 10 +++++----- src/mainwindow.ui | 3 +++ src/modlistsortproxy.cpp | 29 ++++++++++++++++------------- 5 files changed, 36 insertions(+), 30 deletions(-) (limited to 'src/modlistsortproxy.cpp') diff --git a/src/categories.cpp b/src/categories.cpp index 1bd56f7f..5c9a4d55 100644 --- a/src/categories.cpp +++ b/src/categories.cpp @@ -324,15 +324,15 @@ QString CategoryFactory::getSpecialCategoryName(SpecialCategories type) const { switch (type) { - case Checked: return QObject::tr(""); - case UpdateAvailable: return QObject::tr(""); - case HasNoCategory: return QObject::tr(""); + case Checked: return QObject::tr(""); + case UpdateAvailable: return QObject::tr(""); + case HasCategory: return QObject::tr(""); case Conflict: return QObject::tr(""); - case NotEndorsed: return QObject::tr(""); - case Backup: return QObject::tr(""); - case Managed: return QObject::tr(""); - case NoGameData: return QObject::tr(""); - case NoNexusID: return QObject::tr(""); + case Endorsed: return QObject::tr(""); + case Backup: return QObject::tr(""); + case Managed: return QObject::tr(""); + case HasGameData: return QObject::tr(""); + case HasNexusID: return QObject::tr(""); default: return {}; } } diff --git a/src/categories.h b/src/categories.h index 296e7711..02695e4d 100644 --- a/src/categories.h +++ b/src/categories.h @@ -41,13 +41,13 @@ public: { Checked = 10000, UpdateAvailable, - HasNoCategory, + HasCategory, Conflict, - NotEndorsed, + Endorsed, Backup, Managed, - NoGameData, - NoNexusID + HasGameData, + HasNexusID }; public: diff --git a/src/filterlist.cpp b/src/filterlist.cpp index 0dee8544..b65f0f4a 100644 --- a/src/filterlist.cpp +++ b/src/filterlist.cpp @@ -11,7 +11,7 @@ using Criteria = ModListSortProxy::Criteria; class FilterList::CriteriaItem : public QTreeWidgetItem { public: - enum States : int + enum States { FirstState = 0, @@ -234,11 +234,11 @@ void FilterList::refresh() addSpecialCriteria(F::UpdateAvailable); addSpecialCriteria(F::Backup); addSpecialCriteria(F::Managed); - addSpecialCriteria(F::HasNoCategory); + addSpecialCriteria(F::HasCategory); addSpecialCriteria(F::Conflict); - addSpecialCriteria(F::NotEndorsed); - addSpecialCriteria(F::NoNexusID); - addSpecialCriteria(F::NoGameData); + addSpecialCriteria(F::Endorsed); + addSpecialCriteria(F::HasNexusID); + addSpecialCriteria(F::HasGameData); addContentCriteria(); diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 1a64dfdd..92a41c67 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -76,6 +76,9 @@ 0 + + Qt::NoContextMenu + QAbstractItemView::NoSelection diff --git a/src/modlistsortproxy.cpp b/src/modlistsortproxy.cpp index e6bed49c..fd3dbc9e 100644 --- a/src/modlistsortproxy.cpp +++ b/src/modlistsortproxy.cpp @@ -371,9 +371,9 @@ bool ModListSortProxy::categoryMatchesMod( break; } - case CategoryFactory::HasNoCategory: + case CategoryFactory::HasCategory: { - b = (info->getCategories().size() == 0); + b = !info->getCategories().empty(); break; } @@ -383,10 +383,9 @@ bool ModListSortProxy::categoryMatchesMod( break; } - case CategoryFactory::NotEndorsed: + case CategoryFactory::Endorsed: { - ModInfo::EEndorsedState state = info->endorsedState(); - b = (state != ModInfo::ENDORSED_TRUE); + b = (info->endorsedState() == ModInfo::ENDORSED_TRUE); break; } @@ -402,20 +401,24 @@ bool ModListSortProxy::categoryMatchesMod( break; } - case CategoryFactory::NoGameData: + case CategoryFactory::HasGameData: { - b = (info->hasFlag(ModInfo::FLAG_INVALID)); + b = !info->hasFlag(ModInfo::FLAG_INVALID); break; } - case CategoryFactory::NoNexusID: + case CategoryFactory::HasNexusID: { - b = ( - info->getNexusID() == -1 && - !info->hasFlag(ModInfo::FLAG_FOREIGN) && - !info->hasFlag(ModInfo::FLAG_BACKUP) && - !info->hasFlag(ModInfo::FLAG_OVERWRITE)); + // never show these + if ( + info->hasFlag(ModInfo::FLAG_FOREIGN) || + info->hasFlag(ModInfo::FLAG_BACKUP) || + info->hasFlag(ModInfo::FLAG_OVERWRITE)) + { + return false; + } + b = (info->getNexusID() > 0); break; } -- cgit v1.3.1 From 3c25117fe163f7fab7afa22ba171ea2d41112f23 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Mon, 2 Dec 2019 10:41:52 -0500 Subject: three modes for separators, save state renamed enumerators --- src/filterlist.cpp | 28 ++++++++++++++++----- src/filterlist.h | 7 +++++- src/mainwindow.cpp | 16 +++++++----- src/mainwindow.h | 3 ++- src/mainwindow.ui | 21 ++++++++++++---- src/modlistsortproxy.cpp | 65 +++++++++++++++++++++++++++++------------------- src/modlistsortproxy.h | 25 ++++++++++++------- 7 files changed, 112 insertions(+), 53 deletions(-) (limited to 'src/modlistsortproxy.cpp') diff --git a/src/filterlist.cpp b/src/filterlist.cpp index b65f0f4a..05bff2dd 100644 --- a/src/filterlist.cpp +++ b/src/filterlist.cpp @@ -2,6 +2,7 @@ #include "ui_mainwindow.h" #include "categories.h" #include "categoriesdialog.h" +#include "settings.h" #include using namespace MOBase; @@ -157,7 +158,7 @@ FilterList::FilterList(Ui::MainWindow* ui, CategoryFactory& factory) [&]{ onOptionsChanged(); }); connect( - ui->filtersSeparators, &QCheckBox::toggled, + ui->filtersSeparators, qOverload(&QComboBox::currentIndexChanged), [&]{ onOptionsChanged(); }); ui->filters->header()->setMinimumSectionSize(0); @@ -165,6 +166,20 @@ FilterList::FilterList(Ui::MainWindow* ui, CategoryFactory& factory) ui->filters->header()->resizeSection(0, 30); ui->categoriesSplitter->setCollapsible(0, false); ui->categoriesSplitter->setCollapsible(1, false); + + ui->filtersSeparators->addItem(tr("Filter separators"), ModListSortProxy::SeparatorFilter); + ui->filtersSeparators->addItem(tr("Show separators"), ModListSortProxy::SeparatorShow); + ui->filtersSeparators->addItem(tr("Hide separators"), ModListSortProxy::SeparatorHide); +} + +void FilterList::restoreState(const Settings& s) +{ + s.widgets().restoreIndex(ui->filtersSeparators); +} + +void FilterList::saveState(Settings& s) const +{ + s.widgets().saveIndex(ui->filtersSeparators); } QTreeWidgetItem* FilterList::addCriteriaItem( @@ -189,7 +204,7 @@ void FilterList::addContentCriteria() for (unsigned i = 0; i < ModInfo::NUM_CONTENT_TYPES; ++i) { addCriteriaItem( nullptr, tr("").arg(ModInfo::getContentTypeName(i)), - i, ModListSortProxy::TYPE_CONTENT); + i, ModListSortProxy::TypeContent); } } @@ -202,7 +217,7 @@ void FilterList::addCategoryCriteria(QTreeWidgetItem *root, const std::set if (categoriesUsed.find(categoryID) != categoriesUsed.end()) { QTreeWidgetItem *item = addCriteriaItem(root, m_factory.getCategoryName(i), - categoryID, ModListSortProxy::TYPE_CATEGORY); + categoryID, ModListSortProxy::TypeCategory); if (m_factory.hasChildren(i)) { addCategoryCriteria(item, categoriesUsed, categoryID); } @@ -217,7 +232,7 @@ void FilterList::addSpecialCriteria(int type) addCriteriaItem( nullptr, m_factory.getSpecialCategoryName(sc), - type, ModListSortProxy::TYPE_SPECIAL); + type, ModListSortProxy::TypeSpecial); } void FilterList::refresh() @@ -361,9 +376,10 @@ void FilterList::editCategories() void FilterList::onOptionsChanged() { const auto mode = ui->filtersAnd->isChecked() ? - ModListSortProxy::FILTER_AND : ModListSortProxy::FILTER_OR; + ModListSortProxy::FilterAnd: ModListSortProxy::FilterOr; - const bool separators = ui->filtersSeparators->isChecked(); + const auto separators = static_cast( + ui->filtersSeparators->currentData().toInt()); emit optionsChanged(mode, separators); } diff --git a/src/filterlist.h b/src/filterlist.h index fac1d683..671462d4 100644 --- a/src/filterlist.h +++ b/src/filterlist.h @@ -6,6 +6,7 @@ namespace Ui { class MainWindow; }; class CategoryFactory; +class Settings; class FilterList : public QObject { @@ -14,13 +15,17 @@ class FilterList : public QObject public: FilterList(Ui::MainWindow* ui, CategoryFactory& factory); + void restoreState(const Settings& s); + void saveState(Settings& s) const; + void setSelection(const std::vector& criteria); void clearSelection(); void refresh(); signals: void criteriaChanged(std::vector criteria); - void optionsChanged(ModListSortProxy::FilterMode mode, bool separators); + void optionsChanged( + ModListSortProxy::FilterMode mode, ModListSortProxy::SeparatorsMode sep); private: class CriteriaItem; diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 096ea076..b5af9aa5 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -269,7 +269,7 @@ MainWindow::MainWindow(Settings &settings connect( m_Filters.get(), &FilterList::optionsChanged, - [&](auto mode, bool sep) { onFiltersOptions(mode, sep); }); + [&](auto&& mode, auto&& sep) { onFiltersOptions(mode, sep); }); ui->logList->setCore(m_OrganizerCore); @@ -2205,6 +2205,7 @@ void MainWindow::readSettings() } s.widgets().restoreIndex(ui->groupCombo); + m_Filters->restoreState(s); { s.geometry().restoreVisibility(ui->categoriesGroup, false); @@ -2283,6 +2284,8 @@ void MainWindow::storeSettings() s.widgets().saveIndex(ui->groupCombo); s.widgets().saveIndex(ui->executablesListBox); + + m_Filters->saveState(s); } QWidget* MainWindow::qtWidget() @@ -4125,13 +4128,13 @@ void MainWindow::checkModsForUpdates() if (updatesAvailable || checkingModsForUpdate) { m_ModListSortProxy->setCriteria({{ - ModListSortProxy::TYPE_SPECIAL, + ModListSortProxy::TypeSpecial, CategoryFactory::UpdateAvailable, false} }); m_Filters->setSelection({{ - ModListSortProxy::TYPE_SPECIAL, + ModListSortProxy::TypeSpecial, CategoryFactory::UpdateAvailable, false }}); @@ -6131,7 +6134,7 @@ void MainWindow::onFiltersCriteria(const std::vector } else if (criteria.size() == 1) { const auto& c = criteria[0]; - if (c.type == ModListSortProxy::TYPE_CONTENT) { + if (c.type == ModListSortProxy::TypeContent) { label = ModInfo::getContentTypeName(c.id); } else { label = m_CategoryFactory.getCategoryNameByID(c.id); @@ -6148,9 +6151,10 @@ void MainWindow::onFiltersCriteria(const std::vector ui->modList->reset(); } -void MainWindow::onFiltersOptions(ModListSortProxy::FilterMode mode, bool separators) +void MainWindow::onFiltersOptions( + ModListSortProxy::FilterMode mode, ModListSortProxy::SeparatorsMode sep) { - m_ModListSortProxy->setOptions(mode, separators); + m_ModListSortProxy->setOptions(mode, sep); } void MainWindow::updateESPLock(bool locked) diff --git a/src/mainwindow.h b/src/mainwindow.h index 0b559300..69aee073 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -515,7 +515,8 @@ private slots: void deselectFilters(); void refreshFilters(); void onFiltersCriteria(const std::vector& filters); - void onFiltersOptions(ModListSortProxy::FilterMode mode, bool separators); + void onFiltersOptions( + ModListSortProxy::FilterMode mode, ModListSortProxy::SeparatorsMode sep); void displayModInformation(const QString &modName, ModInfoTabIDs tabID); diff --git a/src/mainwindow.ui b/src/mainwindow.ui index 92a41c67..85be22b3 100644 --- a/src/mainwindow.ui +++ b/src/mainwindow.ui @@ -153,6 +153,18 @@ + + 0 + + + 2 + + + 0 + + + 0 + @@ -177,12 +189,11 @@ - + - Include separators - - - Separators + Filter: only show the separators that match the current filters +Show: always show separators +Hide: never show separators diff --git a/src/modlistsortproxy.cpp b/src/modlistsortproxy.cpp index fd3dbc9e..7ac98f66 100644 --- a/src/modlistsortproxy.cpp +++ b/src/modlistsortproxy.cpp @@ -37,8 +37,8 @@ ModListSortProxy::ModListSortProxy(Profile* profile, QObject *parent) : QSortFilterProxyModel(parent) , m_Profile(profile) , m_FilterActive(false) - , m_FilterMode(FILTER_AND) - , m_FilterSeparators(false) + , m_FilterMode(FilterAnd) + , m_FilterSeparators(SeparatorFilter) { setDynamicSortFilter(true); // this seems to work without dynamicsortfilter // but I don't know why. This should be necessary @@ -269,10 +269,6 @@ bool ModListSortProxy::hasConflictFlag(const std::vector &flags) bool ModListSortProxy::filterMatchesModAnd(ModInfo::Ptr info, bool enabled) const { - if (!optionsMatchMod(info, enabled)) { - return false; - } - for (auto&& c : m_Criteria) { if (!criteriaMatchMod(info, enabled, c)) { return false; @@ -284,10 +280,6 @@ bool ModListSortProxy::filterMatchesModAnd(ModInfo::Ptr info, bool enabled) cons bool ModListSortProxy::filterMatchesModOr(ModInfo::Ptr info, bool enabled) const { - if (!optionsMatchMod(info, enabled)) { - return false; - } - for (auto&& c : m_Criteria) { if (criteriaMatchMod(info, enabled, c)) { return true; @@ -304,16 +296,6 @@ bool ModListSortProxy::filterMatchesModOr(ModInfo::Ptr info, bool enabled) const bool ModListSortProxy::optionsMatchMod(ModInfo::Ptr info, bool) const { - // don't check options if there are no filters selected - if (!m_FilterActive) { - return true; - } - - if (!m_FilterSeparators) { - if (info->hasFlag(ModInfo::FLAG_SEPARATOR)) { - return false; - } - } return true; } @@ -325,14 +307,14 @@ bool ModListSortProxy::criteriaMatchMod( switch (c.type) { - case TYPE_SPECIAL: // fall-through - case TYPE_CATEGORY: + case TypeSpecial: // fall-through + case TypeCategory: { b = categoryMatchesMod(info, enabled, c.id); break; } - case TYPE_CONTENT: + case TypeContent: { b = contentMatchesMod(info, enabled, c.id); break; @@ -439,6 +421,37 @@ bool ModListSortProxy::contentMatchesMod(ModInfo::Ptr info, bool enabled, int co bool ModListSortProxy::filterMatchesMod(ModInfo::Ptr info, bool enabled) const { + // don't check if there are no filters selected + if (!m_FilterActive) { + return true; + } + + + // special case for separators + if (info->hasFlag(ModInfo::FLAG_SEPARATOR)) { + switch (m_FilterSeparators) + { + case SeparatorFilter: + { + // filter normally + break; + } + + case SeparatorShow: + { + // force visible + return true; + } + + case SeparatorHide: + { + // force hide + return false; + } + } + } + + if (!m_Filter.isEmpty()) { bool display = false; QString filterCopy = QString(m_Filter); @@ -519,7 +532,8 @@ bool ModListSortProxy::filterMatchesMod(ModInfo::Ptr info, bool enabled) const } }//if (!m_CurrentFilter.isEmpty()) - if (m_FilterMode == FILTER_AND) { + + if (m_FilterMode == FilterAnd) { return filterMatchesModAnd(info, enabled); } else { @@ -532,7 +546,8 @@ void ModListSortProxy::setColumnVisible(int column, bool visible) m_EnabledColumns[column] = visible; } -void ModListSortProxy::setOptions(ModListSortProxy::FilterMode mode, bool separators) +void ModListSortProxy::setOptions( + ModListSortProxy::FilterMode mode, SeparatorsMode separators) { if (m_FilterMode != mode || separators != m_FilterSeparators) { m_FilterMode = mode; diff --git a/src/modlistsortproxy.h b/src/modlistsortproxy.h index 9b533492..46356fe9 100644 --- a/src/modlistsortproxy.h +++ b/src/modlistsortproxy.h @@ -31,16 +31,23 @@ class ModListSortProxy : public QSortFilterProxyModel Q_OBJECT public: - - enum FilterMode { - FILTER_AND, - FILTER_OR + enum FilterMode + { + FilterAnd, + FilterOr }; enum CriteriaType { - TYPE_SPECIAL, - TYPE_CATEGORY, - TYPE_CONTENT + TypeSpecial, + TypeCategory, + TypeContent + }; + + enum SeparatorsMode + { + SeparatorFilter, + SeparatorShow, + SeparatorHide }; struct Criteria @@ -101,7 +108,7 @@ public: bool isFilterActive() const { return m_FilterActive; } void setCriteria(const std::vector& criteria); - void setOptions(FilterMode mode, bool separators); + void setOptions(FilterMode mode, SeparatorsMode separators); /** * @brief tests if the specified index has child nodes @@ -153,7 +160,7 @@ private: bool m_FilterActive; FilterMode m_FilterMode; - bool m_FilterSeparators; + SeparatorsMode m_FilterSeparators; std::vector m_PreChangeCriteria; -- cgit v1.3.1