added brace wrapping after if and for
This commit is contained in:
@@ -46,8 +46,10 @@ public:
|
||||
|
||||
bool isMatch(const QString &subject) const
|
||||
{
|
||||
if (this->isRegex()) {
|
||||
if (this->isValidRegex()) {
|
||||
if (this->isRegex())
|
||||
{
|
||||
if (this->isValidRegex())
|
||||
{
|
||||
return this->regex_.match(subject).hasMatch();
|
||||
}
|
||||
|
||||
@@ -91,7 +93,8 @@ namespace Settings {
|
||||
QString pattern;
|
||||
bool isRegex = false;
|
||||
|
||||
if (!value.IsObject()) {
|
||||
if (!value.IsObject())
|
||||
{
|
||||
return chatterino::HighlightBlacklistUser(pattern, isRegex);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,8 @@ void HighlightController::initialize(Settings &settings, Paths &paths)
|
||||
assert(!this->initialized_);
|
||||
this->initialized_ = true;
|
||||
|
||||
for (const HighlightPhrase &phrase : this->highlightsSetting_.getValue()) {
|
||||
for (const HighlightPhrase &phrase : this->highlightsSetting_.getValue())
|
||||
{
|
||||
this->phrases.appendItem(phrase);
|
||||
}
|
||||
|
||||
@@ -26,7 +27,8 @@ void HighlightController::initialize(Settings &settings, Paths &paths)
|
||||
});
|
||||
|
||||
for (const HighlightBlacklistUser &blacklistedUser :
|
||||
this->blacklistSetting_.getValue()) {
|
||||
this->blacklistSetting_.getValue())
|
||||
{
|
||||
this->blacklistedUsers.appendItem(blacklistedUser);
|
||||
}
|
||||
|
||||
@@ -54,8 +56,10 @@ UserHighlightModel *HighlightController::createUserModel(QObject *parent)
|
||||
bool HighlightController::isHighlightedUser(const QString &username)
|
||||
{
|
||||
const auto &userItems = this->highlightedUsers.getVector();
|
||||
for (const auto &highlightedUser : userItems) {
|
||||
if (highlightedUser.isMatch(username)) {
|
||||
for (const auto &highlightedUser : userItems)
|
||||
{
|
||||
if (highlightedUser.isMatch(username))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -76,8 +80,10 @@ bool HighlightController::blacklistContains(const QString &username)
|
||||
{
|
||||
std::vector<HighlightBlacklistUser> blacklistItems =
|
||||
this->blacklistedUsers.getVector();
|
||||
for (const auto &blacklistedUser : blacklistItems) {
|
||||
if (blacklistedUser.isMatch(username)) {
|
||||
for (const auto &blacklistedUser : blacklistItems)
|
||||
{
|
||||
if (blacklistedUser.isMatch(username))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,42 +66,63 @@ void HighlightModel::customRowSetData(const std::vector<QStandardItem *> &row,
|
||||
int column, const QVariant &value,
|
||||
int role, int rowIndex)
|
||||
{
|
||||
switch (column) {
|
||||
case 0: {
|
||||
if (role == Qt::CheckStateRole) {
|
||||
if (rowIndex == 0) {
|
||||
switch (column)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
if (role == Qt::CheckStateRole)
|
||||
{
|
||||
if (rowIndex == 0)
|
||||
{
|
||||
getSettings()->enableSelfHighlight.setValue(value.toBool());
|
||||
} else if (rowIndex == 1) {
|
||||
}
|
||||
else if (rowIndex == 1)
|
||||
{
|
||||
getSettings()->enableWhisperHighlight.setValue(
|
||||
value.toBool());
|
||||
}
|
||||
}
|
||||
} break;
|
||||
case 1: {
|
||||
if (role == Qt::CheckStateRole) {
|
||||
if (rowIndex == 0) {
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
{
|
||||
if (role == Qt::CheckStateRole)
|
||||
{
|
||||
if (rowIndex == 0)
|
||||
{
|
||||
getSettings()->enableSelfHighlightTaskbar.setValue(
|
||||
value.toBool());
|
||||
} else if (rowIndex == 1) {
|
||||
}
|
||||
else if (rowIndex == 1)
|
||||
{
|
||||
getSettings()->enableWhisperHighlightTaskbar.setValue(
|
||||
value.toBool());
|
||||
}
|
||||
}
|
||||
} break;
|
||||
case 2: {
|
||||
if (role == Qt::CheckStateRole) {
|
||||
if (rowIndex == 0) {
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
if (role == Qt::CheckStateRole)
|
||||
{
|
||||
if (rowIndex == 0)
|
||||
{
|
||||
getSettings()->enableSelfHighlightSound.setValue(
|
||||
value.toBool());
|
||||
} else if (rowIndex == 1) {
|
||||
}
|
||||
else if (rowIndex == 1)
|
||||
{
|
||||
getSettings()->enableWhisperHighlightSound.setValue(
|
||||
value.toBool());
|
||||
}
|
||||
}
|
||||
} break;
|
||||
case 3: {
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
// empty element
|
||||
} break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,8 @@ namespace Settings {
|
||||
struct Deserialize<chatterino::HighlightPhrase> {
|
||||
static chatterino::HighlightPhrase get(const rapidjson::Value &value)
|
||||
{
|
||||
if (!value.IsObject()) {
|
||||
if (!value.IsObject())
|
||||
{
|
||||
return chatterino::HighlightPhrase(QString(), true, false,
|
||||
false);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user