mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
alternate message colors now work on replaced messages and when
changing channels
This commit is contained in:
parent
34a58021bc
commit
3e3cbf0415
|
@ -140,7 +140,7 @@ void ThemeManager::actuallyUpdate(double hue, double multiplier)
|
|||
this->messages.textColors.system = QColor(140, 127, 127);
|
||||
|
||||
this->messages.backgrounds.regular = splits.background;
|
||||
this->messages.backgrounds.alternate = getColor(0, sat, 0.96);
|
||||
this->messages.backgrounds.alternate = getColor(0, sat, 0.93);
|
||||
this->messages.backgrounds.highlighted =
|
||||
blendColors(themeColor, this->messages.backgrounds.regular, 0.8);
|
||||
// this->messages.backgrounds.resub
|
||||
|
|
|
@ -277,26 +277,26 @@ QString ChannelView::getSelectedText()
|
|||
|
||||
messages::LimitedQueueSnapshot<MessageLayoutPtr> messagesSnapshot = this->getMessagesSnapshot();
|
||||
|
||||
Selection selection = this->selection;
|
||||
Selection _selection = this->selection;
|
||||
|
||||
if (selection.isEmpty()) {
|
||||
if (_selection.isEmpty()) {
|
||||
return result;
|
||||
}
|
||||
|
||||
qDebug() << "xd >>>>";
|
||||
for (int msg = selection.selectionMin.messageIndex; msg <= selection.selectionMax.messageIndex;
|
||||
msg++) {
|
||||
qDebug() << "xd >";
|
||||
for (int msg = _selection.selectionMin.messageIndex;
|
||||
msg <= _selection.selectionMax.messageIndex; msg++) {
|
||||
MessageLayoutPtr layout = messagesSnapshot[msg];
|
||||
int from =
|
||||
msg == selection.selectionMin.messageIndex ? selection.selectionMin.charIndex : 0;
|
||||
int to = msg == selection.selectionMax.messageIndex ? selection.selectionMax.charIndex
|
||||
: layout->getLastCharacterIndex() + 1;
|
||||
msg == _selection.selectionMin.messageIndex ? _selection.selectionMin.charIndex : 0;
|
||||
int to = msg == _selection.selectionMax.messageIndex ? _selection.selectionMax.charIndex
|
||||
: layout->getLastCharacterIndex() + 1;
|
||||
|
||||
qDebug() << "from:" << from << ", to:" << to;
|
||||
|
||||
layout->addSelectionText(result, from, to);
|
||||
}
|
||||
qDebug() << "xd <<<<";
|
||||
qDebug() << "xd <";
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -430,6 +430,9 @@ void ChannelView::setChannel(ChannelPtr newChannel)
|
|||
this->messageReplacedConnection =
|
||||
newChannel->messageReplaced.connect([this](size_t index, MessagePtr replacement) {
|
||||
MessageLayoutPtr newItem(new MessageLayout(replacement));
|
||||
if (this->messages.getSnapshot()[index]->flags & MessageLayout::AlternateBackground) {
|
||||
newItem->flags |= MessageLayout::AlternateBackground;
|
||||
}
|
||||
|
||||
this->scrollBar.replaceHighlight(index, replacement->getScrollBarHighlight());
|
||||
|
||||
|
@ -444,6 +447,11 @@ void ChannelView::setChannel(ChannelPtr newChannel)
|
|||
|
||||
auto messageRef = new MessageLayout(snapshot[i]);
|
||||
|
||||
if (this->lastMessageHasAlternateBackground) {
|
||||
messageRef->flags |= MessageLayout::AlternateBackground;
|
||||
}
|
||||
this->lastMessageHasAlternateBackground = !this->lastMessageHasAlternateBackground;
|
||||
|
||||
this->messages.pushBack(MessageLayoutPtr(messageRef), deleted);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue