mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
first step of partial channel loading: only load all posts from meta data
This commit is contained in:
parent
d31f5d1159
commit
ac02b68b34
@ -65,6 +65,7 @@ public:
|
||||
const std::list<SubFileItem *> &getFileItems() {return mFileItems; }
|
||||
|
||||
bool isUnread() const ;
|
||||
const std::set<RsGxsMessageId>& olderVersions() const { return mPost.mOlderVersions; }
|
||||
|
||||
static uint64_t computeIdentifier(const RsGxsMessageId& msgid) { return hash64("GxsChannelPostItem " + msgid.toStdString()) ; }
|
||||
protected:
|
||||
|
@ -456,19 +456,24 @@ void GxsChannelPostsWidget::filterChanged(int filter)
|
||||
return bVisible;
|
||||
}
|
||||
|
||||
void GxsChannelPostsWidget::createPostItem(const RsGxsChannelPost& post, bool related)
|
||||
#ifdef TODO
|
||||
void GxsChannelPostsWidget::createPostItemFromMetaData(const RsGxsMsgMetaData& meta,bool related)
|
||||
{
|
||||
GxsChannelPostItem *item = NULL;
|
||||
RsGxsChannelPost post;
|
||||
|
||||
if(!post.mMeta.mOrigMsgId.isNull())
|
||||
if(!meta.mOrigMsgId.isNull())
|
||||
{
|
||||
FeedItem *feedItem = ui->feedWidget->findFeedItem(GxsChannelPostItem::computeIdentifier(post.mMeta.mOrigMsgId)) ;
|
||||
FeedItem *feedItem = ui->feedWidget->findFeedItem(GxsChannelPostItem::computeIdentifier(meta.mOrigMsgId)) ;
|
||||
item = dynamic_cast<GxsChannelPostItem*>(feedItem);
|
||||
|
||||
if(item)
|
||||
{
|
||||
post = feedItem->post();
|
||||
ui->feedWidget->removeFeedItem(item) ;
|
||||
|
||||
post.mOlderVersions.insert(post.mMeta.mMsgId);
|
||||
|
||||
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, post, true, false,post.mOlderVersions);
|
||||
ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs));
|
||||
|
||||
@ -478,18 +483,69 @@ void GxsChannelPostsWidget::createPostItem(const RsGxsChannelPost& post, bool re
|
||||
|
||||
if (related)
|
||||
{
|
||||
FeedItem *feedItem = ui->feedWidget->findFeedItem(GxsChannelPostItem::computeIdentifier(post.mMeta.mMsgId)) ;
|
||||
FeedItem *feedItem = ui->feedWidget->findFeedItem(GxsChannelPostItem::computeIdentifier(meta.mMsgId)) ;
|
||||
item = dynamic_cast<GxsChannelPostItem*>(feedItem);
|
||||
}
|
||||
if (item) {
|
||||
if (item)
|
||||
{
|
||||
item->setPost(post);
|
||||
ui->feedWidget->setSort(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs));
|
||||
} else {
|
||||
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, post, true, false,post.mOlderVersions);
|
||||
ui->feedWidget->setSort(item, ROLE_PUBLISH, QDateTime::fromTime_t(meta.mPublishTs));
|
||||
}
|
||||
else
|
||||
{
|
||||
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, meta.mGroupId,meta.mMsgId, true, true);
|
||||
ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(post.mMeta.mPublishTs));
|
||||
}
|
||||
|
||||
#ifdef TODO
|
||||
ui->fileWidget->addFiles(post, related);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
void GxsChannelPostsWidget::createPostItem(const RsGxsChannelPost& post, bool related)
|
||||
{
|
||||
GxsChannelPostItem *item = NULL;
|
||||
|
||||
const RsMsgMetaData& meta(post.mMeta);
|
||||
|
||||
if(!meta.mOrigMsgId.isNull())
|
||||
{
|
||||
FeedItem *feedItem = ui->feedWidget->findFeedItem(GxsChannelPostItem::computeIdentifier(meta.mOrigMsgId)) ;
|
||||
item = dynamic_cast<GxsChannelPostItem*>(feedItem);
|
||||
|
||||
if(item)
|
||||
{
|
||||
std::set<RsGxsMessageId> older_versions(item->olderVersions());
|
||||
ui->feedWidget->removeFeedItem(item) ;
|
||||
|
||||
older_versions.insert(meta.mMsgId);
|
||||
|
||||
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, meta.mGroupId,meta.mMsgId, true, false,older_versions);
|
||||
ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(meta.mPublishTs));
|
||||
|
||||
return ;
|
||||
}
|
||||
}
|
||||
|
||||
if (related)
|
||||
{
|
||||
FeedItem *feedItem = ui->feedWidget->findFeedItem(GxsChannelPostItem::computeIdentifier(meta.mMsgId)) ;
|
||||
item = dynamic_cast<GxsChannelPostItem*>(feedItem);
|
||||
}
|
||||
if (item)
|
||||
{
|
||||
item->setPost(post);
|
||||
ui->feedWidget->setSort(item, ROLE_PUBLISH, QDateTime::fromTime_t(meta.mPublishTs));
|
||||
}
|
||||
else
|
||||
{
|
||||
GxsChannelPostItem *item = new GxsChannelPostItem(this, 0, meta.mGroupId,meta.mMsgId, true, true);
|
||||
ui->feedWidget->addFeedItem(item, ROLE_PUBLISH, QDateTime::fromTime_t(meta.mPublishTs));
|
||||
}
|
||||
|
||||
#ifdef TODO
|
||||
ui->fileWidget->addFiles(post, related);
|
||||
#endif
|
||||
}
|
||||
|
||||
void GxsChannelPostsWidget::fillThreadCreatePost(const QVariant &post, bool related, int current, int count)
|
||||
|
Loading…
Reference in New Issue
Block a user