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