attempt to sort out the mess in item deletion in FeedHolder widgets

This commit is contained in:
csoler 2020-01-14 21:43:29 +01:00
parent a0b6f50b60
commit c552890459
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
35 changed files with 149 additions and 283 deletions

View file

@ -233,8 +233,12 @@ QScrollArea *GxsChannelPostsWidget::getScrollArea()
return NULL;
}
void GxsChannelPostsWidget::deleteFeedItem(QWidget * /*item*/, uint32_t /*type*/)
void GxsChannelPostsWidget::deleteFeedItem(FeedItem *feedItem, uint32_t /*type*/)
{
if (!feedItem)
return;
ui->feedWidget->removeFeedItem(feedItem);
}
void GxsChannelPostsWidget::openChat(const RsPeerId & /*peerId*/)
@ -460,7 +464,7 @@ void GxsChannelPostsWidget::createPostItem(const RsGxsChannelPost& post, bool re
if(!post.mMeta.mOrigMsgId.isNull())
{
FeedItem *feedItem = ui->feedWidget->findGxsFeedItem(post.mMeta.mGroupId, post.mMeta.mOrigMsgId);
FeedItem *feedItem = ui->feedWidget->findFeedItem(GxsChannelPostItem::computeIdentifier(post.mMeta.mOrigMsgId)) ;
item = dynamic_cast<GxsChannelPostItem*>(feedItem);
if(item)
@ -476,7 +480,7 @@ void GxsChannelPostsWidget::createPostItem(const RsGxsChannelPost& post, bool re
if (related)
{
FeedItem *feedItem = ui->feedWidget->findGxsFeedItem(post.mMeta.mGroupId, post.mMeta.mMsgId);
FeedItem *feedItem = ui->feedWidget->findFeedItem(GxsChannelPostItem::computeIdentifier(post.mMeta.mMsgId)) ;
item = dynamic_cast<GxsChannelPostItem*>(feedItem);
}
if (item) {
@ -669,7 +673,7 @@ void GxsChannelPostsWidget::blank()
bool GxsChannelPostsWidget::navigatePostItem(const RsGxsMessageId &msgId)
{
FeedItem *feedItem = ui->feedWidget->findGxsFeedItem(groupId(), msgId);
FeedItem *feedItem = ui->feedWidget->findFeedItem(GxsChannelPostItem::computeIdentifier(msgId));
if (!feedItem) {
return false;
}
@ -718,17 +722,17 @@ void GxsChannelPostsWidget::toggleAutoDownload()
return;
}
RsQThreadUtils::postToObject( [=]()
{
/* Here it goes any code you want to be executed on the Qt Gui
* thread, for example to update the data model with new information
* after a blocking call to RetroShare API complete, note that
* Qt::QueuedConnection is important!
*/
std::cerr << __PRETTY_FUNCTION__ << " Has been executed on GUI "
<< "thread but was scheduled by async thread" << std::endl;
}, this );
// RsQThreadUtils::postToObject( [=]()
// {
// /* Here it goes any code you want to be executed on the Qt Gui
// * thread, for example to update the data model with new information
// * after a blocking call to RetroShare API complete, note that
// * Qt::QueuedConnection is important!
// */
//
// std::cerr << __PRETTY_FUNCTION__ << " Has been executed on GUI "
// << "thread but was scheduled by async thread" << std::endl;
// }, this );
});
}