Apply (selective) Clang-tidy const function and new const pointer suggestions on TimelineModel

This commit is contained in:
MTRNord 2021-12-23 02:55:25 +01:00
parent a872bdf8c5
commit 049613211a
2 changed files with 9 additions and 9 deletions

View file

@ -1027,13 +1027,13 @@ TimelineModel::readEvent(const std::string &id)
}
QString
TimelineModel::displayName(QString id) const
TimelineModel::displayName(const QString &id) const
{
return cache::displayName(room_id_, id).toHtmlEscaped();
}
QString
TimelineModel::avatarUrl(QString id) const
TimelineModel::avatarUrl(const QString &id) const
{
return cache::avatarUrl(room_id_, id);
}
@ -1093,9 +1093,9 @@ TimelineModel::openUserProfile(QString userid)
}
void
TimelineModel::replyAction(QString id)
TimelineModel::replyAction(const QString &id)
{
setReply(std::move(id));
setReply(id);
}
void

View file

@ -242,8 +242,8 @@ public:
bool canFetchMore(const QModelIndex &) const override;
void fetchMore(const QModelIndex &) override;
Q_INVOKABLE QString displayName(QString id) const;
Q_INVOKABLE QString avatarUrl(QString id) const;
Q_INVOKABLE QString displayName(const QString &id) const;
Q_INVOKABLE QString avatarUrl(const QString &id) const;
Q_INVOKABLE QString formatDateSeparator(QDate date) const;
Q_INVOKABLE QString formatTypingUsers(const std::vector<QString> &users, const QColor &bg);
Q_INVOKABLE bool showAcceptKnockButton(const QString &id);
@ -260,7 +260,7 @@ public:
Q_INVOKABLE void viewDecryptedRawMessage(const QString &id);
Q_INVOKABLE void openUserProfile(QString userid);
Q_INVOKABLE void editAction(QString id);
Q_INVOKABLE void replyAction(QString id);
Q_INVOKABLE void replyAction(const QString &id);
Q_INVOKABLE void unpin(const QString &id);
Q_INVOKABLE void pin(const QString &id);
Q_INVOKABLE void showReadReceipts(QString id);
@ -367,8 +367,8 @@ public slots:
QString roomAvatarUrl() const;
QString roomId() const { return room_id_; }
bool hasMentions() { return highlight_count > 0; }
int notificationCount() { return notification_count; }
bool hasMentions() const { return highlight_count > 0; }
int notificationCount() const { return notification_count; }
QString scrollTarget() const;