removed most of the token queue system from GxsFeedItems

This commit is contained in:
csoler 2020-02-16 20:57:36 +01:00
parent d1b26c9d36
commit 7e08d24b64
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
18 changed files with 607 additions and 491 deletions

View file

@ -23,6 +23,7 @@
#include "FeedHolder.h"
#include "gui/RetroShareLink.h"
#include "util/qtthreadsutils.h"
/****
* #define DEBUG_ITEM 1
@ -87,29 +88,43 @@ bool GxsForumGroupItem::setGroup(const RsGxsForumGroup &group)
return true;
}
void GxsForumGroupItem::loadGroup(const uint32_t &token)
void GxsForumGroupItem::loadGroup()
{
#ifdef DEBUG_ITEM
std::cerr << "GxsForumGroupItem::loadGroup()";
std::cerr << std::endl;
RsThread::async([this]()
{
// 1 - get group data
#ifdef DEBUG_FORUMS
std::cerr << "Retrieving post data for post " << mThreadId << std::endl;
#endif
std::vector<RsGxsForumGroup> groups;
if (!rsGxsForums->getGroupData(token, groups))
{
std::cerr << "GxsForumGroupItem::loadGroup() ERROR getting data";
std::cerr << std::endl;
return;
}
std::vector<RsGxsForumGroup> groups;
const std::list<RsGxsGroupId> forumIds = { groupId() };
if (groups.size() != 1)
{
std::cerr << "GxsForumGroupItem::loadGroup() Wrong number of Items";
std::cerr << std::endl;
return;
}
if(!rsGxsForums->getForumsInfo(forumIds,groups))
{
RsErr() << "GxsForumGroupItem::loadGroup() ERROR getting data" << std::endl;
return;
}
setGroup(groups[0]);
if (groups.size() != 1)
{
std::cerr << "GxsForumGroupItem::loadGroup() Wrong number of Items";
std::cerr << std::endl;
return;
}
const RsGxsForumGroup& group(groups[0]);
RsQThreadUtils::postToObject( [group,this]()
{
/* 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 */
setGroup(group);
}, this );
});
}
QString GxsForumGroupItem::groupName()