mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-08-02 11:16:34 -04:00
Added new Wire notify, for new joind users
This commit is contained in:
parent
f7ab95ca3b
commit
6bae643b8e
5 changed files with 45 additions and 16 deletions
|
@ -532,16 +532,19 @@ void NewsFeed::handleWireEvent(std::shared_ptr<const RsEvent> event)
|
||||||
case RsWireEventCode::FOLLOW_STATUS_CHANGED:
|
case RsWireEventCode::FOLLOW_STATUS_CHANGED:
|
||||||
addFeedItem( new WireNotifyGroupItem(this, NEWSFEED_WIRELIST, pe->mWireGroupId, false, true));
|
addFeedItem( new WireNotifyGroupItem(this, NEWSFEED_WIRELIST, pe->mWireGroupId, false, true));
|
||||||
break;
|
break;
|
||||||
|
case RsWireEventCode::NEW_WIRE:
|
||||||
|
addFeedItem( new WireNotifyGroupItem(this, NEWSFEED_WIRELIST, pe->mWireGroupId, false, true));
|
||||||
|
break;
|
||||||
case RsWireEventCode::NEW_POST:
|
case RsWireEventCode::NEW_POST:
|
||||||
addFeedItem( new WireNotifyPostItem(this, NEWSFEED_WIRELIST, pe->mWireGroupId, pe->mWireMsgId, false, true));
|
addFeedItem( new WireNotifyPostItem(this, NEWSFEED_WIRELIST, pe->mWireGroupId, pe->mWireMsgId, false, true));
|
||||||
break;
|
break;
|
||||||
case RsWireEventCode::NEW_REPLY:
|
case RsWireEventCode::NEW_REPLY:
|
||||||
addFeedItem( new WireNotifyPostItem(this, NEWSFEED_WIRELIST, pe->mWireGroupId, pe->mWireMsgId, false, true));
|
addFeedItem( new WireNotifyPostItem(this, NEWSFEED_WIRELIST, pe->mWireGroupId, pe->mWireMsgId, false, true));
|
||||||
break;
|
break;
|
||||||
case RsWireEventCode::NEW_LIKE:
|
case RsWireEventCode::NEW_REPUBLISH:
|
||||||
addFeedItem( new WireNotifyPostItem(this, NEWSFEED_WIRELIST, pe->mWireGroupId, pe->mWireMsgId, false, true));
|
addFeedItem( new WireNotifyPostItem(this, NEWSFEED_WIRELIST, pe->mWireGroupId, pe->mWireMsgId, false, true));
|
||||||
break;
|
break;
|
||||||
case RsWireEventCode::NEW_REPUBLISH:
|
case RsWireEventCode::NEW_LIKE:
|
||||||
addFeedItem( new WireNotifyPostItem(this, NEWSFEED_WIRELIST, pe->mWireGroupId, pe->mWireMsgId, false, true));
|
addFeedItem( new WireNotifyPostItem(this, NEWSFEED_WIRELIST, pe->mWireGroupId, pe->mWireMsgId, false, true));
|
||||||
break;
|
break;
|
||||||
// case RsWireEventCode::WIRE_UPDATED:
|
// case RsWireEventCode::WIRE_UPDATED:
|
||||||
|
|
|
@ -36,20 +36,45 @@ WireNotifyGroupItem::WireNotifyGroupItem(FeedHolder *feedHolder, uint32_t feedId
|
||||||
GxsGroupFeedItem(feedHolder, feedId, groupId, isHome, rsWire, autoUpdate)
|
GxsGroupFeedItem(feedHolder, feedId, groupId, isHome, rsWire, autoUpdate)
|
||||||
{
|
{
|
||||||
setup();
|
setup();
|
||||||
|
|
||||||
requestGroup();
|
requestGroup();
|
||||||
|
addEventHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
WireNotifyGroupItem::WireNotifyGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsWireGroup &group, bool isHome, bool autoUpdate) :
|
WireNotifyGroupItem::WireNotifyGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsWireGroup &group, bool isHome, bool autoUpdate) :
|
||||||
GxsGroupFeedItem(feedHolder, feedId, group.mMeta.mGroupId, isHome, rsWire, autoUpdate)
|
GxsGroupFeedItem(feedHolder, feedId, group.mMeta.mGroupId, isHome, rsWire, autoUpdate)
|
||||||
{
|
{
|
||||||
setup();
|
setup();
|
||||||
|
|
||||||
setGroup(group);
|
setGroup(group);
|
||||||
|
addEventHandler();
|
||||||
|
}
|
||||||
|
|
||||||
|
void WireNotifyGroupItem::addEventHandler()
|
||||||
|
{
|
||||||
|
mEventHandlerId = 0;
|
||||||
|
rsEvents->registerEventsHandler( [this](std::shared_ptr<const RsEvent> event)
|
||||||
|
{
|
||||||
|
RsQThreadUtils::postToObject([=]()
|
||||||
|
{
|
||||||
|
const auto *e = dynamic_cast<const RsWireEvent*>(event.get());
|
||||||
|
|
||||||
|
if(!e || e->mWireGroupId != this->groupId())
|
||||||
|
return;
|
||||||
|
|
||||||
|
switch(e->mWireEventCode)
|
||||||
|
{
|
||||||
|
case RsWireEventCode::FOLLOW_STATUS_CHANGED:
|
||||||
|
case RsWireEventCode::WIRE_UPDATED:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}, this );
|
||||||
|
}, mEventHandlerId, RsEventType::WIRE );
|
||||||
}
|
}
|
||||||
|
|
||||||
WireNotifyGroupItem::~WireNotifyGroupItem()
|
WireNotifyGroupItem::~WireNotifyGroupItem()
|
||||||
{
|
{
|
||||||
|
rsEvents->unregisterEventsHandler(mEventHandlerId);
|
||||||
delete(ui);
|
delete(ui);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +100,7 @@ void WireNotifyGroupItem::setup()
|
||||||
connect(ui->copyLinkButton, SIGNAL(clicked()), this, SLOT(copyGroupLink()));
|
connect(ui->copyLinkButton, SIGNAL(clicked()), this, SLOT(copyGroupLink()));
|
||||||
|
|
||||||
//ui->copyLinkButton->hide(); // No link type at this moment
|
//ui->copyLinkButton->hide(); // No link type at this moment
|
||||||
|
ui->nameLabel->setEnabled(false);
|
||||||
ui->expandFrame->hide();
|
ui->expandFrame->hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ protected:
|
||||||
/* GxsGroupFeedItem */
|
/* GxsGroupFeedItem */
|
||||||
virtual QString groupName();
|
virtual QString groupName();
|
||||||
virtual void loadGroup() override;
|
virtual void loadGroup() override;
|
||||||
virtual RetroShareLink::enumType getLinkType() { return RetroShareLink::TYPE_UNKNOWN; }
|
virtual RetroShareLink::enumType getLinkType() { return RetroShareLink::TYPE_WIRE; }
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void toggle() override;
|
void toggle() override;
|
||||||
|
@ -60,12 +60,14 @@ private slots:
|
||||||
private:
|
private:
|
||||||
void fill();
|
void fill();
|
||||||
void setup();
|
void setup();
|
||||||
|
void addEventHandler();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RsWireGroup mGroup;
|
RsWireGroup mGroup;
|
||||||
|
|
||||||
/** Qt Designer generated object */
|
/** Qt Designer generated object */
|
||||||
Ui::WireNotifyGroupItem *ui;
|
Ui::WireNotifyGroupItem *ui;
|
||||||
|
RsEventsHandlerId_t mEventHandlerId;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // WIRENOTIFYGROUPITEM_H
|
#endif // WIRENOTIFYGROUPITEM_H
|
|
@ -172,6 +172,7 @@
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<pointsize>11</pointsize>
|
<pointsize>11</pointsize>
|
||||||
|
<weight>75</weight>
|
||||||
<italic>true</italic>
|
<italic>true</italic>
|
||||||
<bold>true</bold>
|
<bold>true</bold>
|
||||||
</font>
|
</font>
|
||||||
|
@ -186,6 +187,7 @@
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
<pointsize>11</pointsize>
|
<pointsize>11</pointsize>
|
||||||
|
<weight>75</weight>
|
||||||
<italic>true</italic>
|
<italic>true</italic>
|
||||||
<bold>true</bold>
|
<bold>true</bold>
|
||||||
</font>
|
</font>
|
||||||
|
@ -215,6 +217,7 @@
|
||||||
<widget class="QLabel" name="infoLastPostLabel">
|
<widget class="QLabel" name="infoLastPostLabel">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
|
<weight>75</weight>
|
||||||
<bold>true</bold>
|
<bold>true</bold>
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
|
@ -227,6 +230,7 @@
|
||||||
<widget class="QLabel" name="infoLastPost">
|
<widget class="QLabel" name="infoLastPost">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
<font>
|
<font>
|
||||||
|
<weight>75</weight>
|
||||||
<italic>true</italic>
|
<italic>true</italic>
|
||||||
<bold>true</bold>
|
<bold>true</bold>
|
||||||
</font>
|
</font>
|
||||||
|
@ -252,7 +256,7 @@
|
||||||
<enum>Qt::NoFocus</enum>
|
<enum>Qt::NoFocus</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Subscribe to Posted</string>
|
<string><html><head/><body><p>Follow to User</p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Follow</string>
|
<string>Follow</string>
|
||||||
|
|
|
@ -203,6 +203,7 @@ void WireNotifyPostItem::setup()
|
||||||
ui->titleLabel->setMinimumWidth(100);
|
ui->titleLabel->setMinimumWidth(100);
|
||||||
ui->subjectLabel->setMinimumWidth(100);
|
ui->subjectLabel->setMinimumWidth(100);
|
||||||
//ui->warning_label->setMinimumWidth(100);
|
//ui->warning_label->setMinimumWidth(100);
|
||||||
|
ui->titleLabel->setEnabled(false);
|
||||||
|
|
||||||
ui->feedFrame->setProperty("new", false);
|
ui->feedFrame->setProperty("new", false);
|
||||||
ui->feedFrame->style()->unpolish(ui->feedFrame);
|
ui->feedFrame->style()->unpolish(ui->feedFrame);
|
||||||
|
@ -543,16 +544,14 @@ void WireNotifyPostItem::fill()
|
||||||
removeItem();
|
removeItem();
|
||||||
}
|
}
|
||||||
|
|
||||||
// title = tr("Wire Feed") + ": ";
|
|
||||||
// RetroShareLink link = RetroShareLink::createGxsGroupLink(RetroShareLink::TYPE_WIRE, mPulse.mMeta.mGroupId, groupName());
|
|
||||||
// title += link.toHtml();
|
|
||||||
// ui->titleLabel->setText(title);
|
|
||||||
|
|
||||||
msgText = tr("Pulse") + ": ";
|
msgText = tr("Pulse") + ": ";
|
||||||
RetroShareLink msgLink = RetroShareLink::createGxsMessageLink(RetroShareLink::TYPE_WIRE, mPulse.mMeta.mGroupId, mPulse.mMeta.mMsgId, messageName());
|
RetroShareLink msgLink = RetroShareLink::createGxsMessageLink(RetroShareLink::TYPE_WIRE, mPulse.mMeta.mGroupId, mPulse.mMeta.mMsgId, messageName());
|
||||||
msgText += msgLink.toHtml();
|
msgText += msgLink.toHtml();
|
||||||
ui->subjectLabel->setText(msgText);
|
ui->subjectLabel->setText(msgText);
|
||||||
|
|
||||||
|
ui->pulseMessage->setText(QString::fromUtf8(mPulse.mPulseText.c_str()));
|
||||||
|
ui->datetimelabel->setText(DateTime::formatLongDateTime(mPulse.mRefPublishTs));
|
||||||
|
|
||||||
if (IS_GROUP_SUBSCRIBED(mGroupMeta.mSubscribeFlags) || IS_GROUP_ADMIN(mGroupMeta.mSubscribeFlags))
|
if (IS_GROUP_SUBSCRIBED(mGroupMeta.mSubscribeFlags) || IS_GROUP_ADMIN(mGroupMeta.mSubscribeFlags))
|
||||||
{
|
{
|
||||||
ui->unsubscribeButton->setEnabled(true);
|
ui->unsubscribeButton->setEnabled(true);
|
||||||
|
@ -571,8 +570,6 @@ void WireNotifyPostItem::fill()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* subject */
|
|
||||||
ui->titleLabel->setText(QString::fromUtf8(mPulse.mMeta.mMsgName.c_str()));
|
|
||||||
|
|
||||||
/* disable buttons: deletion facility not enabled with cache services yet */
|
/* disable buttons: deletion facility not enabled with cache services yet */
|
||||||
ui->clearButton->setEnabled(false);
|
ui->clearButton->setEnabled(false);
|
||||||
|
@ -645,8 +642,6 @@ void WireNotifyPostItem::fill()
|
||||||
// if (wasExpanded() || ui->expandFrame->isVisible()) {
|
// if (wasExpanded() || ui->expandFrame->isVisible()) {
|
||||||
// fillExpandFrame();
|
// fillExpandFrame();
|
||||||
// }
|
// }
|
||||||
ui->pulseMessage->setText(QString::fromUtf8(mPulse.mPulseText.c_str()));
|
|
||||||
ui->datetimelabel->setText(DateTime::formatLongDateTime(mPulse.mRefPublishTs));
|
|
||||||
|
|
||||||
// if ( (mPulse.mAttachmentCount != 0) || (mPulse.mSize != 0) ) {
|
// if ( (mPulse.mAttachmentCount != 0) || (mPulse.mSize != 0) ) {
|
||||||
// ui->filelabel->setVisible(true);
|
// ui->filelabel->setVisible(true);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue