mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-07-28 17:04:58 -04:00
added NewsFeed item for advertising about new/removed moderators
This commit is contained in:
parent
f7199f1f1c
commit
89843a6cbe
5 changed files with 111 additions and 12 deletions
|
@ -251,14 +251,20 @@ void NewsFeed::handleForumEvent(std::shared_ptr<const RsEvent> event)
|
||||||
|
|
||||||
switch(pe->mForumEventCode)
|
switch(pe->mForumEventCode)
|
||||||
{
|
{
|
||||||
|
case RsForumEventCode::MODERATOR_LIST_CHANGED:
|
||||||
|
addFeedItem(new GxsForumGroupItem(this, NEWSFEED_UPDATED_FORUM, pe->mForumGroupId,pe->mModeratorsAdded,pe->mModeratorsRemoved, false, true));
|
||||||
|
break;
|
||||||
|
|
||||||
case RsForumEventCode::UPDATED_FORUM:
|
case RsForumEventCode::UPDATED_FORUM:
|
||||||
case RsForumEventCode::NEW_FORUM:
|
case RsForumEventCode::NEW_FORUM:
|
||||||
addFeedItem(new GxsForumGroupItem(this, NEWSFEED_FORUMNEWLIST, pe->mForumGroupId, false, true));
|
addFeedItem(new GxsForumGroupItem(this, NEWSFEED_NEW_FORUM, pe->mForumGroupId, false, true));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RsForumEventCode::UPDATED_MESSAGE:
|
case RsForumEventCode::UPDATED_MESSAGE:
|
||||||
case RsForumEventCode::NEW_MESSAGE:
|
case RsForumEventCode::NEW_MESSAGE:
|
||||||
addFeedItem(new GxsForumMsgItem(this, NEWSFEED_FORUMNEWLIST, pe->mForumGroupId, pe->mForumMsgId, false, true));
|
addFeedItem(new GxsForumMsgItem(this, NEWSFEED_NEW_FORUM, pe->mForumGroupId, pe->mForumMsgId, false, true));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,8 +31,10 @@
|
||||||
|
|
||||||
const uint32_t NEWSFEED_PEERLIST = 0x0001;
|
const uint32_t NEWSFEED_PEERLIST = 0x0001;
|
||||||
|
|
||||||
const uint32_t NEWSFEED_FORUMNEWLIST = 0x0002;
|
const uint32_t NEWSFEED_NEW_FORUM = 0x0002;
|
||||||
const uint32_t NEWSFEED_FORUMMSGLIST = 0x0003;
|
const uint32_t NEWSFEED_NEW_FORUM_MSG = 0x0003;
|
||||||
|
const uint32_t NEWSFEED_UPDATED_FORUM = 0x000f;
|
||||||
|
|
||||||
const uint32_t NEWSFEED_CHANNELNEWLIST = 0x0004;
|
const uint32_t NEWSFEED_CHANNELNEWLIST = 0x0004;
|
||||||
//const uint32_t NEWSFEED_CHANNELMSGLIST = 0x0005;
|
//const uint32_t NEWSFEED_CHANNELMSGLIST = 0x0005;
|
||||||
#if 0
|
#if 0
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
|
|
||||||
#include "GxsForumGroupItem.h"
|
#include "GxsForumGroupItem.h"
|
||||||
#include "ui_GxsForumGroupItem.h"
|
#include "ui_GxsForumGroupItem.h"
|
||||||
|
#include "gui/NewsFeed.h"
|
||||||
|
|
||||||
#include "FeedHolder.h"
|
#include "FeedHolder.h"
|
||||||
#include "gui/RetroShareLink.h"
|
#include "gui/RetroShareLink.h"
|
||||||
|
@ -37,6 +38,16 @@ GxsForumGroupItem::GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, co
|
||||||
requestGroup();
|
requestGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GxsForumGroupItem::GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const std::list<RsGxsId>& added_moderators,const std::list<RsGxsId>& removed_moderators,bool isHome, bool autoUpdate):
|
||||||
|
GxsGroupFeedItem(feedHolder, feedId, groupId, isHome, rsGxsForums, autoUpdate),
|
||||||
|
mAddedModerators(added_moderators),
|
||||||
|
mRemovedModerators(removed_moderators)
|
||||||
|
{
|
||||||
|
setup();
|
||||||
|
|
||||||
|
requestGroup();
|
||||||
|
}
|
||||||
|
|
||||||
GxsForumGroupItem::GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsForumGroup &group, bool isHome, bool autoUpdate) :
|
GxsForumGroupItem::GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsForumGroup &group, bool isHome, bool autoUpdate) :
|
||||||
GxsGroupFeedItem(feedHolder, feedId, group.mMeta.mGroupId, isHome, rsGxsForums, autoUpdate)
|
GxsGroupFeedItem(feedHolder, feedId, group.mMeta.mGroupId, isHome, rsGxsForums, autoUpdate)
|
||||||
{
|
{
|
||||||
|
@ -158,10 +169,59 @@ void GxsForumGroupItem::fill()
|
||||||
ui->subscribeButton->setEnabled(true);
|
ui->subscribeButton->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (mIsNew)
|
if(feedId() == NEWSFEED_UPDATED_FORUM)
|
||||||
// {
|
{
|
||||||
|
if(!mAddedModerators.empty() || !mRemovedModerators.empty())
|
||||||
|
{
|
||||||
|
ui->titleLabel->setText(tr("Moderator list changed"));
|
||||||
|
ui->moderatorList_GB->show();
|
||||||
|
|
||||||
|
QString msg;
|
||||||
|
|
||||||
|
if(!mAddedModerators.empty())
|
||||||
|
{
|
||||||
|
msg += "<b>Added moderators:</b>" ;
|
||||||
|
msg += "<p>";
|
||||||
|
for(auto& gxsid: mAddedModerators)
|
||||||
|
{
|
||||||
|
RsIdentityDetails det;
|
||||||
|
if(rsIdentity->getIdDetails(gxsid,det))
|
||||||
|
msg += QString::fromUtf8(det.mNickname.c_str())+" ("+QString::fromStdString(gxsid.toStdString())+"), ";
|
||||||
|
else
|
||||||
|
msg += QString("[Unknown name]") + " ("+QString::fromStdString(gxsid.toStdString())+"), ";
|
||||||
|
}
|
||||||
|
msg.resize(msg.size()-2);
|
||||||
|
msg += "</p>";
|
||||||
|
}
|
||||||
|
if(!mRemovedModerators.empty())
|
||||||
|
{
|
||||||
|
msg += "<b>Removed moderators:</b>" ;
|
||||||
|
msg += "<p>";
|
||||||
|
for(auto& gxsid: mRemovedModerators)
|
||||||
|
{
|
||||||
|
RsIdentityDetails det;
|
||||||
|
|
||||||
|
if( rsIdentity->getIdDetails(gxsid,det))
|
||||||
|
msg += QString::fromUtf8(det.mNickname.c_str())+" ("+QString::fromStdString(gxsid.toStdString())+"), ";
|
||||||
|
else
|
||||||
|
msg += QString("[Unknown name]") + " ("+QString::fromStdString(gxsid.toStdString())+"), ";
|
||||||
|
}
|
||||||
|
msg.resize(msg.size()-2);
|
||||||
|
msg += "</p>";
|
||||||
|
}
|
||||||
|
ui->moderatorList_TE->setText(msg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->moderatorList_GB->hide();
|
||||||
|
|
||||||
|
ui->titleLabel->setText(tr("Forum updated"));
|
||||||
|
ui->moderatorList_GB->hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
ui->titleLabel->setText(tr("New Forum"));
|
ui->titleLabel->setText(tr("New Forum"));
|
||||||
// }
|
|
||||||
// else
|
// else
|
||||||
// {
|
// {
|
||||||
// ui->titleLabel->setText(tr("Updated Forum"));
|
// ui->titleLabel->setText(tr("Updated Forum"));
|
||||||
|
|
|
@ -37,6 +37,7 @@ class GxsForumGroupItem : public GxsGroupFeedItem
|
||||||
public:
|
public:
|
||||||
/** Default Constructor */
|
/** Default Constructor */
|
||||||
GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, bool isHome, bool autoUpdate);
|
GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, bool isHome, bool autoUpdate);
|
||||||
|
GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const std::list<RsGxsId>& added_moderators,const std::list<RsGxsId>& removed_moderators,bool isHome, bool autoUpdate);
|
||||||
GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsForumGroup &group, bool isHome, bool autoUpdate);
|
GxsForumGroupItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsForumGroup &group, bool isHome, bool autoUpdate);
|
||||||
~GxsForumGroupItem();
|
~GxsForumGroupItem();
|
||||||
|
|
||||||
|
@ -65,6 +66,9 @@ private:
|
||||||
|
|
||||||
/** Qt Designer generated object */
|
/** Qt Designer generated object */
|
||||||
Ui::GxsForumGroupItem *ui;
|
Ui::GxsForumGroupItem *ui;
|
||||||
|
|
||||||
|
std::list<RsGxsId> mAddedModerators;
|
||||||
|
std::list<RsGxsId> mRemovedModerators;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>618</width>
|
<width>784</width>
|
||||||
<height>161</height>
|
<height>464</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout">
|
<layout class="QGridLayout">
|
||||||
|
@ -104,8 +104,8 @@
|
||||||
<property name="frameShadow">
|
<property name="frameShadow">
|
||||||
<enum>QFrame::Sunken</enum>
|
<enum>QFrame::Sunken</enum>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item row="0" column="0">
|
<item>
|
||||||
<layout class="QGridLayout">
|
<layout class="QGridLayout">
|
||||||
<item row="0" column="0" rowspan="2">
|
<item row="0" column="0" rowspan="2">
|
||||||
<widget class="QLabel" name="forumlogo_label">
|
<widget class="QLabel" name="forumlogo_label">
|
||||||
|
@ -280,7 +280,7 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item>
|
||||||
<widget class="QFrame" name="expandFrame">
|
<widget class="QFrame" name="expandFrame">
|
||||||
<layout class="QVBoxLayout">
|
<layout class="QVBoxLayout">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
|
@ -334,6 +334,33 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="moderatorList_GB">
|
||||||
|
<property name="title">
|
||||||
|
<string>Moderator list</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<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>
|
||||||
|
<widget class="QTextEdit" name="moderatorList_TE"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue