mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
Revert "attempt to delay channel post loading on demand when displayed"
This commit is contained in:
parent
f5abf54aaf
commit
9a5e46dd49
@ -51,13 +51,11 @@ GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId,
|
|||||||
{
|
{
|
||||||
setup();
|
setup();
|
||||||
|
|
||||||
mLoaded = false ;
|
requestGroup();
|
||||||
|
requestMessage();
|
||||||
|
requestComment();
|
||||||
}
|
}
|
||||||
|
|
||||||
// This code has been suspended because it adds more complexity than usefulness.
|
|
||||||
// It was used to load a channel post where the post item is already known.
|
|
||||||
|
|
||||||
#ifdef SUSPENDED
|
|
||||||
GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelGroup &group, const RsGxsChannelPost &post, bool isHome, bool autoUpdate) :
|
GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelGroup &group, const RsGxsChannelPost &post, bool isHome, bool autoUpdate) :
|
||||||
GxsFeedItem(feedHolder, feedId, post.mMeta.mGroupId, post.mMeta.mMsgId, isHome, rsGxsChannels, autoUpdate)
|
GxsFeedItem(feedHolder, feedId, post.mMeta.mGroupId, post.mMeta.mMsgId, isHome, rsGxsChannels, autoUpdate)
|
||||||
{
|
{
|
||||||
@ -84,9 +82,9 @@ GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId,
|
|||||||
setup();
|
setup();
|
||||||
|
|
||||||
setGroup(group, false);
|
setGroup(group, false);
|
||||||
|
//requestGroup(); //Already have RsGxsChannelGroup
|
||||||
setPost(post,false);
|
setPost(post);
|
||||||
mLoaded = false ;
|
requestComment();
|
||||||
}
|
}
|
||||||
|
|
||||||
GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelPost &post, bool isHome, bool autoUpdate) :
|
GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelPost &post, bool isHome, bool autoUpdate) :
|
||||||
@ -99,30 +97,10 @@ GxsChannelPostItem::GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId,
|
|||||||
|
|
||||||
setup();
|
setup();
|
||||||
|
|
||||||
mLoaded = true ;
|
|
||||||
requestGroup();
|
requestGroup();
|
||||||
setPost(post);
|
setPost(post);
|
||||||
requestComment();
|
requestComment();
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
void GxsChannelPostItem::paintEvent(QPaintEvent *e)
|
|
||||||
{
|
|
||||||
/* This method employs a trick to trigger a deferred loading. The post and group is requested only
|
|
||||||
* when actually displayed on the screen. */
|
|
||||||
|
|
||||||
if(!mLoaded)
|
|
||||||
{
|
|
||||||
mLoaded = true ;
|
|
||||||
|
|
||||||
requestGroup();
|
|
||||||
requestMessage();
|
|
||||||
requestComment();
|
|
||||||
}
|
|
||||||
|
|
||||||
GxsFeedItem::paintEvent(e) ;
|
|
||||||
}
|
|
||||||
|
|
||||||
GxsChannelPostItem::~GxsChannelPostItem()
|
GxsChannelPostItem::~GxsChannelPostItem()
|
||||||
{
|
{
|
||||||
|
@ -41,11 +41,9 @@ class GxsChannelPostItem : public GxsFeedItem
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// This one is used in NewFeed for incoming channel posts. Only the group and msg ids are known at this point.
|
|
||||||
GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate);
|
GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsGroupId &groupId, const RsGxsMessageId &messageId, bool isHome, bool autoUpdate);
|
||||||
|
GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelGroup &group, const RsGxsChannelPost &post, bool isHome, bool autoUpdate);
|
||||||
//GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelGroup &group, const RsGxsChannelPost &post, bool isHome, bool autoUpdate);
|
GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelPost &post, bool isHome, bool autoUpdate);
|
||||||
//GxsChannelPostItem(FeedHolder *feedHolder, uint32_t feedId, const RsGxsChannelPost &post, bool isHome, bool autoUpdate);
|
|
||||||
virtual ~GxsChannelPostItem();
|
virtual ~GxsChannelPostItem();
|
||||||
|
|
||||||
bool setGroup(const RsGxsChannelGroup &group, bool doFill = true);
|
bool setGroup(const RsGxsChannelGroup &group, bool doFill = true);
|
||||||
@ -64,8 +62,6 @@ protected:
|
|||||||
virtual void doExpand(bool open);
|
virtual void doExpand(bool open);
|
||||||
virtual void expandFill(bool first);
|
virtual void expandFill(bool first);
|
||||||
|
|
||||||
virtual void paintEvent(QPaintEvent *);
|
|
||||||
|
|
||||||
/* GxsGroupFeedItem */
|
/* GxsGroupFeedItem */
|
||||||
virtual QString groupName();
|
virtual QString groupName();
|
||||||
virtual void loadGroup(const uint32_t &token);
|
virtual void loadGroup(const uint32_t &token);
|
||||||
@ -105,7 +101,6 @@ private:
|
|||||||
private:
|
private:
|
||||||
bool mInFill;
|
bool mInFill;
|
||||||
bool mCloseOnRead;
|
bool mCloseOnRead;
|
||||||
bool mLoaded;
|
|
||||||
|
|
||||||
RsGxsChannelGroup mGroup;
|
RsGxsChannelGroup mGroup;
|
||||||
RsGxsChannelPost mPost;
|
RsGxsChannelPost mPost;
|
||||||
|
@ -407,12 +407,10 @@ void GxsChannelPostsWidget::createPostItem(const RsGxsChannelPost &post, bool re
|
|||||||
if(item)
|
if(item)
|
||||||
{
|
{
|
||||||
ui->feedWidget->removeFeedItem(item) ;
|
ui->feedWidget->removeFeedItem(item) ;
|
||||||
//RsGxsChannelGroup dummyGroup;
|
RsGxsChannelGroup dummyGroup;
|
||||||
//dummyGroup.mMeta.mGroupId = groupId();
|
dummyGroup.mMeta.mGroupId = groupId();
|
||||||
//dummyGroup.mMeta.mSubscribeFlags = 0xffffffff;
|
dummyGroup.mMeta.mSubscribeFlags = 0xffffffff;
|
||||||
//GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, dummyGroup, post, true, false);
|
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, dummyGroup, post, true, false);
|
||||||
|
|
||||||
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, post.mMeta.mGroupId, post.mMeta.mMsgId, true, true);
|
|
||||||
ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs));
|
ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs));
|
||||||
|
|
||||||
return ;
|
return ;
|
||||||
@ -429,13 +427,10 @@ void GxsChannelPostsWidget::createPostItem(const RsGxsChannelPost &post, bool re
|
|||||||
ui->feedWidget->setSort(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs));
|
ui->feedWidget->setSort(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs));
|
||||||
} else {
|
} else {
|
||||||
/* Group is not always available because of the TokenQueue */
|
/* Group is not always available because of the TokenQueue */
|
||||||
|
RsGxsChannelGroup dummyGroup;
|
||||||
//RsGxsChannelGroup dummyGroup;
|
dummyGroup.mMeta.mGroupId = groupId();
|
||||||
//dummyGroup.mMeta.mGroupId = groupId();
|
dummyGroup.mMeta.mSubscribeFlags = 0xffffffff;
|
||||||
//dummyGroup.mMeta.mSubscribeFlags = 0xffffffff;
|
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, dummyGroup, post, true, false);
|
||||||
//GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, dummyGroup, post, true, false);
|
|
||||||
|
|
||||||
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, post.mMeta.mGroupId, post.mMeta.mMsgId, true, true);
|
|
||||||
ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs));
|
ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user