improved efficiency of channel posts loading

This commit is contained in:
csoler 2020-04-17 23:23:59 +02:00
parent fa8968797c
commit 678bcf5830
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
5 changed files with 108 additions and 81 deletions

View file

@ -520,7 +520,7 @@ void GxsChannelPostsWidget::createPostItem(const RsGxsChannelPost& post, bool re
older_versions.insert(meta.mMsgId);
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, meta.mGroupId,meta.mMsgId, true, false,older_versions);
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, mGroup,meta.mMsgId, true, false,older_versions);
ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(meta.mPublishTs));
return ;
@ -539,7 +539,7 @@ void GxsChannelPostsWidget::createPostItem(const RsGxsChannelPost& post, bool re
}
else
{
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, meta.mGroupId,meta.mMsgId, true, true);
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, mGroup,meta.mMsgId, true, true);
ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(meta.mPublishTs));
}
@ -548,6 +548,8 @@ void GxsChannelPostsWidget::createPostItem(const RsGxsChannelPost& post, bool re
#endif
}
void GxsChannelPostsWidget::fillThreadCreatePost(const QVariant &post, bool related, int current, int count)
{
/* show fill progress */
@ -842,6 +844,8 @@ bool GxsChannelPostsWidget::getGroupData(RsGxsGenericGroupData *& data)
if(rsGxsChannels->getChannelsInfo(std::list<RsGxsGroupId>({groupId()}),groups) && groups.size()==1)
{
data = new RsGxsChannelGroup(groups[0]);
mGroup = groups[0]; // make a local copy to pass on to items
return true;
}
else
@ -852,6 +856,7 @@ bool GxsChannelPostsWidget::getGroupData(RsGxsGenericGroupData *& data)
{
insertChannelDetails(distant_group);
data = new RsGxsChannelGroup(distant_group);
mGroup = distant_group; // make a local copy to pass on to items
return true ;
}
}

View file

@ -106,6 +106,7 @@ private:
private:
QAction *mAutoDownloadAction;
RsGxsChannelGroup mGroup;
bool mUseThread;
RsEventsHandlerId_t mEventHandlerId ;