removed some debug info. Added information tooltips on circles and ids in circle member/invitee list

This commit is contained in:
csoler 2016-05-28 20:58:28 -04:00
parent 9a328f67ce
commit ccd72cb827
2 changed files with 52 additions and 7 deletions

View File

@ -1878,7 +1878,9 @@ void p3GxsCircles::handle_event(uint32_t event_type, const std::string &elabel)
bool p3GxsCircles::pushCircleMembershipRequest(const RsGxsId& own_gxsid,const RsGxsCircleId& circle_id,uint32_t request_type) bool p3GxsCircles::pushCircleMembershipRequest(const RsGxsId& own_gxsid,const RsGxsCircleId& circle_id,uint32_t request_type)
{ {
#ifdef DEBUG_CIRCLES
std::cerr << "Circle membership request: own_gxsid = " << own_gxsid << ", circle=" << circle_id << ", req type=" << request_type << std::endl; std::cerr << "Circle membership request: own_gxsid = " << own_gxsid << ", circle=" << circle_id << ", req type=" << request_type << std::endl;
#endif
// check for some consistency // check for some consistency
@ -1918,10 +1920,12 @@ bool p3GxsCircles::pushCircleMembershipRequest(const RsGxsId& own_gxsid,const Rs
// msgItem->meta.mParentId = ; // leave these blank // msgItem->meta.mParentId = ; // leave these blank
// msgItem->meta.mOrigMsgId= ; // msgItem->meta.mOrigMsgId= ;
#ifdef DEBUG_CIRCLES
std::cerr << "p3GxsCircles::publishSubscribeRequest()" << std::endl; std::cerr << "p3GxsCircles::publishSubscribeRequest()" << std::endl;
std::cerr << " GroupId : " << circle_id << std::endl; std::cerr << " GroupId : " << circle_id << std::endl;
std::cerr << " AuthorId : " << s->meta.mAuthorId << std::endl; std::cerr << " AuthorId : " << s->meta.mAuthorId << std::endl;
std::cerr << " ThreadId : " << s->meta.mThreadId << std::endl; std::cerr << " ThreadId : " << s->meta.mThreadId << std::endl;
#endif
uint32_t token ; uint32_t token ;
RsGenExchange::publishMsg(token, s); RsGenExchange::publishMsg(token, s);
@ -1965,7 +1969,9 @@ bool p3GxsCircles::processMembershipRequests(uint32_t token)
for(GxsMsgDataMap::const_iterator it(msgItems.begin());it!=msgItems.end();++it) for(GxsMsgDataMap::const_iterator it(msgItems.begin());it!=msgItems.end();++it)
{ {
RsStackMutex stack(mCircleMtx); /********** STACK LOCKED MTX ******/ RsStackMutex stack(mCircleMtx); /********** STACK LOCKED MTX ******/
#ifdef DEBUG_CIRCLES
std::cerr << " Circle ID: " << it->first << std::endl; std::cerr << " Circle ID: " << it->first << std::endl;
#endif
RsGxsCircleId cid ( it->first ); RsGxsCircleId cid ( it->first );
@ -1978,12 +1984,16 @@ bool p3GxsCircles::processMembershipRequests(uint32_t token)
// Find the circle ID in cache and process the list of messages to keep the latest order in time. // Find the circle ID in cache and process the list of messages to keep the latest order in time.
RsGxsCircleCache& data = mCircleCache.ref(cid); RsGxsCircleCache& data = mCircleCache.ref(cid);
#ifdef DEBUG_CIRCLES
std::cerr << " Circle found in cache!" << std::endl; std::cerr << " Circle found in cache!" << std::endl;
std::cerr << " Retrieving messages..." << std::endl; std::cerr << " Retrieving messages..." << std::endl;
#endif
for(uint32_t i=0;i<it->second.size();++i) for(uint32_t i=0;i<it->second.size();++i)
{ {
#ifdef DEBUG_CIRCLES
std::cerr << " Group ID: " << it->second[i]->meta.mGroupId << ", Message ID: " << it->second[i]->meta.mMsgId << ": " ; std::cerr << " Group ID: " << it->second[i]->meta.mGroupId << ", Message ID: " << it->second[i]->meta.mMsgId << ": " ;
#endif
RsGxsCircleSubscriptionRequestItem *item = dynamic_cast<RsGxsCircleSubscriptionRequestItem*>(it->second[i]) ; RsGxsCircleSubscriptionRequestItem *item = dynamic_cast<RsGxsCircleSubscriptionRequestItem*>(it->second[i]) ;
@ -1995,7 +2005,9 @@ bool p3GxsCircles::processMembershipRequests(uint32_t token)
RsGxsCircleMembershipStatus& info(data.mMembershipStatus[item->meta.mAuthorId]) ; RsGxsCircleMembershipStatus& info(data.mMembershipStatus[item->meta.mAuthorId]) ;
#ifdef DEBUG_CIRCLES
std::cerr << " is from id " << item->meta.mAuthorId << " " << time(NULL) - item->time_stamp << " seconds ago, " ; std::cerr << " is from id " << item->meta.mAuthorId << " " << time(NULL) - item->time_stamp << " seconds ago, " ;
#endif
if(info.last_subscription_TS < item->time_stamp) if(info.last_subscription_TS < item->time_stamp)
{ {
@ -2008,11 +2020,15 @@ bool p3GxsCircles::processMembershipRequests(uint32_t token)
else else
std::cerr << " (EE) unknown subscription order type: " << item->subscription_type ; std::cerr << " (EE) unknown subscription order type: " << item->subscription_type ;
#ifdef DEBUG_CIRCLES
std::cerr << " UPDATING" << std::endl; std::cerr << " UPDATING" << std::endl;
#endif
} }
else if(info.last_subscription_TS > item->time_stamp) else if(info.last_subscription_TS > item->time_stamp)
{ {
#ifdef DEBUG_CIRCLES
std::cerr << " Older than last known (" << time(NULL)-info.last_subscription_TS << " seconds ago): deleting." << std::endl; std::cerr << " Older than last known (" << time(NULL)-info.last_subscription_TS << " seconds ago): deleting." << std::endl;
#endif
messages_to_delete[RsGxsGroupId(cid)].push_back(it->second[i]->meta.mMsgId) ; messages_to_delete[RsGxsGroupId(cid)].push_back(it->second[i]->meta.mMsgId) ;
} }
} }

View File

@ -419,6 +419,8 @@ void IdDialog::loadCircleGroupMeta(const uint32_t &token)
bool should_re_add = true ; bool should_re_add = true ;
bool am_I_in_circle = details.mAmIAllowed ; bool am_I_in_circle = details.mAmIAllowed ;
bool am_I_admin (vit->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN) ;
bool am_I_subscribed (vit->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_SUBSCRIBED) ;
QTreeWidgetItem *item = NULL ; QTreeWidgetItem *item = NULL ;
#ifdef ID_DEBUG #ifdef ID_DEBUG
@ -478,12 +480,26 @@ void IdDialog::loadCircleGroupMeta(const uint32_t &token)
item = new QTreeWidgetItem(); item = new QTreeWidgetItem();
item->setText(CIRCLEGROUP_CIRCLE_COL_GROUPNAME, QString::fromUtf8(vit->mGroupName.c_str())); item->setText(CIRCLEGROUP_CIRCLE_COL_GROUPNAME, QString::fromUtf8(vit->mGroupName.c_str()));
item->setToolTip(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,tr("Circle ID: ")+QString::fromStdString(vit->mGroupId.toStdString()));
item->setData(CIRCLEGROUP_CIRCLE_COL_GROUPID,Qt::UserRole, QString::fromStdString(vit->mGroupId.toStdString())); item->setData(CIRCLEGROUP_CIRCLE_COL_GROUPID,Qt::UserRole, QString::fromStdString(vit->mGroupId.toStdString()));
item->setData(CIRCLEGROUP_CIRCLE_COL_GROUPFLAGS, Qt::UserRole, QVariant(vit->mSubscribeFlags)); item->setData(CIRCLEGROUP_CIRCLE_COL_GROUPFLAGS, Qt::UserRole, QVariant(vit->mSubscribeFlags));
#warning TODO
//item->setData(CIRCLEGROUP_CIRCLE_COL_SUBSCRIBEFLAGS, Qt::UserRole, QVariant(details.mSubscribeFlags));
QString tooltip ;
tooltip += tr("Circle ID: ")+QString::fromStdString(vit->mGroupId.toStdString()) ;
tooltip += "\n"+tr("Role: ");
if(am_I_admin)
tooltip += tr("Administrator (Can edit invite list, and request membership).") ;
else
tooltip += tr("User (Can only request membership).") ;
tooltip += "\n"+tr("Distribution: ");
if(am_I_subscribed)
tooltip += tr("subscribed (Receive/forward membership requests from others and invite list).") ;
else
tooltip += tr("unsubscribed (Only receive invite list).") ;
item->setToolTip(CIRCLEGROUP_CIRCLE_COL_GROUPNAME,tooltip);
#ifdef CIRCLE_MEMBERSHIP_CATEGORIES #ifdef CIRCLE_MEMBERSHIP_CATEGORIES
if(am_I_in_circle) if(am_I_in_circle)
{ {
@ -513,10 +529,8 @@ void IdDialog::loadCircleGroupMeta(const uint32_t &token)
// just in case. // just in case.
item->setData(CIRCLEGROUP_CIRCLE_COL_GROUPFLAGS, Qt::UserRole, QVariant(vit->mSubscribeFlags)); item->setData(CIRCLEGROUP_CIRCLE_COL_GROUPFLAGS, Qt::UserRole, QVariant(vit->mSubscribeFlags));
#warning TODO
//item->setData(CIRCLEGROUP_CIRCLE_COL_SUBSCRIBEFLAGS, Qt::UserRole, QVariant(details.mSubscribeFlags));
if (vit->mSubscribeFlags & GXS_SERV::GROUP_SUBSCRIBE_ADMIN) if (am_I_admin)
{ {
QFont font = item->font(CIRCLEGROUP_CIRCLE_COL_GROUPNAME) ; QFont font = item->font(CIRCLEGROUP_CIRCLE_COL_GROUPNAME) ;
font.setBold(true) ; font.setBold(true) ;
@ -608,7 +622,22 @@ void IdDialog::loadCircleGroupMeta(const uint32_t &token)
else else
subitem->setText(CIRCLEGROUP_CIRCLE_COL_GROUPNAME, tr("Unknown ID :")+QString::fromStdString(it->first.toStdString())) ; subitem->setText(CIRCLEGROUP_CIRCLE_COL_GROUPNAME, tr("Unknown ID :")+QString::fromStdString(it->first.toStdString())) ;
subitem->setToolTip(CIRCLEGROUP_CIRCLE_COL_GROUPNAME, tr("Indentity ID: ")+QString::fromStdString(it->first.toStdString())) ; QString tooltip ;
tooltip += tr("Identity ID: ")+QString::fromStdString(it->first.toStdString()) ;
tooltip += "\n"+tr("Status: ") ;
if(invited)
if(subscrb)
tooltip += tr("Full member") ;
else
tooltip += tr("Invited by admin") ;
else
if(subscrb)
tooltip += tr("Subscription request pending") ;
else
tooltip += tr("unknown") ;
subitem->setToolTip(CIRCLEGROUP_CIRCLE_COL_GROUPNAME, tooltip) ;
subitem->setData(CIRCLEGROUP_CIRCLE_COL_GROUPFLAGS, Qt::UserRole, QVariant(it->second)) ; subitem->setData(CIRCLEGROUP_CIRCLE_COL_GROUPFLAGS, Qt::UserRole, QVariant(it->second)) ;
subitem->setData(CIRCLEGROUP_CIRCLE_COL_GROUPID, Qt::UserRole, QString::fromStdString(it->first.toStdString())) ; subitem->setData(CIRCLEGROUP_CIRCLE_COL_GROUPID, Qt::UserRole, QString::fromStdString(it->first.toStdString())) ;