Fixup how REF message are displayed

Ensure RefImageCount is correct.
Update docs on m(Ref)GroupPtr points to
fill-in GroupPtrs on Ref Msgs.
Remove mRefAuthorName as not so useful.
Add images into Response Msgs.
Display Headshot / Images on Ref Msgs - if possible.
This commit is contained in:
drbob 2020-05-19 19:40:12 +10:00
parent fbf56fcf03
commit f4457b1331
7 changed files with 113 additions and 21 deletions

View file

@ -104,3 +104,34 @@ void PulseMessage::setMessage(QString msg)
textBrowser->setPlainText(msg);
}
void PulseMessage::setRefImageCount(uint32_t count)
{
QString msg = "Follow to see Image";
label_image1->setText(msg);
label_image2->setText(msg);
label_image3->setText(msg);
label_image4->setText(msg);
label_image1->setVisible(false);
label_image2->setVisible(false);
label_image3->setVisible(false);
label_image4->setVisible(false);
switch(count) {
case 4:
label_image4->setVisible(true);
case 3:
label_image3->setVisible(true);
case 2:
label_image2->setVisible(true);
case 1:
label_image1->setVisible(true);
default:
break;
}
if (count < 1) {
frame_expand->setVisible(false);
}
}

View file

@ -34,6 +34,7 @@ public:
void setup(RsWirePulseSPtr pulse);
void setMessage(QString msg);
void setRefImageCount(uint32_t count);
};
#endif

View file

@ -85,7 +85,7 @@ void PulseReply::setAuthorString(QString name)
void PulseReply::setRefMessage(QString msg, uint32_t image_count)
{
widget_message->setMessage(msg);
//, image_count);
widget_message->setRefImageCount(image_count);
}
void PulseReply::setMessage(RsWirePulseSPtr pulse)

View file

@ -226,6 +226,32 @@ void PulseDataItem::showPulse()
if (mPulse->mPulseType & WIRE_PULSE_TYPE_REFERENCE)
{
// Group
bool headshotOkay = false;
if (mPulse->mRefGroupPtr) {
if (mPulse->mRefGroupPtr->mHeadshot.mData)
{
QPixmap pixmap;
if (GxsIdDetails::loadPixmapFromData(
mPulse->mRefGroupPtr->mHeadshot.mData,
mPulse->mRefGroupPtr->mHeadshot.mSize,
pixmap,GxsIdDetails::ORIGINAL))
{
headshotOkay = true;
pixmap = pixmap.scaled(50,50);
setHeadshot(pixmap);
}
}
}
if (!headshotOkay)
{
// default.
QPixmap pixmap = QPixmap(":/icons/png/posted.png").scaled(50,50);
setHeadshot(pixmap);
}
// Group
setGroupName(mPulse->mRefGroupName);
setAuthor(mPulse->mRefAuthorId.toStdString());
@ -235,15 +261,15 @@ void PulseDataItem::showPulse()
setDate(mPulse->mRefPublishTs);
// References (unknown for a REFERENCE)
// should show FOLLOW button instead.
// setLikes(mPulse->mLikes.size());
// setReplies(mPulse->mReplies.size());
// setRepublishes(mPulse->mRepublishes.size());
// show FOLLOW button instead.
showResponseStats(false);
//
setReference(mPulse->mPulseType & WIRE_PULSE_RESPONSE_MASK, mPulse->mMeta.mGroupId, "GroupName TODO");
if (mPulse->mGroupPtr) {
setReference(mPulse->mPulseType & WIRE_PULSE_RESPONSE_MASK, mPulse->mMeta.mGroupId, mPulse->mGroupPtr->mMeta.mGroupName);
} else {
setReference(mPulse->mPulseType & WIRE_PULSE_RESPONSE_MASK, mPulse->mMeta.mGroupId, "REF GROUP MISSING");
}
}
else // ORIG / RESPONSE.