84 lines
2.0 KiB
C++
84 lines
2.0 KiB
C++
#include "messages/Message.hpp"
|
|
|
|
#include "providers/colors/ColorProvider.hpp"
|
|
#include "providers/twitch/TwitchBadge.hpp"
|
|
#include "singletons/Settings.hpp"
|
|
#include "util/DebugCount.hpp"
|
|
#include "widgets/helper/ScrollbarHighlight.hpp"
|
|
|
|
namespace chatterino {
|
|
|
|
Message::Message()
|
|
: parseTime(QTime::currentTime())
|
|
{
|
|
DebugCount::increase("messages");
|
|
}
|
|
|
|
Message::~Message()
|
|
{
|
|
DebugCount::decrease("messages");
|
|
}
|
|
|
|
ScrollbarHighlight Message::getScrollBarHighlight() const
|
|
{
|
|
if (this->flags.has(MessageFlag::Highlighted) ||
|
|
this->flags.has(MessageFlag::HighlightedWhisper))
|
|
{
|
|
return {
|
|
this->highlightColor,
|
|
};
|
|
}
|
|
|
|
if (this->flags.has(MessageFlag::Subscription) &&
|
|
getSettings()->enableSubHighlight)
|
|
{
|
|
return {
|
|
ColorProvider::instance().color(ColorType::Subscription),
|
|
};
|
|
}
|
|
|
|
if (this->flags.has(MessageFlag::RedeemedHighlight) ||
|
|
this->flags.has(MessageFlag::RedeemedChannelPointReward))
|
|
{
|
|
return {
|
|
ColorProvider::instance().color(ColorType::RedeemedHighlight),
|
|
ScrollbarHighlight::Default,
|
|
true,
|
|
};
|
|
}
|
|
|
|
if (this->flags.has(MessageFlag::ElevatedMessage))
|
|
{
|
|
return {
|
|
ColorProvider::instance().color(
|
|
ColorType::ElevatedMessageHighlight),
|
|
ScrollbarHighlight::Default,
|
|
false,
|
|
false,
|
|
true,
|
|
};
|
|
}
|
|
|
|
if (this->flags.has(MessageFlag::FirstMessage))
|
|
{
|
|
return {
|
|
ColorProvider::instance().color(ColorType::FirstMessageHighlight),
|
|
ScrollbarHighlight::Default,
|
|
false,
|
|
true,
|
|
};
|
|
}
|
|
|
|
if (this->flags.has(MessageFlag::AutoModOffendingMessage) ||
|
|
this->flags.has(MessageFlag::AutoModOffendingMessageHeader))
|
|
{
|
|
return {
|
|
ColorProvider::instance().color(ColorType::AutomodHighlight),
|
|
};
|
|
}
|
|
|
|
return {};
|
|
}
|
|
|
|
} // namespace chatterino
|