mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-17 13:30:36 -04:00
changed std::vector into std::set in notification system, hence removing lots of std::find(std::vector::begin(),std::vector::end(),T), causing quadratic costs in multiple places.
This commit is contained in:
parent
6139632378
commit
84699db744
36 changed files with 208 additions and 272 deletions
|
@ -2132,12 +2132,12 @@ void IdDialog::updateDisplay(bool complete)
|
|||
}
|
||||
requestCircleGroupMeta();
|
||||
|
||||
std::list<RsGxsGroupId> grpIds;
|
||||
std::set<RsGxsGroupId> grpIds;
|
||||
getAllGrpIds(grpIds);
|
||||
if (!getGrpIds().empty()) {
|
||||
requestIdList();
|
||||
|
||||
if (!mId.isNull() && std::find(grpIds.begin(), grpIds.end(), mId) != grpIds.end()) {
|
||||
if (!mId.isNull() && grpIds.find(mId)!=grpIds.end()) {
|
||||
requestIdDetails();
|
||||
requestRepList();
|
||||
}
|
||||
|
|
|
@ -366,8 +366,8 @@ void NewsFeed::updateDisplay()
|
|||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||
|
||||
GxsMsgReq msgIds;
|
||||
std::vector<RsGxsMessageId> &vect_msgIds = msgIds[grpId];
|
||||
vect_msgIds.push_back(msgId);
|
||||
std::set<RsGxsMessageId> &vect_msgIds = msgIds[grpId];
|
||||
vect_msgIds.insert(msgId);
|
||||
|
||||
uint32_t token;
|
||||
mTokenQueueCircle->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, TOKEN_TYPE_MESSAGE);
|
||||
|
|
|
@ -438,8 +438,8 @@ void GxsForumMsgItem::requestParentMessage(const RsGxsMessageId &msgId)
|
|||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||
|
||||
GxsMsgReq msgIds;
|
||||
std::vector<RsGxsMessageId> &vect_msgIds = msgIds[groupId()];
|
||||
vect_msgIds.push_back(msgId);
|
||||
std::set<RsGxsMessageId> &vect_msgIds = msgIds[groupId()];
|
||||
vect_msgIds.insert(msgId);
|
||||
|
||||
uint32_t token;
|
||||
mLoadQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, mTokenTypeParentMessage);
|
||||
|
|
|
@ -93,19 +93,15 @@ void GxsFeedItem::fillDisplay(RsGxsUpdateBroadcastBase *updateBroadcastBase, boo
|
|||
{
|
||||
GxsGroupFeedItem::fillDisplay(updateBroadcastBase, complete);
|
||||
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > msgs;
|
||||
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > msgs;
|
||||
updateBroadcastBase->getAllMsgIds(msgs);
|
||||
|
||||
if (!msgs.empty())
|
||||
{
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::const_iterator mit = msgs.find(groupId());
|
||||
if (mit != msgs.end())
|
||||
{
|
||||
const std::vector<RsGxsMessageId> &msgIds = mit->second;
|
||||
if (std::find(msgIds.begin(), msgIds.end(), messageId()) != msgIds.end()) {
|
||||
std::map<RsGxsGroupId, std::set<RsGxsMessageId> >::const_iterator mit = msgs.find(groupId());
|
||||
|
||||
if (mit != msgs.end() && mit->second.find(messageId()) != mit->second.end())
|
||||
requestMessage();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -129,8 +125,8 @@ void GxsFeedItem::requestMessage()
|
|||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||
|
||||
GxsMsgReq msgIds;
|
||||
std::vector<RsGxsMessageId> &vect_msgIds = msgIds[groupId()];
|
||||
vect_msgIds.push_back(mMessageId);
|
||||
std::set<RsGxsMessageId> &vect_msgIds = msgIds[groupId()];
|
||||
vect_msgIds.insert(mMessageId);
|
||||
|
||||
uint32_t token;
|
||||
mLoadQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, mTokenTypeMessage);
|
||||
|
|
|
@ -170,12 +170,11 @@ void GxsGroupFeedItem::fillDisplaySlot(bool complete)
|
|||
|
||||
void GxsGroupFeedItem::fillDisplay(RsGxsUpdateBroadcastBase *updateBroadcastBase, bool /*complete*/)
|
||||
{
|
||||
std::list<RsGxsGroupId> grpIds;
|
||||
std::set<RsGxsGroupId> grpIds;
|
||||
updateBroadcastBase->getAllGrpIds(grpIds);
|
||||
|
||||
if (std::find(grpIds.begin(), grpIds.end(), groupId()) != grpIds.end()) {
|
||||
if (grpIds.find(groupId()) != grpIds.end())
|
||||
requestGroup();
|
||||
}
|
||||
}
|
||||
|
||||
/***********************************************************/
|
||||
|
|
|
@ -236,11 +236,10 @@ void GxsGroupFrameDialog::updateDisplay(bool complete)
|
|||
requestGroupSummary();
|
||||
} else {
|
||||
/* Update all groups of changed messages */
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > msgIds;
|
||||
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > msgIds;
|
||||
getAllMsgIds(msgIds);
|
||||
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::iterator msgIt;
|
||||
for (msgIt = msgIds.begin(); msgIt != msgIds.end(); ++msgIt) {
|
||||
for (auto msgIt = msgIds.begin(); msgIt != msgIds.end(); ++msgIt) {
|
||||
updateMessageSummaryList(msgIt->first);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,21 +109,22 @@ void GxsMessageFramePostWidget::updateDisplay(bool complete)
|
|||
}
|
||||
|
||||
bool updateGroup = false;
|
||||
const std::list<RsGxsGroupId> &grpIdsMeta = getGrpIdsMeta();
|
||||
if (std::find(grpIdsMeta.begin(), grpIdsMeta.end(), groupId()) != grpIdsMeta.end()) {
|
||||
updateGroup = true;
|
||||
}
|
||||
const std::set<RsGxsGroupId> &grpIdsMeta = getGrpIdsMeta();
|
||||
|
||||
const std::list<RsGxsGroupId> &grpIds = getGrpIds();
|
||||
if (!groupId().isNull() && std::find(grpIds.begin(), grpIds.end(), groupId()) != grpIds.end()) {
|
||||
if(grpIdsMeta.find(groupId())!=grpIdsMeta.end())
|
||||
updateGroup = true;
|
||||
|
||||
const std::set<RsGxsGroupId> &grpIds = getGrpIds();
|
||||
if (!groupId().isNull() && grpIds.find(groupId())!=grpIds.end())
|
||||
{
|
||||
updateGroup = true;
|
||||
/* Do we need to fill all posts? */
|
||||
requestAllPosts();
|
||||
} else {
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > msgs;
|
||||
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > msgs;
|
||||
getAllMsgIds(msgs);
|
||||
if (!msgs.empty()) {
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::const_iterator mit = msgs.find(groupId());
|
||||
auto mit = msgs.find(groupId());
|
||||
if (mit != msgs.end()) {
|
||||
requestPosts(mit->second);
|
||||
}
|
||||
|
@ -341,7 +342,7 @@ void GxsMessageFramePostWidget::loadAllPosts(const uint32_t &token)
|
|||
emit groupChanged(this);
|
||||
}
|
||||
|
||||
void GxsMessageFramePostWidget::requestPosts(const std::vector<RsGxsMessageId> &msgIds)
|
||||
void GxsMessageFramePostWidget::requestPosts(const std::set<RsGxsMessageId> &msgIds)
|
||||
{
|
||||
#ifdef ENABLE_DEBUG
|
||||
std::cerr << "GxsMessageFramePostWidget::requestPosts()";
|
||||
|
|
|
@ -72,7 +72,7 @@ protected:
|
|||
void loadAllPosts(const uint32_t &token);
|
||||
virtual void insertAllPosts(const uint32_t &token, GxsMessageFramePostThread *thread) = 0;
|
||||
|
||||
void requestPosts(const std::vector<RsGxsMessageId> &msgIds);
|
||||
void requestPosts(const std::set<RsGxsMessageId> &msgIds);
|
||||
void loadPosts(const uint32_t &token);
|
||||
virtual void insertPosts(const uint32_t &token) = 0;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ RsGxsUpdateBroadcastBase::RsGxsUpdateBroadcastBase(RsGxsIfaceHelper *ifaceImpl,
|
|||
mUpdateBroadcast = RsGxsUpdateBroadcast::get(ifaceImpl);
|
||||
connect(mUpdateBroadcast, SIGNAL(changed()), this, SLOT(updateBroadcastChanged()));
|
||||
connect(mUpdateBroadcast, SIGNAL(grpsChanged(std::list<RsGxsGroupId>, std::list<RsGxsGroupId>)), this, SLOT(updateBroadcastGrpsChanged(std::list<RsGxsGroupId>,std::list<RsGxsGroupId>)));
|
||||
connect(mUpdateBroadcast, SIGNAL(msgsChanged(std::map<RsGxsGroupId,std::vector<RsGxsMessageId> >, std::map<RsGxsGroupId,std::vector<RsGxsMessageId> >)), this, SLOT(updateBroadcastMsgsChanged(std::map<RsGxsGroupId,std::vector<RsGxsMessageId> >,std::map<RsGxsGroupId,std::vector<RsGxsMessageId> >)));
|
||||
connect(mUpdateBroadcast, SIGNAL(msgsChanged(std::map<RsGxsGroupId,std::set<RsGxsMessageId> >, std::map<RsGxsGroupId,std::set<RsGxsMessageId> >)), this, SLOT(updateBroadcastMsgsChanged(std::map<RsGxsGroupId,std::set<RsGxsMessageId> >,std::map<RsGxsGroupId,std::set<RsGxsMessageId> >)));
|
||||
}
|
||||
|
||||
RsGxsUpdateBroadcastBase::~RsGxsUpdateBroadcastBase()
|
||||
|
@ -84,79 +84,36 @@ void RsGxsUpdateBroadcastBase::updateBroadcastChanged()
|
|||
void RsGxsUpdateBroadcastBase::updateBroadcastGrpsChanged(const std::list<RsGxsGroupId> &grpIds, const std::list<RsGxsGroupId> &grpIdsMeta)
|
||||
{
|
||||
std::list<RsGxsGroupId>::const_iterator it;
|
||||
for (it = grpIds.begin(); it != grpIds.end(); ++it) {
|
||||
if (std::find(mGrpIds.begin(), mGrpIds.end(), *it) == mGrpIds.end()) {
|
||||
mGrpIds.push_back(*it);
|
||||
}
|
||||
}
|
||||
for (it = grpIdsMeta.begin(); it != grpIdsMeta.end(); ++it) {
|
||||
if (std::find(mGrpIdsMeta.begin(), mGrpIdsMeta.end(), *it) == mGrpIdsMeta.end()) {
|
||||
mGrpIdsMeta.push_back(*it);
|
||||
}
|
||||
}
|
||||
for (it = grpIds.begin(); it != grpIds.end(); ++it)
|
||||
mGrpIds.insert(*it) ;
|
||||
|
||||
for (it = grpIdsMeta.begin(); it != grpIdsMeta.end(); ++it)
|
||||
mGrpIdsMeta.insert(*it);
|
||||
}
|
||||
|
||||
void RsGxsUpdateBroadcastBase::updateBroadcastMsgsChanged(const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgIds, const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgIdsMeta)
|
||||
template<class U> void merge(std::set<U>& dst,const std::set<U>& src) { for(auto it(src.begin());it!=src.end();++it) dst.insert(*it) ; }
|
||||
|
||||
void RsGxsUpdateBroadcastBase::updateBroadcastMsgsChanged(const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgIds, const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgIdsMeta)
|
||||
{
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::const_iterator mapIt;
|
||||
for (mapIt = msgIds.begin(); mapIt != msgIds.end(); ++mapIt) {
|
||||
const RsGxsGroupId &grpId = mapIt->first;
|
||||
const std::vector<RsGxsMessageId> &srcMsgIds = mapIt->second;
|
||||
std::vector<RsGxsMessageId> &destMsgIds = mMsgIds[grpId];
|
||||
for (auto mapIt = msgIds.begin(); mapIt != msgIds.end(); ++mapIt)
|
||||
merge(mMsgIds[mapIt->first],mapIt->second) ;
|
||||
|
||||
std::vector<RsGxsMessageId>::const_iterator msgIt;
|
||||
for (msgIt = srcMsgIds.begin(); msgIt != srcMsgIds.end(); ++msgIt) {
|
||||
if (std::find(destMsgIds.begin(), destMsgIds.end(), *msgIt) == destMsgIds.end()) {
|
||||
destMsgIds.push_back(*msgIt);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (mapIt = msgIdsMeta.begin(); mapIt != msgIdsMeta.end(); ++mapIt) {
|
||||
const RsGxsGroupId &grpId = mapIt->first;
|
||||
const std::vector<RsGxsMessageId> &srcMsgIds = mapIt->second;
|
||||
std::vector<RsGxsMessageId> &destMsgIds = mMsgIdsMeta[grpId];
|
||||
|
||||
std::vector<RsGxsMessageId>::const_iterator msgIt;
|
||||
for (msgIt = srcMsgIds.begin(); msgIt != srcMsgIds.end(); ++msgIt) {
|
||||
if (std::find(destMsgIds.begin(), destMsgIds.end(), *msgIt) == destMsgIds.end()) {
|
||||
destMsgIds.push_back(*msgIt);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (auto mapIt = msgIdsMeta.begin(); mapIt != msgIdsMeta.end(); ++mapIt)
|
||||
merge(mMsgIdsMeta[mapIt->first],mapIt->second) ;
|
||||
}
|
||||
|
||||
void RsGxsUpdateBroadcastBase::getAllGrpIds(std::list<RsGxsGroupId> &grpIds)
|
||||
void RsGxsUpdateBroadcastBase::getAllGrpIds(std::set<RsGxsGroupId> &grpIds)
|
||||
{
|
||||
std::list<RsGxsGroupId>::const_iterator it;
|
||||
for (it = mGrpIds.begin(); it != mGrpIds.end(); ++it) {
|
||||
if (std::find(grpIds.begin(), grpIds.end(), *it) == grpIds.end()) {
|
||||
grpIds.push_back(*it);
|
||||
}
|
||||
}
|
||||
for (it = mGrpIdsMeta.begin(); it != mGrpIdsMeta.end(); ++it) {
|
||||
if (std::find(grpIds.begin(), grpIds.end(), *it) == grpIds.end()) {
|
||||
grpIds.push_back(*it);
|
||||
}
|
||||
}
|
||||
grpIds = mGrpIds;
|
||||
merge(grpIds,mGrpIdsMeta) ;
|
||||
}
|
||||
|
||||
void RsGxsUpdateBroadcastBase::getAllMsgIds(std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgIds)
|
||||
void RsGxsUpdateBroadcastBase::getAllMsgIds(std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgIds)
|
||||
{
|
||||
/* Copy first map */
|
||||
msgIds = mMsgIds;
|
||||
|
||||
/* Append second map */
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::const_iterator mapIt;
|
||||
for (mapIt = mMsgIdsMeta.begin(); mapIt != mMsgIdsMeta.end(); ++mapIt) {
|
||||
const RsGxsGroupId &grpId = mapIt->first;
|
||||
const std::vector<RsGxsMessageId> &srcMsgIds = mapIt->second;
|
||||
std::vector<RsGxsMessageId> &destMsgIds = msgIds[grpId];
|
||||
|
||||
std::vector<RsGxsMessageId>::const_iterator msgIt;
|
||||
for (msgIt = srcMsgIds.begin(); msgIt != srcMsgIds.end(); ++msgIt) {
|
||||
if (std::find(destMsgIds.begin(), destMsgIds.end(), *msgIt) == destMsgIds.end()) {
|
||||
destMsgIds.push_back(*msgIt);
|
||||
}
|
||||
}
|
||||
}
|
||||
for (auto mapIt = mMsgIdsMeta.begin(); mapIt != mMsgIdsMeta.end(); ++mapIt)
|
||||
merge(msgIds[mapIt->first],mapIt->second);
|
||||
}
|
||||
|
|
|
@ -19,12 +19,12 @@ public:
|
|||
RsGxsUpdateBroadcastBase(RsGxsIfaceHelper* ifaceImpl, QWidget *parent = NULL);
|
||||
virtual ~RsGxsUpdateBroadcastBase();
|
||||
|
||||
const std::list<RsGxsGroupId> &getGrpIds() { return mGrpIds; }
|
||||
const std::list<RsGxsGroupId> &getGrpIdsMeta() { return mGrpIdsMeta; }
|
||||
void getAllGrpIds(std::list<RsGxsGroupId> &grpIds);
|
||||
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &getMsgIds() { return mMsgIds; }
|
||||
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &getMsgIdsMeta() { return mMsgIdsMeta; }
|
||||
void getAllMsgIds(std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgIds);
|
||||
const std::set<RsGxsGroupId> &getGrpIds() { return mGrpIds; }
|
||||
const std::set<RsGxsGroupId> &getGrpIdsMeta() { return mGrpIdsMeta; }
|
||||
void getAllGrpIds(std::set<RsGxsGroupId> &grpIds);
|
||||
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIds() { return mMsgIds; }
|
||||
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIdsMeta() { return mMsgIdsMeta; }
|
||||
void getAllMsgIds(std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgIds);
|
||||
|
||||
protected:
|
||||
void fillComplete();
|
||||
|
@ -38,15 +38,15 @@ signals:
|
|||
private slots:
|
||||
void updateBroadcastChanged();
|
||||
void updateBroadcastGrpsChanged(const std::list<RsGxsGroupId>& grpIds, const std::list<RsGxsGroupId> &grpIdsMeta);
|
||||
void updateBroadcastMsgsChanged(const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >& msgIds, const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >& msgIdsMeta);
|
||||
void updateBroadcastMsgsChanged(const std::map<RsGxsGroupId, std::set<RsGxsMessageId> >& msgIds, const std::map<RsGxsGroupId, std::set<RsGxsMessageId> >& msgIdsMeta);
|
||||
void securedUpdateDisplay();
|
||||
|
||||
private:
|
||||
RsGxsUpdateBroadcast *mUpdateBroadcast;
|
||||
bool mFillComplete;
|
||||
bool mUpdateWhenInvisible; // Update also when not visible
|
||||
std::list<RsGxsGroupId> mGrpIds;
|
||||
std::list<RsGxsGroupId> mGrpIdsMeta;
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > mMsgIds;
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > mMsgIdsMeta;
|
||||
std::set<RsGxsGroupId> mGrpIds;
|
||||
std::set<RsGxsGroupId> mGrpIdsMeta;
|
||||
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > mMsgIds;
|
||||
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > mMsgIdsMeta;
|
||||
};
|
||||
|
|
|
@ -22,32 +22,32 @@ void RsGxsUpdateBroadcastPage::setUpdateWhenInvisible(bool update)
|
|||
mBase->setUpdateWhenInvisible(update);
|
||||
}
|
||||
|
||||
const std::list<RsGxsGroupId> &RsGxsUpdateBroadcastPage::getGrpIdsMeta()
|
||||
const std::set<RsGxsGroupId> &RsGxsUpdateBroadcastPage::getGrpIdsMeta()
|
||||
{
|
||||
return mBase->getGrpIdsMeta();
|
||||
}
|
||||
|
||||
void RsGxsUpdateBroadcastPage::getAllGrpIds(std::list<RsGxsGroupId> &grpIds)
|
||||
void RsGxsUpdateBroadcastPage::getAllGrpIds(std::set<RsGxsGroupId> &grpIds)
|
||||
{
|
||||
mBase->getAllGrpIds(grpIds);
|
||||
}
|
||||
|
||||
const std::list<RsGxsGroupId> &RsGxsUpdateBroadcastPage::getGrpIds()
|
||||
const std::set<RsGxsGroupId> &RsGxsUpdateBroadcastPage::getGrpIds()
|
||||
{
|
||||
return mBase->getGrpIds();
|
||||
}
|
||||
|
||||
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &RsGxsUpdateBroadcastPage::getMsgIdsMeta()
|
||||
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &RsGxsUpdateBroadcastPage::getMsgIdsMeta()
|
||||
{
|
||||
return mBase->getMsgIdsMeta();
|
||||
}
|
||||
|
||||
void RsGxsUpdateBroadcastPage::getAllMsgIds(std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgIds)
|
||||
void RsGxsUpdateBroadcastPage::getAllMsgIds(std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgIds)
|
||||
{
|
||||
mBase->getAllMsgIds(msgIds);
|
||||
}
|
||||
|
||||
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &RsGxsUpdateBroadcastPage::getMsgIds()
|
||||
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &RsGxsUpdateBroadcastPage::getMsgIds()
|
||||
{
|
||||
return mBase->getMsgIds();
|
||||
}
|
||||
|
|
|
@ -24,12 +24,12 @@ public:
|
|||
|
||||
void fillComplete();
|
||||
void setUpdateWhenInvisible(bool update);
|
||||
const std::list<RsGxsGroupId> &getGrpIds();
|
||||
const std::list<RsGxsGroupId> &getGrpIdsMeta();
|
||||
void getAllGrpIds(std::list<RsGxsGroupId> &grpIds);
|
||||
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &getMsgIds();
|
||||
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &getMsgIdsMeta();
|
||||
void getAllMsgIds(std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgIds);
|
||||
const std::set<RsGxsGroupId> &getGrpIds();
|
||||
const std::set<RsGxsGroupId> &getGrpIdsMeta();
|
||||
void getAllGrpIds(std::set<RsGxsGroupId> &grpIds);
|
||||
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIds();
|
||||
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIdsMeta();
|
||||
void getAllMsgIds(std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgIds);
|
||||
|
||||
protected:
|
||||
virtual void showEvent(QShowEvent *event);
|
||||
|
|
|
@ -24,32 +24,32 @@ void RsGxsUpdateBroadcastWidget::setUpdateWhenInvisible(bool update)
|
|||
mBase->setUpdateWhenInvisible(update);
|
||||
}
|
||||
|
||||
const std::list<RsGxsGroupId> &RsGxsUpdateBroadcastWidget::getGrpIds()
|
||||
const std::set<RsGxsGroupId> &RsGxsUpdateBroadcastWidget::getGrpIds()
|
||||
{
|
||||
return mBase->getGrpIds();
|
||||
}
|
||||
|
||||
const std::list<RsGxsGroupId> &RsGxsUpdateBroadcastWidget::getGrpIdsMeta()
|
||||
const std::set<RsGxsGroupId> &RsGxsUpdateBroadcastWidget::getGrpIdsMeta()
|
||||
{
|
||||
return mBase->getGrpIdsMeta();
|
||||
}
|
||||
|
||||
void RsGxsUpdateBroadcastWidget::getAllGrpIds(std::list<RsGxsGroupId> &grpIds)
|
||||
void RsGxsUpdateBroadcastWidget::getAllGrpIds(std::set<RsGxsGroupId> &grpIds)
|
||||
{
|
||||
mBase->getAllGrpIds(grpIds);
|
||||
}
|
||||
|
||||
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &RsGxsUpdateBroadcastWidget::getMsgIds()
|
||||
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &RsGxsUpdateBroadcastWidget::getMsgIds()
|
||||
{
|
||||
return mBase->getMsgIds();
|
||||
}
|
||||
|
||||
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &RsGxsUpdateBroadcastWidget::getMsgIdsMeta()
|
||||
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &RsGxsUpdateBroadcastWidget::getMsgIdsMeta()
|
||||
{
|
||||
return mBase->getMsgIdsMeta();
|
||||
}
|
||||
|
||||
void RsGxsUpdateBroadcastWidget::getAllMsgIds(std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgIds)
|
||||
void RsGxsUpdateBroadcastWidget::getAllMsgIds(std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgIds)
|
||||
{
|
||||
mBase->getAllMsgIds(msgIds);
|
||||
}
|
||||
|
|
|
@ -24,12 +24,12 @@ public:
|
|||
|
||||
void fillComplete();
|
||||
void setUpdateWhenInvisible(bool update);
|
||||
const std::list<RsGxsGroupId> &getGrpIds();
|
||||
const std::list<RsGxsGroupId> &getGrpIdsMeta();
|
||||
void getAllGrpIds(std::list<RsGxsGroupId> &grpIds);
|
||||
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &getMsgIds();
|
||||
const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &getMsgIdsMeta();
|
||||
void getAllMsgIds(std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgIds);
|
||||
const std::set<RsGxsGroupId> &getGrpIds();
|
||||
const std::set<RsGxsGroupId> &getGrpIdsMeta();
|
||||
void getAllGrpIds(std::set<RsGxsGroupId> &grpIds);
|
||||
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIds();
|
||||
const std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &getMsgIdsMeta();
|
||||
void getAllMsgIds(std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgIds);
|
||||
|
||||
RsGxsIfaceHelper *interfaceHelper() { return mInterfaceHelper; }
|
||||
|
||||
|
|
|
@ -604,7 +604,7 @@ void CreateGxsChannelMsg::newChannelMsg()
|
|||
GxsMsgReq message_ids;
|
||||
|
||||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||
message_ids[mChannelId].push_back(mOrigPostId);
|
||||
message_ids[mChannelId].insert(mOrigPostId);
|
||||
mChannelQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_SUMMARY, opts, message_ids, CREATEMSG_CHANNEL_POST_INFO);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -185,8 +185,8 @@ void CreateGxsForumMsg::newMsg()
|
|||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||
|
||||
GxsMsgReq msgIds;
|
||||
std::vector<RsGxsMessageId> &vect = msgIds[mForumId];
|
||||
vect.push_back(mParentId);
|
||||
std::set<RsGxsMessageId> &vect = msgIds[mForumId];
|
||||
vect.insert(mParentId);
|
||||
|
||||
//std::cerr << "ForumsV2Dialog::newMsg() Requesting Parent Summary(" << mParentId << ")";
|
||||
//std::cerr << std::endl;
|
||||
|
@ -205,8 +205,8 @@ void CreateGxsForumMsg::newMsg()
|
|||
opts.mReqType = GXS_REQUEST_TYPE_MSG_DATA;
|
||||
|
||||
GxsMsgReq msgIds;
|
||||
std::vector<RsGxsMessageId> &vect = msgIds[mForumId];
|
||||
vect.push_back(mOrigMsgId);
|
||||
std::set<RsGxsMessageId> &vect = msgIds[mForumId];
|
||||
vect.insert(mOrigMsgId);
|
||||
|
||||
//std::cerr << "ForumsV2Dialog::newMsg() Requesting Parent Summary(" << mParentId << ")";
|
||||
//std::cerr << std::endl;
|
||||
|
|
|
@ -404,25 +404,25 @@ void GxsForumThreadWidget::changeEvent(QEvent *e)
|
|||
}
|
||||
}
|
||||
|
||||
static void removeMessages(std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgIds, QList<RsGxsMessageId> &removeMsgId)
|
||||
static void removeMessages(std::map<RsGxsGroupId, std::set<RsGxsMessageId> > &msgIds, QList<RsGxsMessageId> &removeMsgId)
|
||||
{
|
||||
QList<RsGxsMessageId> removedMsgId;
|
||||
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::iterator grpIt;
|
||||
for (grpIt = msgIds.begin(); grpIt != msgIds.end(); ) {
|
||||
std::vector<RsGxsMessageId> &msgs = grpIt->second;
|
||||
for (auto grpIt = msgIds.begin(); grpIt != msgIds.end(); )
|
||||
{
|
||||
std::set<RsGxsMessageId> &msgs = grpIt->second;
|
||||
|
||||
QList<RsGxsMessageId>::const_iterator removeMsgIt;
|
||||
for (removeMsgIt = removeMsgId.begin(); removeMsgIt != removeMsgId.end(); ++removeMsgIt) {
|
||||
std::vector<RsGxsMessageId>::iterator msgIt = std::find(msgs.begin(), msgs.end(), *removeMsgIt);
|
||||
if (msgIt != msgs.end()) {
|
||||
if(msgs.find(*removeMsgIt) != msgs.end())
|
||||
{
|
||||
removedMsgId.push_back(*removeMsgIt);
|
||||
msgs.erase(msgIt);
|
||||
msgs.erase(*removeMsgIt);
|
||||
}
|
||||
}
|
||||
|
||||
if (msgs.empty()) {
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >::iterator grpItErase = grpIt++;
|
||||
std::map<RsGxsGroupId, std::set<RsGxsMessageId> >::iterator grpItErase = grpIt++;
|
||||
msgIds.erase(grpItErase);
|
||||
} else {
|
||||
++grpIt;
|
||||
|
@ -452,18 +452,18 @@ void GxsForumThreadWidget::updateDisplay(bool complete)
|
|||
}
|
||||
|
||||
bool updateGroup = false;
|
||||
const std::list<RsGxsGroupId> &grpIdsMeta = getGrpIdsMeta();
|
||||
if (std::find(grpIdsMeta.begin(), grpIdsMeta.end(), groupId()) != grpIdsMeta.end()) {
|
||||
updateGroup = true;
|
||||
}
|
||||
const std::set<RsGxsGroupId> &grpIdsMeta = getGrpIdsMeta();
|
||||
|
||||
const std::list<RsGxsGroupId> &grpIds = getGrpIds();
|
||||
if (std::find(grpIds.begin(), grpIds.end(), groupId()) != grpIds.end()) {
|
||||
if(grpIdsMeta.find(groupId())!=grpIdsMeta.end())
|
||||
updateGroup = true;
|
||||
|
||||
const std::set<RsGxsGroupId> &grpIds = getGrpIds();
|
||||
if (grpIds.find(groupId())!=grpIds.end()){
|
||||
updateGroup = true;
|
||||
/* Update threads */
|
||||
insertThreads();
|
||||
} else {
|
||||
std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > msgIds;
|
||||
std::map<RsGxsGroupId, std::set<RsGxsMessageId> > msgIds;
|
||||
getAllMsgIds(msgIds);
|
||||
|
||||
if (!mIgnoredMsgId.empty()) {
|
||||
|
@ -2111,8 +2111,8 @@ void GxsForumThreadWidget::flagperson()
|
|||
#endif
|
||||
|
||||
GxsMsgReq msgIds;
|
||||
std::vector<RsGxsMessageId> &vect = msgIds[postId.first];
|
||||
vect.push_back(postId.second);
|
||||
std::set<RsGxsMessageId> &vect = msgIds[postId.first];
|
||||
vect.insert(postId.second);
|
||||
|
||||
uint32_t token;
|
||||
mTokenQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, token_type);
|
||||
|
@ -2413,8 +2413,8 @@ void GxsForumThreadWidget::requestMessageData(const RsGxsGrpMsgIdPair &msgId)
|
|||
#endif
|
||||
|
||||
GxsMsgReq msgIds;
|
||||
std::vector<RsGxsMessageId> &vect = msgIds[msgId.first];
|
||||
vect.push_back(msgId.second);
|
||||
std::set<RsGxsMessageId> &vect = msgIds[msgId.first];
|
||||
vect.insert(msgId.second);
|
||||
|
||||
uint32_t token;
|
||||
mTokenQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, mTokenTypeMessageData);
|
||||
|
@ -2464,8 +2464,8 @@ void GxsForumThreadWidget::requestMsgData_ReplyWithPrivateMessage(const RsGxsGrp
|
|||
#endif
|
||||
|
||||
GxsMsgReq msgIds;
|
||||
std::vector<RsGxsMessageId> &vect = msgIds[msgId.first];
|
||||
vect.push_back(msgId.second);
|
||||
std::set<RsGxsMessageId> &vect = msgIds[msgId.first];
|
||||
vect.insert(msgId.second);
|
||||
|
||||
uint32_t token;
|
||||
mTokenQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, mTokenTypeReplyMessage);
|
||||
|
@ -2482,8 +2482,8 @@ void GxsForumThreadWidget::requestMsgData_ShowAuthorInPeople(const RsGxsGrpMsgId
|
|||
#endif
|
||||
|
||||
GxsMsgReq msgIds;
|
||||
std::vector<RsGxsMessageId> &vect = msgIds[msgId.first];
|
||||
vect.push_back(msgId.second);
|
||||
std::set<RsGxsMessageId> &vect = msgIds[msgId.first];
|
||||
vect.insert(msgId.second);
|
||||
|
||||
uint32_t token;
|
||||
mTokenQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, mTokenTypeShowAuthorInPeople);
|
||||
|
@ -2499,8 +2499,8 @@ void GxsForumThreadWidget::requestMsgData_EditForumMessage(const RsGxsGrpMsgIdPa
|
|||
#endif
|
||||
|
||||
GxsMsgReq msgIds;
|
||||
std::vector<RsGxsMessageId> &vect = msgIds[msgId.first];
|
||||
vect.push_back(msgId.second);
|
||||
std::set<RsGxsMessageId> &vect = msgIds[msgId.first];
|
||||
vect.insert(msgId.second);
|
||||
|
||||
uint32_t token;
|
||||
mTokenQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, mTokenTypeEditForumMessage);
|
||||
|
@ -2516,8 +2516,8 @@ void GxsForumThreadWidget::requestMsgData_ReplyForumMessage(const RsGxsGrpMsgIdP
|
|||
#endif
|
||||
|
||||
GxsMsgReq msgIds;
|
||||
std::vector<RsGxsMessageId> &vect = msgIds[msgId.first];
|
||||
vect.push_back(msgId.second);
|
||||
std::set<RsGxsMessageId> &vect = msgIds[msgId.first];
|
||||
vect.insert(msgId.second);
|
||||
|
||||
uint32_t token;
|
||||
mTokenQueue->requestMsgInfo(token, RS_TOKREQ_ANSTYPE_DATA, opts, msgIds, mTokenTypeReplyForumMessage);
|
||||
|
|
|
@ -19,7 +19,7 @@ public:
|
|||
|
||||
signals:
|
||||
void changed();
|
||||
void msgsChanged(const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >& msgIds, const std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >& msgIdsMeta);
|
||||
void msgsChanged(const std::map<RsGxsGroupId, std::set<RsGxsMessageId> >& msgIds, const std::map<RsGxsGroupId, std::set<RsGxsMessageId> >& msgIdsMeta);
|
||||
void grpsChanged(const std::list<RsGxsGroupId>& grpIds, const std::list<RsGxsGroupId>& grpIdsMeta);
|
||||
|
||||
private slots:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue