added up-to-date info about sync period in group data details (channels, boards, forums) and warning when the sync period is too small w.r.t. the date of last post

This commit is contained in:
csoler 2020-10-24 21:17:34 +02:00
parent 709b323b03
commit c30107c248
20 changed files with 331 additions and 183 deletions

View File

@ -1695,6 +1695,14 @@ void RsGenExchange::notifyReceivePublishKey(const RsGxsGroupId &grpId)
mNotifications.push_back(gc);
}
void RsGenExchange::notifyChangedGroupSyncParams(const RsGxsGroupId &grpId)
{
RS_STACK_MUTEX(mGenMtx);
RsGxsGroupChange* gc = new RsGxsGroupChange(RsGxsNotify::TYPE_GROUP_SYNC_PARAMETERS_UPDATED,grpId, false);
mNotifications.push_back(gc);
}
void RsGenExchange::notifyChangedGroupStats(const RsGxsGroupId &grpId)
{
RS_STACK_MUTEX(mGenMtx);

View File

@ -133,28 +133,29 @@ public:
/*!
* @param messages messages are deleted after function returns
*/
virtual void receiveNewMessages(std::vector<RsNxsMsg*>& messages);
virtual void receiveNewMessages(std::vector<RsNxsMsg*>& messages) override;
/*!
* @param groups groups are deleted after function returns
*/
virtual void receiveNewGroups(std::vector<RsNxsGrp*>& groups);
virtual void receiveNewGroups(std::vector<RsNxsGrp*>& groups) override;
/*!
* @param grpId group id
*/
virtual void notifyReceivePublishKey(const RsGxsGroupId &grpId);
virtual void notifyReceivePublishKey(const RsGxsGroupId &grpId) override;
virtual void notifyChangedGroupSyncParams(const RsGxsGroupId &grpId) override;
/*!
* \brief notifyReceiveDistantSearchResults
* Should be called when new search results arrive.
* \param grpId
*/
virtual void receiveDistantSearchResults(TurtleRequestId id,const RsGxsGroupId &grpId);
virtual void receiveDistantSearchResults(TurtleRequestId id,const RsGxsGroupId &grpId) override;
/*!
* @param grpId group id
*/
virtual void notifyChangedGroupStats(const RsGxsGroupId &grpId);
virtual void notifyChangedGroupStats(const RsGxsGroupId &grpId) override;
/** E: Observer implementation **/

View File

@ -446,6 +446,7 @@ int RsGxsNetService::tick()
should_notify = should_notify || !mNewMessagesToNotify.empty() ;
should_notify = should_notify || !mNewPublishKeysToNotify.empty() ;
should_notify = should_notify || !mNewStatsToNotify.empty() ;
should_notify = should_notify || !mNewGrpSyncParamsToNotify.empty() ;
}
if(should_notify)
@ -490,7 +491,7 @@ void RsGxsNetService::processObserverNotifications()
std::vector<RsNxsGrp*> grps_copy ;
std::vector<RsNxsMsg*> msgs_copy ;
std::set<RsGxsGroupId> stat_copy ;
std::set<RsGxsGroupId> keys_copy ;
std::set<RsGxsGroupId> keys_copy,grpss_copy ;
{
RS_STACK_MUTEX(mNxsMutex) ;
@ -499,11 +500,13 @@ void RsGxsNetService::processObserverNotifications()
msgs_copy = mNewMessagesToNotify ;
stat_copy = mNewStatsToNotify ;
keys_copy = mNewPublishKeysToNotify ;
grpss_copy = mNewGrpSyncParamsToNotify ;
mNewGroupsToNotify.clear() ;
mNewMessagesToNotify.clear() ;
mNewStatsToNotify.clear() ;
mNewPublishKeysToNotify.clear() ;
mNewGrpSyncParamsToNotify.clear() ;
}
if(!grps_copy.empty()) mObserver->receiveNewGroups (grps_copy);
@ -514,6 +517,9 @@ void RsGxsNetService::processObserverNotifications()
for(std::set<RsGxsGroupId>::const_iterator it(stat_copy.begin());it!=stat_copy.end();++it)
mObserver->notifyChangedGroupStats(*it);
for(std::set<RsGxsGroupId>::const_iterator it(grpss_copy.begin());it!=grpss_copy.end();++it)
mObserver->notifyChangedGroupSyncParams(*it);
}
void RsGxsNetService::rejectMessage(const RsGxsMessageId& msg_id)
@ -4740,6 +4746,10 @@ void RsGxsNetService::setSyncAge(const RsGxsGroupId &grpId, uint32_t age_in_secs
locked_resetClientTS(grpId);
IndicateConfigChanged();
// also send an event so that UI is updated
mNewGrpSyncParamsToNotify.insert(grpId);
}
}
void RsGxsNetService::setKeepAge(const RsGxsGroupId &grpId, uint32_t age_in_secs)

