Add setting to stack bits (#1452)

This commit is contained in:
apa420 2019-12-21 10:36:46 +01:00 committed by pajlada
parent d5001b97f4
commit be898e88dd
4 changed files with 30 additions and 0 deletions

View file

@ -1286,6 +1286,32 @@ Outcome TwitchMessageBuilder::tryParseCheermote(const QString &string)
int cheerValue = match.captured(1).toInt(); int cheerValue = match.captured(1).toInt();
if (getSettings()->stackBits)
{
if (this->bitsStacked)
{
return Success;
}
if (cheerEmote.staticEmote)
{
this->emplace<EmoteElement>(cheerEmote.staticEmote,
MessageElementFlag::BitsStatic);
}
if (cheerEmote.animatedEmote)
{
this->emplace<EmoteElement>(cheerEmote.animatedEmote,
MessageElementFlag::BitsAnimated);
}
if (cheerEmote.color != QColor())
{
this->emplace<TextElement>(QString::number(this->bitsLeft),
MessageElementFlag::BitsAmount,
cheerEmote.color);
}
this->bitsStacked = true;
return Success;
}
if (this->bitsLeft >= cheerValue) if (this->bitsLeft >= cheerValue)
{ {
this->bitsLeft -= cheerValue; this->bitsLeft -= cheerValue;

View file

@ -82,6 +82,7 @@ private:
bool hasBits_ = false; bool hasBits_ = false;
QString bits; QString bits;
int bitsLeft; int bitsLeft;
bool bitsStacked = false;
bool historicalMessage_ = false; bool historicalMessage_ = false;
QString userId_; QString userId_;

View file

@ -120,6 +120,8 @@ public:
QStringSetting emojiSet = {"/emotes/emojiSet", "EmojiOne 2"}; QStringSetting emojiSet = {"/emotes/emojiSet", "EmojiOne 2"};
BoolSetting stackBits = {"/emotes/stackBits", false};
/// Links /// Links
BoolSetting linksDoubleClickOnly = {"/links/doubleClickToOpen", false}; BoolSetting linksDoubleClickOnly = {"/links/doubleClickToOpen", false};
BoolSetting linkInfoTooltip = {"/links/linkInfoTooltip", false}; BoolSetting linkInfoTooltip = {"/links/linkInfoTooltip", false};

View file

@ -391,6 +391,7 @@ void GeneralPage::initLayout(SettingsLayout &layout)
layout.addCheckbox("Animate", s.animateEmotes); layout.addCheckbox("Animate", s.animateEmotes);
layout.addCheckbox("Animate only when Chatterino is focused", layout.addCheckbox("Animate only when Chatterino is focused",
s.animationsWhenFocused); s.animationsWhenFocused);
layout.addCheckbox("Stack bits", s.stackBits);
layout.addDropdown<float>( layout.addDropdown<float>(
"Size", {"0.5x", "0.75x", "Default", "1.25x", "1.5x", "2x"}, "Size", {"0.5x", "0.75x", "Default", "1.25x", "1.5x", "2x"},
s.emoteScale, s.emoteScale,