added brace wrapping after if and for

This commit is contained in:
fourtf
2018-10-21 13:43:02 +02:00
parent c6e1ec3c71
commit e259b9e39f
138 changed files with 4738 additions and 2237 deletions
@@ -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;
}
}
+39 -18
View File
@@ -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);
}