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)