Update display of WireGroup

This commit is contained in:
drbob 2020-05-26 18:31:55 +10:00
parent bcd8f4b0de
commit 589bb65324
4 changed files with 72 additions and 4 deletions

View File

@ -42,6 +42,8 @@ typedef std::shared_ptr<const RsWireGroup> RsWireGroupConstSPtr;
class RsWireGroup: public RsGxsGenericGroupData class RsWireGroup: public RsGxsGenericGroupData
{ {
public: public:
RsWireGroup();
std::string mTagline; std::string mTagline;
std::string mLocation; std::string mLocation;

View File

@ -30,6 +30,12 @@
RsWire *rsWire = NULL; RsWire *rsWire = NULL;
RsWireGroup::RsWireGroup()
:mGroupPulses(0),mGroupRepublishes(0),mGroupLikes(0),mGroupReplies(0)
,mRefMentions(0),mRefRepublishes(0),mRefLikes(0),mRefReplies(0)
{
return;
}
uint32_t RsWirePulse::ImageCount() uint32_t RsWirePulse::ImageCount()
{ {
@ -878,6 +884,19 @@ bool p3Wire::getPulsesForGroups(const std::list<RsGxsGroupId> &groupIds, std::li
return false; return false;
} }
std::cerr << "p3Wire::getPulsesForGroups() size = " << pulsePtrs.size();
std::cerr << std::endl;
{
std::list<RsWirePulseSPtr>::iterator it;
for (it = pulsePtrs.begin(); it != pulsePtrs.end(); it++)
{
std::cerr << "p3Wire::getPulsesForGroups() Flags: ";
std::cerr << (*it)->mPulseType << " Msg: " << (*it)->mPulseText;
std::cerr << std::endl;
}
}
std::cerr << "p3Wire::getPulsesForGroups() size = " << pulsePtrs.size(); std::cerr << "p3Wire::getPulsesForGroups() size = " << pulsePtrs.size();
std::cerr << " sorting and trimming"; std::cerr << " sorting and trimming";
std::cerr << std::endl; std::cerr << std::endl;

View File

@ -25,6 +25,7 @@
#include "PulseViewGroup.h" #include "PulseViewGroup.h"
#include "gui/gxs/GxsIdDetails.h"
#include "util/DateTime.h" #include "util/DateTime.h"
/** Constructor */ /** Constructor */
@ -40,8 +41,54 @@ PulseViewGroup::PulseViewGroup(PulseViewHolder *holder, RsWireGroupSPtr group)
void PulseViewGroup::setup() void PulseViewGroup::setup()
{ {
if (mGroup) { if (mGroup) {
label_groupName->setText(QString::fromStdString(mGroup->mMeta.mGroupName)); label_groupName->setText("@" + QString::fromStdString(mGroup->mMeta.mGroupName));
label_authorName->setText(QString::fromStdString(mGroup->mMeta.mAuthorId.toStdString())); label_authorName->setText(BoldString(QString::fromStdString(mGroup->mMeta.mAuthorId.toStdString())));
label_date->setText(DateTime::formatDateTime(mGroup->mMeta.mPublishTs));
label_tagline->setText(QString::fromStdString(mGroup->mTagline));
label_location->setText(QString::fromStdString(mGroup->mLocation));
// need to draw mGroup->mMasthead, as background to headshot.
// TODO frame_headerBackground->setBackground()
if (mGroup->mHeadshot.mData)
{
QPixmap pixmap;
if (GxsIdDetails::loadPixmapFromData(
mGroup->mHeadshot.mData,
mGroup->mHeadshot.mSize,
pixmap,GxsIdDetails::ORIGINAL))
{
pixmap = pixmap.scaled(50,50);
label_headshot->setPixmap(pixmap);
}
}
else
{
// default.
QPixmap pixmap = QPixmap(":/icons/png/posted.png").scaled(50,50);
label_headshot->setPixmap(pixmap);
}
if (mGroup->mMeta.mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED)
{
uint32_t pulses = mGroup->mGroupPulses + mGroup->mGroupReplies;
uint32_t replies = mGroup->mRefReplies;
uint32_t republishes = mGroup->mRefRepublishes;
uint32_t likes = mGroup->mRefLikes;
label_extra_pulses->setText(BoldString(ToNumberUnits(pulses)));
label_extra_replies->setText(BoldString(ToNumberUnits(replies)));
label_extra_republishes->setText(BoldString(ToNumberUnits(republishes)));
label_extra_likes->setText(BoldString(ToNumberUnits(likes)));
// hide follow.
widget_actions->setVisible(false);
}
else
{
// hide stats.
widget_replies->setVisible(false);
}
} }
} }

View File

@ -245,7 +245,7 @@ border-radius: 10px}</string>
</spacer> </spacer>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_location">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
@ -277,7 +277,7 @@ border-radius: 10px}</string>
</spacer> </spacer>
</item> </item>
<item row="0" column="0" colspan="4"> <item row="0" column="0" colspan="4">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_tagline">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding"> <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
<horstretch>0</horstretch> <horstretch>0</horstretch>