This commit is contained in:
fourtf 2018-01-11 21:03:40 +01:00
parent a7fa4160e8
commit a339c4ca0a

View file

@ -378,12 +378,14 @@ void ChannelView::setChannel(SharedChannel newChannel)
auto messageRef = new MessageLayout(message); auto messageRef = new MessageLayout(message);
if (this->messages.pushBack(MessageLayoutPtr(messageRef), deleted)) { if (this->messages.pushBack(MessageLayoutPtr(messageRef), deleted)) {
if (!this->paused) {
if (this->scrollBar.isAtBottom()) { if (this->scrollBar.isAtBottom()) {
this->scrollBar.scrollToBottom(); this->scrollBar.scrollToBottom();
} else { } else {
this->scrollBar.offset(-1); this->scrollBar.offset(-1);
} }
} }
}
if (!message->hasFlags(Message::DoNotTriggerNotification)) { if (!message->hasFlags(Message::DoNotTriggerNotification)) {
this->highlightedMessageReceived.invoke(); this->highlightedMessageReceived.invoke();
@ -404,6 +406,7 @@ void ChannelView::setChannel(SharedChannel newChannel)
messageRefs.at(i) = MessageLayoutPtr(new MessageLayout(messages.at(i))); messageRefs.at(i) = MessageLayoutPtr(new MessageLayout(messages.at(i)));
} }
if (!this->paused) {
if (this->messages.pushFront(messageRefs).size() > 0) { if (this->messages.pushFront(messageRefs).size() > 0) {
if (this->scrollBar.isAtBottom()) { if (this->scrollBar.isAtBottom()) {
this->scrollBar.scrollToBottom(); this->scrollBar.scrollToBottom();
@ -411,6 +414,7 @@ void ChannelView::setChannel(SharedChannel newChannel)
this->scrollBar.offset((qreal)messages.size()); this->scrollBar.offset((qreal)messages.size());
} }
} }
}
std::vector<ScrollbarHighlight> highlights; std::vector<ScrollbarHighlight> highlights;
highlights.reserve(messages.size()); highlights.reserve(messages.size());