mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
alternate color for historic messages
This commit is contained in:
parent
5453c65f0f
commit
6416bf3927
|
@ -620,26 +620,31 @@ void ChannelView::messageAddedAtStart(std::vector<MessagePtr> &messages)
|
|||
{
|
||||
std::vector<MessageLayoutPtr> messageRefs;
|
||||
messageRefs.resize(messages.size());
|
||||
|
||||
/// Create message layouts
|
||||
for (size_t i = 0; i < messages.size(); i++)
|
||||
{
|
||||
messageRefs.at(i) = MessageLayoutPtr(new MessageLayout(messages.at(i)));
|
||||
auto layout = new MessageLayout(messages.at(i));
|
||||
|
||||
// alternate color
|
||||
if (!this->lastMessageHasAlternateBackgroundReverse_)
|
||||
layout->flags.set(MessageLayoutFlag::AlternateBackground);
|
||||
this->lastMessageHasAlternateBackgroundReverse_ =
|
||||
!this->lastMessageHasAlternateBackgroundReverse_;
|
||||
|
||||
messageRefs.at(i) = MessageLayoutPtr(layout);
|
||||
}
|
||||
|
||||
// if (!this->isPaused())
|
||||
{
|
||||
/// Add the messages at the start
|
||||
if (this->messages.pushFront(messageRefs).size() > 0)
|
||||
{
|
||||
if (this->scrollBar_->isAtBottom())
|
||||
{
|
||||
this->scrollBar_->scrollToBottom();
|
||||
}
|
||||
else
|
||||
{
|
||||
this->scrollBar_->offset(qreal(messages.size()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Add highlights
|
||||
std::vector<ScrollbarHighlight> highlights;
|
||||
highlights.reserve(messages.size());
|
||||
for (size_t i = 0; i < messages.size(); i++)
|
||||
|
|
|
@ -149,6 +149,7 @@ private:
|
|||
bool updateQueued_ = false;
|
||||
bool messageWasAdded_ = false;
|
||||
bool lastMessageHasAlternateBackground_ = false;
|
||||
bool lastMessageHasAlternateBackgroundReverse_ = true;
|
||||
|
||||
QTimer pauseTimer_;
|
||||
std::unordered_map<PauseReason, boost::optional<SteadyClock::time_point>>
|
||||
|
|
Loading…
Reference in a new issue