8 #include <QRegularExpression> 11 #include <pajlada/serialize.hpp> 29 const QString &soundUrl, QColor color);
36 HighlightPhrase(
const QString &pattern,
bool showInMentions,
bool hasAlert,
37 bool hasSound,
bool isRegex,
bool isCaseSensitive,
38 const QString &soundUrl, std::shared_ptr<QColor> color);
73 bool isMatch(
const QString &subject)
const;
76 const std::shared_ptr<QColor>
getColor()
const;
95 bool isCaseSensitive_;
97 std::shared_ptr<QColor> color_;
98 QRegularExpression regex_;
109 false,
false, QString(), QColor());
116 rapidjson::Document::AllocatorType &a)
118 rapidjson::Value ret(rapidjson::kObjectType);
128 value.getColor()->name(QColor::HexArgb), a);
137 bool *error =
nullptr)
139 if (!value.IsObject())
141 PAJLADA_REPORT_ERROR(error)
143 return constructError();
147 bool _showInMentions =
true;
148 bool _hasAlert =
true;
149 bool _hasSound =
false;
150 bool _isRegex =
false;
151 bool _isCaseSensitive =
false;
153 QString encodedColor;
164 auto _color = QColor(encodedColor);
165 if (!_color.isValid())
170 _isCaseSensitive, _soundUrl, _color);
bool isRegex() const
Definition: HighlightPhrase.cpp:102
static QColor FALLBACK_ELEVATED_MESSAGE_HIGHLIGHT_COLOR
Definition: HighlightPhrase.hpp:86
static QColor FALLBACK_HIGHLIGHT_COLOR
Definition: HighlightPhrase.hpp:82
static QColor FALLBACK_THREAD_HIGHLIGHT_COLOR
Definition: HighlightPhrase.hpp:87
bool hasAlert() const
Definition: HighlightPhrase.cpp:87
static QColor FALLBACK_SUB_COLOR
Definition: HighlightPhrase.hpp:84
bool operator==(const HighlightPhrase &other) const
Definition: HighlightPhrase.cpp:23
Definition: Application.cpp:48
bool showInMentions() const
Definition: HighlightPhrase.cpp:82
bool hasSound() const
Check if this highlight phrase should play a sound when triggered.
Definition: HighlightPhrase.cpp:92
HighlightPhrase(const QString &pattern, bool showInMentions, bool hasAlert, bool hasSound, bool isRegex, bool isCaseSensitive, const QString &soundUrl, QColor color)
Create a new HighlightPhrase.
Definition: HighlightPhrase.cpp:33
bool isValid() const
Definition: HighlightPhrase.cpp:107
const QUrl & getSoundUrl() const
Definition: HighlightPhrase.cpp:122
void set(rapidjson::Value &obj, const char *key, const Type &value, rapidjson::Document::AllocatorType &a)
Definition: RapidjsonHelpers.hpp:22
Definition: Command.hpp:25
const QString & getPattern() const
Definition: HighlightPhrase.cpp:77
bool getSafe(const rapidjson::Value &obj, const char *key, Type &out)
Definition: RapidjsonHelpers.hpp:73
static QColor FALLBACK_REDEEMED_HIGHLIGHT_COLOR
Definition: HighlightPhrase.hpp:83
const std::shared_ptr< QColor > getColor() const
Definition: HighlightPhrase.cpp:127
bool isMatch(const QString &subject) const
Definition: HighlightPhrase.cpp:112
bool isCaseSensitive() const
Definition: HighlightPhrase.cpp:117
static QColor FALLBACK_FIRST_MESSAGE_HIGHLIGHT_COLOR
Definition: HighlightPhrase.hpp:85
bool hasCustomSound() const
Check if this highlight phrase has a custom sound set.
Definition: HighlightPhrase.cpp:97
Definition: HighlightPhrase.hpp:17