Merge pull request #2245 from csoler/v0.6-BugFixing_7

Fixing the token queues
This commit is contained in:
csoler 2021-01-25 20:48:48 +01:00 committed by GitHub
commit 7613fe1a44
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 474 additions and 173 deletions

View file

@ -252,9 +252,9 @@ void BoardPostDisplayWidgetBase::setup()
scoreLabel()->setText(score);
// FIX THIS UP LATER.
notes()->setText(RsHtml().formatText(NULL, QString::fromUtf8(mPost.mNotes.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
pictureLabel()->setText(RsHtml().formatText(NULL, QString::fromUtf8(mPost.mNotes.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
// FIX THIS UP LATER. Smileys are extra costly, so we only use them where really necessary
notes()->setText(RsHtml().formatText(NULL, QString::fromUtf8(mPost.mNotes.c_str()), /* RSHTML_FORMATTEXT_EMBED_SMILEYS |*/ RSHTML_FORMATTEXT_EMBED_LINKS));
pictureLabel()->setText(RsHtml().formatText(NULL, QString::fromUtf8(mPost.mNotes.c_str()), /* RSHTML_FORMATTEXT_EMBED_SMILEYS |*/ RSHTML_FORMATTEXT_EMBED_LINKS));
// feed.
//frame_comment->show();

View file

@ -286,7 +286,7 @@ void PostedCardView::fill()
ui->scoreLabel->setText(score);
// FIX THIS UP LATER.
ui->notes->setText(RsHtml().formatText(NULL, QString::fromUtf8(mPost.mNotes.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
ui->notes->setText(RsHtml().formatText(NULL, QString::fromUtf8(mPost.mNotes.c_str()), /* RSHTML_FORMATTEXT_EMBED_SMILEYS |*/ RSHTML_FORMATTEXT_EMBED_LINKS));
QTextDocument doc;
doc.setHtml(ui->notes->text());

View file

@ -603,7 +603,7 @@ void PostedItem::fill()
ui->scoreLabel->setText(score);
// FIX THIS UP LATER.
ui->notes->setText(RsHtml().formatText(NULL, QString::fromUtf8(mPost.mNotes.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
ui->notes->setText(RsHtml().formatText(NULL, QString::fromUtf8(mPost.mNotes.c_str()), /* RSHTML_FORMATTEXT_EMBED_SMILEYS |*/ RSHTML_FORMATTEXT_EMBED_LINKS));
QTextDocument doc;
doc.setHtml(ui->notes->text());

View file

@ -548,7 +548,7 @@ void PostedListWidgetWithModel::showPostDetails()
std::cerr << "Showing details about selected index : "<< index.row() << "," << index.column() << std::endl;
ui->postDetails_TE->setText(RsHtml().formatText(NULL, QString::fromUtf8(post.mMsg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
ui->postDetails_TE->setText(RsHtml().formatText(NULL, QString::fromUtf8(post.mMsg.c_str()), /* RSHTML_FORMATTEXT_EMBED_SMILEYS |*/ RSHTML_FORMATTEXT_EMBED_LINKS));
QPixmap postImage;

View file

@ -732,13 +732,13 @@ void RsPostedPostsModel::setAllMsgReadStatus(bool read)
for(uint32_t i=0;i<mPosts.size();++i)
pairs.push_back(RsGxsGrpMsgIdPair(mPosts[i].mMeta.mGroupId,mPosts[i].mMeta.mMsgId));
RsThread::async([read,pairs]()
{
// Call blocking API
for(auto& p:pairs)
for(auto& p:pairs)
RsThread::async([read,p]()
{
rsPosted->setPostReadStatus(p,read);
} );
} );
}
void RsPostedPostsModel::setMsgReadStatus(const QModelIndex& i,bool read_status)
{

View file

@ -616,7 +616,7 @@ void GxsChannelPostItem::fill()
void GxsChannelPostItem::fillExpandFrame()
{
ui->msgLabel->setText(RsHtml().formatText(NULL, QString::fromUtf8(mPost.mMsg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
ui->msgLabel->setText(RsHtml().formatText(NULL, QString::fromUtf8(mPost.mMsg.c_str()), /* RSHTML_FORMATTEXT_EMBED_SMILEYS |*/ RSHTML_FORMATTEXT_EMBED_LINKS));
}

View file

@ -795,12 +795,12 @@ void RsGxsChannelPostsModel::setAllMsgReadStatus(bool read_status)
// 2 - then call the async methods
RsThread::async([pairs, read_status]()
{
for(uint32_t i=0;i<pairs.size();++i)
if(!rsGxsChannels->markRead(pairs[i],read_status))
RsErr() << "setAllMsgReadStatus: failed to change status of msg " << pairs[i].first << " in group " << pairs[i].second << " to status " << read_status << std::endl;
});
for(uint32_t i=0;i<pairs.size();++i)
RsThread::async([p=pairs[i], read_status]() // use async because each markRead() waits for the token to complete in order to properly acknowledge it.
{
if(!rsGxsChannels->markRead(p,read_status))
RsErr() << "setAllMsgReadStatus: failed to change status of msg " << p.first << " in group " << p.second << " to status " << read_status << std::endl;
});
}
void RsGxsChannelPostsModel::setMsgReadStatus(const QModelIndex& i,bool read_status)

View file

@ -818,7 +818,7 @@ void GxsChannelPostsWidgetWithModel::showPostDetails()
std::cerr << "Showing details about selected index : "<< index.row() << "," << index.column() << std::endl;
#endif
ui->postDetails_TE->setText(RsHtml().formatText(NULL, QString::fromUtf8(post.mMsg.c_str()), RSHTML_FORMATTEXT_EMBED_SMILEYS | RSHTML_FORMATTEXT_EMBED_LINKS));
ui->postDetails_TE->setText(RsHtml().formatText(NULL, QString::fromUtf8(post.mMsg.c_str()), /* RSHTML_FORMATTEXT_EMBED_SMILEYS |*/ RSHTML_FORMATTEXT_EMBED_LINKS));
QPixmap postImage;

View file

@ -1256,17 +1256,22 @@ void RsGxsForumModel::recursSetMsgReadStatus(ForumModelIndex i,bool read_status,
if (bChanged)
{
//Don't recurs post versions as this should be done before, if no change.
uint32_t token;
auto s = getPostVersions(mPosts[i].mMsgId) ;
if(!s.empty())
for(auto it(s.begin());it!=s.end();++it)
{
rsGxsForums->setMessageReadStatus(token,std::make_pair( mForumGroup.mMeta.mGroupId, it->second ), read_status);
std::cerr << "Setting version " << it->second << " of post " << mPosts[i].mMsgId << " as read." << std::endl;
RsThread::async( [grpId=mForumGroup.mMeta.mGroupId,msgId=it->second,original_msg_id=mPosts[i].mMsgId,read_status]()
{
rsGxsForums->markRead(std::make_pair( grpId, msgId ), read_status);
std::cerr << "Setting version " << msgId << " of post " << original_msg_id << " as read." << std::endl;
});
}
else
rsGxsForums->setMessageReadStatus(token,std::make_pair( mForumGroup.mMeta.mGroupId, mPosts[i].mMsgId ), read_status);
RsThread::async( [grpId=mForumGroup.mMeta.mGroupId,original_msg_id=mPosts[i].mMsgId,read_status]()
{
rsGxsForums->markRead(std::make_pair( grpId, original_msg_id), read_status);
});
void *ref ;
convertTabEntryToRefPointer(i,ref); // we dont use i+1 here because i is not a row, but an index in the mPosts tab