Which badges that are shown are now customizable #282 (#696)

This commit is contained in:
apa420 2018-09-16 17:42:30 +02:00 committed by pajlada
parent 56aac47fde
commit 23cf815219
4 changed files with 67 additions and 7 deletions

View file

@ -29,7 +29,6 @@ public:
"/appearance/enableAnimationsWhenFocused", false}; "/appearance/enableAnimationsWhenFocused", false};
QStringSetting timestampFormat = {"/appearance/messages/timestampFormat", QStringSetting timestampFormat = {"/appearance/messages/timestampFormat",
"h:mm"}; "h:mm"};
BoolSetting showBadges = {"/appearance/messages/showBadges", true};
BoolSetting showLastMessageIndicator = { BoolSetting showLastMessageIndicator = {
"/appearance/messages/showLastMessageIndicator", false}; "/appearance/messages/showLastMessageIndicator", false};
IntSetting lastMessagePattern = {"/appearance/messages/lastMessagePattern", IntSetting lastMessagePattern = {"/appearance/messages/lastMessagePattern",
@ -67,6 +66,16 @@ public:
// BoolSetting useCustomWindowFrame = {"/appearance/useCustomWindowFrame", // BoolSetting useCustomWindowFrame = {"/appearance/useCustomWindowFrame",
// false}; // false};
// Badges
BoolSetting showBadgesGlobalAuthority = {
"/appearance/badges/GlobalAuthority", true};
BoolSetting showBadgesChannelAuthority = {
"/appearance/badges/ChannelAuthority", true};
BoolSetting showBadgesSubscription = {"/appearance/badges/subscription",
true};
BoolSetting showBadgesVanity = {"/appearance/badges/vanity", true};
BoolSetting showBadgesChatterino = {"/appearance/badges/chatterino", true};
/// Behaviour /// Behaviour
BoolSetting allowDuplicateMessages = {"/behaviour/allowDuplicateMessages", BoolSetting allowDuplicateMessages = {"/behaviour/allowDuplicateMessages",
true}; true};

View file

@ -69,7 +69,11 @@ WindowManager::WindowManager()
auto settings = getSettings(); auto settings = getSettings();
this->wordFlagsListener_.addSetting(settings->showTimestamps); this->wordFlagsListener_.addSetting(settings->showTimestamps);
this->wordFlagsListener_.addSetting(settings->showBadges); this->wordFlagsListener_.addSetting(settings->showBadgesGlobalAuthority);
this->wordFlagsListener_.addSetting(settings->showBadgesChannelAuthority);
this->wordFlagsListener_.addSetting(settings->showBadgesSubscription);
this->wordFlagsListener_.addSetting(settings->showBadgesVanity);
this->wordFlagsListener_.addSetting(settings->showBadgesChatterino);
this->wordFlagsListener_.addSetting(settings->enableBttvEmotes); this->wordFlagsListener_.addSetting(settings->enableBttvEmotes);
this->wordFlagsListener_.addSetting(settings->enableEmojis); this->wordFlagsListener_.addSetting(settings->enableEmojis);
this->wordFlagsListener_.addSetting(settings->enableFfzEmotes); this->wordFlagsListener_.addSetting(settings->enableFfzEmotes);
@ -114,7 +118,15 @@ void WindowManager::updateWordTypeMask()
: MEF::BitsStatic); : MEF::BitsStatic);
// badges // badges
flags.set(settings->showBadges ? MEF::Badges : MEF::None); flags.set(settings->showBadgesGlobalAuthority ? MEF::BadgeGlobalAuthority
: MEF::None);
flags.set(settings->showBadgesChannelAuthority ? MEF::BadgeChannelAuthority
: MEF::None);
flags.set(settings->showBadgesSubscription ? MEF::BadgeSubscription
: MEF::None);
flags.set(settings->showBadgesVanity ? MEF::BadgeVanity : MEF::None);
flags.set(settings->showBadgesChatterino ? MEF::BadgeChatterino
: MEF::None);
// username // username
flags.set(MEF::Username); flags.set(MEF::Username);

View file

