disabled red background in #mentions

This commit is contained in:
fourtf 2018-10-21 13:29:52 +02:00
parent f4cf464ddb
commit c6e1ec3c71
5 changed files with 15 additions and 5 deletions

View file

@ -226,6 +226,12 @@ bool Channel::isLive() const
return false;
}
bool Channel::shouldIgnoreHighlights() const
{
return this->type_ == Type::TwitchMentions ||
this->type_ == Type::TwitchWhispers;
}
std::shared_ptr<Channel> Channel::getEmpty()
{
static std::shared_ptr<Channel> channel(new Channel("", Type::None));

View file

@ -70,6 +70,7 @@ public:
virtual bool isBroadcaster() const;
virtual bool hasModRights() const;
virtual bool isLive() const;
virtual bool shouldIgnoreHighlights() const;
static std::shared_ptr<Channel> getEmpty();

View file

@ -209,21 +209,20 @@ void MessageLayout::updateBuffer(QPixmap *buffer, int /*messageIndex*/,
auto app = getApp();
QPainter painter(buffer);
painter.setRenderHint(QPainter::SmoothPixmapTransform);
// draw background
QColor backgroundColor;
if (this->message_->flags.has(MessageFlag::Highlighted)) {
QColor backgroundColor = app->themes->messages.backgrounds.regular;
if (this->message_->flags.has(MessageFlag::Highlighted) &&
!this->flags.has(MessageLayoutFlag::IgnoreHighlights)) {
backgroundColor = app->themes->messages.backgrounds.highlighted;
} else if (this->message_->flags.has(MessageFlag::Subscription)) {
backgroundColor = app->themes->messages.backgrounds.subscription;
} else if (getSettings()->alternateMessageBackground.getValue() &&
this->flags.has(MessageLayoutFlag::AlternateBackground)) {
backgroundColor = app->themes->messages.backgrounds.alternate;
} else {
backgroundColor = app->themes->messages.backgrounds.regular;
}
painter.fillRect(buffer->rect(), backgroundColor);
// draw message

View file

@ -26,6 +26,7 @@ enum class MessageLayoutFlag : uint8_t {
AlternateBackground = 1 << 3,
Collapsed = 1 << 4,
Expanded = 1 << 5,
IgnoreHighlights = 1 << 6,
};
using MessageLayoutFlags = FlagsEnum<MessageLayoutFlag>;

View file

@ -421,6 +421,9 @@ void ChannelView::setChannel(ChannelPtr newChannel)
if (this->lastMessageHasAlternateBackground_) {
messageRef->flags.set(MessageLayoutFlag::AlternateBackground);
}
if (this->channel_->shouldIgnoreHighlights()) {
messageRef->flags.set(MessageLayoutFlag::IgnoreHighlights);
}
this->lastMessageHasAlternateBackground_ =
!this->lastMessageHasAlternateBackground_;