Fix Graphic Circles update.

This commit is contained in:
Phenom 2016-04-10 12:00:23 +02:00
parent 3eb9a5e5f1
commit d727311dbc
3 changed files with 64 additions and 40 deletions

View File

@ -127,14 +127,16 @@ void IdentityWidget::updateData(const RsPeerDetails &pgp_details)
ui->labelKeyId->setText(_keyId);
ui->labelKeyId->setToolTip(tr("PGP id:").append(" "+_keyId));
QPixmap avatar;
/*AvatarDefs::getAvatarFromGpgId(_details.gpg_id, avatar);
if (_avatar != avatar.toImage()) {
_avatar = avatar.toImage();
_scene->clear();
_scene->addPixmap(avatar.scaled(ui->graphicsView->width(),ui->graphicsView->height()));
emit imageUpdated();
}*///if (_avatar != avatar.toImage())
if (!_haveGXSId) {
QPixmap avatar;
AvatarDefs::getAvatarFromGpgId(_details.gpg_id, avatar);
if (_avatar != avatar.toImage()) {
_avatar = avatar.toImage();
_scene->clear();
_scene->addPixmap(avatar.scaled(ui->graphicsView->width(),ui->graphicsView->height()));
emit imageUpdated();
}
}
//}//if (_details != gpg_details)

View File