View File

@ -608,6 +608,7 @@ private:
std::vector<RsNxsMsg*> mNewMessagesToNotify ;
std::set<RsGxsGroupId> mNewStatsToNotify ;
std::set<RsGxsGroupId> mNewPublishKeysToNotify ;
std::set<RsGxsGroupId> mNewGrpSyncParamsToNotify ;
// Distant search result map
std::map<TurtleRequestId,std::map<RsGxsGroupId,RsGxsGroupSearchResults> > mDistantSearchResults ;

View File

@ -48,6 +48,7 @@ public:
TYPE_UPDATED = 0x07,
TYPE_MESSAGE_DELETED = 0x08,
TYPE_GROUP_DELETED = 0x09,
TYPE_GROUP_SYNC_PARAMETERS_UPDATED = 0x0a,
};
virtual NotifyType getType() = 0;

View File

@ -61,6 +61,11 @@ public:
*/
virtual void notifyReceivePublishKey(const RsGxsGroupId &grpId) = 0;
/*!
* \brief notifyChangedGroupSyncParams
* \param caled when a group sync parameter is updated
*/
virtual void notifyChangedGroupSyncParams(const RsGxsGroupId &grpId) = 0;
/*!
* @param grpId group id
*/

View File

@ -113,6 +113,7 @@ enum class RsChannelEventCode: uint8_t
READ_STATUS_CHANGED = 0x07, // existing message has been read or set to unread
RECEIVED_DISTANT_SEARCH_RESULT = 0x08, // result for the given group id available for the given turtle request id
STATISTICS_CHANGED = 0x09, // stats (nb of supplier friends, how many msgs they have etc) has changed
SYNC_PARAMETERS_UPDATED = 0x0a, // sync and storage times have changed
};
struct RsGxsChannelEvent: RsEvent

View File

@ -115,6 +115,7 @@ enum class RsForumEventCode: uint8_t
READ_STATUS_CHANGED = 0x06, /// msg was read or marked unread
STATISTICS_CHANGED = 0x07, /// suppliers and how many messages they have changed
MODERATOR_LIST_CHANGED = 0x08, /// forum moderation list has changed.
SYNC_PARAMETERS_UPDATED = 0x0a, /// sync and storage times have changed
};
struct RsGxsForumEvent: RsEvent

View File

@ -116,6 +116,7 @@ enum class RsPostedEventCode: uint8_t
READ_STATUS_CHANGED = 0x06,
STATISTICS_CHANGED = 0x07,
MESSAGE_VOTES_UPDATED = 0x08,
SYNC_PARAMETERS_UPDATED = 0x09,
};

View File

