attempt to use a cache for user-defined avatars. Should reduce memory footprint. to be tested

This commit is contained in:
csoler 2019-06-03 23:52:29 +02:00
parent 807bbedd5a
commit e66fb923fb
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
25 changed files with 163 additions and 113 deletions

View file

@ -26,6 +26,7 @@
#include <QMimeData>
#include "CreateGxsChannelMsg.h"
#include "gui/gxs/GxsIdDetails.h"
#include "gui/feeds/SubFileItem.h"
#include "gui/RetroShareLink.h"
#include "util/HandleRichText.h"
@ -771,7 +772,7 @@ void CreateGxsChannelMsg::loadChannelPostInfo(const uint32_t &token)
for(std::list<RsGxsFile>::const_iterator it(post.mFiles.begin());it!=post.mFiles.end();++it)
addAttachment(it->mHash,it->mName,it->mSize,true,RsPeerId(),true);
picture.loadFromData(post.mThumbnail.mData,post.mThumbnail.mSize,"PNG");
GxsIdDetails::loadPixmapFromData(post.mThumbnail.mData,post.mThumbnail.mSize,picture);
thumbnail_label->setPixmap(picture);
}

View file

@ -326,7 +326,7 @@ void GxsChannelDialog::loadGroupSummaryToken(const uint32_t &token, std::list<Rs
if (group.mImage.mData != NULL) {
QPixmap image;
image.loadFromData(group.mImage.mData, group.mImage.mSize, "PNG");
GxsIdDetails::loadPixmapFromData(group.mImage.mData, group.mImage.mSize, image);
channelData->mIcon[group.mMeta.mGroupId] = image;
}

View file

@ -20,6 +20,7 @@
#include <QBuffer>
#include "gui/gxs/GxsIdDetails.h"
#include "GxsChannelGroupDialog.h"
#include <retroshare/rsgxschannels.h>
@ -179,7 +180,8 @@ bool GxsChannelGroupDialog::service_loadGroup(uint32_t token, Mode /*mode*/, RsG
if (group.mImage.mData) {
QPixmap pixmap;
if (pixmap.loadFromData(group.mImage.mData, group.mImage.mSize, "PNG")) {
if (GxsIdDetails::loadPixmapFromData(group.mImage.mData, group.mImage.mSize,pixmap)) {
setLogo(pixmap);
}
}

View file

@ -26,6 +26,7 @@
#include "GxsChannelPostsWidget.h"
#include "ui_GxsChannelPostsWidget.h"
#include "gui/feeds/GxsChannelPostItem.h"
#include "gui/gxs/GxsIdDetails.h"
#include "gui/gxschannels/CreateGxsChannelMsg.h"
#include "gui/common/UIStateHelper.h"
#include "gui/settings/rsharesettings.h"
@ -238,7 +239,7 @@ void GxsChannelPostsWidget::insertChannelDetails(const RsGxsChannelGroup &group)
/* IMAGE */
QPixmap chanImage;
if (group.mImage.mData != NULL) {
chanImage.loadFromData(group.mImage.mData, group.mImage.mSize, "PNG");
GxsIdDetails::loadPixmapFromData(group.mImage.mData, group.mImage.mSize, chanImage);
} else {
chanImage = QPixmap(CHAN_DEFAULT_IMAGE);
}