summary refs log tree commit diff
path: root/src/ChatPage.cc
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/ChatPage.cc
parentLink with pthread on Linux (diff)
downloadnheko-72d5d6d2863a4e7c56089bb966ae9181e22e1b91.tar.xz
Show avatars in the completion popup
Diffstat (limited to 'src/ChatPage.cc')
-rw-r--r--src/ChatPage.cc19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/ChatPage.cc b/src/ChatPage.cc

index b49fb6a2..0d69c51f 100644 --- a/src/ChatPage.cc +++ b/src/ChatPage.cc
@@ -579,11 +579,20 @@ ChatPage::updateOwnProfileInfo(const QUrl &avatar_url, const QString &display_na user_info_widget_->setUserId(userid); user_info_widget_->setDisplayName(display_name); - if (avatar_url.isValid()) - client_->fetchUserAvatar( - avatar_url, - [this](QImage img) { user_info_widget_->setAvatar(img); }, - [](QString error) { qWarning() << error << ": failed to fetch own avatar"; }); + if (avatar_url.isValid()) { + auto proxy = client_->fetchUserAvatar(avatar_url); + if (proxy == nullptr) + return; + + proxy->setParent(this); + connect(proxy.data(), + &DownloadMediaProxy::avatarDownloaded, + this, + [this, proxy](const QImage &img) { + proxy->deleteLater(); + user_info_widget_->setAvatar(img); + }); + } } void