Add ability to hide Twitch Prediction badges (#2668)

We now properly categorize the Twitch `predictions` badges since they take up their own slot in Twitch web chat
This commit is contained in:
Paweł 2021-04-25 14:37:19 +02:00 committed by GitHub
parent 1ef2f17cd4
commit c3d61ad77b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 40 additions and 25 deletions

View file

@ -2,6 +2,7 @@
## Unversioned
- Minor: Added a setting to hide Twitch Predictions badges. (#2668)
- Bugfix: Added missing Copy/Open link context menu entries to emotes in Emote Picker. (#2670)
- Bugfix: Fixed visual glitch with smooth scrolling. (#2084)

View file

@ -44,58 +44,65 @@ enum class MessageElementFlag : int64_t {
ChannelPointReward = (1LL << 8),
ChannelPointRewardImage = ChannelPointReward | TwitchEmoteImage,
FfzEmoteImage = (1LL << 10),
FfzEmoteText = (1LL << 11),
FfzEmoteImage = (1LL << 9),
FfzEmoteText = (1LL << 10),
FfzEmote = FfzEmoteImage | FfzEmoteText,
EmoteImages = TwitchEmoteImage | BttvEmoteImage | FfzEmoteImage,
EmoteText = TwitchEmoteText | BttvEmoteText | FfzEmoteText,
BitsStatic = (1LL << 12),
BitsAnimated = (1LL << 13),
BitsStatic = (1LL << 11),
BitsAnimated = (1LL << 12),
// Slot 1: Twitch
// - Staff badge
// - Admin badge
// - Global Moderator badge
BadgeGlobalAuthority = (1LL << 14),
BadgeGlobalAuthority = (1LL << 13),
// Slot 2: Twitch
// - Predictions badge
BadgePredictions = (1LL << 14),
// Slot 3: Twitch
// - VIP badge
// - Moderator badge
// - Broadcaster badge
BadgeChannelAuthority = (1LL << 15),
// Slot 3: Twitch
// Slot 4: Twitch
// - Subscription badges
BadgeSubscription = (1LL << 16),
// Slot 4: Twitch
// Slot 5: Twitch
// - Turbo badge
// - Prime badge
// - Bit badges
// - Game badges
BadgeVanity = (1LL << 17),
// Slot 5: Chatterino
// Slot 6: Chatterino
// - Chatterino developer badge
// - Chatterino contributor badge
// - Chatterino donator badge
// - Chatterino top donator badge
// - Chatterino special pepe badge
// - Chatterino gnome badge
BadgeChatterino = (1LL << 18),
// Slot 6: FrankerFaceZ
// Slot 7: FrankerFaceZ
// - FFZ developer badge
// - FFZ bot badge
// - FFZ donator badge
BadgeFfz = (1LL << 32),
BadgeFfz = (1LL << 19),
Badges = BadgeGlobalAuthority | BadgeChannelAuthority | BadgeSubscription |
BadgeVanity | BadgeChatterino | BadgeFfz,
Badges = BadgeGlobalAuthority | BadgePredictions | BadgeChannelAuthority |
BadgeSubscription | BadgeVanity | BadgeChatterino | BadgeFfz,
ChannelName = (1LL << 19),
ChannelName = (1LL << 20),
BitsAmount = (1LL << 20),
BitsAmount = (1LL << 21),
ModeratorTools = (1LL << 21),
ModeratorTools = (1LL << 22),
EmojiImage = (1LL << 23),
EmojiText = (1LL << 24),
@ -119,8 +126,6 @@ enum class MessageElementFlag : int64_t {
// e.g. BTTV's SoSnowy during christmas season
ZeroWidthEmote = (1LL << 31),
// (1LL << 32) is used by BadgeFfz, it is next to BadgeChatterino
Default = Timestamp | Badges | Username | BitsStatic | FfzEmoteImage |
BttvEmoteImage | TwitchEmoteImage | BitsAmount | Text |
AlwaysShow,

View file

@ -7,6 +7,7 @@ namespace chatterino {
// set of badge IDs that should be given specific flags.
// vanity flag is left out on purpose as it is our default flag
const QSet<QString> globalAuthority{"staff", "admin", "global_mod"};
const QSet<QString> predictions{"predictions"};
const QSet<QString> channelAuthority{"moderator", "vip", "broadcaster"};
const QSet<QString> subBadges{"subscriber", "founder"};
@ -18,6 +19,10 @@ Badge::Badge(QString key, QString value)
{
this->flag_ = MessageElementFlag::BadgeGlobalAuthority;
}
else if (predictions.contains(this->key_))
{
this->flag_ = MessageElementFlag::BadgePredictions;
}
else if (channelAuthority.contains(this->key_))
{
this->flag_ = MessageElementFlag::BadgeChannelAuthority;

View file

@ -122,6 +122,8 @@ public:
// Badges
BoolSetting showBadgesGlobalAuthority = {
"/appearance/badges/GlobalAuthority", true};
BoolSetting showBadgesPredictions = {"/appearance/badges/predictions",
true};
BoolSetting showBadgesChannelAuthority = {
"/appearance/badges/ChannelAuthority", true};
BoolSetting showBadgesSubscription = {"/appearance/badges/subscription",

View file

@ -104,6 +104,7 @@ WindowManager::WindowManager()
this->wordFlagsListener_.addSetting(settings->showTimestamps);
this->wordFlagsListener_.addSetting(settings->showBadgesGlobalAuthority);
this->wordFlagsListener_.addSetting(settings->showBadgesPredictions);
this->wordFlagsListener_.addSetting(settings->showBadgesChannelAuthority);
this->wordFlagsListener_.addSetting(settings->showBadgesSubscription);
this->wordFlagsListener_.addSetting(settings->showBadgesVanity);
@ -167,6 +168,8 @@ void WindowManager::updateWordTypeMask()
// badges
flags.set(settings->showBadgesGlobalAuthority ? MEF::BadgeGlobalAuthority
: MEF::None);
flags.set(settings->showBadgesPredictions ? MEF::BadgePredictions
: MEF::None);
flags.set(settings->showBadgesChannelAuthority ? MEF::BadgeChannelAuthority
: MEF::None);
flags.set(settings->showBadgesSubscription ? MEF::BadgeSubscription

View file

@ -545,16 +545,15 @@ void GeneralPage::initLayout(GeneralPageView &layout)
});
layout.addSubtitle("Visible badges");
layout.addCheckbox("Authority (staff, admin)",
getSettings()->showBadgesGlobalAuthority);
layout.addCheckbox("Authority (staff, admin)", s.showBadgesGlobalAuthority);
layout.addCheckbox("Predictions", s.showBadgesPredictions);
layout.addCheckbox("Channel (broadcaster, moderator)",
getSettings()->showBadgesChannelAuthority);
layout.addCheckbox("Subscriber ", getSettings()->showBadgesSubscription);
layout.addCheckbox("Vanity (prime, bits, subgifter)",
getSettings()->showBadgesVanity);
layout.addCheckbox("Chatterino", getSettings()->showBadgesChatterino);
s.showBadgesChannelAuthority);
layout.addCheckbox("Subscriber ", s.showBadgesSubscription);
layout.addCheckbox("Vanity (prime, bits, subgifter)", s.showBadgesVanity);
layout.addCheckbox("Chatterino", s.showBadgesChatterino);
layout.addCheckbox("FrankerFaceZ (Bot, FFZ Supporter, FFZ Developer)",
getSettings()->showBadgesFfz);
s.showBadgesFfz);
layout.addSubtitle("Miscellaneous");