mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Make ModBadgeElement a descendant of BadgeElement instead of EmoteElement (#1602)
this causes it to behave as it should, and not be scaled when emotes are scaled. :)
This commit is contained in:
parent
9a8b85e338
commit
0f2355459d
|
@ -3,5 +3,6 @@
|
||||||
## Unversioned
|
## Unversioned
|
||||||
- Minor: Emotes in the emote popup are now sorted in the same order as the tab completion (#1549)
|
- Minor: Emotes in the emote popup are now sorted in the same order as the tab completion (#1549)
|
||||||
- Bugfix: Fix preview on hover not working when Animated emotes options was disabled (#1546)
|
- Bugfix: Fix preview on hover not working when Animated emotes options was disabled (#1546)
|
||||||
|
- Bugfix: FFZ custom mod badges no longer scale with the emote scale options (#1602)
|
||||||
- Settings open faster
|
- Settings open faster
|
||||||
- Dev: Fully remove Twitch Chatroom support
|
- Dev: Fully remove Twitch Chatroom support
|
||||||
|
|
|
@ -164,21 +164,6 @@ MessageLayoutElement *EmoteElement::makeImageLayoutElement(
|
||||||
return new ImageLayoutElement(*this, image, size);
|
return new ImageLayoutElement(*this, image, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
// MOD BADGE
|
|
||||||
ModBadgeElement::ModBadgeElement(const EmotePtr &data,
|
|
||||||
MessageElementFlags flags_)
|
|
||||||
: EmoteElement(data, flags_)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
MessageLayoutElement *ModBadgeElement::makeImageLayoutElement(
|
|
||||||
const ImagePtr &image, const QSize &size)
|
|
||||||
{
|
|
||||||
static const QColor modBadgeBackgroundColor("#34AE0A");
|
|
||||||
return new ImageWithBackgroundLayoutElement(*this, image, size,
|
|
||||||
modBadgeBackgroundColor);
|
|
||||||
}
|
|
||||||
|
|
||||||
// BADGE
|
// BADGE
|
||||||
BadgeElement::BadgeElement(const EmotePtr &emote, MessageElementFlags flags)
|
BadgeElement::BadgeElement(const EmotePtr &emote, MessageElementFlags flags)
|
||||||
: MessageElement(flags)
|
: MessageElement(flags)
|
||||||
|
@ -200,8 +185,7 @@ void BadgeElement::addToContainer(MessageLayoutContainer &container,
|
||||||
auto size = QSize(int(container.getScale() * image->width()),
|
auto size = QSize(int(container.getScale() * image->width()),
|
||||||
int(container.getScale() * image->height()));
|
int(container.getScale() * image->height()));
|
||||||
|
|
||||||
container.addElement((new ImageLayoutElement(*this, image, size))
|
container.addElement(this->makeImageLayoutElement(image, size));
|
||||||
->setLink(this->getLink()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,6 +194,34 @@ EmotePtr BadgeElement::getEmote() const
|
||||||
return this->emote_;
|
return this->emote_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MessageLayoutElement *BadgeElement::makeImageLayoutElement(
|
||||||
|
const ImagePtr &image, const QSize &size)
|
||||||
|
{
|
||||||
|
auto element =
|
||||||
|
(new ImageLayoutElement(*this, image, size))->setLink(this->getLink());
|
||||||
|
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
|
||||||
|
// MOD BADGE
|
||||||
|
ModBadgeElement::ModBadgeElement(const EmotePtr &data,
|
||||||
|
MessageElementFlags flags_)
|
||||||
|
: BadgeElement(data, flags_)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
MessageLayoutElement *ModBadgeElement::makeImageLayoutElement(
|
||||||
|
const ImagePtr &image, const QSize &size)
|
||||||
|
{
|
||||||
|
static const QColor modBadgeBackgroundColor("#34AE0A");
|
||||||
|
|
||||||
|
auto element = (new ImageWithBackgroundLayoutElement(
|
||||||
|
*this, image, size, modBadgeBackgroundColor))
|
||||||
|
->setLink(this->getLink());
|
||||||
|
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
|
||||||
// TEXT
|
// TEXT
|
||||||
TextElement::TextElement(const QString &text, MessageElementFlags flags,
|
TextElement::TextElement(const QString &text, MessageElementFlags flags,
|
||||||
const MessageColor &color, FontStyle style)
|
const MessageColor &color, FontStyle style)
|
||||||
|
|
|
@ -223,17 +223,6 @@ private:
|
||||||
EmotePtr emote_;
|
EmotePtr emote_;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Behaves like an emote element, except it creates a different image layout element that draws the mod badge background
|
|
||||||
class ModBadgeElement : public EmoteElement
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ModBadgeElement(const EmotePtr &data, MessageElementFlags flags_);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
MessageLayoutElement *makeImageLayoutElement(const ImagePtr &image,
|
|
||||||
const QSize &size) override;
|
|
||||||
};
|
|
||||||
|
|
||||||
class BadgeElement : public MessageElement
|
class BadgeElement : public MessageElement
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -244,10 +233,24 @@ public:
|
||||||
|
|
||||||
EmotePtr getEmote() const;
|
EmotePtr getEmote() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual MessageLayoutElement *makeImageLayoutElement(const ImagePtr &image,
|
||||||
|
const QSize &size);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
EmotePtr emote_;
|
EmotePtr emote_;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class ModBadgeElement : public BadgeElement
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ModBadgeElement(const EmotePtr &data, MessageElementFlags flags_);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
MessageLayoutElement *makeImageLayoutElement(const ImagePtr &image,
|
||||||
|
const QSize &size) override;
|
||||||
|
};
|
||||||
|
|
||||||
// contains a text, formated depending on the preferences
|
// contains a text, formated depending on the preferences
|
||||||
class TimestampElement : public MessageElement
|
class TimestampElement : public MessageElement
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue