Get Republishing Pulses working

* Copy Original Pulse data for Republished Pulses
 * Add LHS | to indicate republish
 * Update Ref Icon in PulseTopLevel
 * Add FollowParent button in PulseTopLevel
 * display republished pulses as part of PulseFocus view
This commit is contained in:
drbob 2020-08-08 15:52:31 +10:00
parent ca2da39167
commit d0104e0364
8 changed files with 142 additions and 5 deletions

View File

@ -302,6 +302,18 @@ void PulseAddDialog::postReplyPulse()
pPulse->mImage3 = mImage3;
pPulse->mImage4 = mImage4;
if (mReplyType & WIRE_PULSE_TYPE_REPUBLISH) {
// Copy details from parent, and override
pPulse->mSentiment = mReplyToPulse.mSentiment;
pPulse->mPulseText = mReplyToPulse.mPulseText;
// Copy images.
pPulse->mImage1 = mReplyToPulse.mImage1;
pPulse->mImage2 = mReplyToPulse.mImage2;
pPulse->mImage3 = mReplyToPulse.mImage3;
pPulse->mImage4 = mReplyToPulse.mImage4;
}
// this should be in async thread, so doesn't block UI thread.
if (!rsWire->createReplyPulse(mReplyToPulse.mMeta.mGroupId,
mReplyToPulse.mMeta.mOrigMsgId,

View File

@ -36,6 +36,10 @@ void PulseMessage::setup(RsWirePulseSPtr pulse)
setMessage(QString::fromStdString(pulse->mPulseText));
// show indent if republish (both RESPONSE or REF)
bool showIndent = (pulse->mPulseType & WIRE_PULSE_TYPE_REPUBLISH);
widget_indent->setVisible(showIndent);
// setup images.
int width = 256;
int height = 128;

View File

@ -13,11 +13,39 @@
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0" rowspan="2">
<widget class="QWidget" name="widget_indent" native="true">
<property name="enabled">
<bool>true</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="Line" name="line">
<property name="minimumSize">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
<property name="frameShadow">
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>5</number>
</property>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="0" column="1">
<widget class="QTextBrowser" name="textBrowser"/>
</item>
<item>
<item row="1" column="1">
<widget class="QFrame" name="frame_expand">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>

View File

@ -48,6 +48,7 @@ void PulseTopLevel::setup()
connect(toolButton_viewGroup, SIGNAL(clicked()), this, SLOT(actionViewGroup()));
connect(toolButton_viewParent, SIGNAL(clicked()), this, SLOT(actionViewParent()));
connect(toolButton_follow, SIGNAL(clicked()), this, SLOT(actionFollow()));
connect(toolButton_followParent, SIGNAL(clicked()), this, SLOT(actionFollowParent()));
// connect(toolButton_rate, SIGNAL(clicked()), this, SLOT(rate()));
connect(toolButton_reply, SIGNAL(clicked()), this, SLOT(actionReply()));
@ -122,12 +123,28 @@ void PulseTopLevel::setReferenceString(QString ref)
else
{
label_reference->setText(ref);
// set ref icon
if (mPulse->mPulseType & WIRE_PULSE_TYPE_REPUBLISH) {
label_reficon->setPixmap(QPixmap(":/images/retweet.png"));
} else {
label_reficon->setPixmap(QPixmap(":/images/reply.png"));
}
}
if (mPulse->mRefGroupPtr) {
toolButton_viewParent->setVisible(true);
if (mPulse->mRefGroupPtr->mMeta.mSubscribeFlags &
(GXS_SERV::GROUP_SUBSCRIBE_ADMIN |
GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED)) {
toolButton_viewParent->setVisible(true);
toolButton_followParent->setVisible(false);
} else {
toolButton_viewParent->setVisible(false);
toolButton_followParent->setVisible(true);
}
} else {
toolButton_viewParent->setVisible(false);
toolButton_followParent->setVisible(false);
}
}

View File

@ -91,8 +91,20 @@ border-radius: 10px}</string>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="text">
<string>icn</string>
<string/>
</property>
<property name="pixmap">
<pixmap resource="TheWire_images.qrc">:/images/reply.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
@ -123,6 +135,26 @@ border-radius: 10px}</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="toolButton_followParent">
<property name="toolTip">
<string>follow Parent Group</string>
</property>
<property name="text">
<string>...</string>
</property>
<property name="icon">
<iconset resource="TheWire_images.qrc">
<normaloff>:/images/invite.png</normaloff>:/images/invite.png</iconset>
</property>
<property name="iconSize">
<size>
<width>24</width>
<height>24</height>
</size>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_15">
<property name="orientation">

View File

@ -201,6 +201,29 @@ void PulseDataItem::actionFollow()
}
}
void PulseDataItem::actionFollowParent()
{
std::cerr << "PulseDataItem::actionFollowParent()";
std::cerr << std::endl;
RsGxsGroupId groupId;
if (mPulse->mPulseType & WIRE_PULSE_TYPE_REFERENCE) {
std::cerr << "PulseDataItem::actionFollowParent() REF following Group: ";
std::cerr << mPulse->mMeta.mGroupId;
std::cerr << std::endl;
groupId = mPulse->mMeta.mGroupId;
} else {
std::cerr << "PulseDataItem::actionFollowParent() RESPONSE following RefGroup: ";
std::cerr << mPulse->mRefGroupId;
std::cerr << std::endl;
groupId = mPulse->mRefGroupId;
}
if (mHolder) {
mHolder->PVHfollow(groupId);
}
}
void PulseDataItem::actionRate()
{
std::cerr << "PulseDataItem::actionRate()";

View File

@ -112,6 +112,7 @@ private slots:
void actionViewPulse();
void actionFollow();
void actionFollowParent();
void actionRate();
// Action interfaces --------------------------

View File

@ -819,6 +819,26 @@ void WireDialog::postPulseFocus(RsWirePulseSPtr pPulse)
addTwitterView(new PulseReplySeperator());
}
// Add big separator, and republishes.
if (pPulse->mReplies.size() > 0 && pPulse->mRepublishes.size() > 0)
{
addTwitterView(new PulseReplySeperator());
addTwitterView(new PulseReplySeperator());
}
for(it = pPulse->mRepublishes.begin(); it != pPulse->mRepublishes.end(); it++)
{
RsWirePulseSPtr repub = *it;
PulseReply *firstRepub = new PulseReply(this, repub);
firstRepub->showReplyLine(false);
addTwitterView(firstRepub);
addTwitterView(new PulseReplySeperator());
}
}
void WireDialog::requestGroupFocus(const RsGxsGroupId groupId)