@ -28,6 +28,7 @@
#include "gui/settings/rsharesettings.h"
#include "gui/msgs/MessageComposer.h"
#include "gui/gxs/GxsIdDetails.h"
#include "gui/gxs/RsGxsUpdateBroadcastBase.h"
#include "gui/Identity/IdDetailsDialog.h"
#include "retroshare/rspeers.h"
@ -60,7 +61,10 @@ PeopleDialog::PeopleDialog(QWidget *parent)
/* Setup TokenQueue */
mIdentityQueue = new TokenQueue(rsIdentity->getTokenService(), this);
mCirclesQueue = new TokenQueue(rsGxsCircles->getTokenService(), this);
// This is used to grab the broadcast of changes from p3GxsCircles, which is discarded by the current dialog, since it expects data for p3Identity only.
mCirclesBroadcastBase = new RsGxsUpdateBroadcastBase(rsGxsCircles, this);
connect(mCirclesBroadcastBase, SIGNAL(fillDisplay(bool)), this, SLOT(updateCirclesDisplay(bool)));
tabWidget->removeTab(1);
@ -115,6 +119,9 @@ PeopleDialog::PeopleDialog(QWidget *parent)
if (geometryInt.isEmpty() == false) {
splitterInternal->restoreState(geometryInt);
}
reloadAll();
}
/** Destructor. */
@ -280,18 +287,18 @@ void PeopleDialog::insertCircles(uint32_t token)
}//if(!rsGxsCircles->getCircleDetails(RsGxsCircleId(git->mGroupId), details))
if (!details.mIsExternal){
std::map<RsGxsGroupId, CircleWidget*>::iterator itFound;
std::map<RsGxsGroupId, CircleWidget*>::iterator itFound;
if((itFound=_int_circles_widgets.find(gsItem.mGroupId)) == _int_circles_widgets.end()) {
std::cerr << "PeopleDialog::insertExtCircles() add new Internal GroupId: " << gsItem.mGroupId;
std::cerr << " GroupName: " << gsItem.mGroupName;
std::cerr << std::endl;
std::cerr << " GroupName: " << gsItem.mGroupName;
std::cerr << std::endl;
CircleWidget *gitem = new CircleWidget() ;
CircleWidget *gitem = new CircleWidget() ;
QObject::connect(gitem, SIGNAL(flowLayoutItemDropped(QList<FlowLayoutItem*>,bool&)), this, SLOT(fl_flowLayoutItemDroppedInt(QList<FlowLayoutItem*>,bool&)));
QObject::connect(gitem, SIGNAL(askForGXSIdentityWidget(RsGxsId)), this, SLOT(cw_askForGXSIdentityWidget(RsGxsId)));
QObject::connect(gitem, SIGNAL(askForGXSIdentityWidget(RsGxsId)), this, SLOT(cw_askForGXSIdentityWidget(RsGxsId)));
QObject::connect(gitem, SIGNAL(askForPGPIdentityWidget(RsPgpId)), this, SLOT(cw_askForPGPIdentityWidget(RsPgpId)));
QObject::connect(gitem, SIGNAL(imageUpdated()), this, SLOT(cw_imageUpdatedInt()));
gitem->updateData( gsItem, details );
gitem->updateData( gsItem, details );
_int_circles_widgets[gsItem.mGroupId] = gitem ;
_flowLayoutInt->addWidget(gitem);
@ -328,21 +335,21 @@ void PeopleDialog::insertCircles(uint32_t token)
_flowLayoutExt->addWidget(gitem);
QPixmap pixmap = gitem->getImage();
QPixmap pixmap = gitem->getImage();
pictureFlowWidgetExternal->addSlide( pixmap );
_extListCir << gitem;
} else {//if((itFound=_circles_widgets.find(gsItem.mGroupId)) == _circles_widgets.end())
} else {//if((itFound=_circles_widgets.find(gsItem.mGroupId)) == _circles_widgets.end())
std::cerr << "PeopleDialog::insertExtCircles() Update GroupId: " << gsItem.mGroupId;
std::cerr << " GroupName: " << gsItem.mGroupName;
std::cerr << std::endl;
std::cerr << " GroupName: " << gsItem.mGroupName;
std::cerr << std::endl;
CircleWidget *cirWidget = itFound->second;
CircleWidget *cirWidget = itFound->second;
cirWidget->updateData( gsItem, details );
//int index = _extListCir.indexOf(cirWidget);
//QPixmap pixmap = cirWidget->getImage();
//pictureFlowWidgetExternal->setSlide(index, pixmap);
}//if((item=_circles_items.find(gsItem.mGroupId)) == _circles_items.end())
}//if((item=_circles_items.find(gsItem.mGroupId)) == _circles_items.end())
}//else (!details.mIsExternal)
}//for(gsIt = gSummaryList.begin(); gsIt != gSummaryList.end(); ++gsIt)
}
@ -378,32 +385,40 @@ void PeopleDialog::requestCirclesList()
mCirclesQueue->requestGroupInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, PD_CIRCLES);
}
void PeopleDialog::updateCirclesDisplay(bool)
{
std::cerr << "!!Updating circles display!" << std::endl;
requestCirclesList() ;
}
void PeopleDialog::loadRequest(const TokenQueue * /*queue*/, const TokenRequest &req)
{
std::cerr << "IdDialog::loadRequest() UserType: " << req.mUserType;
std::cerr << std::endl;
switch(req.mUserType) {
case PD_IDLIST:
insertIdList(req.mToken);
break;
case PD_IDLIST:
insertIdList(req.mToken);
break;
case PD_IDDETAILS:
//insertIdDetails(req.mToken);
break;
case PD_IDDETAILS:
//insertIdDetails(req.mToken);
break;
case PD_CIRCLES:
insertCircles(req.mToken);
break;
case PD_CIRCLES:
insertCircles(req.mToken);
break;
case PD_REFRESH:
updateDisplay(true);
break;
default:
std::cerr << "IdDialog::loadRequest() ERROR";
std::cerr << std::endl;
break;
case PD_REFRESH:
updateDisplay(true);
break;
default:
std::cerr << "IdDialog::loadRequest() ERROR";
std::cerr << std::endl;
break;
}//switch(req.mUserType)
}
void PeopleDialog::iw_AddButtonClickedExt()
@ -629,7 +644,9 @@ void PeopleDialog::cw_askForGXSIdentityWidget(RsGxsId gxs_id)
IdentityWidget *idWidget = itFound->second;
dest->addIdent(idWidget);
}//if((itFound=_gxs_identity_widgets.find(gxs_id)) != _gxs_identity_widgets.end()) {
}//if (dest)
} else {
reloadAll();
}
}
void PeopleDialog::cw_askForPGPIdentityWidget(RsPgpId pgp_id)
@ -643,7 +660,9 @@ void PeopleDialog::cw_askForPGPIdentityWidget(RsPgpId pgp_id)
IdentityWidget *idWidget = itFound->second;
dest->addIdent(idWidget);
}//if((itFound=_pgp_identity_widgets.find(gxs_id)) != _pgp_identity_widgets.end()) {
}//if (dest)
} else {
reloadAll();
}
}
void PeopleDialog::cw_imageUpdatedInt()

View File

@ -53,7 +53,7 @@ class PeopleDialog : public RsGxsUpdateBroadcastPage, public Ui::PeopleDialog, p
virtual QString pageName() const { return tr("People") ; } //MainPage
virtual QString helpText() const { return ""; } //MainPage
void loadRequest(const TokenQueue * /*queue*/, const TokenRequest &req) ;
void loadRequest(const TokenQueue * queue, const TokenRequest &req) ;
void requestIdList() ;
void requestCirclesList() ;
@ -67,6 +67,8 @@ class PeopleDialog : public RsGxsUpdateBroadcastPage, public Ui::PeopleDialog, p
//End RsGxsUpdateBroadcastPage
private slots:
void updateCirclesDisplay(bool);
void iw_AddButtonClickedExt();
void iw_AddButtonClickedInt();
void addToCircleExt();
@ -95,6 +97,7 @@ private:
TokenQueue *mIdentityQueue;
TokenQueue *mCirclesQueue;
RsGxsUpdateBroadcastBase *mCirclesBroadcastBase ;
FlowLayout *_flowLayoutExt;
std::map<RsGxsId,IdentityWidget *> _gxs_identity_widgets ;