mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 23:49:35 -05:00
removed token queue from circles
This commit is contained in:
parent
52dffddf64
commit
8ab9adacef
@ -25,6 +25,7 @@
|
||||
#include "gui/Circles/CirclesDialog.h"
|
||||
#include "gui/Circles/CreateCircleDialog.h"
|
||||
#include "gui/common/UIStateHelper.h"
|
||||
#include "util/qtthreadsutils.h"
|
||||
|
||||
#include <retroshare/rsgxscircles.h>
|
||||
#include <retroshare/rspeers.h>
|
||||
@ -72,9 +73,6 @@ CirclesDialog::CirclesDialog(QWidget *parent)
|
||||
|
||||
connect(ui.treeWidget_membership, SIGNAL(itemSelectionChanged()), this, SLOT(circle_selected()));
|
||||
|
||||
/* Setup TokenQueue */
|
||||
mCircleQueue = new TokenQueue(rsGxsCircles->getTokenService(), this);
|
||||
|
||||
/* Set header resize modes and initial section sizes */
|
||||
QHeaderView * membership_header = ui.treeWidget_membership->header () ;
|
||||
membership_header->resizeSection ( CIRCLEGROUP_CIRCLE_COL_GROUPNAME, 200 );
|
||||
@ -82,7 +80,6 @@ CirclesDialog::CirclesDialog(QWidget *parent)
|
||||
|
||||
CirclesDialog::~CirclesDialog()
|
||||
{
|
||||
delete mCircleQueue;
|
||||
}
|
||||
|
||||
void CirclesDialog::todo()
|
||||
@ -564,37 +561,59 @@ void CirclesDialog::requestGroupMeta()
|
||||
{
|
||||
mStateHelper->setLoading(CIRCLESDIALOG_GROUPMETA, true);
|
||||
|
||||
std::cerr << "CirclesDialog::requestGroupMeta()";
|
||||
std::cerr << std::endl;
|
||||
RsThread::async([this]()
|
||||
{
|
||||
std::list<RsGroupMetaData> circles;
|
||||
|
||||
mCircleQueue->cancelActiveRequestTokens(CIRCLESDIALOG_GROUPMETA);
|
||||
if(!rsGxsCircles->getCirclesSummaries(circles))
|
||||
{
|
||||
std::cerr << __PRETTY_FUNCTION__ << " failed to get circles summaries " << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
RsTokReqOptions opts;
|
||||
opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
|
||||
RsQThreadUtils::postToObject( [this,circles]()
|
||||
{
|
||||
/* 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!
|
||||
*/
|
||||
|
||||
uint32_t token;
|
||||
mCircleQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, CIRCLESDIALOG_GROUPMETA);
|
||||
loadGroupMeta(circles);
|
||||
|
||||
}, this );
|
||||
});
|
||||
// std::cerr << "CirclesDialog::requestGroupMeta()";
|
||||
// std::cerr << std::endl;
|
||||
//
|
||||
// mCircleQueue->cancelActiveRequestTokens(CIRCLESDIALOG_GROUPMETA);
|
||||
//
|
||||
// RsTokReqOptions opts;
|
||||
// opts.mReqType = GXS_REQUEST_TYPE_GROUP_META;
|
||||
//
|
||||
// uint32_t token;
|
||||
// mCircleQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, CIRCLESDIALOG_GROUPMETA);
|
||||
}
|
||||
|
||||
void CirclesDialog::loadGroupMeta(const uint32_t &token)
|
||||
void CirclesDialog::loadGroupMeta(const std::list<RsGroupMetaData>& groupInfo)
|
||||
{
|
||||
mStateHelper->setLoading(CIRCLESDIALOG_GROUPMETA, false);
|
||||
|
||||
std::cerr << "CirclesDialog::loadGroupMeta()";
|
||||
std::cerr << std::endl;
|
||||
// std::cerr << "CirclesDialog::loadGroupMeta()";
|
||||
// std::cerr << std::endl;
|
||||
|
||||
ui.treeWidget_membership->clear();
|
||||
|
||||
std::list<RsGroupMetaData> groupInfo;
|
||||
std::list<RsGroupMetaData>::iterator vit;
|
||||
// std::list<RsGroupMetaData> groupInfo;
|
||||
// std::list<RsGroupMetaData>::iterator vit;
|
||||
|
||||
if (!rsGxsCircles->getGroupSummary(token,groupInfo))
|
||||
{
|
||||
std::cerr << "CirclesDialog::loadGroupMeta() Error getting GroupMeta";
|
||||
std::cerr << std::endl;
|
||||
mStateHelper->setActive(CIRCLESDIALOG_GROUPMETA, false);
|
||||
return;
|
||||
}
|
||||
// if (!rsGxsCircles->getGroupSummary(token,groupInfo))
|
||||
// {
|
||||
// std::cerr << "CirclesDialog::loadGroupMeta() Error getting GroupMeta";
|
||||
// std::cerr << std::endl;
|
||||
// mStateHelper->setActive(CIRCLESDIALOG_GROUPMETA, false);
|
||||
// return;
|
||||
// }
|
||||
|
||||
mStateHelper->setActive(CIRCLESDIALOG_GROUPMETA, true);
|
||||
|
||||
@ -615,7 +634,7 @@ void CirclesDialog::loadGroupMeta(const uint32_t &token)
|
||||
externalOtherCirclesItem->setText(0, tr("External Circles (Other)"));
|
||||
ui.treeWidget_membership->addTopLevelItem(externalOtherCirclesItem);
|
||||
|
||||
for(vit = groupInfo.begin(); vit != groupInfo.end(); ++vit)
|
||||
for(auto vit = groupInfo.begin(); vit != groupInfo.end(); ++vit)
|
||||
{
|
||||
/* Add Widget, and request Pages */
|
||||
std::cerr << "CirclesDialog::loadGroupMeta() GroupId: " << vit->mGroupId;
|
||||
@ -648,24 +667,24 @@ void CirclesDialog::loadGroupMeta(const uint32_t &token)
|
||||
}
|
||||
}
|
||||
|
||||
void CirclesDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||
{
|
||||
std::cerr << "CirclesDialog::loadRequest() UserType: " << req.mUserType;
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (queue == mCircleQueue)
|
||||
{
|
||||
/* now switch on req */
|
||||
switch(req.mUserType)
|
||||
{
|
||||
case CIRCLESDIALOG_GROUPMETA:
|
||||
loadGroupMeta(req.mToken);
|
||||
break;
|
||||
|
||||
default:
|
||||
std::cerr << "CirclesDialog::loadRequest() ERROR: INVALID TYPE";
|
||||
std::cerr << std::endl;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// void CirclesDialog::loadRequest(const TokenQueue *queue, const TokenRequest &req)
|
||||
// {
|
||||
// std::cerr << "CirclesDialog::loadRequest() UserType: " << req.mUserType;
|
||||
// std::cerr << std::endl;
|
||||
//
|
||||
// if (queue == mCircleQueue)
|
||||
// {
|
||||
// /* now switch on req */
|
||||
// switch(req.mUserType)
|
||||
// {
|
||||
// case CIRCLESDIALOG_GROUPMETA:
|
||||
// loadGroupMeta(req.mToken);
|
||||
// break;
|
||||
//
|
||||
// default:
|
||||
// std::cerr << "CirclesDialog::loadRequest() ERROR: INVALID TYPE";
|
||||
// std::cerr << std::endl;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
@ -24,14 +24,13 @@
|
||||
#define MRK_CIRCLE_DIALOG_H
|
||||
|
||||
#include "gui/gxs/RsGxsUpdateBroadcastPage.h"
|
||||
#include "util/TokenQueue.h"
|
||||
#include "ui_CirclesDialog.h"
|
||||
|
||||
#define IMAGE_CIRCLES ":/icons/png/circles.png"
|
||||
|
||||
class UIStateHelper;
|
||||
|
||||
class CirclesDialog : public MainPage, public TokenResponse
|
||||
class CirclesDialog : public MainPage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -43,8 +42,6 @@ public:
|
||||
virtual QString pageName() const { return tr("Circles") ; } //MainPage
|
||||
virtual QString helpText() const { return ""; } //MainPage
|
||||
|
||||
void loadRequest(const TokenQueue *queue, const TokenRequest &req);
|
||||
|
||||
protected:
|
||||
virtual void updateDisplay(bool complete);
|
||||
|
||||
@ -62,9 +59,8 @@ private:
|
||||
void reloadAll();
|
||||
|
||||
void requestGroupMeta();
|
||||
void loadGroupMeta(const uint32_t &token);
|
||||
void loadGroupMeta(const std::list<RsGroupMetaData>& groupInfo);
|
||||
|
||||
TokenQueue *mCircleQueue;
|
||||
UIStateHelper *mStateHelper;
|
||||
|
||||
/* UI - from Designer */
|
||||
|
Loading…
Reference in New Issue
Block a user