@ -59,6 +59,7 @@ void LookPage::initializeUi()
this->addMessageTab(tabs.appendTab(new QVBoxLayout, "Messages")); this->addMessageTab(tabs.appendTab(new QVBoxLayout, "Messages"));
this->addEmoteTab(tabs.appendTab(new QVBoxLayout, "Emotes")); this->addEmoteTab(tabs.appendTab(new QVBoxLayout, "Emotes"));
this->addSplitHeaderTab(tabs.appendTab(new QVBoxLayout, "Split header")); this->addSplitHeaderTab(tabs.appendTab(new QVBoxLayout, "Split header"));
this->addBadgesTab(tabs.appendTab(new QVBoxLayout, "Badges"));
layout->addStretch(1); layout->addStretch(1);
@ -145,10 +146,6 @@ void LookPage::addMessageTab(LayoutCreator<QVBoxLayout> layout)
box->addStretch(1); box->addStretch(1);
} }
// badges
layout.append(
this->createCheckBox("Show badges", getSettings()->showBadges));
// -- // --
layout.emplace<Line>(false); layout.emplace<Line>(false);
@ -280,6 +277,47 @@ void LookPage::addSplitHeaderTab(LayoutCreator<QVBoxLayout> layout)
layout->addStretch(1); layout->addStretch(1);
} }
void LookPage::addBadgesTab(LayoutCreator<QVBoxLayout> layout)
{
// layout.append(
// this->createCheckBox(("Show all badges"), getSettings()->showBadges));
auto fastSelection = layout.emplace<QHBoxLayout>();
{
auto addAll = fastSelection.emplace<QPushButton>("Enable all");
QObject::connect(addAll.getElement(), &QPushButton::clicked, this, [] {
getSettings()->showBadgesGlobalAuthority = true;
getSettings()->showBadgesChannelAuthority = true;
getSettings()->showBadgesSubscription = true;
getSettings()->showBadgesVanity = true;
getSettings()->showBadgesChatterino = true;
});
auto removeAll = fastSelection.emplace<QPushButton>("Disable all");
QObject::connect(removeAll.getElement(), &QPushButton::clicked, this,
[] {
getSettings()->showBadgesGlobalAuthority = false;
getSettings()->showBadgesChannelAuthority = false;
getSettings()->showBadgesSubscription = false;
getSettings()->showBadgesVanity = false;
getSettings()->showBadgesChatterino = false;
});
}
layout.emplace<Line>(false);
layout.append(this->createCheckBox(
("Show authorty badges (staff, admin, turbo, etc)"),
getSettings()->showBadgesGlobalAuthority));
layout.append(
this->createCheckBox(("Show channel badges (broadcaster, moderator)"),
getSettings()->showBadgesChannelAuthority));
layout.append(this->createCheckBox(("Show subscriber badges "),
getSettings()->showBadgesSubscription));
layout.append(
this->createCheckBox(("Show vanity badges (prime, bits, subgifter)"),
getSettings()->showBadgesVanity));
layout.append(this->createCheckBox(("Show chatterino badges"),
getSettings()->showBadgesChatterino));
layout->addStretch(1);
}
void LookPage::addLastReadMessageIndicatorPatternSelector( void LookPage::addLastReadMessageIndicatorPatternSelector(
LayoutCreator<QVBoxLayout> layout) LayoutCreator<QVBoxLayout> layout)
{ {

View file

@ -23,6 +23,7 @@ private:
void addMessageTab(LayoutCreator<QVBoxLayout> layout); void addMessageTab(LayoutCreator<QVBoxLayout> layout);
void addEmoteTab(LayoutCreator<QVBoxLayout> layout); void addEmoteTab(LayoutCreator<QVBoxLayout> layout);
void addSplitHeaderTab(LayoutCreator<QVBoxLayout> layout); void addSplitHeaderTab(LayoutCreator<QVBoxLayout> layout);
void addBadgesTab(LayoutCreator<QVBoxLayout> layout);
void addLastReadMessageIndicatorPatternSelector( void addLastReadMessageIndicatorPatternSelector(
LayoutCreator<QVBoxLayout> layout); LayoutCreator<QVBoxLayout> layout);