From ca2da39167ea995744c24d8a64692f147bbf228a Mon Sep 17 00:00:00 2001 From: drbob Date: Fri, 7 Aug 2020 23:54:14 +1000 Subject: [PATCH 1/2] TheWire fix Show and Follow Buttons * Add Icons to Buttons * Wire up Follow Buttons (add in a couple of places too) * Show / Hide buttons depending on Following status * Handle cases where Msgs / Groups unavailable --- retroshare-gui/src/gui/TheWire/PulseReply.cpp | 21 +++- retroshare-gui/src/gui/TheWire/PulseReply.h | 2 +- retroshare-gui/src/gui/TheWire/PulseReply.ui | 43 ++++++- .../src/gui/TheWire/PulseTopLevel.cpp | 20 +-- .../src/gui/TheWire/PulseTopLevel.h | 2 +- .../src/gui/TheWire/PulseTopLevel.ui | 116 +++++++++++++++++- .../src/gui/TheWire/PulseViewGroup.cpp | 14 +++ .../src/gui/TheWire/PulseViewGroup.h | 4 + .../src/gui/TheWire/PulseViewGroup.ui | 9 +- .../src/gui/TheWire/PulseViewItem.cpp | 51 ++++++-- .../src/gui/TheWire/PulseViewItem.h | 9 +- .../src/gui/TheWire/TheWire_images.qrc | 3 + retroshare-gui/src/gui/TheWire/WireDialog.cpp | 6 +- .../src/gui/TheWire/images/external-link.svg | 1 + .../src/gui/TheWire/images/invite.png | Bin 0 -> 5218 bytes .../src/gui/TheWire/images/link.svg | 1 + 16 files changed, 276 insertions(+), 26 deletions(-) create mode 100644 retroshare-gui/src/gui/TheWire/images/external-link.svg create mode 100644 retroshare-gui/src/gui/TheWire/images/invite.png create mode 100644 retroshare-gui/src/gui/TheWire/images/link.svg diff --git a/retroshare-gui/src/gui/TheWire/PulseReply.cpp b/retroshare-gui/src/gui/TheWire/PulseReply.cpp index 76ce49d90..92dccabf5 100644 --- a/retroshare-gui/src/gui/TheWire/PulseReply.cpp +++ b/retroshare-gui/src/gui/TheWire/PulseReply.cpp @@ -114,10 +114,25 @@ void PulseReply::setRepliesString(QString reply) label_replies->setText(reply); } -void PulseReply::showResponseStats(bool enable) +void PulseReply::setPulseStatus(PulseStatus status) { - widget_actions->setVisible(enable); - widget_follow->setVisible(!enable); + widget_actions->setVisible(status == PulseStatus::FULL); + widget_follow->setVisible(status != PulseStatus::FULL); + toolButton_follow->setEnabled(status == PulseStatus::UNSUBSCRIBED); + + switch(status) + { + case PulseStatus::FULL: + break; + case PulseStatus::UNSUBSCRIBED: + break; + case PulseStatus::NO_GROUP: + label_follow_msg->setText("Group unavailable"); + break; + case PulseStatus::REF_MSG: + label_follow_msg->setText("Full Pulse unavailable"); + break; + } } void PulseReply::setReferenceString(QString ref) diff --git a/retroshare-gui/src/gui/TheWire/PulseReply.h b/retroshare-gui/src/gui/TheWire/PulseReply.h index da3c0337b..c2c9545f5 100644 --- a/retroshare-gui/src/gui/TheWire/PulseReply.h +++ b/retroshare-gui/src/gui/TheWire/PulseReply.h @@ -56,7 +56,7 @@ protected: // virtual void setReferenceString(QString ref) override; - virtual void showResponseStats(bool enable) override; + virtual void setPulseStatus(PulseStatus status) override; // PulseDataInterface =========== void mousePressEvent(QMouseEvent *event); diff --git a/retroshare-gui/src/gui/TheWire/PulseReply.ui b/retroshare-gui/src/gui/TheWire/PulseReply.ui index 78a6d7ab7..582ceb269 100644 --- a/retroshare-gui/src/gui/TheWire/PulseReply.ui +++ b/retroshare-gui/src/gui/TheWire/PulseReply.ui @@ -154,6 +154,13 @@ border-radius: 10px} REPLY + + + :/images/reply.png:/images/reply.png + + + Qt::ToolButtonTextBesideIcon + @@ -198,6 +205,13 @@ border-radius: 10px} REPUBLISH + + + :/images/retweet.png:/images/retweet.png + + + Qt::ToolButtonTextBesideIcon + @@ -242,6 +256,13 @@ border-radius: 10px} LIKE + + + :/images/like.png:/images/like.png + + + Qt::ToolButtonTextBesideIcon + @@ -286,6 +307,13 @@ border-radius: 10px} SHOW + + + :/images/external-link.svg:/images/external-link.svg + + + Qt::ToolButtonTextBesideIcon + @@ -339,10 +367,23 @@ border-radius: 10px} FOLLOW + + + :/images/invite.png:/images/invite.png + + + + 16 + 16 + + + + Qt::ToolButtonTextBesideIcon + - + for response statistics diff --git a/retroshare-gui/src/gui/TheWire/PulseTopLevel.cpp b/retroshare-gui/src/gui/TheWire/PulseTopLevel.cpp index a02dfd8fc..d66b90eb3 100644 --- a/retroshare-gui/src/gui/TheWire/PulseTopLevel.cpp +++ b/retroshare-gui/src/gui/TheWire/PulseTopLevel.cpp @@ -45,10 +45,9 @@ PulseTopLevel::PulseTopLevel(PulseViewHolder *holder, RsWirePulseSPtr pulse) void PulseTopLevel::setup() { - connect(pushButton_tmpViewGroup, SIGNAL(clicked()), this, SLOT(actionViewGroup())); - connect(pushButton_tmpViewParent, SIGNAL(clicked()), this, SLOT(actionViewParent())); - - // connect(toolButton_follow, SIGNAL(clicked()), this, SLOT(follow())); + 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_rate, SIGNAL(clicked()), this, SLOT(rate())); connect(toolButton_reply, SIGNAL(clicked()), this, SLOT(actionReply())); @@ -107,10 +106,11 @@ void PulseTopLevel::setRepliesString(QString reply) label_replies->setText(reply); } -void PulseTopLevel::showResponseStats(bool enable) +void PulseTopLevel::setPulseStatus(PulseStatus status) { - widget_replies->setVisible(enable); - widget_actions->setVisible(enable); + widget_replies->setVisible(true); // this is only reachable if we have ORIG so show always. + widget_actions->setVisible(status == PulseStatus::FULL); + widget_actionsFollow->setVisible(status == PulseStatus::UNSUBSCRIBED); } void PulseTopLevel::setReferenceString(QString ref) @@ -123,6 +123,12 @@ void PulseTopLevel::setReferenceString(QString ref) { label_reference->setText(ref); } + + if (mPulse->mRefGroupPtr) { + toolButton_viewParent->setVisible(true); + } else { + toolButton_viewParent->setVisible(false); + } } void PulseTopLevel::mousePressEvent(QMouseEvent *event) diff --git a/retroshare-gui/src/gui/TheWire/PulseTopLevel.h b/retroshare-gui/src/gui/TheWire/PulseTopLevel.h index e43fe012d..c04550023 100644 --- a/retroshare-gui/src/gui/TheWire/PulseTopLevel.h +++ b/retroshare-gui/src/gui/TheWire/PulseTopLevel.h @@ -55,7 +55,7 @@ protected: // virtual void setReferenceString(QString ref) override; - virtual void showResponseStats(bool enable) override; + virtual void setPulseStatus(PulseStatus status) override; // PulseDataInterface =========== protected: diff --git a/retroshare-gui/src/gui/TheWire/PulseTopLevel.ui b/retroshare-gui/src/gui/TheWire/PulseTopLevel.ui index feb31abee..884300c64 100644 --- a/retroshare-gui/src/gui/TheWire/PulseTopLevel.ui +++ b/retroshare-gui/src/gui/TheWire/PulseTopLevel.ui @@ -104,10 +104,23 @@ border-radius: 10px} - + + + open Parent Pulse + SHOW PARENT + + + :/images/external-link.svg:/images/external-link.svg + + + + 24 + 24 + + @@ -228,16 +241,29 @@ border-radius: 10px} - + 0 25 + + open Group + SHOW GROUP + + + :/images/external-link.svg:/images/external-link.svg + + + + 24 + 24 + + @@ -472,6 +498,13 @@ border-radius: 10px} REPLY + + + :/images/reply.png:/images/reply.png + + + Qt::ToolButtonTextBesideIcon + @@ -516,6 +549,13 @@ border-radius: 10px} REPUBLISH + + + :/images/retweet.png:/images/retweet.png + + + Qt::ToolButtonTextBesideIcon + @@ -560,6 +600,13 @@ border-radius: 10px} LIKE + + + :/images/like.png:/images/like.png + + + Qt::ToolButtonTextBesideIcon + @@ -604,6 +651,13 @@ border-radius: 10px} SHOW + + + :/images/external-link.svg:/images/external-link.svg + + + Qt::ToolButtonTextBesideIcon + @@ -624,6 +678,64 @@ border-radius: 10px} + + + + + 0 + 0 + + + + + 0 + 40 + + + + + + + Qt::Horizontal + + + + 298 + 20 + + + + + + + + FOLLOW + + + + :/images/invite.png:/images/invite.png + + + Qt::ToolButtonTextBesideIcon + + + + + + + Qt::Horizontal + + + + 297 + 20 + + + + + + + diff --git a/retroshare-gui/src/gui/TheWire/PulseViewGroup.cpp b/retroshare-gui/src/gui/TheWire/PulseViewGroup.cpp index 715bc8ff6..25d393295 100644 --- a/retroshare-gui/src/gui/TheWire/PulseViewGroup.cpp +++ b/retroshare-gui/src/gui/TheWire/PulseViewGroup.cpp @@ -41,6 +41,8 @@ PulseViewGroup::PulseViewGroup(PulseViewHolder *holder, RsWireGroupSPtr group) void PulseViewGroup::setup() { if (mGroup) { + connect(toolButton_follow, SIGNAL(clicked()), this, SLOT(actionFollow())); + label_groupName->setText("@" + QString::fromStdString(mGroup->mMeta.mGroupName)); label_authorName->setText(BoldString(QString::fromStdString(mGroup->mMeta.mAuthorId.toStdString()))); label_date->setText(DateTime::formatDateTime(mGroup->mMeta.mPublishTs)); @@ -92,3 +94,15 @@ void PulseViewGroup::setup() } } +void PulseViewGroup::actionFollow() +{ + RsGxsGroupId groupId = mGroup->mMeta.mGroupId; + std::cerr << "PulseViewGroup::actionFollow() following "; + std::cerr << groupId; + std::cerr << std::endl; + + if (mHolder) { + mHolder->PVHfollow(groupId); + } +} + diff --git a/retroshare-gui/src/gui/TheWire/PulseViewGroup.h b/retroshare-gui/src/gui/TheWire/PulseViewGroup.h index 94b3f1031..4d00090ca 100644 --- a/retroshare-gui/src/gui/TheWire/PulseViewGroup.h +++ b/retroshare-gui/src/gui/TheWire/PulseViewGroup.h @@ -33,9 +33,13 @@ class PulseViewGroup : public PulseViewItem, private Ui::PulseViewGroup public: PulseViewGroup(PulseViewHolder *holder, RsWireGroupSPtr group); +private slots: + void actionFollow(); + protected: void setup(); + protected: RsWireGroupSPtr mGroup; }; diff --git a/retroshare-gui/src/gui/TheWire/PulseViewGroup.ui b/retroshare-gui/src/gui/TheWire/PulseViewGroup.ui index 6dc0a25cf..7f808dd44 100644 --- a/retroshare-gui/src/gui/TheWire/PulseViewGroup.ui +++ b/retroshare-gui/src/gui/TheWire/PulseViewGroup.ui @@ -508,10 +508,17 @@ border-radius: 10px} - + FOLLOW + + + :/images/invite.png:/images/invite.png + + + Qt::ToolButtonTextBesideIcon + diff --git a/retroshare-gui/src/gui/TheWire/PulseViewItem.cpp b/retroshare-gui/src/gui/TheWire/PulseViewItem.cpp index 1395883bf..3a42f5ba9 100644 --- a/retroshare-gui/src/gui/TheWire/PulseViewItem.cpp +++ b/retroshare-gui/src/gui/TheWire/PulseViewItem.cpp @@ -183,8 +183,18 @@ void PulseDataItem::actionFollow() std::cerr << "PulseDataItem::actionFollow()"; std::cerr << std::endl; - // TODO RsGxsGroupId groupId; + if (mPulse->mPulseType & WIRE_PULSE_TYPE_REFERENCE) { + std::cerr << "PulseDataItem::actionFollow() REF following Replier: "; + std::cerr << mPulse->mRefGroupId; + std::cerr << std::endl; + groupId = mPulse->mRefGroupId; + } else { + std::cerr << "PulseDataItem::actionFollow() RESPONSE following Group: "; + std::cerr << mPulse->mMeta.mGroupId; + std::cerr << std::endl; + groupId = mPulse->mMeta.mGroupId; + } if (mHolder) { mHolder->PVHfollow(groupId); @@ -260,15 +270,28 @@ void PulseDataItem::showPulse() setRefMessage(QString::fromStdString(mPulse->mRefPulseText), mPulse->mRefImageCount); setDate(mPulse->mRefPublishTs); - // References (unknown for a REFERENCE) - // show FOLLOW button instead. - showResponseStats(false); + // Workout Pulse status for Stats/Follow/Msgs. + // Its a REF so cannot be FULL. + PulseStatus status = PulseStatus::REF_MSG; + if (mPulse->mRefGroupPtr) { + // bitwise comparisons. + if (mPulse->mRefGroupPtr->mMeta.mSubscribeFlags & + (GXS_SERV::GROUP_SUBSCRIBE_ADMIN | + GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED)) { + status = PulseStatus::REF_MSG; + } else { + status = PulseStatus::UNSUBSCRIBED; + } + } else { + status = PulseStatus::NO_GROUP; + } + + setPulseStatus(status); - // 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"); + setReference(mPulse->mPulseType & WIRE_PULSE_RESPONSE_MASK, mPulse->mMeta.mGroupId, "UNKNOWN"); } } @@ -310,8 +333,19 @@ void PulseDataItem::showPulse() setMessage(mPulse); setDate(mPulse->mMeta.mPublishTs); - // References - showResponseStats(true); + // Possible to have ORIG and be UNSUBSCRIBED. + PulseStatus status = PulseStatus::FULL; + if (mPulse->mGroupPtr) { + // bitwise comparisons. + if (mPulse->mGroupPtr->mMeta.mSubscribeFlags & + (GXS_SERV::GROUP_SUBSCRIBE_ADMIN | + GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED)) { + status = PulseStatus::FULL; + } else { + status = PulseStatus::UNSUBSCRIBED; + } + } + setPulseStatus(status); setLikes(mPulse->mLikes.size()); setReplies(mPulse->mReplies.size()); setRepublishes(mPulse->mRepublishes.size()); @@ -322,6 +356,7 @@ void PulseDataItem::showPulse() } else { + // NO Parent, so only 0 is important. setReference(0, mPulse->mRefGroupId, mPulse->mRefGroupName); } } diff --git a/retroshare-gui/src/gui/TheWire/PulseViewItem.h b/retroshare-gui/src/gui/TheWire/PulseViewItem.h index 05f23cdb2..549c2d34a 100644 --- a/retroshare-gui/src/gui/TheWire/PulseViewItem.h +++ b/retroshare-gui/src/gui/TheWire/PulseViewItem.h @@ -50,6 +50,13 @@ class PulseDataInterface public: virtual ~PulseDataInterface() {} + enum class PulseStatus { + FULL, // have Msg + Group: Show Stats + UNSUBSCRIBED, // Ref + unsubscribed to Group: Show Follow + NO_GROUP, // Ref Msg, unknown group: Show Missing Group. + REF_MSG // Subscribed, only Ref Msg: Show Missing Msg. + }; + protected: // Group virtual void setHeadshot(const QPixmap &pixmap) = 0; @@ -68,7 +75,7 @@ protected: // virtual void setReferenceString(QString ref) = 0; - virtual void showResponseStats(bool enable) = 0; + virtual void setPulseStatus(PulseStatus status) = 0; }; diff --git a/retroshare-gui/src/gui/TheWire/TheWire_images.qrc b/retroshare-gui/src/gui/TheWire/TheWire_images.qrc index b26e6b7da..2c344c6bd 100644 --- a/retroshare-gui/src/gui/TheWire/TheWire_images.qrc +++ b/retroshare-gui/src/gui/TheWire/TheWire_images.qrc @@ -4,5 +4,8 @@ images/like.png images/reply.png images/retweet.png + images/link.svg + images/external-link.svg + images/invite.png diff --git a/retroshare-gui/src/gui/TheWire/WireDialog.cpp b/retroshare-gui/src/gui/TheWire/WireDialog.cpp index 8a0b2a235..cc0e3d840 100644 --- a/retroshare-gui/src/gui/TheWire/WireDialog.cpp +++ b/retroshare-gui/src/gui/TheWire/WireDialog.cpp @@ -578,8 +578,12 @@ void WireDialog::PVHfollow(const RsGxsGroupId &groupId) { std::cerr << "WireDialog::PVHfollow("; std::cerr << groupId.toStdString(); - std::cerr << ") TODO"; + std::cerr << ")"; std::cerr << std::endl; + + uint32_t token; + rsWire->subscribeToGroup(token, groupId, true); + mWireQueue->queueRequest(token, TOKENREQ_GROUPINFO, RS_TOKREQ_ANSTYPE_ACK, WIRE_TOKEN_TYPE_SUBSCRIBE_CHANGE); } void WireDialog::PVHrate(const RsGxsId &authorId) diff --git a/retroshare-gui/src/gui/TheWire/images/external-link.svg b/retroshare-gui/src/gui/TheWire/images/external-link.svg new file mode 100644 index 000000000..d3a249f34 --- /dev/null +++ b/retroshare-gui/src/gui/TheWire/images/external-link.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/retroshare-gui/src/gui/TheWire/images/invite.png b/retroshare-gui/src/gui/TheWire/images/invite.png new file mode 100644 index 0000000000000000000000000000000000000000..5fda4753e62a963203073ce59fb8097f0360f1e0 GIT binary patch literal 5218 zcmV-o6rJmdP)WhK~#90?VWj;RMnNhf9JhdOBcP+G)p%-$YOV~iD(drintKT zL?(%5V#XmTi^hpD!DKRt5tGk}W1vAYiHVU()R;uYxW<4GAV`{OHlabbrs)Qn zhF;&RJAV|-+Erc4tM{s~f8SSMb-#M=o>T9hy6@g|&plVT*icGXUNJ;BrA(m>(KH4t z#Xz8!f+B$;zz=wVZl|s~3A6&u3hD&vfEp3@hQsU@O?FwDxrN!Is}ND{e6jQ(ZYz*7 zPj2g{>*iz;CM&oC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$gF75ymsNt+=CNT*9zeJq$h4)liK2kl5%st=XVmZAR_1&% z(g05LRK)RI!^;n!I(HDeP7wUZqNa5gJKUZY;FLDY1@Ojkmgo9ZYCY48e4UNO6? zKcAh1F&oG}12~`Mp<=yFO%}AtO4OCWDAJeiwjQBE!m>_@^%o0P*%g@K7TIqA9r5Ir z!MYwURmc!c)L;bzQS??KMS>~<0z?+Zw&$T~08F4!A$6iu9hy2MO7@14Dos?CiEObm c5F=Cge`BmAYoJ}sEdT%j07*qoM6N<$g2hTB!2kdN literal 0 HcmV?d00001 diff --git a/retroshare-gui/src/gui/TheWire/images/link.svg b/retroshare-gui/src/gui/TheWire/images/link.svg new file mode 100644 index 000000000..fdee24b3c --- /dev/null +++ b/retroshare-gui/src/gui/TheWire/images/link.svg @@ -0,0 +1 @@ + \ No newline at end of file From d0104e03645fcd13c05685e9c47c87694890db09 Mon Sep 17 00:00:00 2001 From: drbob Date: Sat, 8 Aug 2020 15:52:31 +1000 Subject: [PATCH 2/2] 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 --- .../src/gui/TheWire/PulseAddDialog.cpp | 12 +++++++ .../src/gui/TheWire/PulseMessage.cpp | 4 +++ .../src/gui/TheWire/PulseMessage.ui | 34 +++++++++++++++++-- .../src/gui/TheWire/PulseTopLevel.cpp | 19 ++++++++++- .../src/gui/TheWire/PulseTopLevel.ui | 34 ++++++++++++++++++- .../src/gui/TheWire/PulseViewItem.cpp | 23 +++++++++++++ .../src/gui/TheWire/PulseViewItem.h | 1 + retroshare-gui/src/gui/TheWire/WireDialog.cpp | 20 +++++++++++ 8 files changed, 142 insertions(+), 5 deletions(-) diff --git a/retroshare-gui/src/gui/TheWire/PulseAddDialog.cpp b/retroshare-gui/src/gui/TheWire/PulseAddDialog.cpp index 41ad2be75..dc09a11f1 100644 --- a/retroshare-gui/src/gui/TheWire/PulseAddDialog.cpp +++ b/retroshare-gui/src/gui/TheWire/PulseAddDialog.cpp @@ -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, diff --git a/retroshare-gui/src/gui/TheWire/PulseMessage.cpp b/retroshare-gui/src/gui/TheWire/PulseMessage.cpp index 0cf986b86..91af09b3a 100644 --- a/retroshare-gui/src/gui/TheWire/PulseMessage.cpp +++ b/retroshare-gui/src/gui/TheWire/PulseMessage.cpp @@ -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; diff --git a/retroshare-gui/src/gui/TheWire/PulseMessage.ui b/retroshare-gui/src/gui/TheWire/PulseMessage.ui index a85f602c6..a1ce9831d 100644 --- a/retroshare-gui/src/gui/TheWire/PulseMessage.ui +++ b/retroshare-gui/src/gui/TheWire/PulseMessage.ui @@ -13,11 +13,39 @@ Form - - + + + + + true + + + + + + + 20 + 0 + + + + QFrame::Plain + + + 5 + + + Qt::Vertical + + + + + + + - + QFrame::StyledPanel diff --git a/retroshare-gui/src/gui/TheWire/PulseTopLevel.cpp b/retroshare-gui/src/gui/TheWire/PulseTopLevel.cpp index d66b90eb3..859a4d735 100644 --- a/retroshare-gui/src/gui/TheWire/PulseTopLevel.cpp +++ b/retroshare-gui/src/gui/TheWire/PulseTopLevel.cpp @@ -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); } } diff --git a/retroshare-gui/src/gui/TheWire/PulseTopLevel.ui b/retroshare-gui/src/gui/TheWire/PulseTopLevel.ui index 884300c64..77d32218a 100644 --- a/retroshare-gui/src/gui/TheWire/PulseTopLevel.ui +++ b/retroshare-gui/src/gui/TheWire/PulseTopLevel.ui @@ -91,8 +91,20 @@ border-radius: 10px} 0 + + + 20 + 20 + + - icn + + + + :/images/reply.png + + + true @@ -123,6 +135,26 @@ border-radius: 10px} + + + + follow Parent Group + + + ... + + + + :/images/invite.png:/images/invite.png + + + + 24 + 24 + + + + diff --git a/retroshare-gui/src/gui/TheWire/PulseViewItem.cpp b/retroshare-gui/src/gui/TheWire/PulseViewItem.cpp index 3a42f5ba9..12568dc49 100644 --- a/retroshare-gui/src/gui/TheWire/PulseViewItem.cpp +++ b/retroshare-gui/src/gui/TheWire/PulseViewItem.cpp @@ -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()"; diff --git a/retroshare-gui/src/gui/TheWire/PulseViewItem.h b/retroshare-gui/src/gui/TheWire/PulseViewItem.h index 549c2d34a..bee96f14b 100644 --- a/retroshare-gui/src/gui/TheWire/PulseViewItem.h +++ b/retroshare-gui/src/gui/TheWire/PulseViewItem.h @@ -112,6 +112,7 @@ private slots: void actionViewPulse(); void actionFollow(); + void actionFollowParent(); void actionRate(); // Action interfaces -------------------------- diff --git a/retroshare-gui/src/gui/TheWire/WireDialog.cpp b/retroshare-gui/src/gui/TheWire/WireDialog.cpp index cc0e3d840..06fa6ba6c 100644 --- a/retroshare-gui/src/gui/TheWire/WireDialog.cpp +++ b/retroshare-gui/src/gui/TheWire/WireDialog.cpp @@ -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)