Add highlights for first messages (#3267)

Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
gempir
2021-10-02 14:17:24 +02:00
committed by GitHub
parent acc573a8c5
commit 0ba7c0f3c5
12 changed files with 84 additions and 4 deletions
+14
View File
@@ -119,6 +119,20 @@ void ColorProvider::initTypeColorMap()
std::make_shared<QColor>(
HighlightPhrase::FALLBACK_REDEEMED_HIGHLIGHT_COLOR)});
}
customColor = getSettings()->firstMessageHighlightColor;
if (QColor(customColor).isValid())
{
this->typeColorMap_.insert({ColorType::FirstMessageHighlight,
std::make_shared<QColor>(customColor)});
}
else
{
this->typeColorMap_.insert(
{ColorType::FirstMessageHighlight,
std::make_shared<QColor>(
HighlightPhrase::FALLBACK_FIRST_MESSAGE_HIGHLIGHT_COLOR)});
}
}
void ColorProvider::initDefaultColors()
+2 -1
View File
@@ -11,7 +11,8 @@ enum class ColorType {
SelfHighlight,
Subscription,
Whisper,
RedeemedHighlight
RedeemedHighlight,
FirstMessageHighlight,
};
class ColorProvider
@@ -180,6 +180,12 @@ MessagePtr TwitchMessageBuilder::build()
this->message().flags.set(MessageFlag::RedeemedHighlight);
}
if (this->tags.contains("first-msg") &&
this->tags["first-msg"].toString() == "1")
{
this->message().flags.set(MessageFlag::FirstMessage);
}
// timestamp
this->emplace<TimestampElement>(
calculateMessageTimestamp(this->ircMessage));