diff options
author | MTRNord <mtrnord1@gmail.com> | 2021-12-23 02:46:33 +0100 |
---|---|---|
committer | MTRNord <mtrnord1@gmail.com> | 2021-12-23 02:46:33 +0100 |
commit | a872bdf8c5dc17f901cc9f553d4ff2539f0334f6 (patch) | |
tree | 337f9c8d5bebde948b73048907d887955a7531c9 /src/timeline/TimelineModel.cpp | |
parent | Apply (selective) Clang-tidy and clazy suggestions on TimelineModel (diff) | |
download | nheko-a872bdf8c5dc17f901cc9f553d4ff2539f0334f6.tar.xz |
Apply (selective) Clang-tidy move and some new detected const pointer suggestions on TimelineModel
Diffstat (limited to 'src/timeline/TimelineModel.cpp')
-rw-r--r-- | src/timeline/TimelineModel.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/timeline/TimelineModel.cpp b/src/timeline/TimelineModel.cpp index 3fe52553..543d2c84 100644 --- a/src/timeline/TimelineModel.cpp +++ b/src/timeline/TimelineModel.cpp @@ -17,6 +17,7 @@ #include <QRegularExpression> #include <QStandardPaths> #include <QVariant> +#include <utility> #include "Cache_p.h" #include "ChatPage.h" @@ -407,7 +408,7 @@ TimelineModel::TimelineModel(TimelineViewManager *manager, const QString &room_i ChatPage::instance()->receivedRoomDeviceVerificationRequest(msg, this); }); 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, @@ -1069,11 +1070,11 @@ TimelineModel::forwardMessage(const QString & eventId, QString roomId) if (!e) return; - emit forwardToRoom(e, roomId); + emit forwardToRoom(e, std::move(roomId)); } void -TimelineModel::viewDecryptedRawMessage(QString id) +TimelineModel::viewDecryptedRawMessage(const QString &id) { auto e = events.get(id.toStdString(), ""); if (!e) @@ -1086,7 +1087,7 @@ TimelineModel::viewDecryptedRawMessage(QString id) void 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); emit manager_->openProfile(userProfile); } @@ -1094,7 +1095,7 @@ TimelineModel::openUserProfile(QString userid) void TimelineModel::replyAction(QString id) { - setReply(id); + setReply(std::move(id)); } void @@ -1423,7 +1424,7 @@ TimelineModel::addPendingMessage(mtx::events::collections::TimelineEvents event) } void -TimelineModel::openMedia(QString eventId) +TimelineModel::openMedia(const QString &eventId) { cacheMedia(eventId, [](const QString &filename) { QDesktopServices::openUrl(QUrl::fromLocalFile(filename)); }); @@ -1700,7 +1701,7 @@ TimelineModel::copyLinkToEvent(const QString &eventId) const } QString -TimelineModel::formatTypingUsers(const std::vector<QString> &users, QColor bg) +TimelineModel::formatTypingUsers(const std::vector<QString> &users, const QColor &bg) { QString temp = tr("%1 and %2 are typing.", |