summary refs log tree commit diff
path: root/src/timeline
diff options
context:
space:
mode:
authorKonstantinos Sideris <sideris.konstantin@gmail.com>2018-03-25 15:59:47 +0300
committerKonstantinos Sideris <sideris.konstantin@gmail.com>2018-03-25 15:59:47 +0300
commit72d5d6d2863a4e7c56089bb966ae9181e22e1b91 (patch)
treeeccdf668c865bd95edc7c71349f153f6b1a1c99c /src/timeline
parentLink with pthread on Linux (diff)
downloadnheko-72d5d6d2863a4e7c56089bb966ae9181e22e1b91.tar.xz
Show avatars in the completion popup
Diffstat (limited to 'src/timeline')
-rw-r--r--src/timeline/TimelineItem.cc14
-rw-r--r--src/timeline/widgets/AudioItem.cc2
-rw-r--r--src/timeline/widgets/FileItem.cc2
-rw-r--r--src/timeline/widgets/ImageItem.cc26
4 files changed, 26 insertions, 18 deletions
diff --git a/src/timeline/TimelineItem.cc b/src/timeline/TimelineItem.cc
index 326b2c14..0296c6cd 100644
--- a/src/timeline/TimelineItem.cc
+++ b/src/timeline/TimelineItem.cc
@@ -126,7 +126,8 @@ TimelineItem::TimelineItem(mtx::events::MessageType ty,
 
                 messageLayout_->addLayout(headerLayout_, 1);
 
-                AvatarProvider::resolve(userid, [this](const QImage &img) { setUserAvatar(img); });
+                AvatarProvider::resolve(
+                  userid, this, [this](const QImage &img) { setUserAvatar(img); });
         } else {
                 generateBody(body);
                 setupSimpleLayout();
@@ -259,7 +260,8 @@ TimelineItem::TimelineItem(const mtx::events::RoomEvent<mtx::events::msg::Notice
 
                 messageLayout_->addLayout(headerLayout_, 1);
 
-                AvatarProvider::resolve(sender, [this](const QImage &img) { setUserAvatar(img); });
+                AvatarProvider::resolve(
+                  sender, this, [this](const QImage &img) { setUserAvatar(img); });
         } else {
                 generateBody(body);
                 setupSimpleLayout();
@@ -303,7 +305,8 @@ TimelineItem::TimelineItem(const mtx::events::RoomEvent<mtx::events::msg::Emote>
 
                 messageLayout_->addLayout(headerLayout_, 1);
 
-                AvatarProvider::resolve(sender, [this](const QImage &img) { setUserAvatar(img); });
+                AvatarProvider::resolve(
+                  sender, this, [this](const QImage &img) { setUserAvatar(img); });
         } else {
                 generateBody(emoteMsg);
                 setupSimpleLayout();
@@ -352,7 +355,8 @@ TimelineItem::TimelineItem(const mtx::events::RoomEvent<mtx::events::msg::Text>
 
                 messageLayout_->addLayout(headerLayout_, 1);
 
-                AvatarProvider::resolve(sender, [this](const QImage &img) { setUserAvatar(img); });
+                AvatarProvider::resolve(
+                  sender, this, [this](const QImage &img) { setUserAvatar(img); });
         } else {
                 generateBody(body);
                 setupSimpleLayout();
@@ -562,5 +566,5 @@ TimelineItem::addAvatar()
         messageLayout_->addWidget(checkmark_);
         messageLayout_->addWidget(timestamp_);
 
-        AvatarProvider::resolve(userid, [this](const QImage &img) { setUserAvatar(img); });
+        AvatarProvider::resolve(userid, this, [this](const QImage &img) { setUserAvatar(img); });
 }
diff --git a/src/timeline/widgets/AudioItem.cc b/src/timeline/widgets/AudioItem.cc
index 9f8b5dd1..79f944ff 100644
--- a/src/timeline/widgets/AudioItem.cc
+++ b/src/timeline/widgets/AudioItem.cc
@@ -135,7 +135,7 @@ AudioItem::mousePressEvent(QMouseEvent *event)
                         return;
 
                 auto proxy = client_->downloadFile(url_);
-                connect(proxy,
+                connect(proxy.data(),
                         &DownloadMediaProxy::fileDownloaded,
                         this,
                         [proxy, this](const QByteArray &data) {
diff --git a/src/timeline/widgets/FileItem.cc b/src/timeline/widgets/FileItem.cc
index d11ebe91..7445eb0f 100644
--- a/src/timeline/widgets/FileItem.cc
+++ b/src/timeline/widgets/FileItem.cc
@@ -121,7 +121,7 @@ FileItem::mousePressEvent(QMouseEvent *event)
                         return;
 
                 auto proxy = client_->downloadFile(url_);
-                connect(proxy,
+                connect(proxy.data(),
                         &DownloadMediaProxy::fileDownloaded,
                         this,
                         [proxy, this](const QByteArray &data) {
diff --git a/src/timeline/widgets/ImageItem.cc b/src/timeline/widgets/ImageItem.cc
index fc1e46f5..3aae63c8 100644
--- a/src/timeline/widgets/ImageItem.cc
+++ b/src/timeline/widgets/ImageItem.cc
@@ -56,11 +56,13 @@ ImageItem::ImageItem(QSharedPointer<MatrixClient> client,
 
         auto proxy = client_.data()->downloadImage(url_);
 
-        connect(
-          proxy, &DownloadMediaProxy::imageDownloaded, this, [this, proxy](const QPixmap &img) {
-                  proxy->deleteLater();
-                  setImage(img);
-          });
+        connect(proxy.data(),
+                &DownloadMediaProxy::imageDownloaded,
+                this,
+                [this, proxy](const QPixmap &img) {
+                        proxy->deleteLater();
+                        setImage(img);
+                });
 }
 
 ImageItem::ImageItem(QSharedPointer<MatrixClient> client,
@@ -92,11 +94,13 @@ ImageItem::ImageItem(QSharedPointer<MatrixClient> client,
 
         auto proxy = client_.data()->downloadImage(url_);
 
-        connect(
-          proxy, &DownloadMediaProxy::imageDownloaded, this, [proxy, this](const QPixmap &img) {
-                  proxy->deleteLater();
-                  setImage(img);
-          });
+        connect(proxy.data(),
+                &DownloadMediaProxy::imageDownloaded,
+                this,
+                [proxy, this](const QPixmap &img) {
+                        proxy->deleteLater();
+                        setImage(img);
+                });
 }
 
 void
@@ -230,7 +234,7 @@ ImageItem::saveAs()
                 return;
 
         auto proxy = client_->downloadFile(url_);
-        connect(proxy,
+        connect(proxy.data(),
                 &DownloadMediaProxy::fileDownloaded,
                 this,
                 [proxy, filename](const QByteArray &data) {