mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
Fixes #1215 Allow previewing badges
This commit is contained in:
parent
dbc20baa65
commit
6d9545157e
3 changed files with 21 additions and 3 deletions
|
@ -185,6 +185,11 @@ void BadgeElement::addToContainer(MessageLayoutContainer &container,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EmotePtr BadgeElement::getEmote() const
|
||||||
|
{
|
||||||
|
return this->emote_;
|
||||||
|
}
|
||||||
|
|
||||||
// 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)
|
||||||
|
|
|
@ -222,6 +222,8 @@ public:
|
||||||
void addToContainer(MessageLayoutContainer &container,
|
void addToContainer(MessageLayoutContainer &container,
|
||||||
MessageElementFlags flags_) override;
|
MessageElementFlags flags_) override;
|
||||||
|
|
||||||
|
EmotePtr getEmote() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
EmotePtr emote_;
|
EmotePtr emote_;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1222,14 +1222,25 @@ void ChannelView::mouseMoveEvent(QMouseEvent *event)
|
||||||
auto &tooltipPreviewImage = TooltipPreviewImage::getInstance();
|
auto &tooltipPreviewImage = TooltipPreviewImage::getInstance();
|
||||||
auto emoteElement = dynamic_cast<const EmoteElement *>(
|
auto emoteElement = dynamic_cast<const EmoteElement *>(
|
||||||
&hoverLayoutElement->getCreator());
|
&hoverLayoutElement->getCreator());
|
||||||
|
auto badgeElement = dynamic_cast<const BadgeElement *>(
|
||||||
|
&hoverLayoutElement->getCreator());
|
||||||
|
|
||||||
if (emoteElement && getSettings()->emotesTooltipPreview.getValue())
|
if ((badgeElement || emoteElement) &&
|
||||||
|
getSettings()->emotesTooltipPreview.getValue())
|
||||||
{
|
{
|
||||||
if (event->modifiers() == Qt::ShiftModifier ||
|
if (event->modifiers() == Qt::ShiftModifier ||
|
||||||
getSettings()->emotesTooltipPreview.getValue() == 1)
|
getSettings()->emotesTooltipPreview.getValue() == 1)
|
||||||
{
|
{
|
||||||
tooltipPreviewImage.setImage(
|
if (emoteElement)
|
||||||
emoteElement->getEmote()->images.getImage(3.0));
|
{
|
||||||
|
tooltipPreviewImage.setImage(
|
||||||
|
emoteElement->getEmote()->images.getImage(3.0));
|
||||||
|
}
|
||||||
|
else if (badgeElement)
|
||||||
|
{
|
||||||
|
tooltipPreviewImage.setImage(
|
||||||
|
badgeElement->getEmote()->images.getImage(3.0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue