Restore option to disable emote images

Condensed into a single option, which will disable/enable all emote and emoji images

Also moved badges into their own element
This commit is contained in:
Rasmus Karlsson
2019-06-22 14:34:54 +02:00
parent a34e3084df
commit 27114c5154
6 changed files with 55 additions and 26 deletions
+26 -4
View File
@@ -138,10 +138,7 @@ void EmoteElement::addToContainer(MessageLayoutContainer &container,
if (image->isEmpty())
return;
auto emoteScale =
this->getFlags().hasAny(MessageElementFlag::Badges)
? 1
: getSettings()->emoteScale.getValue();
auto emoteScale = getSettings()->emoteScale.getValue();
auto size =
QSize(int(container.getScale() * image->width() * emoteScale),
@@ -161,6 +158,31 @@ void EmoteElement::addToContainer(MessageLayoutContainer &container,
}
}
// BADGE
BadgeElement::BadgeElement(const EmotePtr &emote, MessageElementFlags flags)
: MessageElement(flags)
, emote_(emote)
{
this->setTooltip(emote->tooltip.string);
}
void BadgeElement::addToContainer(MessageLayoutContainer &container,
MessageElementFlags flags)
{
if (flags.hasAny(this->getFlags()))
{
auto image = this->emote_->images.getImage(container.getScale());
if (image->isEmpty())
return;
auto size = QSize(int(container.getScale() * image->width()),
int(container.getScale() * image->height()));
container.addElement((new ImageLayoutElement(*this, image, size))
->setLink(this->getLink()));
}
}
// TEXT
TextElement::TextElement(const QString &text, MessageElementFlags flags,
const MessageColor &color, FontStyle style)
+13
View File
@@ -42,6 +42,7 @@ enum class MessageElementFlag {
FfzEmoteText = (1 << 11),
FfzEmote = FfzEmoteImage | FfzEmoteText,
EmoteImages = TwitchEmoteImage | BttvEmoteImage | FfzEmoteImage,
EmoteText = TwitchEmoteText | BttvEmoteText | FfzEmoteText,
BitsStatic = (1 << 12),
BitsAnimated = (1 << 13),
@@ -213,6 +214,18 @@ private:
EmotePtr emote_;
};
class BadgeElement : public MessageElement
{
public:
BadgeElement(const EmotePtr &data, MessageElementFlags flags_);
void addToContainer(MessageLayoutContainer &container,
MessageElementFlags flags_) override;
private:
EmotePtr emote_;
};
// contains a text, formated depending on the preferences
class TimestampElement : public MessageElement
{