@ -309,6 +309,15 @@ void p3GxsChannels::notifyChanges(std::vector<RsGxsNotify *> &changes)
}
break;
case RsGxsNotify::TYPE_GROUP_SYNC_PARAMETERS_UPDATED:
{
auto ev = std::make_shared<RsGxsChannelEvent>();
ev->mChannelGroupId = grpChange->mGroupId;
ev->mChannelEventCode = RsChannelEventCode::SYNC_PARAMETERS_UPDATED;
rsEvents->postEvent(ev);
}
break;
case RsGxsNotify::TYPE_STATISTICS_CHANGED:
{
auto ev = std::make_shared<RsGxsChannelEvent>();

View File

@ -256,6 +256,15 @@ void p3GxsForums::notifyChanges(std::vector<RsGxsNotify *> &changes)
}
break;
case RsGxsNotify::TYPE_GROUP_SYNC_PARAMETERS_UPDATED:
{
auto ev = std::make_shared<RsGxsForumEvent>();
ev->mForumGroupId = grpChange->mGroupId;
ev->mForumEventCode = RsForumEventCode::SYNC_PARAMETERS_UPDATED;
rsEvents->postEvent(ev);
}
break;
case RsGxsNotify::TYPE_PUBLISHED:
case RsGxsNotify::TYPE_RECEIVED_NEW:
{

View File

@ -162,6 +162,15 @@ void p3PostBase::notifyChanges(std::vector<RsGxsNotify *> &changes)
}
break;
case RsGxsNotify::TYPE_GROUP_SYNC_PARAMETERS_UPDATED:
{
auto ev = std::make_shared<RsGxsPostedEvent>();
ev->mPostedGroupId = group_id;
ev->mPostedEventCode = RsPostedEventCode::SYNC_PARAMETERS_UPDATED;
rsEvents->postEvent(ev);
}
break;
case RsGxsNotify::TYPE_STATISTICS_CHANGED:
{
auto ev = std::make_shared<RsGxsPostedEvent>();

View File

@ -36,15 +36,15 @@ public:
/** Default Destructor */
~PostedDialog();
virtual QIcon iconPixmap() const { return QIcon(IMAGE_POSTED) ; } //MainPage
virtual QString pageName() const { return tr("Boards") ; } //MainPage
virtual QString helpText() const { return ""; } //MainPage
virtual QIcon iconPixmap() const override { return QIcon(IMAGE_POSTED) ; } //MainPage
virtual QString pageName() const override { return tr("Boards") ; } //MainPage
virtual QString helpText() const override { return ""; } //MainPage
protected:
virtual UserNotify *createUserNotify(QObject *parent) override;
virtual QString getHelpString() const ;
virtual RetroShareLink::enumType getLinkType() { return RetroShareLink::TYPE_POSTED; }
virtual GroupFrameSettings::Type groupFrameSettingsType() { return GroupFrameSettings::Posted; }
virtual QString getHelpString() const override;
virtual RetroShareLink::enumType getLinkType() override { return RetroShareLink::TYPE_POSTED; }
virtual GroupFrameSettings::Type groupFrameSettingsType() override { return GroupFrameSettings::Posted; }
void groupInfoToGroupItemInfo(const RsGxsGenericGroupData *groupData, GroupItemInfo &groupItemInfo) override;
bool getGroupData(std::list<RsGxsGenericGroupData*>& groupInfo) override;
@ -52,16 +52,16 @@ protected:
private:
/* GxsGroupFrameDialog */
virtual QString text(TextType type);
virtual QString icon(IconType type);
virtual QString settingsGroupName() { return "PostedDialog"; }
virtual GxsGroupDialog *createNewGroupDialog();
virtual GxsGroupDialog *createGroupDialog(GxsGroupDialog::Mode mode, RsGxsGroupId groupId);
virtual int shareKeyType();
virtual GxsMessageFrameWidget *createMessageFrameWidget(const RsGxsGroupId &groupId);
virtual RsGxsCommentService *getCommentService();
virtual QWidget *createCommentHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId);
virtual uint32_t requestGroupSummaryType() { return GXS_REQUEST_TYPE_GROUP_DATA; } // request complete group data
virtual QString text(TextType type) override;
virtual QString icon(IconType type) override;
virtual QString settingsGroupName() override{ return "PostedDialog"; }
virtual GxsGroupDialog *createNewGroupDialog() override;
virtual GxsGroupDialog *createGroupDialog(GxsGroupDialog::Mode mode, RsGxsGroupId groupId) override;
virtual int shareKeyType() override;
virtual GxsMessageFrameWidget *createMessageFrameWidget(const RsGxsGroupId &groupId) override;
virtual RsGxsCommentService *getCommentService() override;
virtual QWidget *createCommentHeaderWidget(const RsGxsGroupId &grpId, const RsGxsMessageId &msgId) override;
virtual uint32_t requestGroupSummaryType() override { return GXS_REQUEST_TYPE_GROUP_DATA; } // request complete group data
void handleEvent_main_thread(std::shared_ptr<const RsEvent> event);
RsEventsHandlerId_t mEventHandlerId;

View File

