mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
fixed update of circles GUI using a timer. This is not optimal, and should be replaced by a proper notify call
This commit is contained in:
parent
3000f94999
commit
c14c240f07
@ -37,7 +37,6 @@
|
||||
/****
|
||||
* #define DEBUG_CIRCLES 1
|
||||
****/
|
||||
#define DEBUG_CIRCLES 1
|
||||
|
||||
RsGxsCircles *rsGxsCircles = NULL;
|
||||
|
||||
@ -999,7 +998,8 @@ bool p3GxsCircles::cache_load_for_token(uint32_t token)
|
||||
|
||||
std::list<RsGxsId> myOwnIds;
|
||||
|
||||
rsIdentity->getOwnIds(myOwnIds) ;
|
||||
if(rsIdentity->getOwnIds(myOwnIds))
|
||||
{
|
||||
bool ownIdInCircle = false ;
|
||||
|
||||
for(std::list<RsGxsId>::const_iterator it(myOwnIds.begin());it!=myOwnIds.end() && !ownIdInCircle;++it)
|
||||
@ -1010,6 +1010,13 @@ bool p3GxsCircles::cache_load_for_token(uint32_t token)
|
||||
#endif
|
||||
|
||||
cache.mAmIAllowed = ownIdInCircle;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << " own ids not loaded yet." << std::endl;
|
||||
isComplete = false;
|
||||
isUnprocessedPeers = true;
|
||||
}
|
||||
|
||||
// need to trigger the searches.
|
||||
for(pit = peers.begin(); pit != peers.end(); ++pit)
|
||||
@ -1197,6 +1204,18 @@ bool p3GxsCircles::cache_reloadids(const RsGxsCircleId &circleId)
|
||||
|
||||
RsGxsCircleCache &cache = it->second;
|
||||
|
||||
std::list<RsGxsId> myOwnIds;
|
||||
|
||||
if(rsIdentity->getOwnIds(myOwnIds))
|
||||
{
|
||||
bool ownIdInCircle = false ;
|
||||
|
||||
for(std::list<RsGxsId>::const_iterator it(myOwnIds.begin());it!=myOwnIds.end() && !ownIdInCircle;++it)
|
||||
ownIdInCircle = ownIdInCircle || cache.isAllowedPeer(*it) ;
|
||||
|
||||
cache.mAmIAllowed = ownIdInCircle ;
|
||||
}
|
||||
|
||||
/* try reload Ids */
|
||||
for(std::set<RsGxsId>::const_iterator pit = cache.mUnprocessedPeers.begin(); pit != cache.mUnprocessedPeers.end(); ++pit)
|
||||
{
|
||||
@ -1227,6 +1246,7 @@ bool p3GxsCircles::cache_reloadids(const RsGxsCircleId &circleId)
|
||||
std::cerr << std::endl;
|
||||
#endif // DEBUG_CIRCLES
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "IdDialog.h"
|
||||
#include "ui_IdDialog.h"
|
||||
#include "IdEditDialog.h"
|
||||
#include "retroshare-gui/RsAutoUpdatePage.h"
|
||||
#include "gui/gxs/GxsIdDetails.h"
|
||||
#include "gui/gxs/RsGxsUpdateBroadcastBase.h"
|
||||
#include "gui/common/UIStateHelper.h"
|
||||
@ -275,8 +276,6 @@ IdDialog::IdDialog(QWidget *parent) :
|
||||
|
||||
// circles stuff
|
||||
|
||||
// connect(ui->pushButton_extCircle, SIGNAL(clicked()), this, SLOT(createExternalCircle()));
|
||||
// connect(ui->pushButton_editCircle, SIGNAL(clicked()), this, SLOT(showEditExistingCircle()));
|
||||
connect(ui->treeWidget_membership, SIGNAL(itemSelectionChanged()), this, SLOT(circle_selected()));
|
||||
connect(ui->treeWidget_membership, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(CircleListCustomPopupMenu(QPoint)));
|
||||
|
||||
@ -285,10 +284,24 @@ IdDialog::IdDialog(QWidget *parent) :
|
||||
mCircleQueue = new TokenQueue(rsGxsCircles->getTokenService(), this);
|
||||
|
||||
requestCircleGroupMeta();
|
||||
|
||||
// This timer shouldn't be needed, but it is now, because the update of subscribe status and appartenance to the
|
||||
// circle doesn't trigger a proper GUI update.
|
||||
|
||||
QTimer *tmer = new QTimer(this) ;
|
||||
connect(tmer,SIGNAL(timeout()),this,SLOT(updateCirclesDisplay())) ;
|
||||
|
||||
tmer->start(10000) ; // update every minute.
|
||||
}
|
||||
|
||||
void IdDialog::updateCirclesDisplay(bool)
|
||||
void IdDialog::updateCirclesDisplay()
|
||||
{
|
||||
if(RsAutoUpdatePage::eventsLocked())
|
||||
return ;
|
||||
|
||||
if(!isVisible())
|
||||
return ;
|
||||
|
||||
#ifdef ID_DEBUG
|
||||
std::cerr << "!!Updating circles display!" << std::endl;
|
||||
#endif
|
||||
@ -302,10 +315,10 @@ void IdDialog::requestCircleGroupMeta()
|
||||
{
|
||||
mStateHelper->setLoading(CIRCLESDIALOG_GROUPMETA, true);
|
||||
|
||||
#ifdef ID_DEBUG
|
||||
//#ifdef ID_DEBUG
|
||||
std::cerr << "CirclesDialog::requestGroupMeta()";
|
||||
std::cerr << std::endl;
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
mCircleQueue->cancelActiveRequestTokens(CIRCLESDIALOG_GROUPMETA);
|
||||
|
||||
@ -399,7 +412,9 @@ void IdDialog::loadCircleGroupMeta(const uint32_t &token)
|
||||
bool am_I_in_circle = details.mAmIAllowed ;
|
||||
QTreeWidgetItem *item = NULL ;
|
||||
|
||||
#ifdef ID_DEBUG
|
||||
std::cerr << "Loaded info for circle " << vit->mGroupId << ". ubscribed=" << subscribed << ", am_I_in_circle=" << am_I_in_circle << std::endl;
|
||||
#endif
|
||||
|
||||
// find already existing items for this circle
|
||||
|
||||
@ -487,10 +502,12 @@ void IdDialog::loadCircleGroupMeta(const uint32_t &token)
|
||||
}
|
||||
|
||||
|
||||
#ifdef ID_DEBUG
|
||||
if (subscribed)
|
||||
item->setIcon(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,QIcon(":icons/bullet_green_128.png")) ;
|
||||
else
|
||||
else
|
||||
item->setIcon(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,QIcon(":icons/bullet_yellow_128.png")) ;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ protected:
|
||||
private slots:
|
||||
void createExternalCircle();
|
||||
void showEditExistingCircle();
|
||||
void updateCirclesDisplay(bool);
|
||||
void updateCirclesDisplay();
|
||||
|
||||
void filterComboBoxChanged();
|
||||
void filterChanged(const QString &text);
|
||||
|
Loading…
Reference in New Issue
Block a user