Try to reduce memory usage by reusing avatar pixmaps

This commit is contained in:
Nicolas Werner 2019-08-26 01:24:56 +02:00
parent 89015b9f18
commit 52056a79fa
27 changed files with 149 additions and 208 deletions

View file

@ -21,6 +21,7 @@
#include <QPainter>
#include <QtGlobal>
#include "AvatarProvider.h"
#include "Cache.h"
#include "Config.h"
#include "RoomInfoListItem.h"
@ -434,10 +435,12 @@ RoomInfoListItem::mousePressEvent(QMouseEvent *event)
}
void
RoomInfoListItem::setAvatar(const QImage &img)
RoomInfoListItem::setAvatar(const QString &avatar_url)
{
roomAvatar_ = utils::scaleImageToPixmap(img, IconSize);
update();
AvatarProvider::resolve(avatar_url, IconSize, this, [this](const QPixmap &img) {
roomAvatar_ = img;
update();
});
}
void