mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-03 02:50:07 -05:00
Enable Republish / Likes from new UI elements
Update interface to use groupId / msgId. Tweak PulseAddDialog for Republish & like. Hide Like messages from showing in UI. Wire up buttons from new UI elements.
This commit is contained in:
parent
8df5a886db
commit
f585b7a629
@ -91,9 +91,13 @@ void PulseAddDialog::cleanup()
|
||||
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);
|
||||
}
|
||||
|
||||
void PulseAddDialog::pulseTextChanged()
|
||||
@ -104,10 +108,11 @@ void PulseAddDialog::pulseTextChanged()
|
||||
}
|
||||
|
||||
// Old Interface, deprecate / make internal.
|
||||
void PulseAddDialog::setReplyTo(RsWirePulse &pulse, std::string &groupName)
|
||||
void PulseAddDialog::setReplyTo(RsWirePulse &pulse, std::string &groupName, uint32_t replyType)
|
||||
{
|
||||
mIsReply = true;
|
||||
mReplyToPulse = pulse;
|
||||
mReplyType = replyType;
|
||||
ui.frame_reply->setVisible(true);
|
||||
|
||||
{
|
||||
@ -121,9 +126,28 @@ void PulseAddDialog::setReplyTo(RsWirePulse &pulse, std::string &groupName)
|
||||
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)
|
||||
}
|
||||
|
||||
void PulseAddDialog::setReplyTo(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId, uint32_t replyType)
|
||||
{
|
||||
/* fetch in the background */
|
||||
RsWireGroupSPtr pGroup;
|
||||
@ -142,7 +166,7 @@ void PulseAddDialog::setReplyTo(const RsGxsGroupId &grpId, const RsGxsMessageId
|
||||
return;
|
||||
}
|
||||
|
||||
setReplyTo(*pPulse, pGroup->mMeta.mGroupName);
|
||||
setReplyTo(*pPulse, pGroup->mMeta.mGroupName, replyType);
|
||||
}
|
||||
|
||||
void PulseAddDialog::addURL()
|
||||
@ -247,7 +271,7 @@ void PulseAddDialog::postReplyPulse()
|
||||
if (!rsWire->createReplyPulse(mReplyToPulse.mMeta.mGroupId,
|
||||
mReplyToPulse.mMeta.mOrigMsgId,
|
||||
mGroup.mMeta.mGroupId,
|
||||
WIRE_PULSE_TYPE_REPLY,
|
||||
mReplyType,
|
||||
pPulse))
|
||||
{
|
||||
std::cerr << "PulseAddDialog::postReplyPulse() FAILED";
|
||||
|
@ -34,7 +34,7 @@ public:
|
||||
|
||||
void cleanup();
|
||||
|
||||
void setReplyTo(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId);
|
||||
void setReplyTo(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId, uint32_t replyType);
|
||||
void setGroup(const RsGxsGroupId &grpId);
|
||||
|
||||
private slots:
|
||||
@ -48,7 +48,7 @@ private slots:
|
||||
private:
|
||||
// OLD VERSIONs, private now.
|
||||
void setGroup(RsWireGroup &group);
|
||||
void setReplyTo(RsWirePulse &pulse, std::string &groupName);
|
||||
void setReplyTo(RsWirePulse &pulse, std::string &groupName, uint32_t replyType);
|
||||
|
||||
void postOriginalPulse();
|
||||
void postReplyPulse();
|
||||
@ -62,9 +62,9 @@ protected:
|
||||
// if this is a reply
|
||||
bool mIsReply;
|
||||
RsWirePulse mReplyToPulse;
|
||||
uint32_t mReplyType;
|
||||
|
||||
Ui::PulseAddDialog ui;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -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>
|
||||
|
@ -47,8 +47,12 @@ void PulseDataItem::actionReply()
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (mHolder) {
|
||||
std::string groupName = "unknownGroupName";
|
||||
mHolder->PVHreply(*mPulse, groupName);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -58,8 +62,12 @@ void PulseDataItem::actionRepublish()
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (mHolder) {
|
||||
std::string groupName = "unknownGroupName";
|
||||
mHolder->PVHrepublish(*mPulse, groupName);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,8 +77,12 @@ void PulseDataItem::actionLike()
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (mHolder) {
|
||||
std::string groupName = "unknownGroupName";
|
||||
mHolder->PVHlike(*mPulse, groupName);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,16 +33,16 @@ public:
|
||||
virtual ~PulseViewHolder() {}
|
||||
|
||||
// Actions.
|
||||
virtual void PVHreply(RsWirePulse &pulse, std::string &groupName) = 0;
|
||||
virtual void PVHrepublish(RsWirePulse &pulse, std::string &groupName) = 0;
|
||||
virtual void PVHlike(RsWirePulse &pulse, std::string &groupName) = 0;
|
||||
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(RsGxsGroupId &groupId) = 0;
|
||||
virtual void PVHviewPulse(RsGxsGroupId &groupId, RsGxsMessageId &msgId) = 0;
|
||||
virtual void PVHviewReply(RsGxsGroupId &groupId, 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(RsGxsGroupId &groupId) = 0;
|
||||
virtual void PVHrate(RsGxsId &authorId) = 0;
|
||||
virtual void PVHfollow(const RsGxsGroupId &groupId) = 0;
|
||||
virtual void PVHrate(const RsGxsId &authorId) = 0;
|
||||
};
|
||||
|
||||
class PulseDataInterface
|
||||
|
@ -132,6 +132,35 @@ void WireDialog::rate(RsGxsId &authorId)
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
bool WireDialog::setupPulseAddDialog()
|
||||
{
|
||||
std::cerr << "WireDialog::setupPulseAddDialog()";
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (!mAddDialog)
|
||||
{
|
||||
mAddDialog = new PulseAddDialog(NULL);
|
||||
mAddDialog->hide();
|
||||
}
|
||||
|
||||
mAddDialog->cleanup();
|
||||
|
||||
int idx = ui.groupChooser->currentIndex();
|
||||
if (idx < 0) {
|
||||
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 false;
|
||||
}
|
||||
|
||||
// publishing group.
|
||||
RsWireGroup group = mOwnGroups[idx];
|
||||
mAddDialog->setGroup(group.mMeta.mGroupId);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void WireDialog::reply(RsWirePulse &pulse, std::string &groupName)
|
||||
{
|
||||
std::cerr << "WireDialog::reply(";
|
||||
@ -143,32 +172,12 @@ void WireDialog::reply(RsWirePulse &pulse, std::string &groupName)
|
||||
std::cerr << ")";
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (!mAddDialog)
|
||||
if (setupPulseAddDialog())
|
||||
{
|
||||
mAddDialog = new PulseAddDialog(NULL);
|
||||
mAddDialog->hide();
|
||||
}
|
||||
|
||||
int idx = ui.groupChooser->currentIndex();
|
||||
if (idx < 0) {
|
||||
std::cerr << "WireDialog::reply() 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;
|
||||
}
|
||||
|
||||
// publishing group.
|
||||
RsWireGroup group = mOwnGroups[idx];
|
||||
mAddDialog->cleanup();
|
||||
mAddDialog->setGroup(group.mMeta.mGroupId);
|
||||
|
||||
// establish replyTo.
|
||||
//mAddDialog->setReplyTo(pulse, groupName);
|
||||
mAddDialog->setReplyTo(pulse.mMeta.mGroupId, pulse.mMeta.mMsgId);
|
||||
|
||||
mAddDialog->setReplyTo(pulse.mMeta.mGroupId, pulse.mMeta.mMsgId, WIRE_PULSE_TYPE_REPLY);
|
||||
mAddDialog->show();
|
||||
}
|
||||
}
|
||||
|
||||
void WireDialog::notifyPulseSelection(PulseItem *item)
|
||||
{
|
||||
@ -857,25 +866,46 @@ void WireDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||
|
||||
// PulseDataItem interface
|
||||
// Actions.
|
||||
void WireDialog::PVHreply(RsWirePulse &pulse, std::string &groupName)
|
||||
void WireDialog::PVHreply(const RsGxsGroupId &groupId, const RsGxsMessageId &msgId)
|
||||
{
|
||||
std::cerr << "WireDialog::PVHreply() TODO";
|
||||
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(RsWirePulse &pulse, std::string &groupName)
|
||||
void WireDialog::PVHrepublish(const RsGxsGroupId &groupId, const RsGxsMessageId &msgId)
|
||||
{
|
||||
std::cerr << "WireDialog::PVHrepublish() TODO";
|
||||
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(RsWirePulse &pulse, std::string &groupName)
|
||||
void WireDialog::PVHlike(const RsGxsGroupId &groupId, const RsGxsMessageId &msgId)
|
||||
{
|
||||
std::cerr << "WireDialog::PVHlike() TODO";
|
||||
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(RsGxsGroupId &groupId)
|
||||
void WireDialog::PVHviewGroup(const RsGxsGroupId &groupId)
|
||||
{
|
||||
std::cerr << "WireDialog::PVHviewGroup(";
|
||||
std::cerr << groupId.toStdString();
|
||||
@ -885,7 +915,7 @@ void WireDialog::PVHviewGroup(RsGxsGroupId &groupId)
|
||||
showGroupFocus(groupId);
|
||||
}
|
||||
|
||||
void WireDialog::PVHviewPulse(RsGxsGroupId &groupId, RsGxsMessageId &msgId)
|
||||
void WireDialog::PVHviewPulse(const RsGxsGroupId &groupId, const RsGxsMessageId &msgId)
|
||||
{
|
||||
std::cerr << "WireDialog::PVHviewPulse(";
|
||||
std::cerr << groupId.toStdString() << ",";
|
||||
@ -896,7 +926,7 @@ void WireDialog::PVHviewPulse(RsGxsGroupId &groupId, RsGxsMessageId &msgId)
|
||||
showPulseFocus(groupId, msgId);
|
||||
}
|
||||
|
||||
void WireDialog::PVHviewReply(RsGxsGroupId &groupId, RsGxsMessageId &msgId)
|
||||
void WireDialog::PVHviewReply(const RsGxsGroupId &groupId, const RsGxsMessageId &msgId)
|
||||
{
|
||||
std::cerr << "WireDialog::PVHviewReply(";
|
||||
std::cerr << groupId.toStdString() << ",";
|
||||
@ -907,7 +937,7 @@ void WireDialog::PVHviewReply(RsGxsGroupId &groupId, RsGxsMessageId &msgId)
|
||||
// showPulseFocus(groupId, msgId);
|
||||
}
|
||||
|
||||
void WireDialog::PVHfollow(RsGxsGroupId &groupId)
|
||||
void WireDialog::PVHfollow(const RsGxsGroupId &groupId)
|
||||
{
|
||||
std::cerr << "WireDialog::PVHfollow(";
|
||||
std::cerr << groupId.toStdString();
|
||||
@ -915,7 +945,7 @@ void WireDialog::PVHfollow(RsGxsGroupId &groupId)
|
||||
std::cerr << std::endl;
|
||||
}
|
||||
|
||||
void WireDialog::PVHrate(RsGxsId &authorId)
|
||||
void WireDialog::PVHrate(const RsGxsId &authorId)
|
||||
{
|
||||
std::cerr << "WireDialog::PVHrate(";
|
||||
std::cerr << authorId.toStdString();
|
||||
@ -1109,6 +1139,14 @@ void WireDialog::postGroupFocus(RsWireGroupSPtr group, std::list<RsWirePulseSPtr
|
||||
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);
|
||||
@ -1155,6 +1193,13 @@ void WireDialog::postGroupsPulses(std::list<RsWirePulseSPtr> pulses)
|
||||
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);
|
||||
|
@ -68,16 +68,16 @@ public:
|
||||
virtual void notifyGroupSelection(WireGroupItem *item) override;
|
||||
|
||||
// PulseViewItem interface
|
||||
virtual void PVHreply(RsWirePulse &pulse, std::string &groupName) override;
|
||||
virtual void PVHrepublish(RsWirePulse &pulse, std::string &groupName) override;
|
||||
virtual void PVHlike(RsWirePulse &pulse, std::string &groupName) override;
|
||||
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(RsGxsGroupId &groupId) override;
|
||||
virtual void PVHviewPulse(RsGxsGroupId &groupId, RsGxsMessageId &msgId) override;
|
||||
virtual void PVHviewReply(RsGxsGroupId &groupId, 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(RsGxsGroupId &groupId) override;
|
||||
virtual void PVHrate(RsGxsId &authorId) override;
|
||||
virtual void PVHfollow(const RsGxsGroupId &groupId) override;
|
||||
virtual void PVHrate(const RsGxsId &authorId) override;
|
||||
|
||||
// New TwitterView
|
||||
void postTestTwitterView();
|
||||
@ -104,6 +104,8 @@ private slots:
|
||||
|
||||
private:
|
||||
|
||||
bool setupPulseAddDialog();
|
||||
|
||||
void addGroup(QWidget *item);
|
||||
|
||||
void addPulse(RsWirePulse *pulse, RsWireGroup *group,
|
||||
|
Loading…
x
Reference in New Issue
Block a user