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