removed calls to getServiceStatistics from GxsUserNotify and replaced by info collected by GxsGroupFrameDialog

This commit is contained in:
csoler 2020-04-08 21:11:53 +02:00
parent c60f1d1331
commit b0e61376f1
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
14 changed files with 47 additions and 62 deletions

View file

@ -1116,7 +1116,7 @@ void GxsGroupFrameDialog::updateGroupStatistics(const RsGxsGroupId &groupId)
return;
}
RsQThreadUtils::postToObject( [this,stats]()
RsQThreadUtils::postToObject( [this,stats, groupId]()
{
/* 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
@ -1129,6 +1129,7 @@ void GxsGroupFrameDialog::updateGroupStatistics(const RsGxsGroupId &groupId)
return;
ui->groupTreeWidget->setUnreadCount(item, mCountChildMsgs ? (stats.mNumThreadMsgsUnread + stats.mNumChildMsgsUnread) : stats.mNumThreadMsgsUnread);
mCachedGroupStats[groupId] = stats;
getUserNotify()->updateIcon();
@ -1136,6 +1137,23 @@ void GxsGroupFrameDialog::updateGroupStatistics(const RsGxsGroupId &groupId)
});
}
void GxsGroupFrameDialog::getServiceStatistics(GxsServiceStatistic& stats) const
{
stats = GxsServiceStatistic(); // clears everything
for(auto it: mCachedGroupStats)
{
const GxsGroupStatistic& s(it.second);
stats.mNumMsgs += s.mNumMsgs;
stats.mNumGrps += 1;
stats.mSizeOfMsgs += s.mTotalSizeOfMsgs;
stats.mNumThreadMsgsNew += s.mNumThreadMsgsNew;
stats.mNumThreadMsgsUnread += s.mNumThreadMsgsUnread;
stats.mNumChildMsgsNew += s.mNumChildMsgsNew ;
stats.mNumChildMsgsUnread += s.mNumChildMsgsUnread ;
}
}
TurtleRequestId GxsGroupFrameDialog::distantSearch(const QString& search_string) // this should be overloaded in the child class
{