@ -29,6 +29,7 @@
#include "ui_PostedListWidgetWithModel.h"
#include "gui/feeds/GxsChannelPostItem.h"
#include "gui/gxs/GxsIdDetails.h"
#include "gui/gxs/GxsGroupFrameDialog.h"
#include "gui/gxs/GxsCommentDialog.h"
#include "util/misc.h"
#include "gui/Posted/PostedCreatePostDialog.h"
@ -277,7 +278,7 @@ PostedListWidgetWithModel::PostedListWidgetWithModel(const RsGxsGroupId& postedI
connect(NotifyQt::getInstance(), SIGNAL(settingsChanged()),this, SLOT(settingsChanged()));
/* add filter actions */
ui->postsTree->setPlaceholderText(tr("Thumbnails"));
ui->postsTree->setPlaceholderText(tr("No posts available in this board"));
//ui->postsTree->setMinimumWidth(COLUMN_SIZE_FONT_FACTOR_W*QFontMetricsF(font()).height()+1);
connect(ui->postsTree,SIGNAL(sizeChanged(QSize)),this,SLOT(handlePostsTreeSizeChange(QSize)));
@ -488,6 +489,7 @@ void PostedListWidgetWithModel::handleEvent_main_thread(std::shared_ptr<const Rs
case RsPostedEventCode::NEW_POSTED_GROUP: // [[fallthrough]];
case RsPostedEventCode::UPDATED_POSTED_GROUP: // [[fallthrough]];
case RsPostedEventCode::UPDATED_MESSAGE:
case RsPostedEventCode::SYNC_PARAMETERS_UPDATED:
{
if(e->mPostedGroupId == groupId())
updateDisplay(true);
@ -855,6 +857,28 @@ void PostedListWidgetWithModel::insertBoardDetails(const RsPostedGroup& group)
ui->infoLastPost->setText(tr("Never"));
else
ui->infoLastPost->setText(DateTime::formatLongDateTime(group.mMeta.mLastPost));
uint32_t current_sync_time = GxsGroupFrameDialog::checkDelay(rsPosted->getSyncPeriod(group.mMeta.mGroupId))/86400 ;
QString sync_string;
switch(current_sync_time)
{
case 5: sync_string = tr("5 days"); break;
case 15: sync_string = tr("2 weeks"); break;
case 30: sync_string = tr("1 month"); break;
case 90: sync_string = tr("3 months"); break;
case 180: sync_string = tr("6 months"); break;
case 365: sync_string = tr("1 year"); break;
case 0: sync_string = tr("indefinitly"); break;
default:
sync_string = tr("Unknown");
}
if(group.mMeta.mLastPost + rsPosted->getSyncPeriod(group.mMeta.mGroupId) < time(NULL) && IS_GROUP_SUBSCRIBED(group.mMeta.mSubscribeFlags))
sync_string += " (Warning: will not allow latest posts to sync)";
ui->syncPeriodLabel->setText(sync_string);
QString formatDescription = QString::fromUtf8(group.mDescription.c_str());
unsigned int formatFlag = RSHTML_FORMATTEXT_EMBED_LINKS;

View File

@ -47,18 +47,6 @@
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<widget class="QLabel" name="namelabel">
<property name="font">
<font>
<pointsize>14</pointsize>
</font>
</property>
<property name="text">
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="0" column="3">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="sizeConstraint">
@ -127,26 +115,6 @@
</item>
</layout>
</item>
<item row="2" column="1">
<widget class="QLabel" name="infoPosts">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string notr="true">0</string>
</property>
</widget>
</item>
<item row="6" column="1" colspan="5">
<widget class="QLabel" name="infoDistribution">
<property name="text">
<string>unknown</string>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="logoLabel">
<property name="minimumSize">
@ -169,16 +137,23 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="createdlabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
<item row="0" column="2">
<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 row="3" column="1" colspan="5">
<widget class="QLabel" name="infoLastPost">
<property name="text">
<string>Created</string>
<string notr="true">unknown</string>
</property>
</widget>
</item>
@ -195,33 +170,7 @@
</property>
</widget>
</item>
<item row="4" column="1" colspan="5">
<widget class="QLabel" name="createdinfolabel">
<property name="text">
<string>unknown</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="infoPostsLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Posts</string>
</property>
</widget>
</item>
<item row="4" column="0">
<item row="5" column="0">
<widget class="QLabel" name="label">
<property name="font">
<font>
@ -234,18 +183,15 @@
</property>
</widget>
</item>
<item row="5" column="1" colspan="5">
<widget class="GxsIdLabel" name="infoAdministrator">
<item row="7" column="1" colspan="5">
<widget class="QLabel" name="infoDistribution">
<property name="text">
<string>unknown</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<item row="7" column="0">
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<weight>75</weight>
@ -253,7 +199,7 @@
</font>
</property>
<property name="text">
<string>Popularity</string>
<string>Distribution:</string>
</property>
</widget>
</item>
@ -276,8 +222,8 @@
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="label_3">
<item row="2" column="1">
<widget class="QLabel" name="infoPosts">
<property name="font">
<font>
<weight>75</weight>
@ -285,29 +231,103 @@
</font>
</property>
<property name="text">
<string>Distribution:</string>
<string notr="true">0</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="5">
<widget class="QLabel" name="infoLastPost">
<item row="6" column="0">
<widget class="QLabel" name="createdlabel">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string notr="true">unknown</string>
<string>Created</string>
</property>
</widget>
</item>
<item row="0" column="2">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<item row="0" column="1">
<widget class="QLabel" name="namelabel">
<property name="font">
<font>
<pointsize>14</pointsize>
</font>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
<property name="text">
<string>TextLabel</string>
</property>
</spacer>
</widget>
</item>
<item row="5" column="1" colspan="5">
<widget class="QLabel" name="createdinfolabel">
<property name="text">
<string>unknown</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Popularity</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="infoPostsLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Posts</string>
</property>
</widget>
</item>
<item row="6" column="1" colspan="5">
<widget class="GxsIdLabel" name="infoAdministrator">
<property name="text">
<string>unknown</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Sync period:</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QLabel" name="syncPeriodLabel">
<property name="text">
<string>unknown</string>
</property>
</widget>
</item>
</layout>
</item>
@ -320,7 +340,7 @@
<string notr="true">&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'MS Shell Dlg 2'; font-size:8pt;&quot;&gt;Description&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textInteractionFlags">

View File

@ -388,7 +388,7 @@ void GxsGroupFrameDialog::removeAllSearches()
// Same function than the one in rsgxsnetservice.cc, so that all times are automatically consistent
static uint32_t checkDelay(uint32_t time_in_secs)
uint32_t GxsGroupFrameDialog::checkDelay(uint32_t time_in_secs)
{
if(time_in_secs < 1 * 86400)
return 0 ;

View File

@ -82,6 +82,8 @@ public:
void getServiceStatistics(GxsServiceStatistic& stats) const ;
static uint32_t checkDelay(uint32_t time_in_secs);
protected:
virtual void showEvent(QShowEvent *event) override;
virtual void paintEvent(QPaintEvent *pe) override;

View File

@ -29,6 +29,7 @@
#include "ui_GxsChannelPostsWidgetWithModel.h"
#include "gui/feeds/GxsChannelPostItem.h"
#include "gui/gxs/GxsIdDetails.h"
#include "gui/gxs/GxsGroupFrameDialog.h"
#include "util/misc.h"
#include "gui/gxschannels/CreateGxsChannelMsg.h"
#include "gui/common/UIStateHelper.h"
@ -429,7 +430,7 @@ GxsChannelPostsWidgetWithModel::GxsChannelPostsWidgetWithModel(const RsGxsGroupI
ui->filterLineEdit->setPlaceholderText(tr("Search..."));
connect(ui->filterLineEdit, SIGNAL(textChanged(QString)), this, SLOT(filterChanged(QString)));
ui->postsTree->setPlaceholderText(tr("Thumbnails"));
ui->postsTree->setPlaceholderText(tr("No posts available in this channel"));
ui->postsTree->setMinimumWidth(COLUMN_SIZE_FONT_FACTOR_W*QFontMetricsF(font()).height()+1);
connect(ui->postsTree,SIGNAL(sizeChanged(QSize)),this,SLOT(handlePostsTreeSizeChange(QSize)));
@ -702,6 +703,7 @@ void GxsChannelPostsWidgetWithModel::handleEvent_main_thread(std::shared_ptr<con
case RsChannelEventCode::UPDATED_CHANNEL: // [[fallthrough]];
case RsChannelEventCode::NEW_MESSAGE: // [[fallthrough]];
case RsChannelEventCode::UPDATED_MESSAGE:
case RsChannelEventCode::SYNC_PARAMETERS_UPDATED:
{
if(e->mChannelGroupId == groupId())
updateDisplay(true);
@ -1067,6 +1069,29 @@ void GxsChannelPostsWidgetWithModel::insertChannelDetails(const RsGxsChannelGrou
ui->infoLastPost->setText(tr("Never"));
else
ui->infoLastPost->setText(DateTime::formatLongDateTime(group.mMeta.mLastPost));
uint32_t current_sync_time = GxsGroupFrameDialog::checkDelay(rsGxsChannels->getSyncPeriod(group.mMeta.mGroupId))/86400 ;
QString sync_string;
switch(current_sync_time)
{
case 5: sync_string = tr("5 days"); break;
case 15: sync_string = tr("2 weeks"); break;
case 30: sync_string = tr("1 month"); break;
case 90: sync_string = tr("3 months"); break;
case 180: sync_string = tr("6 months"); break;
case 365: sync_string = tr("1 year"); break;
case 0: sync_string = tr("indefinitly"); break;
default:
sync_string = tr("Unknown");
}
if(group.mMeta.mLastPost + rsGxsChannels->getSyncPeriod(group.mMeta.mGroupId) < time(NULL) && IS_GROUP_SUBSCRIBED(group.mMeta.mSubscribeFlags))
sync_string += " (Warning: will not allow latest posts to sync)";
ui->infoSyncTimeLabel->setText(sync_string);
QString formatDescription = QString::fromUtf8(group.mDescription.c_str());
unsigned int formatFlag = RSHTML_FORMATTEXT_EMBED_LINKS;

View File

@ -181,7 +181,7 @@
<item>
<widget class="QTabWidget" name="channel_TW">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="tab_3">
<attribute name="title">
@ -219,7 +219,27 @@
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="3">
<item row="4" column="1" colspan="2">
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Distribution:</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="infoPosts">
<property name="text">
<string notr="true">0</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="GxsIdLabel" name="infoAdministrator">
<property name="text">
<string>unknown</string>
@ -229,6 +249,20 @@
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel" name="infoLastPost">
<property name="text">
<string notr="true">unknown</string>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QLabel" name="infoDistribution">
<property name="text">
<string>unknown</string>
</property>
</widget>
</item>
<item row="1" column="1" colspan="2">
<widget class="QLabel" name="infoLastPostLabel">
<property name="sizePolicy">
@ -248,14 +282,7 @@
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QLabel" name="infoCreated">
<property name="text">
<string>unknown</string>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<item row="3" column="1" colspan="2">
<widget class="QLabel" name="label">
<property name="font">
<font>
@ -268,53 +295,6 @@
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QLabel" name="infoLastPost">
<property name="text">
<string notr="true">unknown</string>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Distribution:</string>
</property>
</widget>
</item>
<item row="4" column="1" colspan="2">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Created:</string>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QLabel" name="infoPosts">
<property name="text">
<string notr="true">0</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QLabel" name="infoDistribution">
<property name="text">
<string>unknown</string>
</property>
</widget>
</item>
<item row="0" column="1" colspan="2">
<widget class="QLabel" name="infoPostsLabel">
<property name="sizePolicy">
@ -337,6 +317,46 @@
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QLabel" name="infoCreated">
<property name="text">
<string>unknown</string>
</property>
</widget>
</item>
<item row="5" column="1" colspan="2">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Created:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Sync period:</string>
</property>
</widget>
</item>
<item row="2" column="3">
<widget class="QLabel" name="infoSyncTimeLabel">
<property name="text">
<string>unknown</string>
</property>
</widget>
</item>
</layout>
</item>
<item>

View File

@ -383,6 +383,7 @@ void GxsForumThreadWidget::handleEvent_main_thread(std::shared_ptr<const RsEvent
case RsForumEventCode::NEW_FORUM: // [[fallthrough]];
case RsForumEventCode::UPDATED_MESSAGE: // [[fallthrough]];
case RsForumEventCode::NEW_MESSAGE:
case RsForumEventCode::SYNC_PARAMETERS_UPDATED:
if(e->mForumGroupId == mForumGroup.mMeta.mGroupId)
updateDisplay(true);
break;