feat: Allow negation of search predicates (#4207)

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
closes https://github.com/Chatterino/chatterino2/issues/3998
This commit is contained in:
kornes
2022-12-04 11:34:13 +00:00
committed by GitHub
parent 4fa214a38a
commit b7888749fe
19 changed files with 139 additions and 111 deletions
+5 -7
View File
@@ -4,19 +4,17 @@
namespace chatterino {
SubtierPredicate::SubtierPredicate(const QStringList &subtiers)
SubtierPredicate::SubtierPredicate(const QString &subtiers, bool negate)
: MessagePredicate(negate)
{
// Check if any comma-seperated values were passed and transform those
for (const auto &entry : subtiers)
for (const auto &subtier : subtiers.split(',', Qt::SkipEmptyParts))
{
for (const auto &subtier : entry.split(',', Qt::SkipEmptyParts))
{
this->subtiers_ << subtier;
}
this->subtiers_ << subtier;
}
}
bool SubtierPredicate::appliesTo(const Message &message)
bool SubtierPredicate::appliesToImpl(const Message &message)
{
for (const Badge &badge : message.badges)
{