Applied project style to multiple files

This commit is contained in:
fourtf
2018-07-06 18:10:21 +02:00
parent 3993708164
commit 535c0616a3
26 changed files with 149 additions and 157 deletions
@@ -13,10 +13,6 @@ namespace chatterino {
class HighlightBlacklistUser
{
QString pattern_;
bool isRegex_;
QRegularExpression regex_;
public:
bool operator==(const HighlightBlacklistUser &other) const
{
@@ -58,6 +54,11 @@ public:
return subject.toLower() == this->pattern_.toLower();
}
private:
QString pattern_;
bool isRegex_;
QRegularExpression regex_;
};
} // namespace chatterino
@@ -14,15 +14,15 @@ HighlightController::HighlightController()
void HighlightController::initialize()
{
assert(!this->initialized);
this->initialized = true;
assert(!this->initialized_);
this->initialized_ = true;
for (const HighlightPhrase &phrase : this->highlightsSetting.getValue()) {
for (const HighlightPhrase &phrase : this->highlightsSetting_.getValue()) {
this->phrases.appendItem(phrase);
}
this->phrases.delayedItemsChanged.connect([this] { //
this->highlightsSetting.setValue(this->phrases.getVector());
this->highlightsSetting_.setValue(this->phrases.getVector());
});
}
@@ -33,11 +33,11 @@ public:
void addHighlight(const MessagePtr &msg);
private:
bool initialized = false;
bool initialized_ = false;
ChatterinoSetting<std::vector<HighlightPhrase>> highlightsSetting = {
ChatterinoSetting<std::vector<HighlightPhrase>> highlightsSetting_ = {
"/highlighting/highlights"};
ChatterinoSetting<std::vector<HighlightPhrase>> blacklistSetting = {"/highlighting/blacklist"};
ChatterinoSetting<std::vector<HighlightPhrase>> blacklistSetting_ = {"/highlighting/blacklist"};
};
} // namespace chatterino
+22 -26
View File
@@ -11,61 +11,57 @@ namespace chatterino {
class HighlightPhrase
{
QString pattern;
bool alert;
bool sound;
bool _isRegex;
QRegularExpression regex;
public:
bool operator==(const HighlightPhrase &other) const
{
return std::tie(this->pattern, this->sound, this->alert, this->_isRegex) ==
std::tie(other.pattern, other.sound, other.alert, other._isRegex);
return std::tie(this->pattern_, this->sound_, this->alert_, this->isRegex_) ==
std::tie(other.pattern_, other.sound_, other.alert_, other.isRegex_);
}
HighlightPhrase(const QString &_pattern, bool _alert, bool _sound, bool isRegex)
: pattern(_pattern)
, alert(_alert)
, sound(_sound)
, _isRegex(isRegex)
, regex(_isRegex ? _pattern : "\\b" + QRegularExpression::escape(_pattern) + "\\b",
QRegularExpression::CaseInsensitiveOption |
QRegularExpression::UseUnicodePropertiesOption)
HighlightPhrase(const QString &pattern, bool alert, bool sound, bool isRegex)
: pattern_(pattern)
, alert_(alert)
, sound_(sound)
, isRegex_(isRegex)
, regex_(isRegex_ ? pattern : "\\b" + QRegularExpression::escape(pattern) + "\\b",
QRegularExpression::CaseInsensitiveOption |
QRegularExpression::UseUnicodePropertiesOption)
{
}
const QString &getPattern() const
{
return this->pattern;
return this->pattern_;
}
bool getAlert() const
{
return this->alert;
return this->alert_;
}
bool getSound() const
{
return this->sound;
return this->sound_;
}
bool isRegex() const
{
return this->_isRegex;
return this->isRegex_;
}
bool isValid() const
{
return !this->pattern.isEmpty() && this->regex.isValid();
return !this->pattern_.isEmpty() && this->regex_.isValid();
}
bool isMatch(const QString &subject) const
{
return this->isValid() && this->regex.match(subject).hasMatch();
return this->isValid() && this->regex_.match(subject).hasMatch();
}
// const QRegularExpression &getRegex() const
// {
// return this->regex;
// }
private:
QString pattern_;
bool alert_;
bool sound_;
bool isRegex_;
QRegularExpression regex_;
};
} // namespace chatterino