mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-25 15:39:27 -05:00
Small performance optimization in ForumsDialog when manipulating the read status.
Calculate only processed toplevel items. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3357 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
2b597d4542
commit
2b3fb8e988
@ -1508,7 +1508,7 @@ int ForumsDialog::getSelectedMsgCount(QList<QTreeWidgetItem*> *pRows, QList<QTre
|
||||
void ForumsDialog::setMsgAsReadUnread(QList<QTreeWidgetItem*> &Rows, bool bRead)
|
||||
{
|
||||
QList<QTreeWidgetItem*>::iterator Row;
|
||||
bool bChanged = false;
|
||||
std::list<QTreeWidgetItem*> changedItems;
|
||||
|
||||
for (Row = Rows.begin(); Row != Rows.end(); Row++) {
|
||||
uint32_t status = (*Row)->data(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS).toUInt();
|
||||
@ -1527,12 +1527,21 @@ void ForumsDialog::setMsgAsReadUnread(QList<QTreeWidgetItem*> &Rows, bool bRead)
|
||||
rsForums->setMessageStatus(mCurrForumId, msgId, statusNew, FORUM_MSG_STATUS_READ | FORUM_MSG_STATUS_UNREAD_BY_USER);
|
||||
|
||||
(*Row)->setData(COLUMN_THREAD_DATA, ROLE_THREAD_STATUS, statusNew);
|
||||
bChanged = true;
|
||||
|
||||
QTreeWidgetItem *parentItem = *Row;
|
||||
while (parentItem->parent()) {
|
||||
parentItem = parentItem->parent();
|
||||
}
|
||||
if (std::find(changedItems.begin(), changedItems.end(), parentItem) == changedItems.end()) {
|
||||
changedItems.push_back(parentItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bChanged) {
|
||||
CalculateIconsAndFonts();
|
||||
if (changedItems.size()) {
|
||||
for (std::list<QTreeWidgetItem*>::iterator it = changedItems.begin(); it != changedItems.end(); it++) {
|
||||
CalculateIconsAndFonts(*it);
|
||||
}
|
||||
updateMessageSummaryList(mCurrForumId);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user