Fetch user avatars while browsing the member list

This commit is contained in:
Konstantinos Sideris 2018-05-04 17:59:29 +03:00
parent 8dd21b1dae
commit 156e1e62a6
3 changed files with 19 additions and 1 deletions

View file

@ -45,9 +45,15 @@ public slots:
protected:
void paintEvent(QPaintEvent *event) override;
void moveButtonToBottom();
void hideEvent(QHideEvent *event) override
{
list_->clear();
QFrame::hideEvent(event);
}
private:
void moveButtonToBottom();
QString room_id_;
QLabel *topLabel_;
QListWidget *list_;

View file

@ -44,6 +44,11 @@ public slots:
protected:
void paintEvent(QPaintEvent *event) override;
void hideEvent(QHideEvent *event) override
{
userList_->clear();
QFrame::hideEvent(event);
}
private:
QLabel *topLabel_;

View file

@ -3,6 +3,8 @@
#include <QStyleOption>
#include <QVBoxLayout>
#include "AvatarProvider.h"
#include "ChatPage.h"
#include "Config.h"
#include "FlatButton.h"
#include "Utils.h"
@ -29,6 +31,11 @@ MemberItem::MemberItem(const RoomMember &member, QWidget *parent)
if (!member.avatar.isNull())
avatar_->setImage(member.avatar);
else
AvatarProvider::resolve(ChatPage::instance()->currentRoom(),
member.user_id,
this,
[this](const QImage &img) { avatar_->setImage(img); });
QFont nameFont, idFont;
nameFont.setWeight(65);