Merge pull request #1140 from TranRed/inlineWhisperHighlight

Added setting and functionality to highlight inline whispers
This commit is contained in:
pajlada 2019-07-14 19:32:09 +02:00 committed by GitHub
commit fb6a55847d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 21 additions and 8 deletions

View file

@ -21,7 +21,8 @@ Message::~Message()
SBHighlight Message::getScrollBarHighlight() const
{
if (this->flags.has(MessageFlag::Highlighted))
if (this->flags.has(MessageFlag::Highlighted) ||
this->flags.has(MessageFlag::HighlightedWhisper))
{
return SBHighlight(SBHighlight::Highlight);
}

View file

@ -30,7 +30,8 @@ enum class MessageFlag : uint32_t {
DoNotLog = (1 << 13),
AutoMod = (1 << 14),
RecentMessage = (1 << 15),
Whisper = (1 << 16)
Whisper = (1 << 16),
HighlightedWhisper = (1 << 17),
};
using MessageFlags = FlagsEnum<MessageFlag>;

View file

@ -250,7 +250,8 @@ void MessageLayout::updateBuffer(QPixmap *buffer, int /*messageIndex*/,
// draw background
QColor backgroundColor = app->themes->messages.backgrounds.regular;
if (this->message_->flags.has(MessageFlag::Highlighted) &&
if ((this->message_->flags.has(MessageFlag::Highlighted) ||
this->message_->flags.has(MessageFlag::HighlightedWhisper)) &&
!this->flags.has(MessageLayoutFlag::IgnoreHighlights))
{
backgroundColor = app->themes->messages.backgrounds.highlighted;

View file

@ -184,6 +184,12 @@ MessagePtr TwitchMessageBuilder::build()
// highlights
this->parseHighlights(isPastMsg);
// highlighting incoming whispers if requested per setting
if (this->args.isReceivedWhisper && getSettings()->highlightInlineWhispers)
{
this->message().flags.set(MessageFlag::HighlightedWhisper, true);
}
// QString bits;
auto iterator = this->tags.find("bits");
if (iterator != this->tags.end())

View file

@ -160,6 +160,8 @@ public:
false};
BoolSetting inlineWhispers = {"/whispers/enableInlineWhispers", true};
BoolSetting highlightInlineWhispers = {"/whispers/highlightInlineWhispers",
false};
/// Notifications
BoolSetting notificationFlashTaskbar = {"/notifications/enableFlashTaskbar",

View file

@ -271,17 +271,19 @@ void GeneralPage::initLayout(SettingsLayout &layout)
layout.addCheckbox("Double click links to open", s.linksDoubleClickOnly);
layout.addCheckbox("Unshorten links", s.unshortLinks);
layout.addCheckbox("Show live indicator in tabs", s.showTabLive);
layout.addDropdown<int>(
"Show emote preview in tooltip on hover",
{"Don't show", "Always show", "Hold shift"}, s.emotesTooltipPreview,
[](int index) { return index; }, [](auto args) { return args.index; },
false);
layout.addDropdown<int>("Show emote preview in tooltip on hover",
{"Don't show", "Always show", "Hold shift"},
s.emotesTooltipPreview,
[](int index) { return index; },
[](auto args) { return args.index; }, false);
layout.addSpacing(16);
layout.addSeperator();
layout.addTitle2("Miscellaneous (Twitch)");
layout.addCheckbox("Show twitch whispers inline", s.inlineWhispers);
layout.addCheckbox("Highlight received inline whispers",
s.highlightInlineWhispers);
layout.addCheckbox("Load message history on connect",
s.loadTwitchMessageHistoryOnConnect);