diff options
author | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2018-04-29 15:42:40 +0300 |
---|---|---|
committer | Konstantinos Sideris <sideris.konstantin@gmail.com> | 2018-04-29 15:42:40 +0300 |
commit | 95120c602b2888c244eb15b475483c523a3d4dbd (patch) | |
tree | 08eb9b05ee24210808789cb1c416ff2dc1ed4a97 /src/timeline | |
parent | Install qt5-svg in travis (diff) | |
download | nheko-95120c602b2888c244eb15b475483c523a3d4dbd.tar.xz |
Refactor utils::getMessageDescription
Diffstat (limited to 'src/timeline')
-rw-r--r-- | src/timeline/TimelineItem.cc | 19 | ||||
-rw-r--r-- | src/timeline/TimelineView.cc | 11 |
2 files changed, 16 insertions, 14 deletions
diff --git a/src/timeline/TimelineItem.cc b/src/timeline/TimelineItem.cc index ce82ebd8..2b5ffbf3 100644 --- a/src/timeline/TimelineItem.cc +++ b/src/timeline/TimelineItem.cc @@ -152,7 +152,7 @@ TimelineItem::TimelineItem(ImageItem *image, { init(); - setupLocalWidgetLayout<ImageItem>(image, userid, "sent an image", withSender); + setupLocalWidgetLayout<ImageItem>(image, userid, withSender); addSaveImageAction(image); } @@ -167,7 +167,7 @@ TimelineItem::TimelineItem(FileItem *file, { init(); - setupLocalWidgetLayout<FileItem>(file, userid, "sent a file", withSender); + setupLocalWidgetLayout<FileItem>(file, userid, withSender); } TimelineItem::TimelineItem(AudioItem *audio, @@ -180,7 +180,7 @@ TimelineItem::TimelineItem(AudioItem *audio, { init(); - setupLocalWidgetLayout<AudioItem>(audio, userid, "sent an audio clip", withSender); + setupLocalWidgetLayout<AudioItem>(audio, userid, withSender); } TimelineItem::TimelineItem(VideoItem *video, @@ -193,7 +193,7 @@ TimelineItem::TimelineItem(VideoItem *video, { init(); - setupLocalWidgetLayout<VideoItem>(video, userid, "sent a video clip", withSender); + setupLocalWidgetLayout<VideoItem>(video, userid, withSender); } TimelineItem::TimelineItem(ImageItem *image, @@ -205,7 +205,7 @@ TimelineItem::TimelineItem(ImageItem *image, , room_id_{room_id} { setupWidgetLayout<mtx::events::RoomEvent<mtx::events::msg::Image>, ImageItem>( - image, event, " sent an image", with_sender); + image, event, with_sender); addSaveImageAction(image); } @@ -218,8 +218,7 @@ TimelineItem::TimelineItem(StickerItem *image, : QWidget(parent) , room_id_{room_id} { - setupWidgetLayout<mtx::events::Sticker, StickerItem>( - image, event, " sent a sticker", with_sender); + setupWidgetLayout<mtx::events::Sticker, StickerItem>(image, event, with_sender); addSaveImageAction(image); } @@ -233,7 +232,7 @@ TimelineItem::TimelineItem(FileItem *file, , room_id_{room_id} { setupWidgetLayout<mtx::events::RoomEvent<mtx::events::msg::File>, FileItem>( - file, event, " sent a file", with_sender); + file, event, with_sender); } TimelineItem::TimelineItem(AudioItem *audio, @@ -245,7 +244,7 @@ TimelineItem::TimelineItem(AudioItem *audio, , room_id_{room_id} { setupWidgetLayout<mtx::events::RoomEvent<mtx::events::msg::Audio>, AudioItem>( - audio, event, " sent an audio clip", with_sender); + audio, event, with_sender); } TimelineItem::TimelineItem(VideoItem *video, @@ -257,7 +256,7 @@ TimelineItem::TimelineItem(VideoItem *video, , room_id_{room_id} { setupWidgetLayout<mtx::events::RoomEvent<mtx::events::msg::Video>, VideoItem>( - video, event, " sent a video clip", with_sender); + video, event, with_sender); } /* diff --git a/src/timeline/TimelineView.cc b/src/timeline/TimelineView.cc index d7f674d4..3a8e1c3d 100644 --- a/src/timeline/TimelineView.cc +++ b/src/timeline/TimelineView.cc @@ -19,6 +19,7 @@ #include <QFileInfo> #include <QTimer> +#include "Cache.h" #include "ChatPage.h" #include "Config.h" #include "FloatingButton.h" @@ -212,8 +213,9 @@ TimelineView::addBackwardsEvents(const QString &room_id, const mtx::responses::M isTimelineFinished = false; // Queue incoming messages to be rendered later. - for (auto const &e : msgs.chunk) - topMessages_.emplace_back(e); + topMessages_.insert(topMessages_.end(), + std::make_move_iterator(msgs.chunk.begin()), + std::make_move_iterator(msgs.chunk.end())); // The RoomList message preview will be updated only if this // is the first batch of messages received through /messages @@ -361,8 +363,9 @@ TimelineView::addEvents(const mtx::responses::Timeline &timeline) isInitialSync = false; } - for (const auto &e : timeline.events) - bottomMessages_.push_back(e); + bottomMessages_.insert(bottomMessages_.end(), + std::make_move_iterator(timeline.events.begin()), + std::make_move_iterator(timeline.events.end())); if (!bottomMessages_.empty()) notifyForLastEvent(findLastViewableEvent(bottomMessages_)); |