Added to display the headshot images on the group item

This commit is contained in:
defnax 2020-05-28 22:15:44 +02:00
parent 589bb65324
commit df0ed8e77e
6 changed files with 34 additions and 4 deletions

View File

@ -1,5 +1,8 @@
<RCC> <RCC>
<qresource prefix="/" > <qresource prefix="/">
<file>images/compose.png</file> <file>images/compose.png</file>
<file>images/like.png</file>
<file>images/reply.png</file>
<file>images/retweet.png</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -51,6 +51,25 @@ void WireGroupItem::setup()
label_authorId->setId(mGroup.mMeta.mAuthorId); label_authorId->setId(mGroup.mMeta.mAuthorId);
frame_details->setVisible(false); frame_details->setVisible(false);
if (mGroup.mHeadshot.mData )
{
QPixmap pixmap;
if (GxsIdDetails::loadPixmapFromData(
mGroup.mHeadshot.mData,
mGroup.mHeadshot.mSize,
pixmap,GxsIdDetails::ORIGINAL))
{
pixmap = pixmap.scaled(32,32);
label_headshot->setPixmap(pixmap);
}
}
else
{
// default.
QPixmap pixmap = QPixmap(":/icons/wire.png").scaled(32,32);
label_headshot->setPixmap(pixmap);
}
RsIdentityDetails idDetails ; RsIdentityDetails idDetails ;
rsIdentity->getIdDetails(mGroup.mMeta.mAuthorId,idDetails); rsIdentity->getIdDetails(mGroup.mMeta.mAuthorId,idDetails);
@ -59,6 +78,7 @@ void WireGroupItem::setup()
if(idDetails.mAvatar.mSize == 0 || !GxsIdDetails::loadPixmapFromData(idDetails.mAvatar.mData, idDetails.mAvatar.mSize, pixmap,GxsIdDetails::SMALL)) if(idDetails.mAvatar.mSize == 0 || !GxsIdDetails::loadPixmapFromData(idDetails.mAvatar.mData, idDetails.mAvatar.mSize, pixmap,GxsIdDetails::SMALL))
pixmap = GxsIdDetails::makeDefaultIcon(mGroup.mMeta.mAuthorId,GxsIdDetails::SMALL); pixmap = GxsIdDetails::makeDefaultIcon(mGroup.mMeta.mAuthorId,GxsIdDetails::SMALL);
pixmap = pixmap.scaled(24,24);
label_avatar->setPixmap(pixmap); label_avatar->setPixmap(pixmap);
connect(toolButton_show, SIGNAL(clicked()), this, SLOT(show())); connect(toolButton_show, SIGNAL(clicked()), this, SLOT(show()));

View File

@ -38,7 +38,7 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>
<widget class="QLabel" name="label_avatar"> <widget class="QLabel" name="label_headshot">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>32</width> <width>32</width>
@ -102,6 +102,13 @@
<enum>QFrame::Raised</enum> <enum>QFrame::Raised</enum>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_3"> <layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_avatar">
<property name="text">
<string>Avatar</string>
</property>
</widget>
</item>
<item> <item>
<widget class="GxsIdLabel" name="label_authorId"> <widget class="GxsIdLabel" name="label_authorId">
<property name="text"> <property name="text">

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB