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 "ui_GxsChannelGroupItem.h"
#include "FeedHolder.h"
#include "util/qtthreadsutils.h"
#include "gui/NewsFeed.h"
#include "gui/RetroShareLink.h"
@ -89,29 +90,39 @@ bool GxsChannelGroupItem::setGroup(const RsGxsChannelGroup &group)
return true;
}
void GxsChannelGroupItem::loadGroup(const uint32_t &token)
void GxsChannelGroupItem::loadGroup()
{
#ifdef DEBUG_ITEM
std::cerr << "GxsChannelGroupItem::loadGroup()";
std::cerr << std::endl;
#endif
std::vector<RsGxsChannelGroup> groups;
if (!rsGxsChannels->getGroupData(token, groups))
RsThread::async([this]()
{
std::cerr << "GxsChannelGroupItem::loadGroup() ERROR getting data";
std::cerr << std::endl;
return;
}
// 1 - get group data
if (groups.size() != 1)
{
std::cerr << "GxsChannelGroupItem::loadGroup() Wrong number of Items";
std::cerr << std::endl;
return;
}
std::vector<RsGxsChannelGroup> groups;
const std::list<RsGxsGroupId> groupIds = { groupId() };
setGroup(groups[0]);
if(!rsGxsChannels->getChannelsInfo(groupIds,groups))
{
RsErr() << "GxsGxsChannelGroupItem::loadGroup() ERROR getting data" << std::endl;
return;
}
if (groups.size() != 1)
{
std::cerr << "GxsGxsChannelGroupItem::loadGroup() Wrong number of Items";
std::cerr << std::endl;
return;
}
RsGxsChannelGroup 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 GxsChannelGroupItem::groupName()