Browse Source

Speedup loading history

By not marking everything as not sent then doing a second pass that marks sent things as sent, redoing the layout for every item...
pull/2834/head
tux3 10 years ago
parent
commit
217716184b
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
  1. 9
      src/widget/form/chatform.cpp

9
src/widget/form/chatform.cpp

@ -719,12 +719,13 @@ void ChatForm::loadHistory(QDateTime since, bool processUndelivered) @@ -719,12 +719,13 @@ void ChatForm::loadHistory(QDateTime since, bool processUndelivered)
ToxId authorId = ToxId(it.sender);
QString authorStr = !it.dispName.isEmpty() ? it.dispName : (authorId.isSelf() ? Core::getInstance()->getUsername() : resolveToxId(authorId));
bool isAction = it.message.startsWith("/me ", Qt::CaseInsensitive);
bool needSending = !it.isSent && authorId.isSelf();
ChatMessage::Ptr msg = ChatMessage::createChatMessage(authorStr,
isAction ? it.message.mid(4) : it.message,
isAction ? ChatMessage::ACTION : ChatMessage::NORMAL,
authorId.isSelf(),
QDateTime());
needSending ? QDateTime() : msgDateTime);
if (!isAction && (prevId == authorId) && (prevMsgDateTime.secsTo(msgDateTime) < getChatLog()->repNameAfter) )
msg->hideSender();
@ -732,11 +733,7 @@ void ChatForm::loadHistory(QDateTime since, bool processUndelivered) @@ -732,11 +733,7 @@ void ChatForm::loadHistory(QDateTime since, bool processUndelivered)
prevId = authorId;
prevMsgDateTime = msgDateTime;
if (it.isSent || !authorId.isSelf())
{
msg->markAsSent(msgDateTime);
}
else
if (needSending)
{
if (processUndelivered)
{

Loading…
Cancel
Save