mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Optimized avatar loading in RsFriendListModel
This commit is contained in:
parent
19d613edcc
commit
c8975bb2e9
@ -54,7 +54,9 @@ bool AvatarDefs::getAvatarFromSslId(const RsPeerId& sslId, QPixmap &avatar, cons
|
|||||||
/* get avatar */
|
/* get avatar */
|
||||||
rsMsgs->getAvatarData(RsPeerId(sslId), data, size);
|
rsMsgs->getAvatarData(RsPeerId(sslId), data, size);
|
||||||
if (size == 0) {
|
if (size == 0) {
|
||||||
|
if (!defaultImage.isEmpty()) {
|
||||||
avatar = FilesDefs::getPixmapFromQtResourcePath(defaultImage);
|
avatar = FilesDefs::getPixmapFromQtResourcePath(defaultImage);
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -931,23 +931,25 @@ QVariant RsFriendListModel::decorationRole(const EntryIndex& entry,int col) cons
|
|||||||
{
|
{
|
||||||
if(!isProfileExpanded(entry))
|
if(!isProfileExpanded(entry))
|
||||||
{
|
{
|
||||||
QPixmap sslAvatar = FilesDefs::getPixmapFromQtResourcePath(AVATAR_DEFAULT_IMAGE);
|
QPixmap sslAvatar;
|
||||||
QPixmap sslOverlayIcon;
|
|
||||||
sslOverlayIcon = FilesDefs::getPixmapFromQtResourcePath(StatusDefs::imageStatus(onlineRole(entry,col).toInt()));
|
|
||||||
|
|
||||||
|
|
||||||
const HierarchicalProfileInformation *hn = getProfileInfo(entry);
|
const HierarchicalProfileInformation *hn = getProfileInfo(entry);
|
||||||
|
|
||||||
for(uint32_t i=0;i<hn->child_node_indices.size();++i)
|
for(uint32_t i=0;i<hn->child_node_indices.size();++i) {
|
||||||
if(AvatarDefs::getAvatarFromSslId(RsPeerId(mLocations[hn->child_node_indices[i]].node_info.id.toStdString()), sslAvatar))
|
if(AvatarDefs::getAvatarFromSslId(RsPeerId(mLocations[hn->child_node_indices[i]].node_info.id.toStdString()), sslAvatar, "")) {
|
||||||
if (mDisplayStatusIcon)
|
break;
|
||||||
return QVariant(QIcon(createAvatar(sslAvatar, sslOverlayIcon)));
|
}
|
||||||
else
|
}
|
||||||
return QVariant(QIcon(sslAvatar));
|
|
||||||
|
|
||||||
if (mDisplayStatusIcon)
|
if (sslAvatar.isNull()) {
|
||||||
|
sslAvatar = FilesDefs::getPixmapFromQtResourcePath(AVATAR_DEFAULT_IMAGE);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mDisplayStatusIcon) {
|
||||||
|
QPixmap sslOverlayIcon = FilesDefs::getPixmapFromQtResourcePath(StatusDefs::imageStatus(onlineRole(entry, col).toInt()));
|
||||||
return QVariant(QIcon(createAvatar(sslAvatar, sslOverlayIcon)));
|
return QVariant(QIcon(createAvatar(sslAvatar, sslOverlayIcon)));
|
||||||
else
|
}
|
||||||
|
|
||||||
return QVariant(QIcon(sslAvatar));
|
return QVariant(QIcon(sslAvatar));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -962,13 +964,12 @@ QVariant RsFriendListModel::decorationRole(const EntryIndex& entry,int col) cons
|
|||||||
return QVariant();
|
return QVariant();
|
||||||
|
|
||||||
QPixmap sslAvatar;
|
QPixmap sslAvatar;
|
||||||
QPixmap sslOverlayIcon;
|
|
||||||
sslOverlayIcon = FilesDefs::getPixmapFromQtResourcePath(StatusDefs::imageStatus(statusRole(entry,col).toInt()));
|
|
||||||
|
|
||||||
AvatarDefs::getAvatarFromSslId(RsPeerId(hn->node_info.id.toStdString()), sslAvatar);
|
AvatarDefs::getAvatarFromSslId(RsPeerId(hn->node_info.id.toStdString()), sslAvatar);
|
||||||
if (mDisplayStatusIcon)
|
if (mDisplayStatusIcon) {
|
||||||
|
QPixmap sslOverlayIcon = FilesDefs::getPixmapFromQtResourcePath(StatusDefs::imageStatus(statusRole(entry, col).toInt()));
|
||||||
return QVariant(QIcon(createAvatar(sslAvatar, sslOverlayIcon)));
|
return QVariant(QIcon(createAvatar(sslAvatar, sslOverlayIcon)));
|
||||||
else
|
}
|
||||||
|
|
||||||
return QVariant(QIcon(sslAvatar));
|
return QVariant(QIcon(sslAvatar));
|
||||||
}
|
}
|
||||||
default: return QVariant();
|
default: return QVariant();
|
||||||
|
Loading…
Reference in New Issue
Block a user