Renamed private members
This commit is contained in:
@@ -9,15 +9,15 @@ namespace chatterino {
|
||||
|
||||
void IgnoreController::initialize()
|
||||
{
|
||||
assert(!this->initialized);
|
||||
this->initialized = true;
|
||||
assert(!this->initialized_);
|
||||
this->initialized_ = true;
|
||||
|
||||
for (const IgnorePhrase &phrase : this->ignoresSetting.getValue()) {
|
||||
for (const IgnorePhrase &phrase : this->ignoresSetting_.getValue()) {
|
||||
this->phrases.appendItem(phrase);
|
||||
}
|
||||
|
||||
this->phrases.delayedItemsChanged.connect([this] { //
|
||||
this->ignoresSetting.setValue(this->phrases.getVector());
|
||||
this->ignoresSetting_.setValue(this->phrases.getVector());
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -18,9 +18,9 @@ public:
|
||||
IgnoreModel *createModel(QObject *parent);
|
||||
|
||||
private:
|
||||
bool initialized = false;
|
||||
bool initialized_ = false;
|
||||
|
||||
ChatterinoSetting<std::vector<IgnorePhrase>> ignoresSetting = {"/ignore/phrases"};
|
||||
ChatterinoSetting<std::vector<IgnorePhrase>> ignoresSetting_ = {"/ignore/phrases"};
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -13,43 +13,44 @@ namespace chatterino {
|
||||
|
||||
class IgnorePhrase
|
||||
{
|
||||
QString pattern;
|
||||
bool _isRegex;
|
||||
QRegularExpression regex;
|
||||
|
||||
public:
|
||||
bool operator==(const IgnorePhrase &other) const
|
||||
{
|
||||
return std::tie(this->pattern, this->_isRegex) == std::tie(other.pattern, other._isRegex);
|
||||
return std::tie(this->pattern_, this->isRegex_) == std::tie(other.pattern_, other.isRegex_);
|
||||
}
|
||||
|
||||
IgnorePhrase(const QString &_pattern, bool isRegex)
|
||||
: pattern(_pattern)
|
||||
, _isRegex(isRegex)
|
||||
, regex(_isRegex ? _pattern : "\\b" + QRegularExpression::escape(_pattern) + "\\b",
|
||||
QRegularExpression::CaseInsensitiveOption |
|
||||
QRegularExpression::UseUnicodePropertiesOption)
|
||||
IgnorePhrase(const QString &pattern, bool isRegex)
|
||||
: pattern_(pattern)
|
||||
, 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 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();
|
||||
}
|
||||
|
||||
private:
|
||||
QString pattern_;
|
||||
bool isRegex_;
|
||||
QRegularExpression regex_;
|
||||
};
|
||||
} // namespace chatterino
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ class Image;
|
||||
class ModerationAction
|
||||
{
|
||||
public:
|
||||
ModerationAction(const QString &action_);
|
||||
ModerationAction(const QString &action);
|
||||
|
||||
bool operator==(const ModerationAction &other) const;
|
||||
|
||||
|
||||
@@ -14,15 +14,15 @@ ModerationActions::ModerationActions()
|
||||
|
||||
void ModerationActions::initialize()
|
||||
{
|
||||
assert(!this->initialized);
|
||||
this->initialized = true;
|
||||
assert(!this->initialized_);
|
||||
this->initialized_ = true;
|
||||
|
||||
for (auto &val : this->setting.getValue()) {
|
||||
for (auto &val : this->setting_.getValue()) {
|
||||
this->items.insertItem(val);
|
||||
}
|
||||
|
||||
this->items.delayedItemsChanged.connect([this] { //
|
||||
this->setting.setValue(this->items.getVector());
|
||||
this->setting_.setValue(this->items.getVector());
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -20,8 +20,8 @@ public:
|
||||
ModerationActionModel *createModel(QObject *parent);
|
||||
|
||||
private:
|
||||
ChatterinoSetting<std::vector<ModerationAction>> setting = {"/moderation/actions"};
|
||||
bool initialized = false;
|
||||
ChatterinoSetting<std::vector<ModerationAction>> setting_ = {"/moderation/actions"};
|
||||
bool initialized_ = false;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -4,17 +4,32 @@
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
TaggedUser::TaggedUser(ProviderId _provider, const QString &_name, const QString &_id)
|
||||
: provider(_provider)
|
||||
, name(_name)
|
||||
, id(_id)
|
||||
TaggedUser::TaggedUser(ProviderId provider, const QString &name, const QString &id)
|
||||
: providerId_(provider)
|
||||
, name_(name)
|
||||
, id_(id)
|
||||
{
|
||||
}
|
||||
|
||||
bool TaggedUser::operator<(const TaggedUser &other) const
|
||||
{
|
||||
return std::tie(this->provider, this->name, this->id) <
|
||||
std::tie(other.provider, other.name, other.id);
|
||||
return std::tie(this->providerId_, this->name_, this->id_) <
|
||||
std::tie(other.providerId_, other.name_, other.id_);
|
||||
}
|
||||
|
||||
ProviderId TaggedUser::getProviderId() const
|
||||
{
|
||||
return this->providerId_;
|
||||
}
|
||||
|
||||
QString TaggedUser::getName() const
|
||||
{
|
||||
return this->name_;
|
||||
}
|
||||
|
||||
QString TaggedUser::getId() const
|
||||
{
|
||||
return this->id_;
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -9,13 +9,18 @@ namespace chatterino {
|
||||
class TaggedUser
|
||||
{
|
||||
public:
|
||||
TaggedUser(ProviderId provider, const QString &name, const QString &id);
|
||||
TaggedUser(ProviderId providerId, const QString &name, const QString &id);
|
||||
|
||||
bool operator<(const TaggedUser &other) const;
|
||||
|
||||
ProviderId provider;
|
||||
QString name;
|
||||
QString id;
|
||||
ProviderId getProviderId() const;
|
||||
QString getName() const;
|
||||
QString getId() const;
|
||||
|
||||
private:
|
||||
ProviderId providerId_;
|
||||
QString name_;
|
||||
QString id_;
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
||||
|
||||
@@ -21,7 +21,7 @@ TaggedUser TaggedUsersModel::getItemFromRow(std::vector<QStandardItem *> &row,
|
||||
// turns a row in the model into a vector item
|
||||
void TaggedUsersModel::getRowFromItem(const TaggedUser &item, std::vector<QStandardItem *> &row)
|
||||
{
|
||||
setStringItem(row[0], item.name);
|
||||
setStringItem(row[0], item.getName());
|
||||
}
|
||||
|
||||
void TaggedUsersModel::afterInit()
|
||||
|
||||
Reference in New Issue
Block a user