mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-03 11:00:14 -05:00
Merge pull request #1970 from drbob/TheWire-rework-ui
TheWire rework UI, and update Data Messages.
This commit is contained in:
commit
035010af76
@ -35,11 +35,38 @@
|
||||
class RsWire;
|
||||
extern RsWire *rsWire;
|
||||
|
||||
struct RsWireGroup: RsGxsGenericGroupData
|
||||
class RsWireGroup;
|
||||
typedef std::shared_ptr<RsWireGroup> RsWireGroupSPtr;
|
||||
typedef std::shared_ptr<const RsWireGroup> RsWireGroupConstSPtr;
|
||||
|
||||
class RsWireGroup: public RsGxsGenericGroupData
|
||||
{
|
||||
public:
|
||||
std::string mDescription;
|
||||
RsGxsImage mIcon;
|
||||
RsWireGroup();
|
||||
|
||||
std::string mTagline;
|
||||
std::string mLocation;
|
||||
|
||||
// Images max size should be enforced.
|
||||
RsGxsImage mHeadshot; // max size?
|
||||
RsGxsImage mMasthead; // max size?
|
||||
|
||||
// Unserialised stuff ---------------------
|
||||
|
||||
// These are this groups top-level msgs.
|
||||
uint32_t mGroupPulses;
|
||||
uint32_t mGroupRepublishes;
|
||||
uint32_t mGroupLikes;
|
||||
uint32_t mGroupReplies;
|
||||
// how do we handle these. TODO
|
||||
// uint32_t mGroupFollowing;
|
||||
// uint32_t mGroupFollowers;
|
||||
|
||||
// These are this groups REF / RESPONSE msgs from others.
|
||||
uint32_t mRefMentions; // TODO how to handle this?
|
||||
uint32_t mRefRepublishes;
|
||||
uint32_t mRefLikes;
|
||||
uint32_t mRefReplies;
|
||||
};
|
||||
|
||||
|
||||
@ -60,13 +87,7 @@ struct RsWireGroup: RsGxsGenericGroupData
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
class RsWirePlace
|
||||
{
|
||||
public:
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
/************************************************************************
|
||||
* Pulse comes in three flavours.
|
||||
@ -82,24 +103,39 @@ class RsWirePlace
|
||||
* This info will be duplicated in two msgs - but allow data to spread easier.
|
||||
*
|
||||
* Reply Msg Pulse, will be Top-Level Msg on Publisher's Group.
|
||||
* - mPulseMode = WIRE_PULSE_TYPE_REPLY_MSG
|
||||
* - mPulseMode = WIRE_PULSE_TYPE_RESPONSE | WIRE_PULSE_TYPE_REPLY
|
||||
* - Ref fields refer to Parent (InReplyTo) Msg.
|
||||
*
|
||||
* Reply Reference, is Child Msg of Parent Msg, on Parent Publisher's Group.
|
||||
* - mPulseMode = WIRE_PULSE_TYPE_REPLY_REFERENCE
|
||||
* - mPulseMode = WIRE_PULSE_TYPE_REFERENCE | WIRE_PULSE_TYPE_REPLY
|
||||
* - Ref fields refer to Reply Msg.
|
||||
* - NB: This Msg requires Parent Msg for complete info, while other two are self-contained.
|
||||
*
|
||||
* Additionally need to sort out additional relationships.
|
||||
* - Mentions.
|
||||
* - Followers.
|
||||
* - Following.
|
||||
***********************************************************************/
|
||||
|
||||
#define WIRE_PULSE_TYPE_ORIGINAL_MSG (0x0001)
|
||||
#define WIRE_PULSE_TYPE_REPLY_MSG (0x0002)
|
||||
#define WIRE_PULSE_TYPE_REPLY_REFERENCE (0x0004)
|
||||
#define WIRE_PULSE_TYPE_ORIGINAL (0x0001)
|
||||
#define WIRE_PULSE_TYPE_RESPONSE (0x0002)
|
||||
#define WIRE_PULSE_TYPE_REFERENCE (0x0004)
|
||||
|
||||
#define WIRE_PULSE_RESPONSE_MASK (0x0f00)
|
||||
#define WIRE_PULSE_TYPE_REPLY (0x0100)
|
||||
#define WIRE_PULSE_TYPE_REPUBLISH (0x0200)
|
||||
#define WIRE_PULSE_TYPE_LIKE (0x0400)
|
||||
|
||||
#define WIRE_PULSE_SENTIMENT_NO_SENTIMENT (0x0000)
|
||||
#define WIRE_PULSE_SENTIMENT_POSITIVE (0x0001)
|
||||
#define WIRE_PULSE_SENTIMENT_NEUTRAL (0x0002)
|
||||
#define WIRE_PULSE_SENTIMENT_NEGATIVE (0x0003)
|
||||
|
||||
class RsWirePulse;
|
||||
|
||||
typedef std::shared_ptr<RsWirePulse> RsWirePulseSPtr;
|
||||
typedef std::shared_ptr<const RsWirePulse> RsWirePulseConstSPtr;
|
||||
|
||||
class RsWirePulse
|
||||
{
|
||||
public:
|
||||
@ -110,23 +146,50 @@ class RsWirePulse
|
||||
std::string mPulseText;
|
||||
|
||||
uint32_t mPulseType;
|
||||
uint32_t mReplySentiment; // only relevant if a reply.
|
||||
uint32_t mSentiment; // sentiment can be asserted at any point.
|
||||
|
||||
// These Ref to the related (parent or reply) if reply (MODE_REPLY_MSG set)
|
||||
// Mode REPLY_MSG only REPLY_REFERENCE
|
||||
RsGxsGroupId mRefGroupId; // PARENT_GrpId REPLY_GrpId
|
||||
std::string mRefGroupName; // PARENT_GrpName REPLY_GrpName
|
||||
RsGxsMessageId mRefOrigMsgId; // PARENT_OrigMsgId REPLY_OrigMsgId
|
||||
RsGxsId mRefAuthorId; // PARENT_AuthorId REPLY_AuthorId
|
||||
rstime_t mRefPublishTs; // PARENT_PublishTs REPLY_PublishTs
|
||||
std::string mRefPulseText; // PARENT_PulseText REPLY_PulseText
|
||||
// These Ref to the related (parent or reply) if reply (RESPONSE set)
|
||||
// Mode RESPONSE REFERENCE
|
||||
RsGxsGroupId mRefGroupId; // PARENT_GrpId REPLY_GrpId
|
||||
std::string mRefGroupName; // PARENT_GrpName REPLY_GrpName
|
||||
RsGxsMessageId mRefOrigMsgId; // PARENT_OrigMsgId REPLY_OrigMsgId
|
||||
RsGxsId mRefAuthorId; // PARENT_AuthorId REPLY_AuthorId
|
||||
rstime_t mRefPublishTs; // PARENT_PublishTs REPLY_PublishTs
|
||||
std::string mRefPulseText; // PARENT_PulseText REPLY_PulseText
|
||||
uint32_t mRefImageCount; // PARENT_#Images REPLY_#Images
|
||||
|
||||
// Open Question. Do we want these additional fields?
|
||||
// These can potentially be added at some point.
|
||||
// std::list<std::string> mMentions;
|
||||
// std::list<std::string> mHashTags;
|
||||
// std::list<std::string> mUrls;
|
||||
// RsWirePlace mPlace;
|
||||
// Additional Fields for version 2.
|
||||
// Images, need to enforce 20k limit?
|
||||
RsGxsImage mImage1;
|
||||
RsGxsImage mImage2;
|
||||
RsGxsImage mImage3;
|
||||
RsGxsImage mImage4;
|
||||
|
||||
// Below Here is not serialised.
|
||||
// They are additional fields linking pulses together or parsing elements of msg.
|
||||
|
||||
// functions.
|
||||
uint32_t ImageCount();
|
||||
|
||||
// can't have self referencial list, so need to use pointers.
|
||||
// using SharedPointers to automatically cleanup.
|
||||
|
||||
// Pointer to WireGroups
|
||||
// mRefGroupPtr is opportunistically filled in, but will often be empty.
|
||||
RsWireGroupSPtr mRefGroupPtr; // ORIG/RESP: N/A , REF: Reply Group
|
||||
RsWireGroupSPtr mGroupPtr; // ORIG/RESP: Own Group, REF: Parent Group
|
||||
|
||||
// These are the direct children of this message
|
||||
// split into likes, replies and retweets.
|
||||
std::list<RsWirePulseSPtr> mReplies;
|
||||
std::list<RsWirePulseSPtr> mLikes;
|
||||
std::list<RsWirePulseSPtr> mRepublishes;
|
||||
|
||||
// parsed from msg.
|
||||
// do we need references..?
|
||||
std::list<std::string> mHashTags;
|
||||
std::list<std::string> mMentions;
|
||||
std::list<std::string> mUrls;
|
||||
};
|
||||
|
||||
|
||||
@ -158,7 +221,29 @@ virtual bool createPulse(uint32_t &token, RsWirePulse &pulse) = 0;
|
||||
// Blocking Interfaces.
|
||||
virtual bool createGroup(RsWireGroup &group) = 0;
|
||||
virtual bool updateGroup(const RsWireGroup &group) = 0;
|
||||
virtual bool getGroups(const std::list<RsGxsGroupId> grpIds, std::vector<RsWireGroup> &groups) = 0;
|
||||
virtual bool getGroups(const std::list<RsGxsGroupId> grpIds,
|
||||
std::vector<RsWireGroup> &groups) = 0;
|
||||
|
||||
// New Blocking Interfaces.
|
||||
// Plan to migrate all GUI calls to these, and remove old interfaces above.
|
||||
// These are not single requests, but return data graphs for display.
|
||||
virtual bool createOriginalPulse(const RsGxsGroupId &grpId, RsWirePulseSPtr pPulse) = 0;
|
||||
virtual bool createReplyPulse(RsGxsGroupId grpId, RsGxsMessageId msgId,
|
||||
RsGxsGroupId replyWith, uint32_t reply_type,
|
||||
RsWirePulseSPtr pPulse) = 0;
|
||||
|
||||
|
||||
// Provide Individual Group Details for display.
|
||||
virtual bool getWireGroup(const RsGxsGroupId &groupId, RsWireGroupSPtr &grp) = 0;
|
||||
virtual bool getWirePulse(const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, RsWirePulseSPtr &pPulse) = 0;
|
||||
|
||||
// Provide list of pulses associated with groups.
|
||||
virtual bool getPulsesForGroups(const std::list<RsGxsGroupId> &groupIds,
|
||||
std::list<RsWirePulseSPtr> &pulsePtrs) = 0;
|
||||
|
||||
// Provide pulse, and associated replies / like etc.
|
||||
virtual bool getPulseFocus(const RsGxsGroupId &groupId, const RsGxsMessageId &msgId,
|
||||
int type, RsWirePulseSPtr &pPulse) = 0;
|
||||
|
||||
};
|
||||
|
||||
|
@ -43,39 +43,55 @@ RsItem *RsGxsWireSerialiser::create_item(uint16_t service,uint8_t item_subtype)
|
||||
|
||||
void RsGxsWireGroupItem::clear()
|
||||
{
|
||||
group.mDescription.clear();
|
||||
group.mIcon.clear();
|
||||
group.mTagline.clear();
|
||||
group.mLocation.clear();
|
||||
group.mHeadshot.clear();
|
||||
group.mMasthead.clear();
|
||||
}
|
||||
|
||||
void RsGxsWireGroupItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
|
||||
{
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_DESCR,group.mDescription,"group.mDescription") ;
|
||||
group.mIcon.serial_process(j, ctx);
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_DESCR,group.mTagline,"group.mTagline") ;
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_LOCATION,group.mLocation,"group.mLocation") ;
|
||||
group.mHeadshot.serial_process(j, ctx);
|
||||
group.mMasthead.serial_process(j, ctx);
|
||||
}
|
||||
|
||||
void RsGxsWirePulseItem::clear()
|
||||
{
|
||||
pulse.mPulseText.clear();
|
||||
pulse.mPulseType = 0;
|
||||
pulse.mReplySentiment = 0;
|
||||
pulse.mSentiment = 0;
|
||||
pulse.mRefGroupId.clear();
|
||||
pulse.mRefGroupName.clear();
|
||||
pulse.mRefOrigMsgId.clear();
|
||||
pulse.mRefAuthorId.clear();
|
||||
pulse.mRefPublishTs = 0;
|
||||
pulse.mRefPulseText.clear();
|
||||
pulse.mRefImageCount = 0;
|
||||
|
||||
pulse.mImage1.clear();
|
||||
pulse.mImage2.clear();
|
||||
pulse.mImage3.clear();
|
||||
pulse.mImage4.clear();
|
||||
}
|
||||
|
||||
void RsGxsWirePulseItem::serial_process(RsGenericSerializer::SerializeJob j,RsGenericSerializer::SerializeContext& ctx)
|
||||
{
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_MSG,pulse.mPulseText,"pulse.mPulseText") ;
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_UINT32_PARAM,pulse.mPulseType,"pulse.mPulseType") ;
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_UINT32_PARAM,pulse.mReplySentiment,"pulse.mReplySentiment") ;
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_UINT32_PARAM,pulse.mSentiment,"pulse.mSentiment") ;
|
||||
RsTypeSerializer::serial_process(j,ctx,pulse.mRefGroupId,"pulse.mRefGroupId") ;
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_NAME,pulse.mRefGroupName,"pulse.mRefGroupName") ;
|
||||
RsTypeSerializer::serial_process(j,ctx,pulse.mRefOrigMsgId,"pulse.mRefOrigMsgId") ;
|
||||
RsTypeSerializer::serial_process(j,ctx,pulse.mRefAuthorId,"pulse.mRefAuthorId") ;
|
||||
RsTypeSerializer::serial_process(j,ctx,pulse.mRefPublishTs,"pulse.mRefPublishTs") ;
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_STR_MSG,pulse.mRefPulseText,"pulse.mRefPulseText") ;
|
||||
RsTypeSerializer::serial_process(j,ctx,TLV_TYPE_UINT32_PARAM,pulse.mRefImageCount,"pulse.mRefImageCount") ;
|
||||
|
||||
pulse.mImage1.serial_process(j, ctx);
|
||||
pulse.mImage2.serial_process(j, ctx);
|
||||
pulse.mImage3.serial_process(j, ctx);
|
||||
pulse.mImage4.serial_process(j, ctx);
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -61,7 +61,52 @@ public:
|
||||
virtual bool updateGroup(const RsWireGroup &group) override;
|
||||
virtual bool getGroups(const std::list<RsGxsGroupId> grpIds, std::vector<RsWireGroup> &groups) override;
|
||||
|
||||
// New Interfaces.
|
||||
// Blocking, request structures for display.
|
||||
virtual bool createOriginalPulse(const RsGxsGroupId &grpId, RsWirePulseSPtr pPulse) override;
|
||||
virtual bool createReplyPulse(RsGxsGroupId grpId, RsGxsMessageId msgId,
|
||||
RsGxsGroupId replyWith, uint32_t reply_type,
|
||||
RsWirePulseSPtr pPulse) override;
|
||||
|
||||
#if 0
|
||||
virtual bool createReplyPulse(uint32_t &token, RsWirePulse &pulse) override;
|
||||
virtual bool createRepublishPulse(uint32_t &token, RsWirePulse &pulse) override;
|
||||
virtual bool createLikePulse(uint32_t &token, RsWirePulse &pulse) override;
|
||||
#endif
|
||||
|
||||
virtual bool getWireGroup(const RsGxsGroupId &groupId, RsWireGroupSPtr &grp) override;
|
||||
virtual bool getWirePulse(const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, RsWirePulseSPtr &pPulse) override;
|
||||
|
||||
virtual bool getPulsesForGroups(const std::list<RsGxsGroupId> &groupIds, std::list<RsWirePulseSPtr> &pulsePtrs) override;
|
||||
|
||||
virtual bool getPulseFocus(const RsGxsGroupId &groupId, const RsGxsMessageId &msgId, int type, RsWirePulseSPtr &pPulse) override;
|
||||
|
||||
private:
|
||||
// Internal Service Data.
|
||||
// They should eventually all be here.
|
||||
bool getRelatedPulseData(const uint32_t &token, std::vector<RsWirePulse> &pulses);
|
||||
bool getGroupPtrData(const uint32_t &token,
|
||||
std::map<RsGxsGroupId, RsWireGroupSPtr> &groups);
|
||||
bool getPulsePtrData(const uint32_t &token, std::list<RsWirePulseSPtr> &pulses);
|
||||
|
||||
// util functions fetching data.
|
||||
bool fetchPulse(RsGxsGroupId grpId, RsGxsMessageId msgId, RsWirePulseSPtr &pPulse);
|
||||
bool updatePulse(RsWirePulseSPtr pPulse, int levels);
|
||||
bool updatePulseChildren(RsWirePulseSPtr pParent, uint32_t token);
|
||||
|
||||
// update GroupPtrs
|
||||
bool extractGroupIds(RsWirePulseConstSPtr pPulse, std::set<RsGxsGroupId> &groupIds);
|
||||
|
||||
bool updateGroupPtrs(RsWirePulseSPtr pPulse,
|
||||
const std::map<RsGxsGroupId, RsWireGroupSPtr> &groups);
|
||||
|
||||
bool fetchGroupPtrs(const std::set<RsGxsGroupId> &groupIds,
|
||||
std::map<RsGxsGroupId, RsWireGroupSPtr> &groups);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
virtual void generateDummyData();
|
||||
std::string genRandomId();
|
||||
|
||||
|
@ -19,8 +19,9 @@
|
||||
*******************************************************************************/
|
||||
|
||||
#include <iostream>
|
||||
#include <QtGui>
|
||||
|
||||
#include "PulseDetails.h"
|
||||
#include "PulseReply.h"
|
||||
|
||||
#include "PulseAddDialog.h"
|
||||
|
||||
@ -28,17 +29,17 @@ const uint32_t PULSE_MAX_SIZE = 1000; // 1k char.
|
||||
|
||||
/** Constructor */
|
||||
PulseAddDialog::PulseAddDialog(QWidget *parent)
|
||||
: QWidget(parent), mIsReply(false), mWaitingRefMsg(false)
|
||||
: QWidget(parent), mIsReply(false)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
|
||||
mWireQueue = new TokenQueue(rsWire->getTokenService(), this);
|
||||
|
||||
connect(ui.pushButton_Post, SIGNAL( clicked( void ) ), this, SLOT( postPulse( void ) ) );
|
||||
connect(ui.pushButton_AddURL, SIGNAL( clicked( void ) ), this, SLOT( addURL( void ) ) );
|
||||
connect(ui.pushButton_ClearDisplayAs, SIGNAL( clicked( void ) ), this, SLOT( clearDisplayAs( void ) ) );
|
||||
connect(ui.pushButton_Cancel, SIGNAL( clicked( void ) ), this, SLOT( cancelPulse( void ) ) );
|
||||
connect(ui.textEdit_Pulse, SIGNAL( textChanged( void ) ), this, SLOT( pulseTextChanged( void ) ) );
|
||||
|
||||
setAcceptDrops(true);
|
||||
}
|
||||
|
||||
void PulseAddDialog::setGroup(RsWireGroup &group)
|
||||
@ -48,12 +49,21 @@ void PulseAddDialog::setGroup(RsWireGroup &group)
|
||||
mGroup = group;
|
||||
}
|
||||
|
||||
// set ReplyWith Group.
|
||||
void PulseAddDialog::setGroup(const RsGxsGroupId &grpId)
|
||||
{
|
||||
/* fetch in the background */
|
||||
RsWireGroupSPtr pGroup;
|
||||
rsWire->getWireGroup(grpId, pGroup);
|
||||
|
||||
setGroup(*pGroup);
|
||||
}
|
||||
|
||||
void PulseAddDialog::cleanup()
|
||||
{
|
||||
if (mIsReply)
|
||||
{
|
||||
std::cerr << "PulseAddDialog::setReplyTo() cleaning up old replyto";
|
||||
std::cerr << "PulseAddDialog::cleanup() cleaning up old replyto";
|
||||
std::cerr << std::endl;
|
||||
QLayout *layout = ui.widget_replyto->layout();
|
||||
// completely delete layout and sublayouts
|
||||
@ -63,30 +73,51 @@ void PulseAddDialog::cleanup()
|
||||
{
|
||||
if ((widget = item->widget()) != 0)
|
||||
{
|
||||
std::cerr << "PulseAddDialog::setReplyTo() removing widget";
|
||||
std::cerr << "PulseAddDialog::cleanup() removing widget";
|
||||
std::cerr << std::endl;
|
||||
widget->hide();
|
||||
delete widget;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "PulseAddDialog::setReplyTo() removing item";
|
||||
std::cerr << "PulseAddDialog::cleanup() removing item";
|
||||
std::cerr << std::endl;
|
||||
delete item;
|
||||
}
|
||||
}
|
||||
// then finally
|
||||
delete layout;
|
||||
mIsReply = false;
|
||||
mIsReply = false;
|
||||
}
|
||||
ui.frame_reply->setVisible(false);
|
||||
ui.comboBox_sentiment->setCurrentIndex(0);
|
||||
ui.lineEdit_URL->setText("");
|
||||
ui.lineEdit_DisplayAs->setText("");
|
||||
ui.textEdit_Pulse->setPlainText("");
|
||||
ui.pushButton_Post->setEnabled(false);
|
||||
// disable URL until functionality finished.
|
||||
ui.frame_URL->setEnabled(false);
|
||||
|
||||
ui.pushButton_Post->setEnabled(false);
|
||||
ui.pushButton_Post->setText("Post Pulse to Wire");
|
||||
ui.frame_input->setVisible(true);
|
||||
ui.widget_sentiment->setVisible(true);
|
||||
|
||||
// cleanup images.
|
||||
mImage1.clear();
|
||||
ui.label_image1->clear();
|
||||
ui.label_image1->setText("Drag and Drop Image");
|
||||
|
||||
mImage2.clear();
|
||||
ui.label_image2->clear();
|
||||
ui.label_image2->setText("Drag and Drop Image");
|
||||
|
||||
mImage3.clear();
|
||||
ui.label_image3->clear();
|
||||
ui.label_image3->setText("Drag and Drop Image");
|
||||
|
||||
mImage4.clear();
|
||||
ui.label_image4->clear();
|
||||
ui.label_image4->setText("Drag and Drop Image");
|
||||
}
|
||||
|
||||
void PulseAddDialog::pulseTextChanged()
|
||||
@ -96,26 +127,74 @@ void PulseAddDialog::pulseTextChanged()
|
||||
ui.pushButton_Post->setEnabled(enable);
|
||||
}
|
||||
|
||||
void PulseAddDialog::setReplyTo(RsWirePulse &pulse, std::string &groupName)
|
||||
// Old Interface, deprecate / make internal.
|
||||
// TODO: Convert mReplyToPulse to be an SPtr, and remove &pulse parameter.
|
||||
void PulseAddDialog::setReplyTo(RsWirePulse &pulse, RsWirePulseSPtr pPulse, std::string &groupName, uint32_t replyType)
|
||||
{
|
||||
mIsReply = true;
|
||||
mReplyToPulse = pulse;
|
||||
mReplyGroupName = groupName;
|
||||
mReplyType = replyType;
|
||||
ui.frame_reply->setVisible(true);
|
||||
|
||||
{
|
||||
std::map<rstime_t, RsWirePulse *> replies;
|
||||
PulseDetails *details = new PulseDetails(NULL, &pulse, groupName, replies);
|
||||
PulseReply *reply = new PulseReply(NULL, pPulse);
|
||||
|
||||
// add extra widget into layout.
|
||||
QVBoxLayout *vbox = new QVBoxLayout();
|
||||
vbox->addWidget(details);
|
||||
vbox->addWidget(reply);
|
||||
vbox->setSpacing(1);
|
||||
vbox->setContentsMargins(0,0,0,0);
|
||||
ui.widget_replyto->setLayout(vbox);
|
||||
ui.widget_replyto->setVisible(true);
|
||||
}
|
||||
|
||||
if (mReplyType & WIRE_PULSE_TYPE_REPLY)
|
||||
{
|
||||
ui.pushButton_Post->setText("Reply to Pulse");
|
||||
}
|
||||
else
|
||||
{
|
||||
// cannot add msg for like / republish.
|
||||
ui.pushButton_Post->setEnabled(true);
|
||||
ui.frame_input->setVisible(false);
|
||||
ui.widget_sentiment->setVisible(false);
|
||||
if (mReplyType & WIRE_PULSE_TYPE_REPUBLISH) {
|
||||
ui.pushButton_Post->setText("Republish Pulse");
|
||||
}
|
||||
else if (mReplyType & WIRE_PULSE_TYPE_LIKE) {
|
||||
ui.pushButton_Post->setText("Like Pulse");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void PulseAddDialog::setReplyTo(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId, uint32_t replyType)
|
||||
{
|
||||
/* fetch in the background */
|
||||
RsWireGroupSPtr pGroup;
|
||||
if (!rsWire->getWireGroup(grpId, pGroup))
|
||||
{
|
||||
std::cerr << "PulseAddDialog::setRplyTo() failed to fetch group";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
RsWirePulseSPtr pPulse;
|
||||
if (!rsWire->getWirePulse(grpId, msgId, pPulse))
|
||||
{
|
||||
std::cerr << "PulseAddDialog::setRplyTo() failed to fetch pulse";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
// update GroupPtr
|
||||
// TODO - this should be handled in libretroshare if possible.
|
||||
if (pPulse->mGroupPtr == NULL) {
|
||||
pPulse->mGroupPtr = pGroup;
|
||||
}
|
||||
|
||||
setReplyTo(*pPulse, pPulse, pGroup->mMeta.mGroupName, replyType);
|
||||
}
|
||||
|
||||
void PulseAddDialog::addURL()
|
||||
{
|
||||
@ -164,21 +243,23 @@ void PulseAddDialog::postOriginalPulse()
|
||||
std::cerr << "PulseAddDialog::postOriginalPulse()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
RsWirePulse pulse;
|
||||
RsWirePulseSPtr pPulse(new RsWirePulse());
|
||||
|
||||
pulse.mMeta.mGroupId = mGroup.mMeta.mGroupId;
|
||||
pulse.mMeta.mAuthorId = mGroup.mMeta.mAuthorId;
|
||||
pulse.mMeta.mThreadId.clear();
|
||||
pulse.mMeta.mParentId.clear();
|
||||
pulse.mMeta.mOrigMsgId.clear();
|
||||
pPulse->mSentiment = WIRE_PULSE_SENTIMENT_NO_SENTIMENT;
|
||||
pPulse->mPulseText = ui.textEdit_Pulse->toPlainText().toStdString();
|
||||
// set images here too.
|
||||
pPulse->mImage1 = mImage1;
|
||||
pPulse->mImage2 = mImage2;
|
||||
pPulse->mImage3 = mImage3;
|
||||
pPulse->mImage4 = mImage4;
|
||||
|
||||
pulse.mPulseType = WIRE_PULSE_TYPE_ORIGINAL_MSG;
|
||||
pulse.mReplySentiment = WIRE_PULSE_SENTIMENT_NO_SENTIMENT;
|
||||
pulse.mPulseText = ui.textEdit_Pulse->toPlainText().toStdString();
|
||||
// all mRefs should empty.
|
||||
|
||||
uint32_t token;
|
||||
rsWire->createPulse(token, pulse);
|
||||
// this should be in async thread, so doesn't block UI thread.
|
||||
if (!rsWire->createOriginalPulse(mGroup.mMeta.mGroupId, pPulse))
|
||||
{
|
||||
std::cerr << "PulseAddDialog::postOriginalPulse() FAILED";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
clearDialog();
|
||||
hide();
|
||||
@ -211,67 +292,27 @@ void PulseAddDialog::postReplyPulse()
|
||||
std::cerr << "PulseAddDialog::postReplyPulse()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
RsWirePulse pulse;
|
||||
RsWirePulseSPtr pPulse(new RsWirePulse());
|
||||
|
||||
pulse.mMeta.mGroupId = mGroup.mMeta.mGroupId;
|
||||
pulse.mMeta.mAuthorId = mGroup.mMeta.mAuthorId;
|
||||
pulse.mMeta.mThreadId.clear();
|
||||
pulse.mMeta.mParentId.clear();
|
||||
pulse.mMeta.mOrigMsgId.clear();
|
||||
pPulse->mSentiment = toPulseSentiment(ui.comboBox_sentiment->currentIndex());
|
||||
pPulse->mPulseText = ui.textEdit_Pulse->toPlainText().toStdString();
|
||||
// set images here too.
|
||||
pPulse->mImage1 = mImage1;
|
||||
pPulse->mImage2 = mImage2;
|
||||
pPulse->mImage3 = mImage3;
|
||||
pPulse->mImage4 = mImage4;
|
||||
|
||||
pulse.mPulseType = WIRE_PULSE_TYPE_REPLY_MSG;
|
||||
pulse.mReplySentiment = toPulseSentiment(ui.comboBox_sentiment->currentIndex());
|
||||
pulse.mPulseText = ui.textEdit_Pulse->toPlainText().toStdString();
|
||||
|
||||
// mRefs refer to parent post.
|
||||
pulse.mRefGroupId = mReplyToPulse.mMeta.mGroupId;
|
||||
pulse.mRefGroupName = mReplyGroupName;
|
||||
pulse.mRefOrigMsgId = mReplyToPulse.mMeta.mOrigMsgId;
|
||||
pulse.mRefAuthorId = mReplyToPulse.mMeta.mAuthorId;
|
||||
pulse.mRefPublishTs = mReplyToPulse.mMeta.mPublishTs;
|
||||
pulse.mRefPulseText = mReplyToPulse.mPulseText;
|
||||
|
||||
// Need Pulse MsgID before we can create associated Reference.
|
||||
mWaitingRefMsg = true;
|
||||
|
||||
uint32_t token;
|
||||
rsWire->createPulse(token, pulse);
|
||||
mWireQueue->queueRequest(token, TOKENREQ_MSGINFO, RS_TOKREQ_ANSTYPE_ACK, 0);
|
||||
}
|
||||
|
||||
|
||||
void PulseAddDialog::postRefPulse(RsWirePulse &pulse)
|
||||
{
|
||||
std::cerr << "PulseAddDialog::postRefPulse() create Reference!";
|
||||
std::cerr << std::endl;
|
||||
|
||||
// Reference Pulse. posted on Parent's Group.
|
||||
RsWirePulse refPulse;
|
||||
|
||||
refPulse.mMeta.mGroupId = mReplyToPulse.mMeta.mGroupId;
|
||||
refPulse.mMeta.mAuthorId = mGroup.mMeta.mAuthorId; // own author Id.
|
||||
refPulse.mMeta.mThreadId = mReplyToPulse.mMeta.mOrigMsgId;
|
||||
refPulse.mMeta.mParentId = mReplyToPulse.mMeta.mOrigMsgId;
|
||||
refPulse.mMeta.mOrigMsgId.clear();
|
||||
|
||||
refPulse.mPulseType = WIRE_PULSE_TYPE_REPLY_REFERENCE;
|
||||
refPulse.mReplySentiment = toPulseSentiment(ui.comboBox_sentiment->currentIndex());
|
||||
|
||||
// Dont put parent PulseText into refPulse - it is available on Thread Msg.
|
||||
// otherwise gives impression it is correctly setup Parent / Reply...
|
||||
// when in fact the parent PublishTS, and AuthorId are wrong.
|
||||
refPulse.mPulseText = "";
|
||||
|
||||
// refs refer back to own Post.
|
||||
refPulse.mRefGroupId = mGroup.mMeta.mGroupId;
|
||||
refPulse.mRefGroupName = mGroup.mMeta.mGroupName;
|
||||
refPulse.mRefOrigMsgId = pulse.mMeta.mOrigMsgId;
|
||||
refPulse.mRefAuthorId = mGroup.mMeta.mAuthorId;
|
||||
refPulse.mRefPublishTs = pulse.mMeta.mPublishTs;
|
||||
refPulse.mRefPulseText = pulse.mPulseText;
|
||||
|
||||
uint32_t token;
|
||||
rsWire->createPulse(token, refPulse);
|
||||
// this should be in async thread, so doesn't block UI thread.
|
||||
if (!rsWire->createReplyPulse(mReplyToPulse.mMeta.mGroupId,
|
||||
mReplyToPulse.mMeta.mOrigMsgId,
|
||||
mGroup.mMeta.mGroupId,
|
||||
mReplyType,
|
||||
pPulse))
|
||||
{
|
||||
std::cerr << "PulseAddDialog::postReplyPulse() FAILED";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
clearDialog();
|
||||
hide();
|
||||
@ -282,90 +323,131 @@ void PulseAddDialog::clearDialog()
|
||||
ui.textEdit_Pulse->setPlainText("");
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------
|
||||
// Drag and Drop Images.
|
||||
|
||||
void PulseAddDialog::acknowledgeMessage(const uint32_t &token)
|
||||
void PulseAddDialog::dragEnterEvent(QDragEnterEvent *event)
|
||||
{
|
||||
std::cerr << "PulseAddDialog::acknowledgeMessage()";
|
||||
std::cerr << "PulseAddDialog::dragEnterEvent()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
std::pair<RsGxsGroupId, RsGxsMessageId> p;
|
||||
rsWire->acknowledgeMsg(token, p);
|
||||
|
||||
if (mWaitingRefMsg)
|
||||
if (event->mimeData()->hasUrls())
|
||||
{
|
||||
std::cerr << "PulseAddDialog::acknowledgeMessage() Waiting Ref Msg";
|
||||
std::cerr << "PulseAddDialog::dragEnterEvent() Accepting";
|
||||
std::cerr << std::endl;
|
||||
mWaitingRefMsg = false;
|
||||
|
||||
// request photo data.
|
||||
GxsMsgReq req;
|
||||
std::set<RsGxsMessageId> msgIds;
|
||||
msgIds.insert(p.second);
|
||||
req[p.first] = msgIds;
|
||||
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||
uint32_t token;
|
||||
mWireQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, req, 0);
|
||||
event->accept();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "PulseAddDialog::acknowledgeMessage() Not Waiting Ref Msg";
|
||||
std::cerr << "PulseAddDialog::dragEnterEvent() Ignoring";
|
||||
std::cerr << std::endl;
|
||||
event->ignore();
|
||||
}
|
||||
}
|
||||
|
||||
void PulseAddDialog::loadPulseData(const uint32_t &token)
|
||||
void PulseAddDialog::dragLeaveEvent(QDragLeaveEvent *event)
|
||||
{
|
||||
std::cerr << "PulseAddDialog::loadPulseData()";
|
||||
std::cerr << "PulseAddDialog::dragLeaveEvent()";
|
||||
std::cerr << std::endl;
|
||||
std::vector<RsWirePulse> pulses;
|
||||
rsWire->getPulseData(token, pulses);
|
||||
|
||||
if (pulses.size() != 1)
|
||||
event->ignore();
|
||||
}
|
||||
|
||||
void PulseAddDialog::dragMoveEvent(QDragMoveEvent *event)
|
||||
{
|
||||
std::cerr << "PulseAddDialog::dragMoveEvent()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
event->accept();
|
||||
}
|
||||
|
||||
void PulseAddDialog::dropEvent(QDropEvent *event)
|
||||
{
|
||||
std::cerr << "PulseAddDialog::dropEvent()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (event->mimeData()->hasUrls())
|
||||
{
|
||||
std::cerr << "PulseAddDialog::loadPulseData() Error Too many pulses";
|
||||
std::cerr << "PulseAddDialog::dropEvent() Urls:" << std::endl;
|
||||
|
||||
QList<QUrl> urls = event->mimeData()->urls();
|
||||
QList<QUrl>::iterator uit;
|
||||
for (uit = urls.begin(); uit != urls.end(); ++uit)
|
||||
{
|
||||
QString localpath = uit->toLocalFile();
|
||||
std::cerr << "Whole URL: " << uit->toString().toStdString() << std::endl;
|
||||
std::cerr << "or As Local File: " << localpath.toStdString() << std::endl;
|
||||
|
||||
addImage(localpath);
|
||||
}
|
||||
event->setDropAction(Qt::CopyAction);
|
||||
event->accept();
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "PulseAddDialog::dropEvent Ignoring";
|
||||
std::cerr << std::endl;
|
||||
event->ignore();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PulseAddDialog::addImage(const QString &path)
|
||||
{
|
||||
std::cerr << "PulseAddDialog::addImage() loading image from: " << path.toStdString();
|
||||
std::cerr << std::endl;
|
||||
|
||||
QPixmap qtn = QPixmap(path);
|
||||
if (qtn.isNull()) {
|
||||
std::cerr << "PulseAddDialog::addImage() Invalid Image";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
std::cerr << "PulseAddDialog::loadPulseData() calling postRefMsg";
|
||||
std::cerr << std::endl;
|
||||
QPixmap image;
|
||||
if ((qtn.width() <= 512) && (qtn.height() <= 512)) {
|
||||
image = qtn;
|
||||
} else {
|
||||
image = qtn.scaled(512, 512, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
}
|
||||
|
||||
RsWirePulse& pulse = pulses[0];
|
||||
postRefPulse(pulse);
|
||||
}
|
||||
// scaled down for display, allow wide images.
|
||||
QPixmap icon = qtn.scaled(256, 128, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
QByteArray ba;
|
||||
QBuffer buffer(&ba);
|
||||
|
||||
buffer.open(QIODevice::WriteOnly);
|
||||
image.save(&buffer, "JPG");
|
||||
|
||||
/**************************** Request / Response Filling of Data ************************/
|
||||
|
||||
void PulseAddDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||
{
|
||||
if (queue == mWireQueue)
|
||||
{
|
||||
/* now switch on req */
|
||||
switch(req.mType)
|
||||
{
|
||||
case TOKENREQ_MSGINFO:
|
||||
switch(req.mAnsType)
|
||||
{
|
||||
case RS_TOKREQ_ANSTYPE_ACK:
|
||||
acknowledgeMessage(req.mToken);
|
||||
break;
|
||||
case RS_TOKREQ_ANSTYPE_DATA:
|
||||
loadPulseData(req.mToken);
|
||||
break;
|
||||
default:
|
||||
std::cerr << "PulseAddDialog::loadRequest() ERROR: MSG: INVALID ANS TYPE";
|
||||
std::cerr << std::endl;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
std::cerr << "PulseAddDialog::loadRequest() ERROR: INVALID TYPE";
|
||||
std::cerr << std::endl;
|
||||
break;
|
||||
}
|
||||
if (mImage1.empty()) {
|
||||
std::cerr << "PulseAddDialog::addImage() Installing in Image1";
|
||||
std::cerr << std::endl;
|
||||
ui.label_image1->setPixmap(icon);
|
||||
mImage1.copy((uint8_t *) ba.data(), ba.size());
|
||||
std::cerr << "PulseAddDialog::addImage() Installing in Image1 Size: " << mImage1.mSize;
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
else if (mImage2.empty()) {
|
||||
ui.label_image2->setPixmap(icon);
|
||||
mImage2.copy((uint8_t *) ba.data(), ba.size());
|
||||
std::cerr << "PulseAddDialog::addImage() Installing in Image2 Size: " << mImage2.mSize;
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
else if (mImage3.empty()) {
|
||||
ui.label_image3->setPixmap(icon);
|
||||
mImage3.copy((uint8_t *) ba.data(), ba.size());
|
||||
std::cerr << "PulseAddDialog::addImage() Installing in Image3 Size: " << mImage3.mSize;
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
else if (mImage4.empty()) {
|
||||
ui.label_image4->setPixmap(icon);
|
||||
mImage4.copy((uint8_t *) ba.data(), ba.size());
|
||||
std::cerr << "PulseAddDialog::addImage() Installing in Image4 Size: " << mImage4.mSize;
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
else {
|
||||
std::cerr << "PulseAddDialog::addImage() Images all full";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -24,9 +24,16 @@
|
||||
#include "ui_PulseAddDialog.h"
|
||||
|
||||
#include <retroshare/rswire.h>
|
||||
#include "util/TokenQueue.h"
|
||||
|
||||
class PulseAddDialog : public QWidget, public TokenResponse
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QDragEnterEvent;
|
||||
class QDropEvent;
|
||||
class QMouseEvent;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
|
||||
class PulseAddDialog : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -34,8 +41,9 @@ public:
|
||||
PulseAddDialog(QWidget *parent = 0);
|
||||
|
||||
void cleanup();
|
||||
void setGroup(RsWireGroup &group);
|
||||
void setReplyTo(RsWirePulse &pulse, std::string &groupName);
|
||||
|
||||
void setReplyTo(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId, uint32_t replyType);
|
||||
void setGroup(const RsGxsGroupId &grpId);
|
||||
|
||||
private slots:
|
||||
void addURL();
|
||||
@ -46,28 +54,37 @@ private slots:
|
||||
void pulseTextChanged();
|
||||
|
||||
private:
|
||||
// OLD VERSIONs, private now.
|
||||
void setGroup(RsWireGroup &group);
|
||||
void setReplyTo(RsWirePulse &pulse, RsWirePulseSPtr pPulse, std::string &groupName, uint32_t replyType);
|
||||
|
||||
void postOriginalPulse();
|
||||
void postReplyPulse();
|
||||
void postRefPulse(RsWirePulse &pulse);
|
||||
|
||||
void acknowledgeMessage(const uint32_t &token);
|
||||
void loadPulseData(const uint32_t &token);
|
||||
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||
uint32_t toPulseSentiment(int index);
|
||||
|
||||
protected:
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
void dragLeaveEvent(QDragLeaveEvent *event);
|
||||
void dragMoveEvent(QDragMoveEvent *event);
|
||||
void dropEvent(QDropEvent *event);
|
||||
|
||||
RsWireGroup mGroup; // where we want to post from.
|
||||
void addImage(const QString &path);
|
||||
|
||||
RsWireGroup mGroup; // replyWith.
|
||||
|
||||
// if this is a reply
|
||||
bool mIsReply;
|
||||
std::string mReplyGroupName;
|
||||
RsWirePulse mReplyToPulse;
|
||||
bool mWaitingRefMsg;
|
||||
uint32_t mReplyType;
|
||||
|
||||
// images
|
||||
RsGxsImage mImage1;
|
||||
RsGxsImage mImage2;
|
||||
RsGxsImage mImage3;
|
||||
RsGxsImage mImage4;
|
||||
|
||||
TokenQueue* mWireQueue;
|
||||
Ui::PulseAddDialog ui;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -7,7 +7,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>720</width>
|
||||
<height>586</height>
|
||||
<height>633</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -150,7 +150,7 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame_3">
|
||||
<widget class="QFrame" name="frame_input">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
@ -161,6 +161,88 @@
|
||||
<item>
|
||||
<widget class="QTextEdit" name="textEdit_Pulse"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame_2">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_image1">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Drag and Drop Image</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_image2">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Drag and Drop Image</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_image3">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Drag and Drop Image</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_image4">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Drag and Drop Image</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame_URL">
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
|
@ -1,214 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* gui/TheWire/PulseDetails.cpp *
|
||||
* *
|
||||
* Copyright (c) 2020 Robert Fernie <retroshare.project@gmail.com> *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QMessageBox>
|
||||
#include <QMouseEvent>
|
||||
#include <QBuffer>
|
||||
|
||||
#include "PulseDetails.h"
|
||||
|
||||
#include "util/DateTime.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
|
||||
/** Constructor */
|
||||
PulseDetails::PulseDetails(PulseHolder *actions, RsWirePulse *pulse, std::string &groupName,
|
||||
std::map<rstime_t, RsWirePulse *> replies)
|
||||
:QWidget(NULL), mActions(actions), mPulse(*pulse), mGroupName(groupName)
|
||||
{
|
||||
setupUi(this);
|
||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||
setup();
|
||||
addReplies(replies);
|
||||
}
|
||||
|
||||
PulseDetails::PulseDetails(PulseHolder *actions,
|
||||
RsGxsGroupId &parentGroupId,
|
||||
std::string &parentGroupName,
|
||||
RsGxsMessageId &parentOrigMsgId,
|
||||
RsGxsId &parentAuthorId,
|
||||
rstime_t &parentPublishTs,
|
||||
std::string &parentPulseText)
|
||||
:QWidget(NULL), mActions(actions), mPulse(), mGroupName(parentGroupName)
|
||||
{
|
||||
setupUi(this);
|
||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||
|
||||
// reuse Meta data structure.
|
||||
mPulse.mMeta.mGroupId = parentGroupId;
|
||||
mPulse.mMeta.mOrigMsgId = parentOrigMsgId;
|
||||
mPulse.mMeta.mAuthorId = parentAuthorId;
|
||||
mPulse.mMeta.mPublishTs = parentPublishTs;
|
||||
mPulse.mPulseText = parentPulseText;
|
||||
setup();
|
||||
}
|
||||
|
||||
void PulseDetails::setBackground(QString color)
|
||||
{
|
||||
QWidget *tocolor = this;
|
||||
QPalette p = tocolor->palette();
|
||||
p.setColor(tocolor->backgroundRole(), QColor(color));
|
||||
tocolor->setPalette(p);
|
||||
tocolor->setAutoFillBackground(true);
|
||||
}
|
||||
|
||||
void PulseDetails::setup()
|
||||
{
|
||||
connect(toolButton_expand, SIGNAL(clicked()), this, SLOT(toggle()));
|
||||
|
||||
connect(toolButton_follow, SIGNAL(clicked()), this, SLOT(follow()));
|
||||
connect(toolButton_rate, SIGNAL(clicked()), this, SLOT(rate()));
|
||||
connect(toolButton_reply, SIGNAL(clicked()), this, SLOT(reply()));
|
||||
|
||||
label_wireName->setText(QString::fromStdString(mGroupName));
|
||||
label_idName->setId(mPulse.mMeta.mAuthorId);
|
||||
|
||||
label_date->setText(DateTime::formatDateTime(mPulse.mMeta.mPublishTs));
|
||||
label_summary->setText(getSummary());
|
||||
|
||||
// label_icon->setText();
|
||||
textBrowser->setPlainText(QString::fromStdString(mPulse.mPulseText));
|
||||
frame_expand->setVisible(false);
|
||||
|
||||
label_replies->setText("");
|
||||
frame_replies->setVisible(false);
|
||||
mHasReplies = false;
|
||||
|
||||
toolButton_follow->setEnabled(false); // TODO
|
||||
toolButton_rate->setEnabled(false); // TODO
|
||||
toolButton_reply->setEnabled(mActions != NULL);
|
||||
}
|
||||
|
||||
void PulseDetails::addReplies(std::map<rstime_t, RsWirePulse *> replies)
|
||||
{
|
||||
if (replies.size() == 0)
|
||||
{
|
||||
// do nothing.
|
||||
return;
|
||||
}
|
||||
else if (replies.size() == 1)
|
||||
{
|
||||
label_replies->setText("1 reply");
|
||||
}
|
||||
else if (replies.size() > 1)
|
||||
{
|
||||
label_replies->setText(QString("%1 replies").arg(replies.size()));
|
||||
}
|
||||
|
||||
// add extra widgets into layout.
|
||||
QLayout *vbox = frame_replies->layout();
|
||||
mHasReplies = true;
|
||||
|
||||
std::map<rstime_t, RsWirePulse *> emptyReplies;
|
||||
std::map<rstime_t, RsWirePulse *>::reverse_iterator it;
|
||||
for (it = replies.rbegin(); it != replies.rend(); it++)
|
||||
{
|
||||
// add Ref as child reply.
|
||||
PulseDetails *pd = new PulseDetails(mActions,
|
||||
it->second->mRefGroupId,
|
||||
it->second->mRefGroupName,
|
||||
it->second->mRefOrigMsgId,
|
||||
it->second->mRefAuthorId,
|
||||
it->second->mRefPublishTs,
|
||||
it->second->mRefPulseText);
|
||||
pd->setBackground("goldenrod");
|
||||
vbox->addWidget(pd);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PulseDetails::toggle()
|
||||
{
|
||||
if (frame_expand->isVisible()) {
|
||||
// switch to minimal view.
|
||||
label_summary->setVisible(true);
|
||||
frame_expand->setVisible(false);
|
||||
frame_replies->setVisible(false);
|
||||
} else {
|
||||
// switch to expanded view.
|
||||
label_summary->setVisible(false);
|
||||
frame_expand->setVisible(true);
|
||||
if (mHasReplies) {
|
||||
frame_replies->setVisible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QString PulseDetails::getSummary()
|
||||
{
|
||||
std::string summary = mPulse.mPulseText;
|
||||
std::cerr << "PulseDetails::getSummary() orig: " << summary;
|
||||
std::cerr << std::endl;
|
||||
int len = summary.size();
|
||||
bool in_whitespace = false;
|
||||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
if (isspace(summary[i])) {
|
||||
if (in_whitespace) {
|
||||
// trim
|
||||
summary.erase(i, 1);
|
||||
// rollback index / len.
|
||||
--i;
|
||||
--len;
|
||||
} else {
|
||||
// replace whitespace with space.
|
||||
summary[i] = ' ';
|
||||
in_whitespace = true;
|
||||
}
|
||||
} else {
|
||||
in_whitespace = false;
|
||||
}
|
||||
}
|
||||
std::cerr << "PulseDetails::getSummary() summary: " << summary;
|
||||
std::cerr << std::endl;
|
||||
|
||||
return QString::fromStdString(summary);
|
||||
}
|
||||
|
||||
void PulseDetails::follow()
|
||||
{
|
||||
// follow group.
|
||||
if (mActions)
|
||||
{
|
||||
mActions->follow(mPulse.mMeta.mGroupId);
|
||||
}
|
||||
}
|
||||
|
||||
void PulseDetails::rate()
|
||||
{
|
||||
// rate author
|
||||
if (mActions)
|
||||
{
|
||||
mActions->rate(mPulse.mMeta.mAuthorId);
|
||||
}
|
||||
}
|
||||
|
||||
void PulseDetails::reply()
|
||||
{
|
||||
// reply
|
||||
if (mActions)
|
||||
{
|
||||
mActions->reply(mPulse, mGroupName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,243 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PulseDetails</class>
|
||||
<widget class="QWidget" name="PulseDetails">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>807</width>
|
||||
<height>231</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_expand">
|
||||
<property name="text">
|
||||
<string>\/</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_wireName">
|
||||
<property name="text">
|
||||
<string>WireGroupName</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_replies">
|
||||
<property name="text">
|
||||
<string># replies</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>128</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_summary">
|
||||
<property name="text">
|
||||
<string>Summary Text</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_date">
|
||||
<property name="text">
|
||||
<string>DateTime 02/02/20</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame_expand">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_follow">
|
||||
<property name="text">
|
||||
<string>follow</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_reply">
|
||||
<property name="text">
|
||||
<string>reply</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_rate">
|
||||
<property name="text">
|
||||
<string>rate</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="GxsIdLabel" name="label_idName">
|
||||
<property name="text">
|
||||
<string>idLabel</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_icon">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>80</width>
|
||||
<height>80</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Image</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Expanding</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>5</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextBrowser" name="textBrowser"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame_replies">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Replies</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>GxsIdLabel</class>
|
||||
<extends>QLabel</extends>
|
||||
<header>gui/gxs/GxsIdLabel.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -1,157 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* gui/TheWire/PulseItem.cpp *
|
||||
* *
|
||||
* Copyright (c) 2012-2020 Robert Fernie <retroshare.project@gmail.com> *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QMessageBox>
|
||||
#include <QMouseEvent>
|
||||
#include <QBuffer>
|
||||
|
||||
#include "PulseItem.h"
|
||||
|
||||
#include "PulseDetails.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
|
||||
/****
|
||||
* #define DEBUG_ITEM 1
|
||||
****/
|
||||
|
||||
/** Constructor */
|
||||
|
||||
PulseItem::PulseItem(PulseHolder *holder, std::string path)
|
||||
:QWidget(NULL), mHolder(holder), mType(0)
|
||||
{
|
||||
setupUi(this);
|
||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||
|
||||
}
|
||||
|
||||
PulseItem::PulseItem(PulseHolder *holder, RsWirePulse *pulse_ptr, RsWireGroup *group_ptr, std::map<rstime_t, RsWirePulse *> replies)
|
||||
:QWidget(NULL), mHolder(holder), mPulse(*pulse_ptr), mType(0)
|
||||
{
|
||||
setupUi(this);
|
||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||
QWidget *pulse_widget = widget_parent; // default msg goes into widget_parent.
|
||||
|
||||
/* if it is a reply */
|
||||
if (mPulse.mPulseType & WIRE_PULSE_TYPE_REPLY_MSG) {
|
||||
|
||||
std::cerr << "Installing Reply Msg";
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "GroupID: " << mPulse.mRefGroupId;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "GroupName: " << mPulse.mRefGroupName;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "OrigMsgId: " << mPulse.mRefOrigMsgId;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "AuthorId: " << mPulse.mRefAuthorId;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "PublishTs: " << mPulse.mRefPublishTs;
|
||||
std::cerr << std::endl;
|
||||
std::cerr << "PulseText: " << mPulse.mRefPulseText;
|
||||
std::cerr << std::endl;
|
||||
|
||||
// fill in the parent.
|
||||
PulseDetails *parent = new PulseDetails(
|
||||
mHolder,
|
||||
mPulse.mRefGroupId,
|
||||
mPulse.mRefGroupName,
|
||||
mPulse.mRefOrigMsgId,
|
||||
mPulse.mRefAuthorId,
|
||||
mPulse.mRefPublishTs,
|
||||
mPulse.mRefPulseText);
|
||||
|
||||
parent->setBackground("sienna");
|
||||
|
||||
// add extra widget into layout.
|
||||
QVBoxLayout *vbox = new QVBoxLayout();
|
||||
vbox->addWidget(parent);
|
||||
vbox->setContentsMargins(0,0,0,0);
|
||||
widget_parent->setLayout(vbox);
|
||||
|
||||
// if its a reply, the real msg goes into reply slot.
|
||||
pulse_widget = widget_reply;
|
||||
}
|
||||
else
|
||||
{
|
||||
// ORIGINAL PULSE.
|
||||
// hide widget_reply, as it will be empty.
|
||||
widget_reply->setVisible(false);
|
||||
}
|
||||
|
||||
{
|
||||
std::cerr << "Adding Main Message";
|
||||
std::cerr << std::endl;
|
||||
PulseDetails *details = new PulseDetails(mHolder, &mPulse, group_ptr->mMeta.mGroupName, replies);
|
||||
|
||||
// add extra widget into layout.
|
||||
QVBoxLayout *vbox = new QVBoxLayout();
|
||||
vbox->addWidget(details);
|
||||
vbox->setSpacing(1);
|
||||
vbox->setContentsMargins(0,0,0,0);
|
||||
pulse_widget->setLayout(vbox);
|
||||
pulse_widget->setVisible(true);
|
||||
}
|
||||
}
|
||||
|
||||
rstime_t PulseItem::publishTs()
|
||||
{
|
||||
return mPulse.mMeta.mPublishTs;
|
||||
}
|
||||
|
||||
void PulseItem::removeItem()
|
||||
{
|
||||
}
|
||||
|
||||
void PulseItem::setSelected(bool on)
|
||||
{
|
||||
}
|
||||
|
||||
bool PulseItem::isSelected()
|
||||
{
|
||||
return mSelected;
|
||||
}
|
||||
|
||||
void PulseItem::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
/* We can be very cunning here?
|
||||
* grab out position.
|
||||
* flag ourselves as selected.
|
||||
* then pass the mousePressEvent up for handling by the parent
|
||||
*/
|
||||
|
||||
QPoint pos = event->pos();
|
||||
|
||||
std::cerr << "PulseItem::mousePressEvent(" << pos.x() << ", " << pos.y() << ")";
|
||||
std::cerr << std::endl;
|
||||
|
||||
setSelected(true);
|
||||
|
||||
QWidget::mousePressEvent(event);
|
||||
|
||||
mHolder->notifyPulseSelection(this);
|
||||
}
|
||||
|
||||
const QPixmap *PulseItem::getPixmap()
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
@ -1,192 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PulseItem</class>
|
||||
<widget class="QWidget" name="PulseItem">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>802</width>
|
||||
<height>322</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="leftMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QFrame#frame{border: 2px solid #CCCCCC;
|
||||
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
|
||||
stop: 0 #EEEEEE, stop: 1 #CCCCCC);
|
||||
border-radius: 10px}</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>5</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QFrame" name="widget_parent">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>20</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="widget_reply">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>20</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="TheWire_images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
137
retroshare-gui/src/gui/TheWire/PulseMessage.cpp
Normal file
137
retroshare-gui/src/gui/TheWire/PulseMessage.cpp
Normal file
@ -0,0 +1,137 @@
|
||||
/*******************************************************************************
|
||||
* gui/TheWire/PulseMessage.cpp *
|
||||
* *
|
||||
* Copyright (c) 2020-2020 Robert Fernie <retroshare.project@gmail.com> *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#include "PulseMessage.h"
|
||||
|
||||
/** Constructor */
|
||||
|
||||
PulseMessage::PulseMessage(QWidget *parent)
|
||||
:QWidget(parent)
|
||||
{
|
||||
setupUi(this);
|
||||
}
|
||||
|
||||
void PulseMessage::setup(RsWirePulseSPtr pulse)
|
||||
{
|
||||
if (!pulse) {
|
||||
return;
|
||||
}
|
||||
|
||||
setMessage(QString::fromStdString(pulse->mPulseText));
|
||||
|
||||
// setup images.
|
||||
int width = 256;
|
||||
int height = 128;
|
||||
bool imagesShown = false;
|
||||
|
||||
if (pulse->mImage2.empty()) {
|
||||
// allow wider space for image 1.
|
||||
width = 512;
|
||||
}
|
||||
|
||||
if (!pulse->mImage1.empty()) {
|
||||
// install image.
|
||||
QPixmap qtn;
|
||||
qtn.loadFromData(pulse->mImage1.mData, pulse->mImage1.mSize);
|
||||
label_image1->setPixmap(qtn.scaled(width, height,
|
||||
Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||
imagesShown = true;
|
||||
} else {
|
||||
label_image1->setVisible(false);
|
||||
}
|
||||
|
||||
if (!pulse->mImage2.empty()) {
|
||||
// install image.
|
||||
QPixmap qtn;
|
||||
qtn.loadFromData(pulse->mImage2.mData, pulse->mImage2.mSize);
|
||||
label_image2->setPixmap(qtn.scaled(width, height,
|
||||
Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||
imagesShown = true;
|
||||
} else {
|
||||
label_image2->setVisible(false);
|
||||
}
|
||||
|
||||
width = 256;
|
||||
if (pulse->mImage4.empty()) {
|
||||
// allow wider space for image 3.
|
||||
width = 512;
|
||||
}
|
||||
|
||||
if (!pulse->mImage3.empty()) {
|
||||
// install image.
|
||||
QPixmap qtn;
|
||||
qtn.loadFromData(pulse->mImage3.mData, pulse->mImage3.mSize);
|
||||
label_image3->setPixmap(qtn.scaled(width, height,
|
||||
Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||
imagesShown = true;
|
||||
} else {
|
||||
label_image3->setVisible(false);
|
||||
}
|
||||
|
||||
if (!pulse->mImage4.empty()) {
|
||||
// install image.
|
||||
QPixmap qtn;
|
||||
qtn.loadFromData(pulse->mImage4.mData, pulse->mImage4.mSize);
|
||||
label_image4->setPixmap(qtn.scaled(width, height,
|
||||
Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
||||
imagesShown = true;
|
||||
} else {
|
||||
label_image4->setVisible(false);
|
||||
}
|
||||
|
||||
frame_expand->setVisible(imagesShown);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* gui/TheWire/PulseItem.h *
|
||||
* gui/TheWire/PulseMessage.h *
|
||||
* *
|
||||
* Copyright (c) 2012-2020 Robert Fernie <retroshare.project@gmail.com> *
|
||||
* Copyright (c) 2020-2020 Robert Fernie <retroshare.project@gmail.com> *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
@ -18,54 +18,23 @@
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef MRK_PULSE_ITEM_H
|
||||
#define MRK_PULSE_ITEM_H
|
||||
#ifndef MRK_PULSE_MSG_H
|
||||
#define MRK_PULSE_MSG_H
|
||||
|
||||
#include "ui_PulseItem.h"
|
||||
#include "ui_PulseMessage.h"
|
||||
|
||||
#include <retroshare/rswire.h>
|
||||
|
||||
class PulseItem;
|
||||
|
||||
class PulseHolder
|
||||
{
|
||||
public:
|
||||
virtual ~PulseHolder() {}
|
||||
virtual void deletePulseItem(PulseItem *, uint32_t ptype) = 0;
|
||||
virtual void notifyPulseSelection(PulseItem *item) = 0;
|
||||
|
||||
// Actions.
|
||||
virtual void follow(RsGxsGroupId &groupId) = 0;
|
||||
virtual void rate(RsGxsId &authorId) = 0;
|
||||
virtual void reply(RsWirePulse &pulse, std::string &groupName) = 0;
|
||||
};
|
||||
|
||||
|
||||
class PulseItem : public QWidget, private Ui::PulseItem
|
||||
class PulseMessage : public QWidget, private Ui::PulseMessage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PulseItem(PulseHolder *holder, std::string url);
|
||||
PulseItem(PulseHolder *holder, RsWirePulse *pulse_ptr, RsWireGroup *group_ptr, std::map<rstime_t, RsWirePulse *> replies);
|
||||
PulseMessage(QWidget *parent);
|
||||
|
||||
rstime_t publishTs();
|
||||
void removeItem();
|
||||
|
||||
void setSelected(bool on);
|
||||
bool isSelected();
|
||||
|
||||
const QPixmap *getPixmap();
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
|
||||
private:
|
||||
|
||||
PulseHolder *mHolder;
|
||||
RsWirePulse mPulse;
|
||||
uint32_t mType;
|
||||
bool mSelected;
|
||||
void setup(RsWirePulseSPtr pulse);
|
||||
void setMessage(QString msg);
|
||||
void setRefImageCount(uint32_t count);
|
||||
};
|
||||
|
||||
#endif
|
100
retroshare-gui/src/gui/TheWire/PulseMessage.ui
Normal file
100
retroshare-gui/src/gui/TheWire/PulseMessage.ui
Normal file
@ -0,0 +1,100 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PulseMessage</class>
|
||||
<widget class="QWidget" name="PulseMessage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>570</width>
|
||||
<height>376</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTextBrowser" name="textBrowser"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame_expand">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_image1">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>128</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Image</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_image2">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>128</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Image</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_image3">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>128</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Image</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_image4">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>128</width>
|
||||
<height>128</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Image</string>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
140
retroshare-gui/src/gui/TheWire/PulseReply.cpp
Normal file
140
retroshare-gui/src/gui/TheWire/PulseReply.cpp
Normal file
@ -0,0 +1,140 @@
|
||||
/*******************************************************************************
|
||||
* gui/TheWire/PulseReply.cpp *
|
||||
* *
|
||||
* Copyright (c) 2020-2020 Robert Fernie <retroshare.project@gmail.com> *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QMessageBox>
|
||||
#include <QMouseEvent>
|
||||
#include <QBuffer>
|
||||
|
||||
#include "PulseReply.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
|
||||
/** Constructor */
|
||||
|
||||
PulseReply::PulseReply(PulseViewHolder *holder, RsWirePulseSPtr pulse)
|
||||
:PulseDataItem(holder, pulse)
|
||||
{
|
||||
setupUi(this);
|
||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||
|
||||
setup();
|
||||
|
||||
if (mPulse) {
|
||||
showPulse();
|
||||
}
|
||||
|
||||
widget_prefix->setVisible(false);
|
||||
}
|
||||
|
||||
void PulseReply::setup()
|
||||
{
|
||||
// connect(pushButton_tmpViewGroup, SIGNAL(clicked()), this, SLOT(actionViewGroup()));
|
||||
// connect(pushButton_tmpViewParent, 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()));
|
||||
connect(toolButton_republish, SIGNAL(clicked()), this, SLOT(actionRepublish()));
|
||||
connect(toolButton_like, SIGNAL(clicked()), this, SLOT(actionLike()));
|
||||
connect(toolButton_view, SIGNAL(clicked()), this, SLOT(actionViewPulse()));
|
||||
}
|
||||
|
||||
void PulseReply::showReplyLine(bool enable)
|
||||
{
|
||||
line_replyLine->setVisible(enable);
|
||||
}
|
||||
|
||||
// PulseDataInterface ===========
|
||||
// Group
|
||||
void PulseReply::setHeadshot(const QPixmap &pixmap)
|
||||
{
|
||||
label_headshot->setPixmap(pixmap);
|
||||
}
|
||||
|
||||
void PulseReply::setGroupNameString(QString name)
|
||||
{
|
||||
label_groupName->setText("@" + name);
|
||||
}
|
||||
|
||||
void PulseReply::setAuthorString(QString name)
|
||||
{
|
||||
label_authorName->setText(BoldString(name));
|
||||
}
|
||||
|
||||
// Msg
|
||||
void PulseReply::setRefMessage(QString msg, uint32_t image_count)
|
||||
{
|
||||
widget_message->setMessage(msg);
|
||||
widget_message->setRefImageCount(image_count);
|
||||
}
|
||||
|
||||
void PulseReply::setMessage(RsWirePulseSPtr pulse)
|
||||
{
|
||||
widget_message->setup(pulse);
|
||||
}
|
||||
|
||||
void PulseReply::setDateString(QString date)
|
||||
{
|
||||
label_date->setText(date);
|
||||
}
|
||||
|
||||
// Refs
|
||||
void PulseReply::setLikesString(QString likes)
|
||||
{
|
||||
label_likes->setText(likes);
|
||||
}
|
||||
|
||||
void PulseReply::setRepublishesString(QString repub)
|
||||
{
|
||||
label_republishes->setText(repub);
|
||||
}
|
||||
|
||||
void PulseReply::setRepliesString(QString reply)
|
||||
{
|
||||
label_replies->setText(reply);
|
||||
}
|
||||
|
||||
void PulseReply::showResponseStats(bool enable)
|
||||
{
|
||||
widget_actions->setVisible(enable);
|
||||
widget_follow->setVisible(!enable);
|
||||
}
|
||||
|
||||
void PulseReply::setReferenceString(QString ref)
|
||||
{
|
||||
if (ref.size() == 0)
|
||||
{
|
||||
widget_reply_header->setVisible(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
label_reference->setText(ref);
|
||||
}
|
||||
}
|
||||
// PulseDataInterface ===========
|
||||
|
||||
void PulseReply::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
}
|
||||
|
||||
|
65
retroshare-gui/src/gui/TheWire/PulseReply.h
Normal file
65
retroshare-gui/src/gui/TheWire/PulseReply.h
Normal file
@ -0,0 +1,65 @@
|
||||
/*******************************************************************************
|
||||
* gui/TheWire/PulseReply.h *
|
||||
* *
|
||||
* Copyright (c) 2020-2020 Robert Fernie <retroshare.project@gmail.com> *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef MRK_PULSE_REPLY_H
|
||||
#define MRK_PULSE_REPLY_H
|
||||
|
||||
#include "ui_PulseReply.h"
|
||||
#include "PulseViewItem.h"
|
||||
|
||||
#include <retroshare/rswire.h>
|
||||
|
||||
class PulseReply : public PulseDataItem, private Ui::PulseReply
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PulseReply(PulseViewHolder *holder, RsWirePulseSPtr pulse);
|
||||
|
||||
void showReplyLine(bool enable);
|
||||
|
||||
protected:
|
||||
void setup();
|
||||
|
||||
// PulseDataInterface ===========
|
||||
// Group
|
||||
virtual void setHeadshot(const QPixmap &pixmap) override;
|
||||
virtual void setGroupNameString(QString name) override;
|
||||
virtual void setAuthorString(QString name) override;
|
||||
|
||||
// Msg
|
||||
virtual void setRefMessage(QString msg, uint32_t image_count) override;
|
||||
virtual void setMessage(RsWirePulseSPtr pulse) override;
|
||||
virtual void setDateString(QString date) override;
|
||||
|
||||
// Refs
|
||||
virtual void setLikesString(QString likes) override;
|
||||
virtual void setRepublishesString(QString repub) override;
|
||||
virtual void setRepliesString(QString reply) override;
|
||||
|
||||
//
|
||||
virtual void setReferenceString(QString ref) override;
|
||||
virtual void showResponseStats(bool enable) override;
|
||||
// PulseDataInterface ===========
|
||||
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
};
|
||||
|
||||
#endif
|
575
retroshare-gui/src/gui/TheWire/PulseReply.ui
Normal file
575
retroshare-gui/src/gui/TheWire/PulseReply.ui
Normal file
@ -0,0 +1,575 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PulseReply</class>
|
||||
<widget class="QWidget" name="PulseReply">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>579</width>
|
||||
<height>478</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QFrame#frame{border: 2px solid #CCCCCC;
|
||||
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
|
||||
stop: 0 #EEEEEE, stop: 1 #CCCCCC);
|
||||
border-radius: 10px}</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0" colspan="2">
|
||||
<widget class="QWidget" name="widget_prefix" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_14">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>icn</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>retweeted</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_15">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>222</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="1">
|
||||
<widget class="QWidget" name="widget_actions" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_reply">
|
||||
<property name="text">
|
||||
<string>REPLY</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_replies">
|
||||
<property name="text">
|
||||
<string>1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_republish">
|
||||
<property name="text">
|
||||
<string>REPUBLISH</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_republishes">
|
||||
<property name="text">
|
||||
<string>1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_like">
|
||||
<property name="text">
|
||||
<string>LIKE</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_likes">
|
||||
<property name="text">
|
||||
<string>1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_view">
|
||||
<property name="text">
|
||||
<string>SHOW</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="1">
|
||||
<widget class="QWidget" name="widget_follow" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_422">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>104</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_follow">
|
||||
<property name="text">
|
||||
<string>FOLLOW</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string> for response statistics </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_322">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>104</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QWidget" name="widget_header" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_12">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_authorName">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-weight:600;">Sidler</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_groupName">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" color:#555753;">@sidler_here</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_18">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>10</width>
|
||||
<height>19</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_date">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" color:#2e3436;">· Apr 13 ·</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_13">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>64</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0" rowspan="6">
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_headshot">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Head</p><p>Shot</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_11">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_16">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>5</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_replyLine">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>1</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_17">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>5</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QWidget" name="widget_reply_header" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_13">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_reference">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" color:#555753;">Replying to @sidler</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_20">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>215</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1" rowspan="2">
|
||||
<widget class="PulseMessage" name="widget_message" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>PulseMessage</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/TheWire/PulseMessage.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="TheWire_images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
32
retroshare-gui/src/gui/TheWire/PulseReplySeperator.cpp
Normal file
32
retroshare-gui/src/gui/TheWire/PulseReplySeperator.cpp
Normal file
@ -0,0 +1,32 @@
|
||||
/*******************************************************************************
|
||||
* gui/TheWire/PulseReplySeperator.cpp *
|
||||
* *
|
||||
* Copyright (c) 2020-2020 Robert Fernie <retroshare.project@gmail.com> *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#include "PulseReplySeperator.h"
|
||||
|
||||
/** Constructor */
|
||||
|
||||
PulseReplySeperator::PulseReplySeperator()
|
||||
:PulseViewItem(NULL)
|
||||
{
|
||||
setupUi(this);
|
||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||
}
|
||||
|
||||
|
35
retroshare-gui/src/gui/TheWire/PulseReplySeperator.h
Normal file
35
retroshare-gui/src/gui/TheWire/PulseReplySeperator.h
Normal file
@ -0,0 +1,35 @@
|
||||
/*******************************************************************************
|
||||
* gui/TheWire/PulseReplySeperator.h *
|
||||
* *
|
||||
* Copyright (c) 2020-2020 Robert Fernie <retroshare.project@gmail.com> *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef MRK_PULSE_REPLY_SEPERATOR_H
|
||||
#define MRK_PULSE_REPLY_SEPERATOR_H
|
||||
|
||||
#include "ui_PulseReplySeperator.h"
|
||||
#include "PulseViewItem.h"
|
||||
|
||||
class PulseReplySeperator : public PulseViewItem, private Ui::PulseReplySeperator
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PulseReplySeperator();
|
||||
};
|
||||
|
||||
#endif
|
102
retroshare-gui/src/gui/TheWire/PulseReplySeperator.ui
Normal file
102
retroshare-gui/src/gui/TheWire/PulseReplySeperator.ui
Normal file
@ -0,0 +1,102 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PulseReplySeperator</class>
|
||||
<widget class="QWidget" name="PulseReplySeperator">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>781</width>
|
||||
<height>57</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QFrame#frame{border: 2px solid #CCCCCC;
|
||||
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
|
||||
stop: 0 #EEEEEE, stop: 1 #CCCCCC);
|
||||
border-radius: 10px}</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>3</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>5</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="lineWidth">
|
||||
<number>100</number>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="TheWire_images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
132
retroshare-gui/src/gui/TheWire/PulseTopLevel.cpp
Normal file
132
retroshare-gui/src/gui/TheWire/PulseTopLevel.cpp
Normal file
@ -0,0 +1,132 @@
|
||||
/*******************************************************************************
|
||||
* gui/TheWire/PulseTopLevel.cpp *
|
||||
* *
|
||||
* Copyright (c) 2020-2020 Robert Fernie <retroshare.project@gmail.com> *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QMessageBox>
|
||||
#include <QMouseEvent>
|
||||
#include <QBuffer>
|
||||
|
||||
#include "PulseTopLevel.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
|
||||
/** Constructor */
|
||||
|
||||
PulseTopLevel::PulseTopLevel(PulseViewHolder *holder, RsWirePulseSPtr pulse)
|
||||
:PulseDataItem(holder, pulse)
|
||||
{
|
||||
setupUi(this);
|
||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||
setup();
|
||||
|
||||
if (mPulse) {
|
||||
showPulse();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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_rate, SIGNAL(clicked()), this, SLOT(rate()));
|
||||
|
||||
connect(toolButton_reply, SIGNAL(clicked()), this, SLOT(actionReply()));
|
||||
connect(toolButton_republish, SIGNAL(clicked()), this, SLOT(actionRepublish()));
|
||||
connect(toolButton_like, SIGNAL(clicked()), this, SLOT(actionLike()));
|
||||
connect(toolButton_view, SIGNAL(clicked()), this, SLOT(actionViewPulse()));
|
||||
}
|
||||
|
||||
void PulseTopLevel::setRefMessage(QString msg, uint32_t image_count)
|
||||
{
|
||||
// This should never happen.
|
||||
//widget_message->setRefMessage(msg, image_count);
|
||||
}
|
||||
|
||||
void PulseTopLevel::setMessage(RsWirePulseSPtr pulse)
|
||||
{
|
||||
widget_message->setup(pulse);
|
||||
}
|
||||
|
||||
// Set UI elements.
|
||||
void PulseTopLevel::setHeadshot(const QPixmap &pixmap)
|
||||
{
|
||||
label_headshot->setPixmap(pixmap);
|
||||
}
|
||||
|
||||
void PulseTopLevel::setGroupNameString(QString name)
|
||||
{
|
||||
label_groupName->setText("@" + name);
|
||||
}
|
||||
|
||||
void PulseTopLevel::setAuthorString(QString name)
|
||||
{
|
||||
label_authorName->setText(BoldString(name));
|
||||
}
|
||||
|
||||
void PulseTopLevel::setDateString(QString date)
|
||||
{
|
||||
label_date->setText(date);
|
||||
}
|
||||
|
||||
void PulseTopLevel::setLikesString(QString likes)
|
||||
{
|
||||
label_extra_likes->setText(BoldString(likes));
|
||||
label_likes->setText(likes);
|
||||
}
|
||||
|
||||
void PulseTopLevel::setRepublishesString(QString repub)
|
||||
{
|
||||
label_extra_republishes->setText(BoldString(repub));
|
||||
label_republishes->setText(repub);
|
||||
}
|
||||
|
||||
void PulseTopLevel::setRepliesString(QString reply)
|
||||
{
|
||||
label_extra_replies->setText(BoldString(reply));
|
||||
label_replies->setText(reply);
|
||||
}
|
||||
|
||||
void PulseTopLevel::showResponseStats(bool enable)
|
||||
{
|
||||
widget_replies->setVisible(enable);
|
||||
widget_actions->setVisible(enable);
|
||||
}
|
||||
|
||||
void PulseTopLevel::setReferenceString(QString ref)
|
||||
{
|
||||
if (ref.size() == 0)
|
||||
{
|
||||
widget_prefix->setVisible(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
label_reference->setText(ref);
|
||||
}
|
||||
}
|
||||
|
||||
void PulseTopLevel::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
}
|
||||
|
||||
|
65
retroshare-gui/src/gui/TheWire/PulseTopLevel.h
Normal file
65
retroshare-gui/src/gui/TheWire/PulseTopLevel.h
Normal file
@ -0,0 +1,65 @@
|
||||
/*******************************************************************************
|
||||
* gui/TheWire/PulseTopLevel.h *
|
||||
* *
|
||||
* Copyright (c) 2020-2020 Robert Fernie <retroshare.project@gmail.com> *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef MRK_PULSE_TOP_LEVEL_H
|
||||
#define MRK_PULSE_TOP_LEVEL_H
|
||||
|
||||
#include "ui_PulseTopLevel.h"
|
||||
|
||||
#include "PulseViewItem.h"
|
||||
#include <retroshare/rswire.h>
|
||||
|
||||
class PulseTopLevel : public PulseDataItem, private Ui::PulseTopLevel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PulseTopLevel(PulseViewHolder *holder, RsWirePulseSPtr pulse);
|
||||
|
||||
|
||||
protected:
|
||||
void setup();
|
||||
|
||||
// PulseDataInterface ===========
|
||||
// Group
|
||||
virtual void setHeadshot(const QPixmap &pixmap) override;
|
||||
virtual void setGroupNameString(QString name) override;
|
||||
virtual void setAuthorString(QString name) override;
|
||||
|
||||
// Msg
|
||||
virtual void setRefMessage(QString msg, uint32_t image_count) override;
|
||||
virtual void setMessage(RsWirePulseSPtr pulse) override;
|
||||
virtual void setDateString(QString date) override;
|
||||
|
||||
// Refs
|
||||
virtual void setLikesString(QString likes) override;
|
||||
virtual void setRepublishesString(QString repub) override;
|
||||
virtual void setRepliesString(QString reply) override;
|
||||
|
||||
//
|
||||
virtual void setReferenceString(QString ref) override;
|
||||
virtual void showResponseStats(bool enable) override;
|
||||
// PulseDataInterface ===========
|
||||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
};
|
||||
|
||||
#endif
|
644
retroshare-gui/src/gui/TheWire/PulseTopLevel.ui
Normal file
644
retroshare-gui/src/gui/TheWire/PulseTopLevel.ui
Normal file
@ -0,0 +1,644 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PulseTopLevel</class>
|
||||
<widget class="QWidget" name="PulseTopLevel">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>732</width>
|
||||
<height>551</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QFrame#frame{border: 2px solid #CCCCCC;
|
||||
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
|
||||
stop: 0 #EEEEEE, stop: 1 #CCCCCC);
|
||||
border-radius: 10px}</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_prefix" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_14">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>18</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_reficon">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>icn</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_reference">
|
||||
<property name="text">
|
||||
<string>retweeted</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButton_tmpViewParent">
|
||||
<property name="text">
|
||||
<string>SHOW PARENT</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_15">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>537</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_header" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="2" column="1">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_groupName">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" color:#555753;">@sidler_here</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="label_authorName">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-weight:600;">Sidler</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3" rowspan="3">
|
||||
<spacer name="horizontalSpacer_13">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>518</width>
|
||||
<height>58</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0" rowspan="3">
|
||||
<widget class="QLabel" name="label_headshot">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>50</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Head</p><p>Shot</p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="2">
|
||||
<widget class="QPushButton" name="pushButton_tmpViewGroup">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>25</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>SHOW GROUP</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="PulseMessage" name="widget_message" native="true"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_publish" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_date">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" color:#2e3436;">3:58 AM · Apr 13, 2020 ·</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_12">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>505</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_replies" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_611">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_extra_replies">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-weight:600;">1.2K</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_911">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" color:#2e3436;">Replies</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_1011">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_extra_republishes">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-weight:600;">1.2K</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" color:#2e3436;">Republishes</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_10">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_extra_likes">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-weight:600;">21.3K</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" color:#2e3436;">Likes</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_11">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_9">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_actions" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_8">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_reply">
|
||||
<property name="text">
|
||||
<string>REPLY</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_replies">
|
||||
<property name="text">
|
||||
<string>1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_7">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_6">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_republish">
|
||||
<property name="text">
|
||||
<string>REPUBLISH</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_republishes">
|
||||
<property name="text">
|
||||
<string>1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_5">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_like">
|
||||
<property name="text">
|
||||
<string>LIKE</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_likes">
|
||||
<property name="text">
|
||||
<string>1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_view">
|
||||
<property name="text">
|
||||
<string>SHOW</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>PulseMessage</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/TheWire/PulseMessage.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="TheWire_images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
94
retroshare-gui/src/gui/TheWire/PulseViewGroup.cpp
Normal file
94
retroshare-gui/src/gui/TheWire/PulseViewGroup.cpp
Normal file
@ -0,0 +1,94 @@
|
||||
/*******************************************************************************
|
||||
* gui/TheWire/PulseViewGroup.cpp *
|
||||
* *
|
||||
* Copyright (c) 2012-2020 Robert Fernie <retroshare.project@gmail.com> *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QMessageBox>
|
||||
#include <QMouseEvent>
|
||||
#include <QBuffer>
|
||||
|
||||
#include "PulseViewGroup.h"
|
||||
|
||||
#include "gui/gxs/GxsIdDetails.h"
|
||||
#include "util/DateTime.h"
|
||||
|
||||
/** Constructor */
|
||||
|
||||
PulseViewGroup::PulseViewGroup(PulseViewHolder *holder, RsWireGroupSPtr group)
|
||||
:PulseViewItem(holder), mGroup(group)
|
||||
{
|
||||
setupUi(this);
|
||||
setAttribute ( Qt::WA_DeleteOnClose, true );
|
||||
setup();
|
||||
}
|
||||
|
||||
void PulseViewGroup::setup()
|
||||
{
|
||||
if (mGroup) {
|
||||
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));
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*******************************************************************************
|
||||
* gui/TheWire/PulseDetails.h *
|
||||
* gui/TheWire/PulseViewGroup.h *
|
||||
* *
|
||||
* Copyright (c) 2020 Robert Fernie <retroshare.project@gmail.com> *
|
||||
* Copyright (c) 2020-2020 Robert Fernie <retroshare.project@gmail.com> *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
@ -18,49 +18,26 @@
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef MRK_PULSE_DETAILS_H
|
||||
#define MRK_PULSE_DETAILS_H
|
||||
#ifndef MRK_PULSE_VIEW_GROUP_H
|
||||
#define MRK_PULSE_VIEW_GROUP_H
|
||||
|
||||
#include "ui_PulseDetails.h"
|
||||
#include "PulseItem.h"
|
||||
#include "ui_PulseViewGroup.h"
|
||||
|
||||
#include "PulseViewItem.h"
|
||||
#include <retroshare/rswire.h>
|
||||
|
||||
class PulseDetails : public QWidget, private Ui::PulseDetails
|
||||
class PulseViewGroup : public PulseViewItem, private Ui::PulseViewGroup
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PulseDetails(PulseHolder *actions, RsWirePulse *pulse, std::string &groupName,
|
||||
std::map<rstime_t, RsWirePulse *> replies);
|
||||
|
||||
// when Reply parent....
|
||||
PulseDetails(PulseHolder *actions,
|
||||
RsGxsGroupId &parentGroupId,
|
||||
std::string &parentGroupName,
|
||||
RsGxsMessageId &parentOrigMsgId,
|
||||
RsGxsId &parentAuthorId,
|
||||
rstime_t &parentPublishTs,
|
||||
std::string &parentPulseText);
|
||||
PulseViewGroup(PulseViewHolder *holder, RsWireGroupSPtr group);
|
||||
|
||||
protected:
|
||||
void setup();
|
||||
|
||||
void setBackground(QString color);
|
||||
|
||||
private slots:
|
||||
void toggle();
|
||||
void follow();
|
||||
void rate();
|
||||
void reply();
|
||||
|
||||
private:
|
||||
void addReplies(std::map<rstime_t, RsWirePulse *> replies);
|
||||
QString getSummary();
|
||||
|
||||
PulseHolder *mActions;
|
||||
RsWirePulse mPulse;
|
||||
std::string mGroupName;
|
||||
bool mHasReplies;
|
||||
protected:
|
||||
RsWireGroupSPtr mGroup;
|
||||
};
|
||||
|
||||
#endif
|
542
retroshare-gui/src/gui/TheWire/PulseViewGroup.ui
Normal file
542
retroshare-gui/src/gui/TheWire/PulseViewGroup.ui
Normal file
@ -0,0 +1,542 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>PulseViewGroup</class>
|
||||
<widget class="QWidget" name="PulseViewGroup">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>745</width>
|
||||
<height>483</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true"/>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QFrame#frame{border: 2px solid #CCCCCC;
|
||||
background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1,
|
||||
stop: 0 #EEEEEE, stop: 1 #CCCCCC);
|
||||
border-radius: 10px}</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QFrame" name="frame_headerBackground">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_16">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>283</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_headshot">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>headshot</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_14">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>23</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_header" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>60</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="1" rowspan="3">
|
||||
<spacer name="horizontalSpacer_13">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>518</width>
|
||||
<height>58</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_groupName">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" color:#555753;">@sidler_here</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_authorName">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-weight:600;">Sidler</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>10</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_publish" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>50</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_2">
|
||||
<item row="1" column="2">
|
||||
<widget class="QLabel" name="label_date">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" color:#2e3436;">3:58 AM · Apr 13, 2020 ·</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<spacer name="horizontalSpacer_15">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_location">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Location</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="3">
|
||||
<spacer name="horizontalSpacer_12">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>2000</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item row="0" column="0" colspan="4">
|
||||
<widget class="QLabel" name="label_tagline">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Tag Line</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_replies" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_8">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_622">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_extra_pulses">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-weight:600;">1.2K</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_922">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" color:#2e3436;">Pulses</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_1022">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_611">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_extra_replies">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-weight:600;">1.2K</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_911">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" color:#2e3436;">Replies</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_1011">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_extra_republishes">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-weight:600;">1.2K</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_9">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" color:#2e3436;">Republishes</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_10">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_extra_likes">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" font-weight:600;">21.3K</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_11">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p><span style=" color:#2e3436;">Likes</span></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_11">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Preferred</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_9">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="Line" name="line">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_actions" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_10">
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_20">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>298</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QToolButton" name="toolButton_like_2">
|
||||
<property name="text">
|
||||
<string>FOLLOW</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_21">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>297</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="TheWire_images.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
406
retroshare-gui/src/gui/TheWire/PulseViewItem.cpp
Normal file
406
retroshare-gui/src/gui/TheWire/PulseViewItem.cpp
Normal file
@ -0,0 +1,406 @@
|
||||
/*******************************************************************************
|
||||
* gui/TheWire/PulseViewItem.cpp *
|
||||
* *
|
||||
* Copyright (c) 2012-2020 Robert Fernie <retroshare.project@gmail.com> *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#include <QDateTime>
|
||||
#include <QMessageBox>
|
||||
#include <QMouseEvent>
|
||||
#include <QBuffer>
|
||||
|
||||
#include "PulseViewItem.h"
|
||||
|
||||
#include "gui/gxs/GxsIdDetails.h"
|
||||
#include "util/DateTime.h"
|
||||
|
||||
/** Constructor */
|
||||
|
||||
PulseViewItem::PulseViewItem(PulseViewHolder *holder)
|
||||
:QWidget(NULL), mHolder(holder)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
PulseDataItem::PulseDataItem(PulseViewHolder *holder, RsWirePulseSPtr pulse)
|
||||
:PulseViewItem(holder), mPulse(pulse)
|
||||
{
|
||||
}
|
||||
|
||||
void PulseDataItem::actionReply()
|
||||
{
|
||||
std::cerr << "PulseDataItem::actionReply()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (mHolder) {
|
||||
if (mPulse->mPulseType & WIRE_PULSE_TYPE_REFERENCE) {
|
||||
std::cerr << "PulseDataItem::actionReply() NO ACTION FOR REF";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
mHolder->PVHreply(mPulse->mMeta.mGroupId, mPulse->mMeta.mMsgId);
|
||||
}
|
||||
}
|
||||
|
||||
void PulseDataItem::actionRepublish()
|
||||
{
|
||||
std::cerr << "PulseDataItem::actionRepublish()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (mHolder) {
|
||||
if (mPulse->mPulseType & WIRE_PULSE_TYPE_REFERENCE) {
|
||||
std::cerr << "PulseDataItem::actionRepublish() NO ACTION FOR REF";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
mHolder->PVHrepublish(mPulse->mMeta.mGroupId, mPulse->mMeta.mMsgId);
|
||||
}
|
||||
}
|
||||
|
||||
void PulseDataItem::actionLike()
|
||||
{
|
||||
std::cerr << "PulseDataItem::actionLike()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (mHolder) {
|
||||
if (mPulse->mPulseType & WIRE_PULSE_TYPE_REFERENCE) {
|
||||
std::cerr << "PulseDataItem::actionLike() NO ACTION FOR REF";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
mHolder->PVHlike(mPulse->mMeta.mGroupId, mPulse->mMeta.mMsgId);
|
||||
}
|
||||
}
|
||||
|
||||
void PulseDataItem::actionViewGroup()
|
||||
{
|
||||
std::cerr << "PulseDataItem::actionViewGroup()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
RsGxsGroupId groupId;
|
||||
|
||||
if (mPulse) {
|
||||
if ((mPulse->mPulseType & WIRE_PULSE_TYPE_ORIGINAL) ||
|
||||
(mPulse->mPulseType & WIRE_PULSE_TYPE_RESPONSE))
|
||||
{
|
||||
/* use pulse group */
|
||||
groupId = mPulse->mMeta.mGroupId;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* IS REF use pulse group */
|
||||
groupId = mPulse->mRefGroupId;
|
||||
}
|
||||
}
|
||||
|
||||
if (mHolder) {
|
||||
mHolder->PVHviewGroup(groupId);
|
||||
}
|
||||
}
|
||||
|
||||
void PulseDataItem::actionViewParent()
|
||||
{
|
||||
std::cerr << "PulseDataItem::actionViewParent()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
// TODO
|
||||
RsGxsGroupId groupId;
|
||||
RsGxsMessageId msgId;
|
||||
|
||||
if (mPulse) {
|
||||
if (mPulse->mPulseType & WIRE_PULSE_TYPE_ORIGINAL)
|
||||
{
|
||||
std::cerr << "PulseDataItem::actionViewParent() Error ORIGINAL no parent";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
else if (mPulse->mPulseType & WIRE_PULSE_TYPE_RESPONSE)
|
||||
{
|
||||
/* mRefs refer to parent */
|
||||
groupId = mPulse->mRefGroupId;
|
||||
msgId = mPulse->mRefOrigMsgId;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* type = REF, group / thread ref to parent */
|
||||
groupId = mPulse->mMeta.mGroupId;
|
||||
msgId = mPulse->mMeta.mThreadId;
|
||||
}
|
||||
}
|
||||
|
||||
if (mHolder) {
|
||||
mHolder->PVHviewPulse(groupId, msgId);
|
||||
}
|
||||
}
|
||||
|
||||
void PulseDataItem::actionViewPulse()
|
||||
{
|
||||
std::cerr << "PulseDataItem::actionViewPulse()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
// TODO
|
||||
RsGxsGroupId groupId;
|
||||
RsGxsMessageId msgId;
|
||||
|
||||
if (mPulse) {
|
||||
if ((mPulse->mPulseType & WIRE_PULSE_TYPE_ORIGINAL) ||
|
||||
(mPulse->mPulseType & WIRE_PULSE_TYPE_RESPONSE))
|
||||
{
|
||||
groupId = mPulse->mMeta.mGroupId;
|
||||
msgId = mPulse->mMeta.mOrigMsgId;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* type = REF, mRefs link to message */
|
||||
std::cerr << "PulseDataItem::actionViewPulse() REF unlikely retrievable";
|
||||
std::cerr << std::endl;
|
||||
|
||||
groupId = mPulse->mRefGroupId;
|
||||
msgId = mPulse->mRefOrigMsgId;
|
||||
}
|
||||
}
|
||||
|
||||
if (mHolder) {
|
||||
mHolder->PVHviewPulse(groupId, msgId);
|
||||
}
|
||||
}
|
||||
|
||||
void PulseDataItem::actionFollow()
|
||||
{
|
||||
std::cerr << "PulseDataItem::actionFollow()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
// TODO
|
||||
RsGxsGroupId groupId;
|
||||
|
||||
if (mHolder) {
|
||||
mHolder->PVHfollow(groupId);
|
||||
}
|
||||
}
|
||||
|
||||
void PulseDataItem::actionRate()
|
||||
{
|
||||
std::cerr << "PulseDataItem::actionRate()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
// TODO
|
||||
RsGxsId authorId;
|
||||
|
||||
if (mHolder) {
|
||||
mHolder->PVHrate(authorId);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
void PulseDataItem::showPulse()
|
||||
{
|
||||
std::cerr << "PulseDataItem::showPulse()";
|
||||
std::cerr << std::endl;
|
||||
if (!mPulse) {
|
||||
std::cerr << "PulseDataItem::showPulse() PULSE invalid - skipping";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
/* 3 Modes:
|
||||
* ORIGINAL
|
||||
* RESPONSE
|
||||
* REFERENCE
|
||||
*
|
||||
* ORIG / RESPONSE are similar.
|
||||
*/
|
||||
|
||||
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());
|
||||
|
||||
// Msg
|
||||
setRefMessage(QString::fromStdString(mPulse->mRefPulseText), mPulse->mRefImageCount);
|
||||
setDate(mPulse->mRefPublishTs);
|
||||
|
||||
// References (unknown for a REFERENCE)
|
||||
// show FOLLOW button instead.
|
||||
showResponseStats(false);
|
||||
|
||||
//
|
||||
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.
|
||||
{
|
||||
|
||||
// Group
|
||||
bool headshotOkay = false;
|
||||
if (mPulse->mGroupPtr) {
|
||||
setGroupName(mPulse->mGroupPtr->mMeta.mGroupName);
|
||||
|
||||
if (mPulse->mGroupPtr->mHeadshot.mData)
|
||||
{
|
||||
QPixmap pixmap;
|
||||
if (GxsIdDetails::loadPixmapFromData(
|
||||
mPulse->mGroupPtr->mHeadshot.mData,
|
||||
mPulse->mGroupPtr->mHeadshot.mSize,
|
||||
pixmap,GxsIdDetails::ORIGINAL))
|
||||
{
|
||||
headshotOkay = true;
|
||||
pixmap = pixmap.scaled(50,50);
|
||||
setHeadshot(pixmap);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
setGroupName("GroupName UNKNOWN");
|
||||
}
|
||||
|
||||
if (!headshotOkay)
|
||||
{
|
||||
// default.
|
||||
QPixmap pixmap = QPixmap(":/icons/png/posted.png").scaled(50,50);
|
||||
setHeadshot(pixmap); // QPixmap(":/icons/png/posted.png"));
|
||||
}
|
||||
|
||||
setAuthor(mPulse->mMeta.mAuthorId.toStdString());
|
||||
|
||||
// Msg
|
||||
setMessage(mPulse);
|
||||
setDate(mPulse->mMeta.mPublishTs);
|
||||
|
||||
// References
|
||||
showResponseStats(true);
|
||||
setLikes(mPulse->mLikes.size());
|
||||
setReplies(mPulse->mReplies.size());
|
||||
setRepublishes(mPulse->mRepublishes.size());
|
||||
|
||||
if (mPulse->mPulseType & WIRE_PULSE_TYPE_RESPONSE)
|
||||
{
|
||||
setReference(mPulse->mPulseType & WIRE_PULSE_RESPONSE_MASK, mPulse->mRefGroupId, mPulse->mRefGroupName);
|
||||
}
|
||||
else
|
||||
{
|
||||
setReference(0, mPulse->mRefGroupId, mPulse->mRefGroupName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PulseDataItem::setGroupName(std::string name)
|
||||
{
|
||||
setGroupNameString(QString::fromStdString(name));
|
||||
}
|
||||
|
||||
void PulseDataItem::setAuthor(std::string name)
|
||||
{
|
||||
setAuthorString(QString::fromStdString(name));
|
||||
}
|
||||
|
||||
void PulseDataItem::setDate(rstime_t date)
|
||||
{
|
||||
// could be more intelligent.
|
||||
// eg. 3 Hr ago, if recent.
|
||||
setDateString(DateTime::formatDateTime(date));
|
||||
}
|
||||
|
||||
void PulseDataItem::setLikes(uint32_t count)
|
||||
{
|
||||
setLikesString(ToNumberUnits(count));
|
||||
}
|
||||
|
||||
void PulseDataItem::setRepublishes(uint32_t count)
|
||||
{
|
||||
setRepublishesString(ToNumberUnits(count));
|
||||
}
|
||||
|
||||
void PulseDataItem::setReplies(uint32_t count)
|
||||
{
|
||||
std::cerr << "PulseDataItem::setReplies(" << count << ")";
|
||||
std::cerr << std::endl;
|
||||
setRepliesString(ToNumberUnits(count));
|
||||
}
|
||||
|
||||
void PulseDataItem::setReference(uint32_t response_type, RsGxsGroupId groupId, std::string groupName)
|
||||
{
|
||||
QString ref;
|
||||
if (response_type == WIRE_PULSE_TYPE_REPLY) {
|
||||
ref = "In reply to @" + QString::fromStdString(groupName);
|
||||
}
|
||||
else if (response_type == WIRE_PULSE_TYPE_REPUBLISH) {
|
||||
ref = "retweeting @" + QString::fromStdString(groupName);
|
||||
}
|
||||
else if (response_type == WIRE_PULSE_TYPE_LIKE) {
|
||||
ref = "liking @" + QString::fromStdString(groupName);
|
||||
}
|
||||
|
||||
setReferenceString(ref);
|
||||
}
|
||||
|
||||
// Utils.
|
||||
QString BoldString(QString msg)
|
||||
{
|
||||
QString output = "<html><head/><body><p><span style=\" font-weight:600;\">";
|
||||
output += msg;
|
||||
output += "</span></p></body></html>";
|
||||
return output;
|
||||
}
|
||||
|
||||
QString ToNumberUnits(uint32_t count)
|
||||
{
|
||||
QString ans;
|
||||
if (count > 1000000)
|
||||
{
|
||||
ans.sprintf("%6.2fm", count / 1000000.0);
|
||||
}
|
||||
else if (count > 1000)
|
||||
{
|
||||
ans.sprintf("%6.2fk", count / 1000.0);
|
||||
}
|
||||
else
|
||||
{
|
||||
ans.sprintf("%6d", count);
|
||||
}
|
||||
return ans;
|
||||
}
|
||||
|
142
retroshare-gui/src/gui/TheWire/PulseViewItem.h
Normal file
142
retroshare-gui/src/gui/TheWire/PulseViewItem.h
Normal file
@ -0,0 +1,142 @@
|
||||
/*******************************************************************************
|
||||
* gui/TheWire/PulseViewItem.h *
|
||||
* *
|
||||
* Copyright (c) 2020-2020 Robert Fernie <retroshare.project@gmail.com> *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef MRK_PULSE_VIEW_ITEM_H
|
||||
#define MRK_PULSE_VIEW_ITEM_H
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
#include <retroshare/rswire.h>
|
||||
|
||||
class PulseViewItem;
|
||||
|
||||
class PulseViewHolder
|
||||
{
|
||||
public:
|
||||
virtual ~PulseViewHolder() {}
|
||||
|
||||
// Actions.
|
||||
virtual void PVHreply(const RsGxsGroupId &groupId, const RsGxsMessageId &msgId) = 0;
|
||||
virtual void PVHrepublish(const RsGxsGroupId &groupId, const RsGxsMessageId &msgId) = 0;
|
||||
virtual void PVHlike(const RsGxsGroupId &groupId, const RsGxsMessageId &msgId) = 0;
|
||||
|
||||
virtual void PVHviewGroup(const RsGxsGroupId &groupId) = 0;
|
||||
virtual void PVHviewPulse(const RsGxsGroupId &groupId, const RsGxsMessageId &msgId) = 0;
|
||||
virtual void PVHviewReply(const RsGxsGroupId &groupId, const RsGxsMessageId &msgId) = 0;
|
||||
|
||||
virtual void PVHfollow(const RsGxsGroupId &groupId) = 0;
|
||||
virtual void PVHrate(const RsGxsId &authorId) = 0;
|
||||
};
|
||||
|
||||
class PulseDataInterface
|
||||
{
|
||||
public:
|
||||
virtual ~PulseDataInterface() {}
|
||||
|
||||
protected:
|
||||
// Group
|
||||
virtual void setHeadshot(const QPixmap &pixmap) = 0;
|
||||
virtual void setGroupNameString(QString name) = 0;
|
||||
virtual void setAuthorString(QString name) = 0;
|
||||
|
||||
// Msg
|
||||
virtual void setRefMessage(QString msg, uint32_t image_count) = 0;
|
||||
virtual void setMessage(RsWirePulseSPtr pulse) = 0;
|
||||
virtual void setDateString(QString date) = 0;
|
||||
|
||||
// Refs
|
||||
virtual void setLikesString(QString likes) = 0;
|
||||
virtual void setRepublishesString(QString repub) = 0;
|
||||
virtual void setRepliesString(QString reply) = 0;
|
||||
|
||||
//
|
||||
virtual void setReferenceString(QString ref) = 0;
|
||||
virtual void showResponseStats(bool enable) = 0;
|
||||
};
|
||||
|
||||
|
||||
|
||||
class PulseViewItem : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PulseViewItem(PulseViewHolder *holder);
|
||||
|
||||
protected:
|
||||
PulseViewHolder *mHolder;
|
||||
};
|
||||
|
||||
|
||||
class PulseDataItem : public PulseViewItem, public PulseDataInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PulseDataItem(PulseViewHolder *holder, RsWirePulseSPtr pulse);
|
||||
|
||||
|
||||
private slots:
|
||||
|
||||
// Action interfaces --------------------------
|
||||
void actionReply();
|
||||
void actionRepublish();
|
||||
void actionLike();
|
||||
|
||||
void actionViewGroup();
|
||||
void actionViewParent();
|
||||
void actionViewPulse();
|
||||
|
||||
void actionFollow();
|
||||
void actionRate();
|
||||
// Action interfaces --------------------------
|
||||
|
||||
protected:
|
||||
|
||||
// top-level set data onto UI.
|
||||
virtual void showPulse();
|
||||
|
||||
// UI elements.
|
||||
// Group
|
||||
void setGroupName(std::string name);
|
||||
void setAuthor(std::string name);
|
||||
|
||||
// Msg
|
||||
void setDate(rstime_t date);
|
||||
|
||||
// Refs
|
||||
void setLikes(uint32_t count);
|
||||
void setRepublishes(uint32_t count);
|
||||
void setReplies(uint32_t count);
|
||||
|
||||
//
|
||||
void setReference(uint32_t flags, RsGxsGroupId groupId, std::string groupName);
|
||||
|
||||
// DATA.
|
||||
RsWirePulseSPtr mPulse;
|
||||
};
|
||||
|
||||
|
||||
// utilities.
|
||||
QString BoldString(QString input);
|
||||
QString ToNumberUnits(uint32_t count);
|
||||
|
||||
|
||||
#endif
|
@ -1,5 +1,8 @@
|
||||
<RCC>
|
||||
<qresource prefix="/" >
|
||||
<file>images/compose.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/">
|
||||
<file>images/compose.png</file>
|
||||
<file>images/like.png</file>
|
||||
<file>images/reply.png</file>
|
||||
<file>images/retweet.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@ -23,6 +23,11 @@
|
||||
#include "WireGroupDialog.h"
|
||||
#include "WireGroupItem.h"
|
||||
|
||||
#include "PulseViewGroup.h"
|
||||
#include "PulseReplySeperator.h"
|
||||
|
||||
#include "util/qtthreadsutils.h"
|
||||
|
||||
#include <retroshare/rspeers.h>
|
||||
#include <retroshare/rswire.h>
|
||||
|
||||
@ -56,7 +61,6 @@ WireDialog::WireDialog(QWidget *parent)
|
||||
ui.setupUi(this);
|
||||
|
||||
mAddDialog = NULL;
|
||||
mPulseSelected = NULL;
|
||||
mGroupSelected = NULL;
|
||||
|
||||
connect( ui.toolButton_createAccount, SIGNAL(clicked()), this, SLOT(createGroup()));
|
||||
@ -74,6 +78,9 @@ WireDialog::WireDialog(QWidget *parent)
|
||||
mWireQueue = new TokenQueue(rsWire->getTokenService(), this);
|
||||
|
||||
requestGroupData();
|
||||
|
||||
// just for testing
|
||||
postTestTwitterView();
|
||||
}
|
||||
|
||||
void WireDialog::refreshGroups()
|
||||
@ -88,37 +95,9 @@ void WireDialog::addGroup(QWidget *item)
|
||||
alayout->addWidget(item);
|
||||
}
|
||||
|
||||
// PulseHolder interface.
|
||||
void WireDialog::deletePulseItem(PulseItem * /* item */, uint32_t /* type */)
|
||||
bool WireDialog::setupPulseAddDialog()
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Actions from PulseHolder.
|
||||
void WireDialog::follow(RsGxsGroupId &groupId)
|
||||
{
|
||||
std::cerr << "WireDialog::follow(";
|
||||
std::cerr << groupId.toStdString();
|
||||
std::cerr << ")";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
void WireDialog::rate(RsGxsId &authorId)
|
||||
{
|
||||
std::cerr << "WireDialog::rate(";
|
||||
std::cerr << authorId.toStdString();
|
||||
std::cerr << ")";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
void WireDialog::reply(RsWirePulse &pulse, std::string &groupName)
|
||||
{
|
||||
std::cerr << "WireDialog::reply(";
|
||||
std::cerr << pulse.mMeta.mGroupId.toStdString();
|
||||
std::cerr << ",";
|
||||
std::cerr << pulse.mMeta.mOrigMsgId.toStdString();
|
||||
std::cerr << ")";
|
||||
std::cerr << "WireDialog::setupPulseAddDialog()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (!mAddDialog)
|
||||
@ -127,39 +106,24 @@ void WireDialog::reply(RsWirePulse &pulse, std::string &groupName)
|
||||
mAddDialog->hide();
|
||||
}
|
||||
|
||||
mAddDialog->cleanup();
|
||||
|
||||
int idx = ui.groupChooser->currentIndex();
|
||||
if (idx < 0) {
|
||||
std::cerr << "WireDialog::reply() ERROR GETTING AuthorId!";
|
||||
std::cerr << "WireDialog::setupPulseAddDialog() ERROR GETTING AuthorId!";
|
||||
std::cerr << std::endl;
|
||||
|
||||
QMessageBox::warning(this, tr("RetroShare"),tr("Please create or choose Wire Groupd first"), QMessageBox::Ok, QMessageBox::Ok);
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// publishing group.
|
||||
RsWireGroup group = mOwnGroups[idx];
|
||||
mAddDialog->cleanup();
|
||||
mAddDialog->setGroup(group);
|
||||
mAddDialog->setGroup(group.mMeta.mGroupId);
|
||||
|
||||
// establish replyTo.
|
||||
mAddDialog->setReplyTo(pulse, groupName);
|
||||
|
||||
mAddDialog->show();
|
||||
return true;
|
||||
}
|
||||
|
||||
void WireDialog::notifyPulseSelection(PulseItem *item)
|
||||
{
|
||||
if (mPulseSelected)
|
||||
{
|
||||
std::cerr << "WireDialog::notifyPulseSelection() unselecting old one : " << mPulseSelected;
|
||||
std::cerr << std::endl;
|
||||
|
||||
mPulseSelected->setSelected(false);
|
||||
}
|
||||
mPulseSelected = item;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void WireDialog::subscribe(RsGxsGroupId &groupId)
|
||||
{
|
||||
@ -249,53 +213,10 @@ void WireDialog::createPulse()
|
||||
RsWireGroup group = mOwnGroups[idx];
|
||||
|
||||
mAddDialog->cleanup();
|
||||
mAddDialog->setGroup(group);
|
||||
mAddDialog->setGroup(group.mMeta.mGroupId);
|
||||
mAddDialog->show();
|
||||
}
|
||||
|
||||
void WireDialog::addPulse(RsWirePulse *pulse, RsWireGroup *group,
|
||||
std::map<rstime_t, RsWirePulse *> replies)
|
||||
{
|
||||
std::cerr << "WireDialog::addPulse() GroupId : " << pulse->mMeta.mGroupId;
|
||||
std::cerr << " OrigMsgId : " << pulse->mMeta.mOrigMsgId;
|
||||
std::cerr << " Replies : " << replies.size();
|
||||
std::cerr << std::endl;
|
||||
|
||||
PulseItem *pulseItem = new PulseItem(this, pulse, group, replies);
|
||||
|
||||
/* ensure its a boxlayout */
|
||||
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
||||
QBoxLayout *boxlayout = dynamic_cast<QBoxLayout *>(alayout);
|
||||
if (boxlayout == NULL) {
|
||||
std::cerr << "WireDialog::addPulse() ERROR not boxlayout, inserting at end";
|
||||
std::cerr << std::endl;
|
||||
alayout->addWidget(pulseItem);
|
||||
return;
|
||||
}
|
||||
|
||||
/* iterate through layout, and insert at the correct time */
|
||||
for(int i = 0; i < alayout->count(); i++)
|
||||
{
|
||||
QLayoutItem *layoutItem = boxlayout->itemAt(i);
|
||||
PulseItem *pitem = dynamic_cast<PulseItem *>(layoutItem->widget());
|
||||
if (pitem != NULL)
|
||||
{
|
||||
if (pitem->publishTs() < pulseItem->publishTs())
|
||||
{
|
||||
std::cerr << "WireDialog::addPulse() Inserting at index: " << i;
|
||||
std::cerr << std::endl;
|
||||
/* insert at this index */
|
||||
boxlayout->insertWidget(i, pulseItem);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
// last item.
|
||||
std::cerr << "WireDialog::addPulse() Inserting at end";
|
||||
std::cerr << std::endl;
|
||||
boxlayout->addWidget(pulseItem);
|
||||
}
|
||||
|
||||
void WireDialog::addGroup(const RsWireGroup &group)
|
||||
{
|
||||
std::cerr << "WireDialog::addGroup() GroupId : " << group.mMeta.mGroupId;
|
||||
@ -304,37 +225,6 @@ void WireDialog::addGroup(const RsWireGroup &group)
|
||||
addGroup(new WireGroupItem(this, group));
|
||||
}
|
||||
|
||||
void WireDialog::deletePulses()
|
||||
{
|
||||
std::cerr << "WireDialog::deletePulses()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
||||
QLayoutItem *item;
|
||||
int i = 0;
|
||||
while (i < alayout->count())
|
||||
{
|
||||
item = alayout->itemAt(i);
|
||||
QWidget *widget = item->widget();
|
||||
if (NULL != dynamic_cast<PulseItem *>(widget))
|
||||
{
|
||||
std::cerr << "WireDialog::deletePulses() Removing Item at: " << i;
|
||||
std::cerr << std::endl;
|
||||
|
||||
item = alayout->takeAt(i);
|
||||
delete item->widget();
|
||||
delete item;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "WireDialog::deletePulses() Leaving Item at: " << i;
|
||||
std::cerr << std::endl;
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WireDialog::deleteGroups()
|
||||
{
|
||||
std::cerr << "WireDialog::deleteGroups()";
|
||||
@ -415,11 +305,12 @@ void WireDialog::showSelectedGroups()
|
||||
ui.comboBox_filterTime->setEnabled(false);
|
||||
if (mGroupSelected)
|
||||
{
|
||||
deletePulses();
|
||||
// request data.
|
||||
std::list<RsGxsGroupId> grpIds;
|
||||
grpIds.push_back(mGroupSelected->groupId());
|
||||
requestPulseData(grpIds);
|
||||
|
||||
// show GroupFocus.
|
||||
showGroupFocus(mGroupSelected->groupId());
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -431,9 +322,8 @@ void WireDialog::showGroups()
|
||||
{
|
||||
ui.comboBox_filterTime->setEnabled(false);
|
||||
deleteGroups();
|
||||
deletePulses();
|
||||
|
||||
|
||||
std::list<RsGxsGroupId> allGroupIds;
|
||||
|
||||
/* depends on the comboBox */
|
||||
std::map<RsGxsGroupId, RsWireGroup>::const_iterator it;
|
||||
@ -461,9 +351,11 @@ void WireDialog::showGroups()
|
||||
// request data.
|
||||
std::list<RsGxsGroupId> grpIds;
|
||||
grpIds.push_back(it->second.mMeta.mGroupId);
|
||||
requestPulseData(grpIds);
|
||||
allGroupIds.push_back(it->second.mMeta.mGroupId);
|
||||
}
|
||||
}
|
||||
|
||||
showGroupsPulses(allGroupIds);
|
||||
}
|
||||
|
||||
|
||||
@ -494,62 +386,6 @@ bool WireDialog::loadGroupData(const uint32_t &token)
|
||||
return true;
|
||||
}
|
||||
|
||||
void WireDialog::requestPulseData(const std::list<RsGxsGroupId>& grpIds)
|
||||
{
|
||||
std::cerr << "WireDialog::requestPulseData()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||
opts.mOptions = RS_TOKREQOPT_MSG_LATEST;
|
||||
uint32_t token;
|
||||
mWireQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, grpIds, 0);
|
||||
}
|
||||
|
||||
|
||||
/* LoadPulseData...
|
||||
*
|
||||
* group into threads, using std::map<RsGxsMessageId, PulseReplySet>
|
||||
* then sort by publishTS, using std::map<time, PulseOrderedReply>
|
||||
* then add into gui.
|
||||
* - use pointers to avoid copying everywhere.
|
||||
*
|
||||
* should we mutex Groups, or copy so we don't lose a pointer?
|
||||
* should be fine, as mAllGroups only modified from loadData calls.
|
||||
******
|
||||
*
|
||||
* NB: Potentially, this should be changed to use GXS to do the bulk of the work.
|
||||
* - request Top-Level Msgs, sorted by PublishTS.
|
||||
* - Insert into GUI.
|
||||
* - for each request children Msg, and fill in "replies"
|
||||
*
|
||||
* This needs sorted option on GXS Data fetch.
|
||||
*/
|
||||
|
||||
class PulseReplySet
|
||||
{
|
||||
public:
|
||||
PulseReplySet() : group(NULL), msg(NULL) {}
|
||||
PulseReplySet(RsWirePulse *m, RsWireGroup *g)
|
||||
: group(g), msg(m) {}
|
||||
|
||||
RsWireGroup *group;
|
||||
RsWirePulse *msg;
|
||||
std::map<RsGxsMessageId, RsWirePulse *> replies; // orig ID -> replies.
|
||||
};
|
||||
|
||||
class PulseOrderedReply
|
||||
{
|
||||
public:
|
||||
PulseOrderedReply() : group(NULL), msg(NULL) {}
|
||||
PulseOrderedReply(RsWirePulse *m, RsWireGroup *g)
|
||||
: group(g), msg(m) {}
|
||||
|
||||
RsWireGroup *group;
|
||||
RsWirePulse *msg;
|
||||
std::map<rstime_t, RsWirePulse *> replies; // publish -> replies.
|
||||
};
|
||||
|
||||
rstime_t WireDialog::getFilterTimestamp()
|
||||
{
|
||||
rstime_t filterTimestamp = time(NULL);
|
||||
@ -573,132 +409,6 @@ rstime_t WireDialog::getFilterTimestamp()
|
||||
return filterTimestamp;
|
||||
}
|
||||
|
||||
bool WireDialog::loadPulseData(const uint32_t &token)
|
||||
{
|
||||
std::cerr << "WireDialog::loadPulseData()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
std::vector<RsWirePulse> pulses;
|
||||
rsWire->getPulseData(token, pulses);
|
||||
|
||||
std::list<RsWirePulse *> references;
|
||||
std::map<RsGxsMessageId, PulseReplySet> pulseGrouping;
|
||||
|
||||
// setup time filtering.
|
||||
uint32_t filterTimestamp;
|
||||
bool filterTime = (ui.comboBox_filterTime->currentIndex() > 0);
|
||||
if (filterTime)
|
||||
{
|
||||
filterTimestamp = getFilterTimestamp();
|
||||
}
|
||||
|
||||
std::vector<RsWirePulse>::iterator vit = pulses.begin();
|
||||
for(; vit != pulses.end(); vit++)
|
||||
{
|
||||
RsWirePulse& pulse = *vit;
|
||||
if (pulse.mPulseType & WIRE_PULSE_TYPE_REPLY_REFERENCE)
|
||||
{
|
||||
// store references to add in later.
|
||||
std::cerr << "WireDialog::loadPulseData() REF: GroupId: " << pulse.mMeta.mGroupId;
|
||||
std::cerr << " PulseId: " << pulse.mMeta.mMsgId;
|
||||
std::cerr << std::endl;
|
||||
references.push_back(&pulse);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Filter timestamp now. (as soon as possible).
|
||||
if (filterTime && (pulse.mMeta.mPublishTs < filterTimestamp))
|
||||
{
|
||||
std::cerr << "WireDialog::loadPulseData() SKipping OLD MSG: GroupId: " << pulse.mMeta.mGroupId;
|
||||
std::cerr << " PulseId: " << pulse.mMeta.mMsgId;
|
||||
std::cerr << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
RsGxsGroupId &gid = pulse.mMeta.mGroupId;
|
||||
std::map<RsGxsGroupId, RsWireGroup>::iterator git = mAllGroups.find(gid);
|
||||
if (git != mAllGroups.end())
|
||||
{
|
||||
RsWireGroup &group = git->second;
|
||||
std::cerr << "WireDialog::loadPulseData() MSG: GroupId: " << pulse.mMeta.mGroupId;
|
||||
std::cerr << " PulseId: " << pulse.mMeta.mMsgId;
|
||||
std::cerr << std::endl;
|
||||
|
||||
// install into pulseGrouping.
|
||||
pulseGrouping[pulse.mMeta.mOrigMsgId] = PulseReplySet(&pulse, &group);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "WireDialog::loadPulseData() ERROR Missing GroupId: " << pulse.mMeta.mGroupId;
|
||||
std::cerr << " PulseId: " << pulse.mMeta.mMsgId;
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// add references.
|
||||
std::list<RsWirePulse *>::iterator lrit;
|
||||
for(lrit = references.begin(); lrit != references.end(); lrit++)
|
||||
{
|
||||
std::map<RsGxsMessageId, PulseReplySet>::iterator pgit;
|
||||
pgit = pulseGrouping.find((*lrit)->mMeta.mThreadId);
|
||||
if (pgit != pulseGrouping.end())
|
||||
{
|
||||
// install into reply map.
|
||||
// TODO handle Edits / Latest MSGS.
|
||||
std::map<RsGxsMessageId, RsWirePulse *>::iterator rmit;
|
||||
rmit = pgit->second.replies.find((*lrit)->mMeta.mOrigMsgId);
|
||||
if (rmit == pgit->second.replies.end())
|
||||
{
|
||||
std::cerr << "WireDialog::loadPulseData() Installing REF: " << (*lrit)->mMeta.mOrigMsgId;
|
||||
std::cerr << " to threadId: " << (*lrit)->mMeta.mThreadId;
|
||||
std::cerr << std::endl;
|
||||
pgit->second.replies[(*lrit)->mMeta.mOrigMsgId] = (*lrit);
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "WireDialog::loadPulseData() ERROR Duplicate reply REF: " << (*lrit)->mMeta.mOrigMsgId;
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// no original msg for REF.
|
||||
std::cerr << "WireDialog::loadPulseData() ERROR No matching ThreadId REF: " << (*lrit)->mMeta.mThreadId;
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
}
|
||||
references.clear();
|
||||
|
||||
// sort by publish time.
|
||||
std::map<rstime_t, PulseOrderedReply> pulseOrdering;
|
||||
std::map<RsGxsMessageId, PulseReplySet>::iterator pgit;
|
||||
for(pgit = pulseGrouping.begin(); pgit != pulseGrouping.end(); pgit++)
|
||||
{
|
||||
|
||||
PulseOrderedReply &msg = pulseOrdering[pgit->second.msg->mMeta.mPublishTs] =
|
||||
PulseOrderedReply(pgit->second.msg, pgit->second.group);
|
||||
std::map<RsGxsMessageId, RsWirePulse *>::iterator rmit;
|
||||
for(rmit = pgit->second.replies.begin();
|
||||
rmit != pgit->second.replies.end(); rmit++)
|
||||
{
|
||||
msg.replies[rmit->second->mMeta.mPublishTs] = rmit->second;
|
||||
}
|
||||
}
|
||||
|
||||
// now add to the GUI.
|
||||
std::map<rstime_t, PulseOrderedReply>::reverse_iterator poit;
|
||||
for (poit = pulseOrdering.rbegin(); poit != pulseOrdering.rend(); poit++)
|
||||
{
|
||||
// add into GUI should insert at correct time point, amongst all other ones.
|
||||
addPulse(poit->second.msg, poit->second.group, poit->second.replies);
|
||||
}
|
||||
|
||||
// allow filterTime to be changed again
|
||||
ui.comboBox_filterTime->setEnabled(true);
|
||||
return true;
|
||||
}
|
||||
|
||||
void WireDialog::acknowledgeGroup(const uint32_t &token, const uint32_t &userType)
|
||||
{
|
||||
/* reload groups */
|
||||
@ -727,9 +437,6 @@ void WireDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||
case TOKENREQ_GROUPINFO:
|
||||
switch(req.mAnsType)
|
||||
{
|
||||
// case RS_TOKREQ_ANSTYPE_LIST:
|
||||
// loadGroupList(req.mToken);
|
||||
// break;
|
||||
case RS_TOKREQ_ANSTYPE_DATA:
|
||||
loadGroupData(req.mToken);
|
||||
break;
|
||||
@ -742,40 +449,6 @@ void WireDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case TOKENREQ_MSGINFO:
|
||||
switch(req.mAnsType)
|
||||
{
|
||||
#if 0
|
||||
case RS_TOKREQ_ANSTYPE_LIST:
|
||||
loadPhotoList(req.mToken);
|
||||
break;
|
||||
case RS_TOKREQ_ANSTYPE_ACK:
|
||||
acknowledgeMessage(req.mToken);
|
||||
break;
|
||||
#endif
|
||||
case RS_TOKREQ_ANSTYPE_DATA:
|
||||
loadPulseData(req.mToken);
|
||||
break;
|
||||
default:
|
||||
std::cerr << "WireDialog::loadRequest() ERROR: MSG: INVALID ANS TYPE";
|
||||
std::cerr << std::endl;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#if 0
|
||||
case TOKENREQ_MSGRELATEDINFO:
|
||||
switch(req.mAnsType)
|
||||
{
|
||||
case RS_TOKREQ_ANSTYPE_DATA:
|
||||
loadPhotoData(req.mToken);
|
||||
break;
|
||||
default:
|
||||
std::cerr << "WireDialog::loadRequest() ERROR: MSG: INVALID ANS TYPE";
|
||||
std::cerr << std::endl;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
std::cerr << "WireDialog::loadRequest() ERROR: INVALID TYPE";
|
||||
std::cerr << std::endl;
|
||||
@ -787,3 +460,383 @@ void WireDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||
|
||||
/**************************** Request / Response Filling of Data ************************/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/****************************************************************************************/
|
||||
// TWITTER VIEW.
|
||||
/****************************************************************************************/
|
||||
|
||||
// TODO
|
||||
// - Handle Groups
|
||||
// - Add GroupPtr to WirePulseSPtrs (DONE)
|
||||
// - Add HeadShot to WireGroup
|
||||
// - Add GxsIdLabel to Pulse UI elements.
|
||||
//
|
||||
// - Create Groups.
|
||||
// - Add HeadShot
|
||||
//
|
||||
// - Create Pulse.
|
||||
// - Add Images.
|
||||
//
|
||||
// - Link up Reply / Republish / Like.
|
||||
//
|
||||
// - showGroupFocus
|
||||
// - TODO
|
||||
//
|
||||
// - showPulseFocus
|
||||
// - Basics (DONE).
|
||||
// - MoreReplies
|
||||
// - Show Actual Message.
|
||||
|
||||
//
|
||||
// - showReplyFocus
|
||||
// - TODO
|
||||
|
||||
|
||||
// PulseDataItem interface
|
||||
// Actions.
|
||||
void WireDialog::PVHreply(const RsGxsGroupId &groupId, const RsGxsMessageId &msgId)
|
||||
{
|
||||
std::cerr << "WireDialog::PVHreply() GroupId: " << groupId;
|
||||
std::cerr << "MsgId: " << msgId;
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (setupPulseAddDialog())
|
||||
{
|
||||
mAddDialog->setReplyTo(groupId, msgId, WIRE_PULSE_TYPE_REPLY);
|
||||
mAddDialog->show();
|
||||
}
|
||||
}
|
||||
|
||||
void WireDialog::PVHrepublish(const RsGxsGroupId &groupId, const RsGxsMessageId &msgId)
|
||||
{
|
||||
std::cerr << "WireDialog::PVHrepublish() GroupId: " << groupId;
|
||||
std::cerr << "MsgId: " << msgId;
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (setupPulseAddDialog())
|
||||
{
|
||||
mAddDialog->setReplyTo(groupId, msgId, WIRE_PULSE_TYPE_REPUBLISH);
|
||||
mAddDialog->show();
|
||||
}
|
||||
}
|
||||
|
||||
void WireDialog::PVHlike(const RsGxsGroupId &groupId, const RsGxsMessageId &msgId)
|
||||
{
|
||||
std::cerr << "WireDialog::PVHlike() GroupId: " << groupId;
|
||||
std::cerr << "MsgId: " << msgId;
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (setupPulseAddDialog())
|
||||
{
|
||||
mAddDialog->setReplyTo(groupId, msgId, WIRE_PULSE_TYPE_LIKE);
|
||||
mAddDialog->show();
|
||||
}
|
||||
}
|
||||
|
||||
void WireDialog::PVHviewGroup(const RsGxsGroupId &groupId)
|
||||
{
|
||||
std::cerr << "WireDialog::PVHviewGroup(";
|
||||
std::cerr << groupId.toStdString();
|
||||
std::cerr << ")";
|
||||
std::cerr << std::endl;
|
||||
|
||||
showGroupFocus(groupId);
|
||||
}
|
||||
|
||||
void WireDialog::PVHviewPulse(const RsGxsGroupId &groupId, const RsGxsMessageId &msgId)
|
||||
{
|
||||
std::cerr << "WireDialog::PVHviewPulse(";
|
||||
std::cerr << groupId.toStdString() << ",";
|
||||
std::cerr << msgId.toStdString();
|
||||
std::cerr << ")";
|
||||
std::cerr << std::endl;
|
||||
|
||||
showPulseFocus(groupId, msgId);
|
||||
}
|
||||
|
||||
void WireDialog::PVHviewReply(const RsGxsGroupId &groupId, const RsGxsMessageId &msgId)
|
||||
{
|
||||
std::cerr << "WireDialog::PVHviewReply(";
|
||||
std::cerr << groupId.toStdString() << ",";
|
||||
std::cerr << msgId.toStdString();
|
||||
std::cerr << ")";
|
||||
std::cerr << std::endl;
|
||||
|
||||
// showPulseFocus(groupId, msgId);
|
||||
}
|
||||
|
||||
void WireDialog::PVHfollow(const RsGxsGroupId &groupId)
|
||||
{
|
||||
std::cerr << "WireDialog::PVHfollow(";
|
||||
std::cerr << groupId.toStdString();
|
||||
std::cerr << ") TODO";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
void WireDialog::PVHrate(const RsGxsId &authorId)
|
||||
{
|
||||
std::cerr << "WireDialog::PVHrate(";
|
||||
std::cerr << authorId.toStdString();
|
||||
std::cerr << ") TODO";
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
void WireDialog::postTestTwitterView()
|
||||
{
|
||||
clearTwitterView();
|
||||
|
||||
addTwitterView(new PulseTopLevel(NULL,RsWirePulseSPtr()));
|
||||
addTwitterView(new PulseReply(NULL,RsWirePulseSPtr()));
|
||||
addTwitterView(new PulseReply(NULL,RsWirePulseSPtr()));
|
||||
addTwitterView(new PulseReply(NULL,RsWirePulseSPtr()));
|
||||
addTwitterView(new PulseReply(NULL,RsWirePulseSPtr()));
|
||||
addTwitterView(new PulseReply(NULL,RsWirePulseSPtr()));
|
||||
}
|
||||
|
||||
void WireDialog::clearTwitterView()
|
||||
{
|
||||
std::cerr << "WireDialog::clearTwitterView()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
||||
QLayoutItem *item;
|
||||
int i = 0;
|
||||
while (i < alayout->count())
|
||||
{
|
||||
item = alayout->itemAt(i);
|
||||
QWidget *widget = item->widget();
|
||||
if (NULL != dynamic_cast<PulseViewItem *>(widget))
|
||||
{
|
||||
std::cerr << "WireDialog::clearTwitterView() Removing Item at: " << i;
|
||||
std::cerr << std::endl;
|
||||
|
||||
item = alayout->takeAt(i);
|
||||
delete item->widget();
|
||||
delete item;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << "WireDialog::clearTwitterView() Leaving Item at: " << i;
|
||||
std::cerr << std::endl;
|
||||
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void WireDialog::addTwitterView(PulseViewItem *item)
|
||||
{
|
||||
std::cerr << "WireDialog::addTwitterView()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
/* ensure its a boxlayout */
|
||||
QLayout *alayout = ui.scrollAreaWidgetContents->layout();
|
||||
QBoxLayout *boxlayout = dynamic_cast<QBoxLayout *>(alayout);
|
||||
if (boxlayout == NULL) {
|
||||
std::cerr << "WireDialog::addTwitterView() ERROR not boxlayout, not Inserting";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
// inserting as last item.
|
||||
std::cerr << "WireDialog::addTwitterView() Inserting at end";
|
||||
std::cerr << std::endl;
|
||||
boxlayout->addWidget(item);
|
||||
}
|
||||
|
||||
|
||||
void WireDialog::showPulseFocus(const RsGxsGroupId groupId, const RsGxsMessageId msgId)
|
||||
{
|
||||
clearTwitterView();
|
||||
|
||||
// background thread for loading.
|
||||
RsThread::async([this, groupId, msgId]()
|
||||
{
|
||||
// fetch data from backend.
|
||||
RsWirePulseSPtr pPulse;
|
||||
int type = 0;
|
||||
bool success = rsWire->getPulseFocus(groupId, msgId, type, pPulse);
|
||||
|
||||
// sleep(2);
|
||||
|
||||
/* now insert the pulse + children into the layput */
|
||||
RsQThreadUtils::postToObject([pPulse,this]()
|
||||
{
|
||||
/* Here it goes any code you want to be executed on the Qt Gui
|
||||
* thread, for example to update the data model with new information
|
||||
* after a blocking call to RetroShare API complete */
|
||||
|
||||
postPulseFocus(pPulse);
|
||||
|
||||
}, this);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
void WireDialog::postPulseFocus(RsWirePulseSPtr pPulse)
|
||||
{
|
||||
clearTwitterView();
|
||||
if (!pPulse)
|
||||
{
|
||||
std::cerr << "WireDialog::postPulseFocus() Invalid pulse";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
ui.label_viewMode->setText("Pulse Focus");
|
||||
|
||||
addTwitterView(new PulseTopLevel(this, pPulse));
|
||||
|
||||
std::list<RsWirePulseSPtr>::iterator it;
|
||||
for(it = pPulse->mReplies.begin(); it != pPulse->mReplies.end(); it++)
|
||||
{
|
||||
RsWirePulseSPtr reply = *it;
|
||||
PulseReply *firstReply = new PulseReply(this, reply);
|
||||
addTwitterView(firstReply);
|
||||
|
||||
if (reply->mReplies.size() > 0)
|
||||
{
|
||||
PulseReply *secondReply = new PulseReply(this, reply->mReplies.front());
|
||||
addTwitterView(secondReply);
|
||||
firstReply->showReplyLine(true);
|
||||
secondReply->showReplyLine(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
firstReply->showReplyLine(false);
|
||||
}
|
||||
|
||||
|
||||
if (reply->mReplies.size() > 1)
|
||||
{
|
||||
// addTwitterView(new PulseMoreReplies(NULL, reply));
|
||||
}
|
||||
|
||||
addTwitterView(new PulseReplySeperator());
|
||||
}
|
||||
}
|
||||
|
||||
void WireDialog::showGroupFocus(const RsGxsGroupId groupId)
|
||||
{
|
||||
clearTwitterView();
|
||||
|
||||
// background thread for loading.
|
||||
RsThread::async([this, groupId]()
|
||||
{
|
||||
// fetch data from backend.
|
||||
RsWireGroupSPtr grp;
|
||||
std::list<RsWirePulseSPtr> pulses;
|
||||
|
||||
bool success = rsWire->getWireGroup(groupId, grp);
|
||||
std::list<RsGxsGroupId> groupIds = { groupId };
|
||||
success = rsWire->getPulsesForGroups(groupIds, pulses);
|
||||
|
||||
// sleep(2);
|
||||
|
||||
/* now insert the pulse + children into the layput */
|
||||
RsQThreadUtils::postToObject([grp, pulses,this]()
|
||||
{
|
||||
/* Here it goes any code you want to be executed on the Qt Gui
|
||||
* thread, for example to update the data model with new information
|
||||
* after a blocking call to RetroShare API complete */
|
||||
|
||||
postGroupFocus(grp, pulses);
|
||||
|
||||
}, this);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
void WireDialog::postGroupFocus(RsWireGroupSPtr group, std::list<RsWirePulseSPtr> pulses)
|
||||
{
|
||||
std::cerr << "WireDialog::postGroupFocus()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (!group)
|
||||
{
|
||||
std::cerr << "WireDialog::postGroupFocus() group is INVALID";
|
||||
std::cerr << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
ui.label_viewMode->setText("Group Focus");
|
||||
|
||||
addTwitterView(new PulseViewGroup(this, group));
|
||||
|
||||
std::list<RsWirePulseSPtr>::iterator it;
|
||||
for(it = pulses.begin(); it != pulses.end(); it++)
|
||||
{
|
||||
RsWirePulseSPtr reply = *it;
|
||||
|
||||
// don't show likes
|
||||
if (reply->mPulseType & WIRE_PULSE_TYPE_LIKE) {
|
||||
std::cerr << "WireDialog::postGroupFocus() Not showing LIKE";
|
||||
std::cerr << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
PulseReply *firstReply = new PulseReply(this, reply);
|
||||
addTwitterView(firstReply);
|
||||
firstReply->showReplyLine(false);
|
||||
|
||||
addTwitterView(new PulseReplySeperator());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void WireDialog::showGroupsPulses(const std::list<RsGxsGroupId> groupIds)
|
||||
{
|
||||
clearTwitterView();
|
||||
|
||||
// background thread for loading.
|
||||
RsThread::async([this, groupIds]()
|
||||
{
|
||||
// fetch data from backend.
|
||||
std::list<RsWirePulseSPtr> pulses;
|
||||
bool success = rsWire->getPulsesForGroups(groupIds, pulses);
|
||||
|
||||
// sleep(2);
|
||||
|
||||
/* now insert the pulse + children into the layput */
|
||||
RsQThreadUtils::postToObject([pulses,this]()
|
||||
{
|
||||
/* Here it goes any code you want to be executed on the Qt Gui
|
||||
* thread, for example to update the data model with new information
|
||||
* after a blocking call to RetroShare API complete */
|
||||
|
||||
postGroupsPulses(pulses);
|
||||
|
||||
}, this);
|
||||
});
|
||||
}
|
||||
|
||||
void WireDialog::postGroupsPulses(std::list<RsWirePulseSPtr> pulses)
|
||||
{
|
||||
std::cerr << "WireDialog::postGroupsPulses()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
ui.label_viewMode->setText("Groups Pulses");
|
||||
|
||||
std::list<RsWirePulseSPtr>::iterator it;
|
||||
for(it = pulses.begin(); it != pulses.end(); it++)
|
||||
{
|
||||
RsWirePulseSPtr reply = *it;
|
||||
// don't show likes
|
||||
if (reply->mPulseType & WIRE_PULSE_TYPE_LIKE) {
|
||||
std::cerr << "WireDialog::postGroupsPulses() Not showing LIKE";
|
||||
std::cerr << std::endl;
|
||||
continue;
|
||||
}
|
||||
|
||||
PulseReply *firstReply = new PulseReply(this, reply);
|
||||
addTwitterView(firstReply);
|
||||
firstReply->showReplyLine(false);
|
||||
|
||||
addTwitterView(new PulseReplySeperator());
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,15 +28,19 @@
|
||||
|
||||
#include <map>
|
||||
|
||||
#include "gui/TheWire/PulseItem.h"
|
||||
#include "gui/TheWire/WireGroupItem.h"
|
||||
#include "gui/TheWire/PulseAddDialog.h"
|
||||
|
||||
#include "gui/TheWire/PulseViewItem.h"
|
||||
#include "gui/TheWire/PulseTopLevel.h"
|
||||
#include "gui/TheWire/PulseReply.h"
|
||||
|
||||
|
||||
#include "util/TokenQueue.h"
|
||||
|
||||
#define IMAGE_WIRE ":/icons/wire.png"
|
||||
|
||||
class WireDialog : public MainPage, public TokenResponse, public PulseHolder, public WireGroupHolder
|
||||
class WireDialog : public MainPage, public TokenResponse, public WireGroupHolder, public PulseViewHolder
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -47,19 +51,36 @@ public:
|
||||
virtual QString pageName() const { return tr("The Wire") ; }
|
||||
virtual QString helpText() const { return ""; }
|
||||
|
||||
// PulseHolder interface.
|
||||
virtual void deletePulseItem(PulseItem *, uint32_t type);
|
||||
virtual void notifyPulseSelection(PulseItem *item);
|
||||
|
||||
virtual void follow(RsGxsGroupId &groupId);
|
||||
virtual void rate(RsGxsId &authorId);
|
||||
virtual void reply(RsWirePulse &pulse, std::string &groupName);
|
||||
|
||||
|
||||
// WireGroupHolder interface.
|
||||
virtual void subscribe(RsGxsGroupId &groupId);
|
||||
virtual void unsubscribe(RsGxsGroupId &groupId);
|
||||
virtual void notifyGroupSelection(WireGroupItem *item);
|
||||
virtual void subscribe(RsGxsGroupId &groupId) override;
|
||||
virtual void unsubscribe(RsGxsGroupId &groupId) override;
|
||||
virtual void notifyGroupSelection(WireGroupItem *item) override;
|
||||
|
||||
// PulseViewItem interface
|
||||
virtual void PVHreply(const RsGxsGroupId &groupId, const RsGxsMessageId &msgId) override;
|
||||
virtual void PVHrepublish(const RsGxsGroupId &groupId, const RsGxsMessageId &msgId) override;
|
||||
virtual void PVHlike(const RsGxsGroupId &groupId, const RsGxsMessageId &msgId) override;
|
||||
|
||||
virtual void PVHviewGroup(const RsGxsGroupId &groupId) override;
|
||||
virtual void PVHviewPulse(const RsGxsGroupId &groupId, const RsGxsMessageId &msgId) override;
|
||||
virtual void PVHviewReply(const RsGxsGroupId &groupId, const RsGxsMessageId &msgId) override;
|
||||
|
||||
virtual void PVHfollow(const RsGxsGroupId &groupId) override;
|
||||
virtual void PVHrate(const RsGxsId &authorId) override;
|
||||
|
||||
// New TwitterView
|
||||
void postTestTwitterView();
|
||||
void clearTwitterView();
|
||||
void addTwitterView(PulseViewItem *item);
|
||||
|
||||
void showPulseFocus(const RsGxsGroupId groupId, const RsGxsMessageId msgId);
|
||||
void postPulseFocus(RsWirePulseSPtr pulse);
|
||||
|
||||
void showGroupFocus(const RsGxsGroupId groupId);
|
||||
void postGroupFocus(RsWireGroupSPtr group, std::list<RsWirePulseSPtr> pulses);
|
||||
|
||||
void showGroupsPulses(const std::list<RsGxsGroupId> groupIds);
|
||||
void postGroupsPulses(std::list<RsWirePulseSPtr> pulses);
|
||||
|
||||
private slots:
|
||||
|
||||
@ -72,20 +93,17 @@ private slots:
|
||||
|
||||
private:
|
||||
|
||||
bool setupPulseAddDialog();
|
||||
|
||||
void addGroup(QWidget *item);
|
||||
|
||||
void addPulse(RsWirePulse *pulse, RsWireGroup *group,
|
||||
std::map<rstime_t, RsWirePulse *> replies);
|
||||
|
||||
void addGroup(const RsWireGroup &group);
|
||||
|
||||
void deletePulses();
|
||||
void deleteGroups();
|
||||
void showGroups();
|
||||
void showSelectedGroups();
|
||||
void updateGroups(std::vector<RsWireGroup> &groups);
|
||||
|
||||
// utils.
|
||||
// utils.
|
||||
rstime_t getFilterTimestamp();
|
||||
|
||||
// Loading Data.
|
||||
@ -93,18 +111,12 @@ private:
|
||||
bool loadGroupData(const uint32_t &token);
|
||||
void acknowledgeGroup(const uint32_t &token, const uint32_t &userType);
|
||||
|
||||
void requestPulseData(const std::list<RsGxsGroupId>& grpIds);
|
||||
bool loadPulseData(const uint32_t &token);
|
||||
|
||||
virtual void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||
|
||||
int mGroupSet;
|
||||
|
||||
PulseAddDialog *mAddDialog;
|
||||
|
||||
PulseItem *mPulseSelected;
|
||||
WireGroupItem *mGroupSelected;
|
||||
|
||||
TokenQueue *mWireQueue;
|
||||
|
||||
std::map<RsGxsGroupId, RsWireGroup> mAllGroups;
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>726</width>
|
||||
<height>557</height>
|
||||
<width>804</width>
|
||||
<height>586</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
@ -192,7 +192,7 @@
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>228</width>
|
||||
<height>421</height>
|
||||
<height>442</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
@ -215,118 +215,24 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QFrame" name="frame_2">
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>3</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
<property name="currentIndex">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_range" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show Posts from </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_filterTime">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string> All Time</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Last 24 hours</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Last 7 days</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Last 30 days</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>431</width>
|
||||
<height>443</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QWidget#scrollAreaWidgetContents{border: none;}</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<widget class="QWidget" name="tabWidget_Page1">
|
||||
<attribute name="title">
|
||||
<string>HomePage</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QWidget" name="widget_range" native="true">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
@ -343,23 +249,126 @@
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<widget class="QLabel" name="label_viewMode">
|
||||
<property name="text">
|
||||
<string>Most Recent</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Show Posts from </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox_filterTime">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string> All Time</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Last 24 hours</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Last 7 days</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Last 30 days</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>508</width>
|
||||
<height>435</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QWidget#scrollAreaWidgetContents{border: none;}</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -19,6 +19,8 @@
|
||||
*******************************************************************************/
|
||||
#include <QBuffer>
|
||||
|
||||
#include "WireGroupExtra.h"
|
||||
|
||||
#include "WireGroupDialog.h"
|
||||
#include "gui/gxs/GxsIdDetails.h"
|
||||
|
||||
@ -27,7 +29,7 @@
|
||||
const uint32_t WireCreateEnabledFlags = (
|
||||
GXS_GROUP_FLAGS_NAME |
|
||||
GXS_GROUP_FLAGS_ICON |
|
||||
GXS_GROUP_FLAGS_DESCRIPTION |
|
||||
// GXS_GROUP_FLAGS_DESCRIPTION |
|
||||
GXS_GROUP_FLAGS_DISTRIBUTION |
|
||||
// GXS_GROUP_FLAGS_PUBLISHSIGN |
|
||||
// GXS_GROUP_FLAGS_SHAREKEYS | // disabled because the UI doesn't handle it yet.
|
||||
@ -85,6 +87,9 @@ void WireGroupDialog::initUi()
|
||||
|
||||
setUiText(UITYPE_ADD_ADMINS_CHECKBOX, tr("Add Wire Admins"));
|
||||
setUiText(UITYPE_CONTACTS_DOCK, tr("Select Wire Admins"));
|
||||
|
||||
mExtra = new WireGroupExtra(this);
|
||||
injectExtraWidget(mExtra);
|
||||
}
|
||||
|
||||
QPixmap WireGroupDialog::serviceImage()
|
||||
@ -95,9 +100,6 @@ QPixmap WireGroupDialog::serviceImage()
|
||||
void WireGroupDialog::prepareWireGroup(RsWireGroup &group, const RsGroupMetaData &meta)
|
||||
{
|
||||
group.mMeta = meta;
|
||||
group.mDescription = getDescription().toUtf8().constData();
|
||||
|
||||
#if 0
|
||||
QPixmap pixmap = getLogo();
|
||||
|
||||
if (!pixmap.isNull()) {
|
||||
@ -107,12 +109,27 @@ void WireGroupDialog::prepareWireGroup(RsWireGroup &group, const RsGroupMetaData
|
||||
buffer.open(QIODevice::WriteOnly);
|
||||
pixmap.save(&buffer, "PNG"); // writes image into ba in PNG format
|
||||
|
||||
group.mThumbnail.copy((uint8_t *) ba.data(), ba.size());
|
||||
group.mHeadshot.copy((uint8_t *) ba.data(), ba.size());
|
||||
} else {
|
||||
group.mThumbnail.clear();
|
||||
group.mHeadshot.clear();
|
||||
}
|
||||
#endif
|
||||
|
||||
// from Extra Widget.
|
||||
group.mTagline = mExtra->getTagline();
|
||||
group.mLocation = mExtra->getLocation();
|
||||
pixmap = mExtra->getMasthead();
|
||||
|
||||
if (!pixmap.isNull()) {
|
||||
QByteArray ba;
|
||||
QBuffer buffer(&ba);
|
||||
|
||||
buffer.open(QIODevice::WriteOnly);
|
||||
pixmap.save(&buffer, "JPG");
|
||||
|
||||
group.mMasthead.copy((uint8_t *) ba.data(), ba.size());
|
||||
} else {
|
||||
group.mMasthead.clear();
|
||||
}
|
||||
}
|
||||
|
||||
bool WireGroupDialog::service_createGroup(RsGroupMetaData &meta)
|
||||
@ -152,7 +169,7 @@ bool WireGroupDialog::service_loadGroup(const RsGxsGenericGroupData *data, Mode
|
||||
}
|
||||
|
||||
const RsWireGroup &group = *pgroup;
|
||||
description = QString::fromUtf8(group.mDescription.c_str());
|
||||
// description = QString::fromUtf8(group.mDescription.c_str());
|
||||
|
||||
#if 0
|
||||
if (group.mThumbnail.mData) {
|
||||
|
@ -22,8 +22,11 @@
|
||||
#define _WIRE_GROUP_DIALOG_H
|
||||
|
||||
#include "gui/gxs/GxsGroupDialog.h"
|
||||
|
||||
#include <retroshare/rswire.h>
|
||||
|
||||
class WireGroupExtra;
|
||||
|
||||
class WireGroupDialog : public GxsGroupDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
@ -42,6 +45,8 @@ protected:
|
||||
|
||||
private:
|
||||
void prepareWireGroup(RsWireGroup &group, const RsGroupMetaData &meta);
|
||||
|
||||
WireGroupExtra *mExtra;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
83
retroshare-gui/src/gui/TheWire/WireGroupExtra.cpp
Normal file
83
retroshare-gui/src/gui/TheWire/WireGroupExtra.cpp
Normal file
@ -0,0 +1,83 @@
|
||||
/*******************************************************************************
|
||||
* retroshare-gui/src/gui/TheWire/WireGroupExtra.cpp *
|
||||
* *
|
||||
* Copyright (C) 2020 by Robert Fernie <retroshare.project@gmail.com> *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#include "WireGroupExtra.h"
|
||||
#include "util/misc.h"
|
||||
|
||||
WireGroupExtra::WireGroupExtra(QWidget *parent) :
|
||||
QWidget(NULL)
|
||||
{
|
||||
ui.setupUi(this);
|
||||
setUp();
|
||||
}
|
||||
|
||||
WireGroupExtra::~WireGroupExtra()
|
||||
{
|
||||
}
|
||||
|
||||
void WireGroupExtra::setUp()
|
||||
{
|
||||
connect(ui.pushButton_masthead, SIGNAL(clicked() ), this , SLOT(addMasthead()));
|
||||
}
|
||||
|
||||
|
||||
void WireGroupExtra::addMasthead()
|
||||
{
|
||||
QPixmap img = misc::getOpenThumbnailedPicture(this, tr("Load Masthead"), 400, 100);
|
||||
|
||||
if (img.isNull())
|
||||
return;
|
||||
|
||||
setMasthead(img);
|
||||
}
|
||||
|
||||
|
||||
void WireGroupExtra::setTagline(const std::string &str)
|
||||
{
|
||||
ui.lineEdit_Tagline->setText(QString::fromStdString(str));
|
||||
}
|
||||
|
||||
void WireGroupExtra::setLocation(const std::string &str)
|
||||
{
|
||||
ui.lineEdit_Location->setText(QString::fromStdString(str));
|
||||
}
|
||||
|
||||
void WireGroupExtra::setMasthead(const QPixmap &pixmap)
|
||||
{
|
||||
mMasthead = pixmap;
|
||||
ui.label_masthead->setPixmap(mMasthead);
|
||||
}
|
||||
|
||||
std::string WireGroupExtra::getTagline()
|
||||
{
|
||||
return ui.lineEdit_Tagline->text().toStdString();
|
||||
}
|
||||
|
||||
std::string WireGroupExtra::getLocation()
|
||||
{
|
||||
return ui.lineEdit_Location->text().toStdString();
|
||||
}
|
||||
|
||||
QPixmap WireGroupExtra::getMasthead()
|
||||
{
|
||||
return mMasthead;
|
||||
}
|
||||
|
||||
|
54
retroshare-gui/src/gui/TheWire/WireGroupExtra.h
Normal file
54
retroshare-gui/src/gui/TheWire/WireGroupExtra.h
Normal file
@ -0,0 +1,54 @@
|
||||
/*******************************************************************************
|
||||
* retroshare-gui/src/gui/TheWire/WireGroupExtra.h *
|
||||
* *
|
||||
* Copyright (C) 2020 by Robert Fernie <retroshare.project@gmail.com> *
|
||||
* *
|
||||
* This program is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Affero General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU Affero General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Affero General Public License *
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
*******************************************************************************/
|
||||
|
||||
#ifndef WIRE_GROUP_EXTRA_H
|
||||
#define WIRE_GROUP_EXTRA_H
|
||||
|
||||
#include <QWidget>
|
||||
#include "ui_WireGroupExtra.h"
|
||||
|
||||
class WireGroupExtra : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit WireGroupExtra(QWidget *parent = 0);
|
||||
virtual ~WireGroupExtra();
|
||||
|
||||
void setMasthead(const QPixmap &pixmap);
|
||||
QPixmap getMasthead();
|
||||
|
||||
void setTagline(const std::string &str);
|
||||
void setLocation(const std::string &str);
|
||||
|
||||
std::string getTagline();
|
||||
std::string getLocation();
|
||||
|
||||
private slots:
|
||||
void addMasthead();
|
||||
|
||||
private:
|
||||
void setUp();
|
||||
private:
|
||||
QPixmap mMasthead;
|
||||
Ui::WireGroupExtra ui;
|
||||
};
|
||||
|
||||
#endif // WIRE_GROUP_EXTRA_H
|
68
retroshare-gui/src/gui/TheWire/WireGroupExtra.ui
Normal file
68
retroshare-gui/src/gui/TheWire/WireGroupExtra.ui
Normal file
@ -0,0 +1,68 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>WireGroupExtra</class>
|
||||
<widget class="QWidget" name="WireGroupExtra">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>516</width>
|
||||
<height>199</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Form</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>Masthead</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1" rowspan="2">
|
||||
<widget class="QLabel" name="label_masthead">
|
||||
<property name="text">
|
||||
<string>MastHead background Image</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QPushButton" name="pushButton_masthead">
|
||||
<property name="text">
|
||||
<string>Select Image</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="captionLabel">
|
||||
<property name="text">
|
||||
<string>Tagline:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_Tagline"/>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="label_12">
|
||||
<property name="text">
|
||||
<string>Location:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLineEdit" name="lineEdit_Location"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
@ -51,6 +51,25 @@ void WireGroupItem::setup()
|
||||
label_authorId->setId(mGroup.mMeta.mAuthorId);
|
||||
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 ;
|
||||
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))
|
||||
pixmap = GxsIdDetails::makeDefaultIcon(mGroup.mMeta.mAuthorId,GxsIdDetails::SMALL);
|
||||
|
||||
pixmap = pixmap.scaled(24,24);
|
||||
label_avatar->setPixmap(pixmap);
|
||||
|
||||
connect(toolButton_show, SIGNAL(clicked()), this, SLOT(show()));
|
||||
|
@ -38,7 +38,7 @@
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_avatar">
|
||||
<widget class="QLabel" name="label_headshot">
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>32</width>
|
||||
@ -102,6 +102,13 @@
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_avatar">
|
||||
<property name="text">
|
||||
<string>Avatar</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="GxsIdLabel" name="label_authorId">
|
||||
<property name="text">
|
||||
|
BIN
retroshare-gui/src/gui/TheWire/images/like.png
Normal file
BIN
retroshare-gui/src/gui/TheWire/images/like.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
BIN
retroshare-gui/src/gui/TheWire/images/reply.png
Normal file
BIN
retroshare-gui/src/gui/TheWire/images/reply.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
BIN
retroshare-gui/src/gui/TheWire/images/retweet.png
Normal file
BIN
retroshare-gui/src/gui/TheWire/images/retweet.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.0 KiB |
@ -1231,25 +1231,39 @@ gxsthewire {
|
||||
|
||||
DEFINES += RS_USE_WIRE
|
||||
|
||||
HEADERS += gui/TheWire/PulseItem.h \
|
||||
gui/TheWire/PulseDetails.h \
|
||||
gui/TheWire/WireDialog.h \
|
||||
HEADERS += gui/TheWire/WireDialog.h \
|
||||
gui/TheWire/WireGroupItem.h \
|
||||
gui/TheWire/WireGroupDialog.h \
|
||||
gui/TheWire/WireGroupExtra.h \
|
||||
gui/TheWire/PulseAddDialog.h \
|
||||
|
||||
FORMS += gui/TheWire/PulseItem.ui \
|
||||
gui/TheWire/PulseDetails.ui \
|
||||
gui/TheWire/PulseViewItem.h \
|
||||
gui/TheWire/PulseTopLevel.h \
|
||||
gui/TheWire/PulseViewGroup.h \
|
||||
gui/TheWire/PulseReply.h \
|
||||
gui/TheWire/PulseReplySeperator.h \
|
||||
gui/TheWire/PulseMessage.h \
|
||||
|
||||
FORMS += gui/TheWire/WireDialog.ui \
|
||||
gui/TheWire/WireGroupItem.ui \
|
||||
gui/TheWire/WireDialog.ui \
|
||||
gui/TheWire/WireGroupExtra.ui \
|
||||
gui/TheWire/PulseAddDialog.ui \
|
||||
gui/TheWire/PulseTopLevel.ui \
|
||||
gui/TheWire/PulseViewGroup.ui \
|
||||
gui/TheWire/PulseReply.ui \
|
||||
gui/TheWire/PulseReplySeperator.ui \
|
||||
gui/TheWire/PulseMessage.ui \
|
||||
|
||||
SOURCES += gui/TheWire/PulseItem.cpp \
|
||||
gui/TheWire/PulseDetails.cpp \
|
||||
gui/TheWire/WireDialog.cpp \
|
||||
SOURCES += gui/TheWire/WireDialog.cpp \
|
||||
gui/TheWire/WireGroupItem.cpp \
|
||||
gui/TheWire/WireGroupDialog.cpp \
|
||||
gui/TheWire/WireGroupExtra.cpp \
|
||||
gui/TheWire/PulseAddDialog.cpp \
|
||||
gui/TheWire/PulseViewItem.cpp \
|
||||
gui/TheWire/PulseTopLevel.cpp \
|
||||
gui/TheWire/PulseViewGroup.cpp \
|
||||
gui/TheWire/PulseReply.cpp \
|
||||
gui/TheWire/PulseReplySeperator.cpp \
|
||||
gui/TheWire/PulseMessage.cpp \
|
||||
|
||||
RESOURCES += gui/TheWire/TheWire_images.qrc
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user