re-enabled GroupMetaCache in GxsGroupFrameDialog and only reload fully when needed

This commit is contained in:
csoler 2020-03-22 02:33:51 +01:00
parent 83b130fa90
commit 7ba83272cf
No known key found for this signature in database
GPG Key ID: 7BCA522266C0804C

View File

@ -137,6 +137,8 @@ void GxsGroupFrameDialog::getGroupList(std::map<RsGxsGroupId, RsGroupMetaData> &
if(group_list.empty()) if(group_list.empty())
updateGroupSummary(); updateGroupSummary();
else
std::cerr << "************** Using cached GroupMetaData" << std::endl;
} }
void GxsGroupFrameDialog::initUi() void GxsGroupFrameDialog::initUi()
{ {
@ -181,9 +183,7 @@ void GxsGroupFrameDialog::showEvent(QShowEvent *event)
initUi(); initUi();
} }
updateDisplay(true); updateDisplay( mCachedGroupMetas.empty() );
// RsGxsUpdateBroadcastPage::showEvent(event);
} }
void GxsGroupFrameDialog::processSettings(bool load) void GxsGroupFrameDialog::processSettings(bool load)
@ -1051,10 +1051,17 @@ void GxsGroupFrameDialog::updateGroupSummary()
mNavigatePendingGroupId.clear(); mNavigatePendingGroupId.clear();
mNavigatePendingMsgId.clear(); mNavigatePendingMsgId.clear();
} }
// update the local cache in order to avoid re-asking the data when the UI wants it (this happens on ::show() for instance)
mCachedGroupMetas.clear();
// now delete the data that is not used anymore // now delete the data that is not used anymore
for(auto& g:groupInfo) for(auto& g:groupInfo)
{
mCachedGroupMetas[g->mMeta.mGroupId] = g->mMeta;
delete g; delete g;
}
}, this ); }, this );
}); });