mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
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:
parent
a34e3084df
commit
27114c5154
|
@ -138,10 +138,7 @@ void EmoteElement::addToContainer(MessageLayoutContainer &container,
|
||||||
if (image->isEmpty())
|
if (image->isEmpty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto emoteScale =
|
auto emoteScale = getSettings()->emoteScale.getValue();
|
||||||
this->getFlags().hasAny(MessageElementFlag::Badges)
|
|
||||||
? 1
|
|
||||||
: getSettings()->emoteScale.getValue();
|
|
||||||
|
|
||||||
auto size =
|
auto size =
|
||||||
QSize(int(container.getScale() * image->width() * emoteScale),
|
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
|
// 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)
|
||||||
|
|
|
@ -42,6 +42,7 @@ enum class MessageElementFlag {
|
||||||
FfzEmoteText = (1 << 11),
|
FfzEmoteText = (1 << 11),
|
||||||
FfzEmote = FfzEmoteImage | FfzEmoteText,
|
FfzEmote = FfzEmoteImage | FfzEmoteText,
|
||||||
EmoteImages = TwitchEmoteImage | BttvEmoteImage | FfzEmoteImage,
|
EmoteImages = TwitchEmoteImage | BttvEmoteImage | FfzEmoteImage,
|
||||||
|
EmoteText = TwitchEmoteText | BttvEmoteText | FfzEmoteText,
|
||||||
|
|
||||||
BitsStatic = (1 << 12),
|
BitsStatic = (1 << 12),
|
||||||
BitsAnimated = (1 << 13),
|
BitsAnimated = (1 << 13),
|
||||||
|
@ -213,6 +214,18 @@ private:
|
||||||
EmotePtr emote_;
|
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
|
// contains a text, formated depending on the preferences
|
||||||
class TimestampElement : public MessageElement
|
class TimestampElement : public MessageElement
|
||||||
{
|
{
|
||||||
|
|
|
@ -1026,7 +1026,7 @@ void TwitchMessageBuilder::appendTwitchBadges()
|
||||||
if (const auto &_badge = this->twitchChannel->twitchBadge(
|
if (const auto &_badge = this->twitchChannel->twitchBadge(
|
||||||
"bits", cheerAmount))
|
"bits", cheerAmount))
|
||||||
{
|
{
|
||||||
this->emplace<EmoteElement>(
|
this->emplace<BadgeElement>(
|
||||||
_badge.get(), MessageElementFlag::BadgeVanity)
|
_badge.get(), MessageElementFlag::BadgeVanity)
|
||||||
->setTooltip(tooltip);
|
->setTooltip(tooltip);
|
||||||
continue;
|
continue;
|
||||||
|
@ -1041,7 +1041,7 @@ void TwitchMessageBuilder::appendTwitchBadges()
|
||||||
if (auto _badge = this->twitchChannel->globalTwitchBadges().badge(
|
if (auto _badge = this->twitchChannel->globalTwitchBadges().badge(
|
||||||
"bits", cheerAmount))
|
"bits", cheerAmount))
|
||||||
{
|
{
|
||||||
this->emplace<EmoteElement>(_badge.get(),
|
this->emplace<BadgeElement>(_badge.get(),
|
||||||
MessageElementFlag::BadgeVanity)
|
MessageElementFlag::BadgeVanity)
|
||||||
->setTooltip(tooltip);
|
->setTooltip(tooltip);
|
||||||
}
|
}
|
||||||
|
@ -1071,7 +1071,7 @@ void TwitchMessageBuilder::appendTwitchBadges()
|
||||||
{
|
{
|
||||||
if (auto customModBadge = this->twitchChannel->ffzCustomModBadge())
|
if (auto customModBadge = this->twitchChannel->ffzCustomModBadge())
|
||||||
{
|
{
|
||||||
this->emplace<EmoteElement>(
|
this->emplace<BadgeElement>(
|
||||||
customModBadge.get(),
|
customModBadge.get(),
|
||||||
MessageElementFlag::BadgeChannelAuthority)
|
MessageElementFlag::BadgeChannelAuthority)
|
||||||
->setTooltip((*customModBadge)->tooltip.string);
|
->setTooltip((*customModBadge)->tooltip.string);
|
||||||
|
@ -1131,7 +1131,7 @@ void TwitchMessageBuilder::appendTwitchBadges()
|
||||||
if (auto badgeEmote = this->twitchChannel->twitchBadge(
|
if (auto badgeEmote = this->twitchChannel->twitchBadge(
|
||||||
"subscriber", badge.mid(11)))
|
"subscriber", badge.mid(11)))
|
||||||
{
|
{
|
||||||
this->emplace<EmoteElement>(
|
this->emplace<BadgeElement>(
|
||||||
badgeEmote.get(), MessageElementFlag::BadgeSubscription)
|
badgeEmote.get(), MessageElementFlag::BadgeSubscription)
|
||||||
->setTooltip((*badgeEmote)->tooltip.string);
|
->setTooltip((*badgeEmote)->tooltip.string);
|
||||||
continue;
|
continue;
|
||||||
|
@ -1152,7 +1152,7 @@ void TwitchMessageBuilder::appendTwitchBadges()
|
||||||
if (auto badgeEmote =
|
if (auto badgeEmote =
|
||||||
this->twitchChannel->twitchBadge(splits[0], splits[1]))
|
this->twitchChannel->twitchBadge(splits[0], splits[1]))
|
||||||
{
|
{
|
||||||
this->emplace<EmoteElement>(badgeEmote.get(),
|
this->emplace<BadgeElement>(badgeEmote.get(),
|
||||||
MessageElementFlag::BadgeVanity)
|
MessageElementFlag::BadgeVanity)
|
||||||
->setTooltip((*badgeEmote)->tooltip.string);
|
->setTooltip((*badgeEmote)->tooltip.string);
|
||||||
continue;
|
continue;
|
||||||
|
@ -1160,7 +1160,7 @@ void TwitchMessageBuilder::appendTwitchBadges()
|
||||||
if (auto _badge = this->twitchChannel->globalTwitchBadges().badge(
|
if (auto _badge = this->twitchChannel->globalTwitchBadges().badge(
|
||||||
splits[0], splits[1]))
|
splits[0], splits[1]))
|
||||||
{
|
{
|
||||||
this->emplace<EmoteElement>(_badge.get(),
|
this->emplace<BadgeElement>(_badge.get(),
|
||||||
MessageElementFlag::BadgeVanity)
|
MessageElementFlag::BadgeVanity)
|
||||||
->setTooltip((*_badge)->tooltip.string);
|
->setTooltip((*_badge)->tooltip.string);
|
||||||
continue;
|
continue;
|
||||||
|
@ -1175,7 +1175,7 @@ void TwitchMessageBuilder::appendChatterinoBadges()
|
||||||
getApp()->chatterinoBadges->getBadge({this->userName});
|
getApp()->chatterinoBadges->getBadge({this->userName});
|
||||||
if (chatterinoBadgePtr)
|
if (chatterinoBadgePtr)
|
||||||
{
|
{
|
||||||
this->emplace<EmoteElement>(*chatterinoBadgePtr,
|
this->emplace<BadgeElement>(*chatterinoBadgePtr,
|
||||||
MessageElementFlag::BadgeChatterino);
|
MessageElementFlag::BadgeChatterino);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -105,10 +105,7 @@ public:
|
||||||
/// Emotes
|
/// Emotes
|
||||||
BoolSetting scaleEmotesByLineHeight = {"/emotes/scaleEmotesByLineHeight",
|
BoolSetting scaleEmotesByLineHeight = {"/emotes/scaleEmotesByLineHeight",
|
||||||
false};
|
false};
|
||||||
BoolSetting enableTwitchEmotes = {"/emotes/enableTwitchEmotes", true};
|
BoolSetting enableEmoteImages = {"/emotes/enableEmoteImages", true};
|
||||||
BoolSetting enableBttvEmotes = {"/emotes/enableBTTVEmotes", true};
|
|
||||||
BoolSetting enableFfzEmotes = {"/emotes/enableFFZEmotes", true};
|
|
||||||
BoolSetting enableEmojis = {"/emotes/enableEmojis", true};
|
|
||||||
BoolSetting animateEmotes = {"/emotes/enableGifAnimations", true};
|
BoolSetting animateEmotes = {"/emotes/enableGifAnimations", true};
|
||||||
FloatSetting emoteScale = {"/emotes/scale", 1.f};
|
FloatSetting emoteScale = {"/emotes/scale", 1.f};
|
||||||
|
|
||||||
|
|
|
@ -76,10 +76,7 @@ WindowManager::WindowManager()
|
||||||
this->wordFlagsListener_.addSetting(settings->showBadgesSubscription);
|
this->wordFlagsListener_.addSetting(settings->showBadgesSubscription);
|
||||||
this->wordFlagsListener_.addSetting(settings->showBadgesVanity);
|
this->wordFlagsListener_.addSetting(settings->showBadgesVanity);
|
||||||
this->wordFlagsListener_.addSetting(settings->showBadgesChatterino);
|
this->wordFlagsListener_.addSetting(settings->showBadgesChatterino);
|
||||||
this->wordFlagsListener_.addSetting(settings->enableBttvEmotes);
|
this->wordFlagsListener_.addSetting(settings->enableEmoteImages);
|
||||||
this->wordFlagsListener_.addSetting(settings->enableEmojis);
|
|
||||||
this->wordFlagsListener_.addSetting(settings->enableFfzEmotes);
|
|
||||||
this->wordFlagsListener_.addSetting(settings->enableTwitchEmotes);
|
|
||||||
this->wordFlagsListener_.addSetting(settings->boldUsernames);
|
this->wordFlagsListener_.addSetting(settings->boldUsernames);
|
||||||
this->wordFlagsListener_.addSetting(settings->lowercaseDomains);
|
this->wordFlagsListener_.addSetting(settings->lowercaseDomains);
|
||||||
this->wordFlagsListener_.setCB([this] {
|
this->wordFlagsListener_.setCB([this] {
|
||||||
|
@ -115,13 +112,12 @@ void WindowManager::updateWordTypeMask()
|
||||||
}
|
}
|
||||||
|
|
||||||
// emotes
|
// emotes
|
||||||
flags.set(settings->enableTwitchEmotes ? MEF::TwitchEmoteImage
|
if (settings->enableEmoteImages)
|
||||||
: MEF::TwitchEmoteText);
|
{
|
||||||
flags.set(settings->enableFfzEmotes ? MEF::FfzEmoteImage
|
flags.set(MEF::EmoteImages);
|
||||||
: MEF::FfzEmoteText);
|
}
|
||||||
flags.set(settings->enableBttvEmotes ? MEF::BttvEmoteImage
|
flags.set(MEF::EmoteText);
|
||||||
: MEF::BttvEmoteText);
|
flags.set(MEF::EmojiText);
|
||||||
flags.set(settings->enableEmojis ? MEF::EmojiImage : MEF::EmojiText);
|
|
||||||
|
|
||||||
// bits
|
// bits
|
||||||
flags.set(MEF::BitsAmount);
|
flags.set(MEF::BitsAmount);
|
||||||
|
|
|
@ -228,6 +228,7 @@ void GeneralPage::initLayout(SettingsLayout &layout)
|
||||||
[](auto args) { return fuzzyToFloat(args.value, 1.f); });
|
[](auto args) { return fuzzyToFloat(args.value, 1.f); });
|
||||||
layout.addCheckbox("Gif animations", s.animateEmotes);
|
layout.addCheckbox("Gif animations", s.animateEmotes);
|
||||||
layout.addCheckbox("Animate only when focused", s.animationsWhenFocused);
|
layout.addCheckbox("Animate only when focused", s.animationsWhenFocused);
|
||||||
|
layout.addCheckbox("Emote images", s.enableEmoteImages);
|
||||||
layout.addDropdown("Emoji set",
|
layout.addDropdown("Emoji set",
|
||||||
{"EmojiOne 2", "EmojiOne 3", "Twitter", "Facebook",
|
{"EmojiOne 2", "EmojiOne 3", "Twitter", "Facebook",
|
||||||
"Apple", "Google", "Messenger"},
|
"Apple", "Google", "Messenger"},
|
||||||
|
|
Loading…
Reference in a new issue