Fix some clazy warnings
This commit is contained in:
@@ -26,7 +26,7 @@ int EmojiModel::rowCount(const QModelIndex &parent) const
|
|||||||
{
|
{
|
||||||
Q_UNUSED(parent);
|
Q_UNUSED(parent);
|
||||||
int total = 0;
|
int total = 0;
|
||||||
for (const auto &category : _emojis) {
|
for (const auto &category : std::as_const(_emojis)) {
|
||||||
total += category.count();
|
total += category.count();
|
||||||
}
|
}
|
||||||
return total;
|
return total;
|
||||||
@@ -35,7 +35,7 @@ int EmojiModel::rowCount(const QModelIndex &parent) const
|
|||||||
QVariant EmojiModel::data(const QModelIndex &index, int role) const
|
QVariant EmojiModel::data(const QModelIndex &index, int role) const
|
||||||
{
|
{
|
||||||
auto row = index.row();
|
auto row = index.row();
|
||||||
for (const auto &category : _emojis) {
|
for (const auto &category : std::as_const(_emojis)) {
|
||||||
if (row >= category.count()) {
|
if (row >= category.count()) {
|
||||||
row -= category.count();
|
row -= category.count();
|
||||||
continue;
|
continue;
|
||||||
@@ -79,7 +79,8 @@ QVariantList EmojiModel::filterModelNoCustom(const QString &filter, bool limit)
|
|||||||
{
|
{
|
||||||
QVariantList result;
|
QVariantList result;
|
||||||
|
|
||||||
for (const auto &e : _emojis.values()) {
|
const auto &values = _emojis.values();
|
||||||
|
for (const auto &e : values) {
|
||||||
for (const auto &variant : e) {
|
for (const auto &variant : e) {
|
||||||
const auto &emoji = qvariant_cast<Emoji>(variant);
|
const auto &emoji = qvariant_cast<Emoji>(variant);
|
||||||
if (emoji.shortName.contains(filter, Qt::CaseInsensitive)) {
|
if (emoji.shortName.contains(filter, Qt::CaseInsensitive)) {
|
||||||
@@ -121,7 +122,8 @@ QVariantList EmojiModel::emojis(Category category) const
|
|||||||
}
|
}
|
||||||
if (category == HistoryNoCustom) {
|
if (category == HistoryNoCustom) {
|
||||||
QVariantList list;
|
QVariantList list;
|
||||||
for (const auto &e : emojiHistory()) {
|
const auto &history = emojiHistory();
|
||||||
|
for (const auto &e : history) {
|
||||||
auto emoji = qvariant_cast<Emoji>(e);
|
auto emoji = qvariant_cast<Emoji>(e);
|
||||||
if (!emoji.isCustom) {
|
if (!emoji.isCustom) {
|
||||||
list.append(e);
|
list.append(e);
|
||||||
@@ -224,8 +226,9 @@ QVariantList EmojiModel::categoriesWithCustom() const
|
|||||||
QVariantList EmojiModel::emojiHistory() const
|
QVariantList EmojiModel::emojiHistory() const
|
||||||
{
|
{
|
||||||
QVariantList list;
|
QVariantList list;
|
||||||
for (const auto &historicEmoji : lastUsedEmojis()) {
|
const auto &lastUsed = lastUsedEmojis();
|
||||||
for (const auto &emojiCategory : _emojis) {
|
for (const auto &historicEmoji : lastUsed) {
|
||||||
|
for (const auto &emojiCategory : std::as_const(_emojis)) {
|
||||||
for (const auto &emoji : emojiCategory) {
|
for (const auto &emoji : emojiCategory) {
|
||||||
if (qvariant_cast<Emoji>(emoji).shortName == historicEmoji) {
|
if (qvariant_cast<Emoji>(emoji).shortName == historicEmoji) {
|
||||||
list.append(emoji);
|
list.append(emoji);
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ void PushRuleModel::setRules(QList<Quotient::PushRule> rules, PushRuleKind::Kind
|
|||||||
for (const auto &rule : rules) {
|
for (const auto &rule : rules) {
|
||||||
QString roomId;
|
QString roomId;
|
||||||
if (rule.conditions.size() > 0) {
|
if (rule.conditions.size() > 0) {
|
||||||
for (const auto &condition : rule.conditions) {
|
for (const auto &condition : std::as_const(rule.conditions)) {
|
||||||
if (condition.key == QStringLiteral("room_id")) {
|
if (condition.key == QStringLiteral("room_id")) {
|
||||||
roomId = condition.pattern;
|
roomId = condition.pattern;
|
||||||
}
|
}
|
||||||
@@ -163,7 +163,7 @@ PushRuleSection::Section PushRuleModel::getSection(Quotient::PushRule rule)
|
|||||||
}
|
}
|
||||||
// If the rule has push conditions and one is a room ID it is a room only keyword.
|
// If the rule has push conditions and one is a room ID it is a room only keyword.
|
||||||
if (!rule.conditions.isEmpty()) {
|
if (!rule.conditions.isEmpty()) {
|
||||||
for (auto condition : rule.conditions) {
|
for (const auto &condition : std::as_const(rule.conditions)) {
|
||||||
if (condition.key == QStringLiteral("room_id")) {
|
if (condition.key == QStringLiteral("room_id")) {
|
||||||
return PushRuleSection::RoomKeywords;
|
return PushRuleSection::RoomKeywords;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user