Fix underlying text from disabled emotes not being colorized after using /me (#3333)

This commit is contained in:
Ryan
2021-10-31 06:37:06 -04:00
committed by GitHub
parent b4b745024c
commit b4be7a4b1f
4 changed files with 19 additions and 10 deletions
+1
View File
@@ -44,6 +44,7 @@
- Bugfix: Fixed being unable to disable `First Message` highlights (#3293) - Bugfix: Fixed being unable to disable `First Message` highlights (#3293)
- Bugfix: Fixed `First Message` custom sound not persisting through restart. (#3303) - Bugfix: Fixed `First Message` custom sound not persisting through restart. (#3303)
- Bugfix: Fixed `First Message` scrollbar highlights not being disabled. (#3325) - Bugfix: Fixed `First Message` scrollbar highlights not being disabled. (#3325)
- Bugfix: Fixed underlying text from disabled emotes not being colorized properly. (#3333)
- Dev: Add GitHub action to test builds without precompiled headers enabled. (#3327) - Dev: Add GitHub action to test builds without precompiled headers enabled. (#3327)
- Dev: Renamed CMake's build option `USE_SYSTEM_QT5KEYCHAIN` to `USE_SYSTEM_QTKEYCHAIN`. (#3103) - Dev: Renamed CMake's build option `USE_SYSTEM_QT5KEYCHAIN` to `USE_SYSTEM_QTKEYCHAIN`. (#3103)
- Dev: Add benchmarks that can be compiled with the `BUILD_BENCHMARKS` CMake flag. Off by default. (#3038) - Dev: Add benchmarks that can be compiled with the `BUILD_BENCHMARKS` CMake flag. Off by default. (#3038)
+4 -3
View File
@@ -142,12 +142,13 @@ void ImageElement::addToContainer(MessageLayoutContainer &container,
} }
// EMOTE // EMOTE
EmoteElement::EmoteElement(const EmotePtr &emote, MessageElementFlags flags) EmoteElement::EmoteElement(const EmotePtr &emote, MessageElementFlags flags,
const MessageColor &textElementColor)
: MessageElement(flags) : MessageElement(flags)
, emote_(emote) , emote_(emote)
{ {
this->textElement_.reset( this->textElement_.reset(new TextElement(
new TextElement(emote->getCopyString(), MessageElementFlag::Misc)); emote->getCopyString(), MessageElementFlag::Misc, textElementColor));
this->setTooltip(emote->tooltip.string); this->setTooltip(emote->tooltip.string);
} }
+2 -1
View File
@@ -238,7 +238,8 @@ private:
class EmoteElement : public MessageElement class EmoteElement : public MessageElement
{ {
public: public:
EmoteElement(const EmotePtr &data, MessageElementFlags flags_); EmoteElement(const EmotePtr &data, MessageElementFlags flags_,
const MessageColor &textElementColor = MessageColor::Text);
void addToContainer(MessageLayoutContainer &container, void addToContainer(MessageLayoutContainer &container,
MessageElementFlags flags_) override; MessageElementFlags flags_) override;
+12 -6
View File
@@ -319,7 +319,9 @@ void TwitchMessageBuilder::addWords(
{ {
// This emote exists right at the start of the word! // This emote exists right at the start of the word!
this->emplace<EmoteElement>(currentTwitchEmote.ptr, this->emplace<EmoteElement>(currentTwitchEmote.ptr,
MessageElementFlag::TwitchEmote); MessageElementFlag::TwitchEmote,
this->textColor_);
auto len = currentTwitchEmote.name.string.length(); auto len = currentTwitchEmote.name.string.length();
cursor += len; cursor += len;
word = word.mid(len); word = word.mid(len);
@@ -1007,7 +1009,7 @@ Outcome TwitchMessageBuilder::tryAppendEmote(const EmoteName &name)
if (emote) if (emote)
{ {
this->emplace<EmoteElement>(emote.get(), flags); this->emplace<EmoteElement>(emote.get(), flags, this->textColor_);
return Success; return Success;
} }
@@ -1162,12 +1164,14 @@ Outcome TwitchMessageBuilder::tryParseCheermote(const QString &string)
if (cheerEmote.staticEmote) if (cheerEmote.staticEmote)
{ {
this->emplace<EmoteElement>(cheerEmote.staticEmote, this->emplace<EmoteElement>(cheerEmote.staticEmote,
MessageElementFlag::BitsStatic); MessageElementFlag::BitsStatic,
this->textColor_);
} }
if (cheerEmote.animatedEmote) if (cheerEmote.animatedEmote)
{ {
this->emplace<EmoteElement>(cheerEmote.animatedEmote, this->emplace<EmoteElement>(cheerEmote.animatedEmote,
MessageElementFlag::BitsAnimated); MessageElementFlag::BitsAnimated,
this->textColor_);
} }
if (cheerEmote.color != QColor()) if (cheerEmote.color != QColor())
{ {
@@ -1195,12 +1199,14 @@ Outcome TwitchMessageBuilder::tryParseCheermote(const QString &string)
if (cheerEmote.staticEmote) if (cheerEmote.staticEmote)
{ {
this->emplace<EmoteElement>(cheerEmote.staticEmote, this->emplace<EmoteElement>(cheerEmote.staticEmote,
MessageElementFlag::BitsStatic); MessageElementFlag::BitsStatic,
this->textColor_);
} }
if (cheerEmote.animatedEmote) if (cheerEmote.animatedEmote)
{ {
this->emplace<EmoteElement>(cheerEmote.animatedEmote, this->emplace<EmoteElement>(cheerEmote.animatedEmote,
MessageElementFlag::BitsAnimated); MessageElementFlag::BitsAnimated,
this->textColor_);
} }
if (cheerEmote.color != QColor()) if (cheerEmote.color != QColor())
{ {