mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 23:49:35 -05:00
Optimized fill of forums when modifying the read state.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@8579 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
00007768f1
commit
b7bbe3c937
@ -313,8 +313,10 @@ void GxsForumThreadWidget::changeEvent(QEvent *e)
|
||||
}
|
||||
}
|
||||
|
||||
static void removeMessages(std::map<RsGxsGroupId, std::vector<RsGxsMessageId> > &msgIds, const QList<RsGxsMessageId> &removeMsgId)
|
||||
static void removeMessages(std::map<RsGxsGroupId, std::vector<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;
|
||||
@ -323,6 +325,7 @@ static void removeMessages(std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >
|
||||
for (removeMsgIt = removeMsgId.begin(); removeMsgIt != removeMsgId.end(); ++removeMsgIt) {
|
||||
std::vector<RsGxsMessageId>::iterator msgIt = std::find(msgs.begin(), msgs.end(), *removeMsgIt);
|
||||
if (msgIt != msgs.end()) {
|
||||
removedMsgId.push_back(*removeMsgIt);
|
||||
msgs.erase(msgIt);
|
||||
}
|
||||
}
|
||||
@ -334,6 +337,14 @@ static void removeMessages(std::map<RsGxsGroupId, std::vector<RsGxsMessageId> >
|
||||
++grpIt;
|
||||
}
|
||||
}
|
||||
|
||||
if (!removedMsgId.isEmpty()) {
|
||||
QList<RsGxsMessageId>::const_iterator removedMsgIt;
|
||||
for (removedMsgIt = removedMsgId.begin(); removedMsgIt != removedMsgId.end(); ++removedMsgIt) {
|
||||
// remove first message id
|
||||
removeMsgId.removeOne(*removedMsgIt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GxsForumThreadWidget::updateDisplay(bool complete)
|
||||
@ -367,7 +378,6 @@ void GxsForumThreadWidget::updateDisplay(bool complete)
|
||||
if (!mIgnoredMsgId.empty()) {
|
||||
/* Filter ignored messages */
|
||||
removeMessages(msgIds, mIgnoredMsgId);
|
||||
mIgnoredMsgId.clear();
|
||||
}
|
||||
|
||||
if (msgIds.find(groupId()) != msgIds.end()) {
|
||||
|
Loading…
Reference in New Issue
Block a user