mirror-chatterino2/src/messages/Message.cpp
Ryan e24dffa961
Fix 'First Message' scrollbar highlights not being disabled (#3325)
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
2021-10-30 13:24:38 +02:00

59 lines
1.5 KiB
C++

#include "messages/Message.hpp"
#include "Application.hpp"
#include "MessageElement.hpp"
#include "providers/twitch/PubsubActions.hpp"
#include "singletons/Theme.hpp"
#include "util/DebugCount.hpp"
#include "util/IrcHelpers.hpp"
using SBHighlight = chatterino::ScrollbarHighlight;
namespace chatterino {
Message::Message()
: parseTime(QTime::currentTime())
{
DebugCount::increase("messages");
}
Message::~Message()
{
DebugCount::decrease("messages");
}
SBHighlight Message::getScrollBarHighlight() const
{
if (this->flags.has(MessageFlag::Highlighted) ||
this->flags.has(MessageFlag::HighlightedWhisper))
{
return SBHighlight(this->highlightColor);
}
else if (this->flags.has(MessageFlag::Subscription) &&
getSettings()->enableSubHighlight)
{
return SBHighlight(
ColorProvider::instance().color(ColorType::Subscription));
}
else if (this->flags.has(MessageFlag::RedeemedHighlight) ||
this->flags.has(MessageFlag::RedeemedChannelPointReward))
{
return SBHighlight(
ColorProvider::instance().color(ColorType::RedeemedHighlight),
SBHighlight::Default, true);
}
else if (this->flags.has(MessageFlag::FirstMessage))
{
return SBHighlight(
ColorProvider::instance().color(ColorType::FirstMessageHighlight),
SBHighlight::Default, false, true);
}
return SBHighlight();
}
// Static
namespace {
} // namespace
} // namespace chatterino