diff --git a/libretroshare/src/gxs/rsgxsdataaccess.cc b/libretroshare/src/gxs/rsgxsdataaccess.cc index f04faa4fe..2da84d2b4 100644 --- a/libretroshare/src/gxs/rsgxsdataaccess.cc +++ b/libretroshare/src/gxs/rsgxsdataaccess.cc @@ -335,14 +335,6 @@ RsTokenService::GxsRequestStatus RsGxsDataAccess::requestStatus(uint32_t token) uint32_t anstype; rstime_t ts; -// { -// RS_STACK_MUTEX(mDataMutex); -// -// // first check public tokens -// if(mPublicToken.find(token) != mPublicToken.end()) -// return mPublicToken[token]; -// } - if (!checkRequestStatus(token, status, reqtype, anstype, ts)) return RsTokenService::FAILED; @@ -724,9 +716,6 @@ GxsRequest* RsGxsDataAccess::locked_retrieveCompetedRequest(const uint32_t& toke void RsGxsDataAccess::processRequests() { // process requests -#ifdef DATA_DEBUG - RsDbg() << "processing requests" << std::endl; -#endif while (!mRequestQueue.empty()) { @@ -762,6 +751,7 @@ void RsGxsDataAccess::processRequests() case PENDING: req = mRequestQueue.begin()->second; req->status = PARTIAL; + mRequestQueue.erase(mRequestQueue.begin()); // remove it right away from the waiting queue. break; } @@ -1486,7 +1476,7 @@ bool RsGxsDataAccess::getGroupStatistic(GroupStatisticRequest *req) GxsMsgMetaResult metaResult; mDataStore->retrieveGxsMsgMetaData(metaReq, metaResult); - std::vector& msgMetaV = metaResult[req->mGrpId]; + const std::vector& msgMetaV = metaResult[req->mGrpId]; req->mGroupStatistic.mGrpId = req->mGrpId; req->mGroupStatistic.mNumMsgs = msgMetaV.size(); diff --git a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp index aa9dde0ff..ad8480978 100644 --- a/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp +++ b/retroshare-gui/src/gui/gxs/GxsGroupFrameDialog.cpp @@ -182,7 +182,26 @@ void GxsGroupFrameDialog::showEvent(QShowEvent *event) initUi(); } - updateDisplay( mCachedGroupMetas.empty() ); + bool empty = mCachedGroupMetas.empty(); + + updateDisplay( empty ); +} + +void GxsGroupFrameDialog::paintEvent(QPaintEvent *pe) +{ + if(mShouldUpdateMessageSummaryList) + { + if(!mGroupIdsSummaryToUpdate.empty()) + for(auto& group_id: mGroupIdsSummaryToUpdate) + updateMessageSummaryListReal(group_id); + else + updateMessageSummaryListReal(RsGxsGroupId()); + + mShouldUpdateMessageSummaryList = false; + mGroupIdsSummaryToUpdate.clear(); + } + + MainPage::paintEvent(pe); } void GxsGroupFrameDialog::processSettings(bool load) @@ -988,6 +1007,18 @@ void GxsGroupFrameDialog::insertGroupsData(const std::list &groups) ; protected: - virtual void showEvent(QShowEvent *event); + virtual void showEvent(QShowEvent *event) override; + virtual void paintEvent(QPaintEvent *pe) override; virtual void updateDisplay(bool complete); const RsGxsGroupId &groupId() { return mGroupId; } @@ -159,6 +160,7 @@ private: void initUi(); + void updateMessageSummaryListReal(RsGxsGroupId groupId); void openGroupInNewTab(const RsGxsGroupId &groupId); void groupSubscribe(bool subscribe); @@ -209,6 +211,9 @@ private: RsGxsGroupId mNavigatePendingGroupId; RsGxsMessageId mNavigatePendingMsgId; + bool mShouldUpdateMessageSummaryList ; // whether we should update the counting for groups. This takes some CPU so we only do it when needed. + std::set mGroupIdsSummaryToUpdate; + UIStateHelper *mStateHelper; /** Qt Designer generated object */ diff --git a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp index 3d19f00f9..395c9db31 100644 --- a/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp +++ b/retroshare-gui/src/gui/gxschannels/GxsChannelDialog.cpp @@ -64,8 +64,8 @@ void GxsChannelDialog::handleEvent_main_thread(std::shared_ptr ev switch(e->mChannelEventCode) { - case RsChannelEventCode::NEW_MESSAGE: - case RsChannelEventCode::UPDATED_MESSAGE: // [[fallthrough]]; + case RsChannelEventCode::NEW_MESSAGE: // [[fallthrough]]; + case RsChannelEventCode::UPDATED_MESSAGE: case RsChannelEventCode::READ_STATUS_CHANGED: updateMessageSummaryList(e->mChannelGroupId); break;