mirror of
https://github.com/Nheko-Reborn/nheko.git
synced 2024-11-25 20:48:52 +03:00
Apply (selective) Clang-tidy move and some new detected const pointer suggestions on TimelineModel
This commit is contained in:
parent
02fcd0e7cf
commit
a872bdf8c5
2 changed files with 12 additions and 11 deletions
|
@ -17,6 +17,7 @@
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QStandardPaths>
|
#include <QStandardPaths>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
#include <utility>
|
||||||
|
|
||||||
#include "Cache_p.h"
|
#include "Cache_p.h"
|
||||||
#include "ChatPage.h"
|
#include "ChatPage.h"
|
||||||
|
@ -407,7 +408,7 @@ TimelineModel::TimelineModel(TimelineViewManager *manager, const QString &room_i
|
||||||
ChatPage::instance()->receivedRoomDeviceVerificationRequest(msg, this);
|
ChatPage::instance()->receivedRoomDeviceVerificationRequest(msg, this);
|
||||||
});
|
});
|
||||||
connect(&events, &EventStore::updateFlowEventId, this, [this](std::string event_id) {
|
connect(&events, &EventStore::updateFlowEventId, this, [this](std::string event_id) {
|
||||||
this->updateFlowEventId(event_id);
|
this->updateFlowEventId(std::move(event_id));
|
||||||
});
|
});
|
||||||
|
|
||||||
// When a message is sent, check if the current edit/reply relates to that message,
|
// When a message is sent, check if the current edit/reply relates to that message,
|
||||||
|
@ -1069,11 +1070,11 @@ TimelineModel::forwardMessage(const QString & eventId, QString roomId)
|
||||||
if (!e)
|
if (!e)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
emit forwardToRoom(e, roomId);
|
emit forwardToRoom(e, std::move(roomId));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TimelineModel::viewDecryptedRawMessage(QString id)
|
TimelineModel::viewDecryptedRawMessage(const QString &id)
|
||||||
{
|
{
|
||||||
auto e = events.get(id.toStdString(), "");
|
auto e = events.get(id.toStdString(), "");
|
||||||
if (!e)
|
if (!e)
|
||||||
|
@ -1086,7 +1087,7 @@ TimelineModel::viewDecryptedRawMessage(QString id)
|
||||||
void
|
void
|
||||||
TimelineModel::openUserProfile(QString userid)
|
TimelineModel::openUserProfile(QString userid)
|
||||||
{
|
{
|
||||||
UserProfile *userProfile = new UserProfile(room_id_, userid, manager_, this);
|
UserProfile *userProfile = new UserProfile(room_id_, std::move(userid), manager_, this);
|
||||||
connect(this, &TimelineModel::roomAvatarUrlChanged, userProfile, &UserProfile::updateAvatarUrl);
|
connect(this, &TimelineModel::roomAvatarUrlChanged, userProfile, &UserProfile::updateAvatarUrl);
|
||||||
emit manager_->openProfile(userProfile);
|
emit manager_->openProfile(userProfile);
|
||||||
}
|
}
|
||||||
|
@ -1094,7 +1095,7 @@ TimelineModel::openUserProfile(QString userid)
|
||||||
void
|
void
|
||||||
TimelineModel::replyAction(QString id)
|
TimelineModel::replyAction(QString id)
|
||||||
{
|
{
|
||||||
setReply(id);
|
setReply(std::move(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1423,7 +1424,7 @@ TimelineModel::addPendingMessage(mtx::events::collections::TimelineEvents event)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TimelineModel::openMedia(QString eventId)
|
TimelineModel::openMedia(const QString &eventId)
|
||||||
{
|
{
|
||||||
cacheMedia(eventId,
|
cacheMedia(eventId,
|
||||||
[](const QString &filename) { QDesktopServices::openUrl(QUrl::fromLocalFile(filename)); });
|
[](const QString &filename) { QDesktopServices::openUrl(QUrl::fromLocalFile(filename)); });
|
||||||
|
@ -1700,7 +1701,7 @@ TimelineModel::copyLinkToEvent(const QString &eventId) const
|
||||||
}
|
}
|
||||||
|
|
||||||
QString
|
QString
|
||||||
TimelineModel::formatTypingUsers(const std::vector<QString> &users, QColor bg)
|
TimelineModel::formatTypingUsers(const std::vector<QString> &users, const QColor &bg)
|
||||||
{
|
{
|
||||||
QString temp =
|
QString temp =
|
||||||
tr("%1 and %2 are typing.",
|
tr("%1 and %2 are typing.",
|
||||||
|
|
|
@ -245,7 +245,7 @@ public:
|
||||||
Q_INVOKABLE QString displayName(QString id) const;
|
Q_INVOKABLE QString displayName(QString id) const;
|
||||||
Q_INVOKABLE QString avatarUrl(QString id) const;
|
Q_INVOKABLE QString avatarUrl(QString id) const;
|
||||||
Q_INVOKABLE QString formatDateSeparator(QDate date) const;
|
Q_INVOKABLE QString formatDateSeparator(QDate date) const;
|
||||||
Q_INVOKABLE QString formatTypingUsers(const std::vector<QString> &users, QColor bg);
|
Q_INVOKABLE QString formatTypingUsers(const std::vector<QString> &users, const QColor &bg);
|
||||||
Q_INVOKABLE bool showAcceptKnockButton(const QString &id);
|
Q_INVOKABLE bool showAcceptKnockButton(const QString &id);
|
||||||
Q_INVOKABLE void acceptKnock(const QString &id);
|
Q_INVOKABLE void acceptKnock(const QString &id);
|
||||||
Q_INVOKABLE QString formatMemberEvent(const QString &id);
|
Q_INVOKABLE QString formatMemberEvent(const QString &id);
|
||||||
|
@ -257,7 +257,7 @@ public:
|
||||||
|
|
||||||
Q_INVOKABLE void viewRawMessage(const QString &id);
|
Q_INVOKABLE void viewRawMessage(const QString &id);
|
||||||
Q_INVOKABLE void forwardMessage(const QString &eventId, QString roomId);
|
Q_INVOKABLE void forwardMessage(const QString &eventId, QString roomId);
|
||||||
Q_INVOKABLE void viewDecryptedRawMessage(QString id);
|
Q_INVOKABLE void viewDecryptedRawMessage(const QString &id);
|
||||||
Q_INVOKABLE void openUserProfile(QString userid);
|
Q_INVOKABLE void openUserProfile(QString userid);
|
||||||
Q_INVOKABLE void editAction(QString id);
|
Q_INVOKABLE void editAction(QString id);
|
||||||
Q_INVOKABLE void replyAction(QString id);
|
Q_INVOKABLE void replyAction(QString id);
|
||||||
|
@ -267,7 +267,7 @@ public:
|
||||||
Q_INVOKABLE void redactEvent(const QString &id);
|
Q_INVOKABLE void redactEvent(const QString &id);
|
||||||
Q_INVOKABLE int idToIndex(const QString &id) const;
|
Q_INVOKABLE int idToIndex(const QString &id) const;
|
||||||
Q_INVOKABLE QString indexToId(int index) const;
|
Q_INVOKABLE QString indexToId(int index) const;
|
||||||
Q_INVOKABLE void openMedia(QString eventId);
|
Q_INVOKABLE void openMedia(const QString &eventId);
|
||||||
Q_INVOKABLE void cacheMedia(const QString &eventId);
|
Q_INVOKABLE void cacheMedia(const QString &eventId);
|
||||||
Q_INVOKABLE bool saveMedia(const QString &eventId) const;
|
Q_INVOKABLE bool saveMedia(const QString &eventId) const;
|
||||||
Q_INVOKABLE void showEvent(QString eventId);
|
Q_INVOKABLE void showEvent(QString eventId);
|
||||||
|
@ -331,7 +331,7 @@ public slots:
|
||||||
std::vector<QString> typingUsers() const { return typingUsers_; }
|
std::vector<QString> typingUsers() const { return typingUsers_; }
|
||||||
bool paginationInProgress() const { return m_paginationInProgress; }
|
bool paginationInProgress() const { return m_paginationInProgress; }
|
||||||
QString reply() const { return reply_; }
|
QString reply() const { return reply_; }
|
||||||
void setReply(QString newReply)
|
void setReply(const QString &newReply)
|
||||||
{
|
{
|
||||||
if (edit_.startsWith('m'))
|
if (edit_.startsWith('m'))
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue