mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
disabled red background in #mentions
This commit is contained in:
parent
f4cf464ddb
commit
c6e1ec3c71
5 changed files with 15 additions and 5 deletions
|
@ -226,6 +226,12 @@ bool Channel::isLive() const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Channel::shouldIgnoreHighlights() const
|
||||||
|
{
|
||||||
|
return this->type_ == Type::TwitchMentions ||
|
||||||
|
this->type_ == Type::TwitchWhispers;
|
||||||
|
}
|
||||||
|
|
||||||
std::shared_ptr<Channel> Channel::getEmpty()
|
std::shared_ptr<Channel> Channel::getEmpty()
|
||||||
{
|
{
|
||||||
static std::shared_ptr<Channel> channel(new Channel("", Type::None));
|
static std::shared_ptr<Channel> channel(new Channel("", Type::None));
|
||||||
|
|
|
@ -70,6 +70,7 @@ public:
|
||||||
virtual bool isBroadcaster() const;
|
virtual bool isBroadcaster() const;
|
||||||
virtual bool hasModRights() const;
|
virtual bool hasModRights() const;
|
||||||
virtual bool isLive() const;
|
virtual bool isLive() const;
|
||||||
|
virtual bool shouldIgnoreHighlights() const;
|
||||||
|
|
||||||
static std::shared_ptr<Channel> getEmpty();
|
static std::shared_ptr<Channel> getEmpty();
|
||||||
|
|
||||||
|
|
|
@ -209,21 +209,20 @@ void MessageLayout::updateBuffer(QPixmap *buffer, int /*messageIndex*/,
|
||||||
auto app = getApp();
|
auto app = getApp();
|
||||||
|
|
||||||
QPainter painter(buffer);
|
QPainter painter(buffer);
|
||||||
|
|
||||||
painter.setRenderHint(QPainter::SmoothPixmapTransform);
|
painter.setRenderHint(QPainter::SmoothPixmapTransform);
|
||||||
|
|
||||||
// draw background
|
// draw background
|
||||||
QColor backgroundColor;
|
QColor backgroundColor = app->themes->messages.backgrounds.regular;
|
||||||
if (this->message_->flags.has(MessageFlag::Highlighted)) {
|
if (this->message_->flags.has(MessageFlag::Highlighted) &&
|
||||||
|
!this->flags.has(MessageLayoutFlag::IgnoreHighlights)) {
|
||||||
backgroundColor = app->themes->messages.backgrounds.highlighted;
|
backgroundColor = app->themes->messages.backgrounds.highlighted;
|
||||||
} else if (this->message_->flags.has(MessageFlag::Subscription)) {
|
} else if (this->message_->flags.has(MessageFlag::Subscription)) {
|
||||||
backgroundColor = app->themes->messages.backgrounds.subscription;
|
backgroundColor = app->themes->messages.backgrounds.subscription;
|
||||||
} else if (getSettings()->alternateMessageBackground.getValue() &&
|
} else if (getSettings()->alternateMessageBackground.getValue() &&
|
||||||
this->flags.has(MessageLayoutFlag::AlternateBackground)) {
|
this->flags.has(MessageLayoutFlag::AlternateBackground)) {
|
||||||
backgroundColor = app->themes->messages.backgrounds.alternate;
|
backgroundColor = app->themes->messages.backgrounds.alternate;
|
||||||
} else {
|
|
||||||
backgroundColor = app->themes->messages.backgrounds.regular;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
painter.fillRect(buffer->rect(), backgroundColor);
|
painter.fillRect(buffer->rect(), backgroundColor);
|
||||||
|
|
||||||
// draw message
|
// draw message
|
||||||
|
|
|
@ -26,6 +26,7 @@ enum class MessageLayoutFlag : uint8_t {
|
||||||
AlternateBackground = 1 << 3,
|
AlternateBackground = 1 << 3,
|
||||||
Collapsed = 1 << 4,
|
Collapsed = 1 << 4,
|
||||||
Expanded = 1 << 5,
|
Expanded = 1 << 5,
|
||||||
|
IgnoreHighlights = 1 << 6,
|
||||||
};
|
};
|
||||||
using MessageLayoutFlags = FlagsEnum<MessageLayoutFlag>;
|
using MessageLayoutFlags = FlagsEnum<MessageLayoutFlag>;
|
||||||
|
|
||||||
|
|
|
@ -421,6 +421,9 @@ void ChannelView::setChannel(ChannelPtr newChannel)
|
||||||
if (this->lastMessageHasAlternateBackground_) {
|
if (this->lastMessageHasAlternateBackground_) {
|
||||||
messageRef->flags.set(MessageLayoutFlag::AlternateBackground);
|
messageRef->flags.set(MessageLayoutFlag::AlternateBackground);
|
||||||
}
|
}
|
||||||
|
if (this->channel_->shouldIgnoreHighlights()) {
|
||||||
|
messageRef->flags.set(MessageLayoutFlag::IgnoreHighlights);
|
||||||
|
}
|
||||||
this->lastMessageHasAlternateBackground_ =
|
this->lastMessageHasAlternateBackground_ =
|
||||||
!this->lastMessageHasAlternateBackground_;
|
!this->lastMessageHasAlternateBackground_;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue