Add highlight color and show in mentions to automod messages (#5215)
This commit is contained in:
@@ -37,6 +37,8 @@
|
|||||||
- Minor: Introduce `c2.later()` function to Lua API. (#5154)
|
- Minor: Introduce `c2.later()` function to Lua API. (#5154)
|
||||||
- Minor: Live streams that are marked as reruns now mark a tab as yellow instead of red. (#5176, #5237)
|
- Minor: Live streams that are marked as reruns now mark a tab as yellow instead of red. (#5176, #5237)
|
||||||
- Minor: Updated to Emoji v15.1. Google emojis are now used as the fallback instead of Twitter emojis. (#5182)
|
- Minor: Updated to Emoji v15.1. Google emojis are now used as the fallback instead of Twitter emojis. (#5182)
|
||||||
|
- Minor: Added the ability to show AutoMod caught messages in mentions. (#5215)
|
||||||
|
- Minor: Added the ability to configure the color of highlighted AutoMod caught messages. (#5215)
|
||||||
- Minor: Allow theming of tab live and rerun indicators. (#5188)
|
- Minor: Allow theming of tab live and rerun indicators. (#5188)
|
||||||
- Minor: Added a fallback theme field to custom themes that will be used in case the custom theme does not contain a color Chatterino needs. If no fallback theme is specified, we'll pull the color from the included Dark or Light theme. (#5198)
|
- Minor: Added a fallback theme field to custom themes that will be used in case the custom theme does not contain a color Chatterino needs. If no fallback theme is specified, we'll pull the color from the included Dark or Light theme. (#5198)
|
||||||
- Minor: Image links now reflect the scale of their image instead of an internal label. (#5201)
|
- Minor: Image links now reflect the scale of their image instead of an internal label. (#5201)
|
||||||
|
|||||||
@@ -867,6 +867,14 @@ void Application::initPubSub()
|
|||||||
p.first);
|
p.first);
|
||||||
getApp()->twitch->automodChannel->addMessage(
|
getApp()->twitch->automodChannel->addMessage(
|
||||||
p.second);
|
p.second);
|
||||||
|
|
||||||
|
if (getSettings()->showAutomodInMentions)
|
||||||
|
{
|
||||||
|
getApp()->twitch->mentionsChannel->addMessage(
|
||||||
|
p.first);
|
||||||
|
getApp()->twitch->mentionsChannel->addMessage(
|
||||||
|
p.second);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// "ALLOWED" and "DENIED" statuses remain unimplemented
|
// "ALLOWED" and "DENIED" statuses remain unimplemented
|
||||||
|
|||||||
@@ -213,6 +213,8 @@ void rebuildMessageHighlights(Settings &settings,
|
|||||||
settings.enableAutomodHighlightTaskbar.getValue();
|
settings.enableAutomodHighlightTaskbar.getValue();
|
||||||
const auto highlightSoundUrlValue =
|
const auto highlightSoundUrlValue =
|
||||||
settings.automodHighlightSoundUrl.getValue();
|
settings.automodHighlightSoundUrl.getValue();
|
||||||
|
auto highlightColor =
|
||||||
|
ColorProvider::instance().color(ColorType::AutomodHighlight);
|
||||||
|
|
||||||
checks.emplace_back(HighlightCheck{
|
checks.emplace_back(HighlightCheck{
|
||||||
[=](const auto & /*args*/, const auto & /*badges*/,
|
[=](const auto & /*args*/, const auto & /*badges*/,
|
||||||
@@ -234,7 +236,7 @@ void rebuildMessageHighlights(Settings &settings,
|
|||||||
highlightAlert, // alert
|
highlightAlert, // alert
|
||||||
highlightSound, // playSound
|
highlightSound, // playSound
|
||||||
highlightSoundUrl, // customSoundUrl
|
highlightSoundUrl, // customSoundUrl
|
||||||
nullptr, // color
|
highlightColor, // color
|
||||||
false, // showInMentions
|
false, // showInMentions
|
||||||
};
|
};
|
||||||
}});
|
}});
|
||||||
@@ -471,6 +473,7 @@ void HighlightController::initialize(Settings &settings,
|
|||||||
this->rebuildListener_.addSetting(settings.showThreadHighlightInMentions);
|
this->rebuildListener_.addSetting(settings.showThreadHighlightInMentions);
|
||||||
|
|
||||||
this->rebuildListener_.addSetting(settings.enableAutomodHighlight);
|
this->rebuildListener_.addSetting(settings.enableAutomodHighlight);
|
||||||
|
this->rebuildListener_.addSetting(settings.showAutomodInMentions);
|
||||||
this->rebuildListener_.addSetting(settings.enableAutomodHighlightSound);
|
this->rebuildListener_.addSetting(settings.enableAutomodHighlightSound);
|
||||||
this->rebuildListener_.addSetting(settings.enableAutomodHighlightTaskbar);
|
this->rebuildListener_.addSetting(settings.enableAutomodHighlightTaskbar);
|
||||||
this->rebuildListener_.addSetting(settings.automodHighlightSoundUrl);
|
this->rebuildListener_.addSetting(settings.automodHighlightSoundUrl);
|
||||||
|
|||||||
@@ -238,9 +238,10 @@ void HighlightModel::afterInit()
|
|||||||
const std::vector<QStandardItem *> automodRow = this->createRow();
|
const std::vector<QStandardItem *> automodRow = this->createRow();
|
||||||
setBoolItem(automodRow[Column::Pattern],
|
setBoolItem(automodRow[Column::Pattern],
|
||||||
getSettings()->enableAutomodHighlight.getValue(), true, false);
|
getSettings()->enableAutomodHighlight.getValue(), true, false);
|
||||||
|
setBoolItem(automodRow[Column::ShowInMentions],
|
||||||
|
getSettings()->showAutomodInMentions.getValue(), true, false);
|
||||||
automodRow[Column::Pattern]->setData("AutoMod Caught Messages",
|
automodRow[Column::Pattern]->setData("AutoMod Caught Messages",
|
||||||
Qt::DisplayRole);
|
Qt::DisplayRole);
|
||||||
automodRow[Column::ShowInMentions]->setFlags({});
|
|
||||||
setBoolItem(automodRow[Column::FlashTaskbar],
|
setBoolItem(automodRow[Column::FlashTaskbar],
|
||||||
getSettings()->enableAutomodHighlightTaskbar.getValue(), true,
|
getSettings()->enableAutomodHighlightTaskbar.getValue(), true,
|
||||||
false);
|
false);
|
||||||
@@ -253,8 +254,9 @@ void HighlightModel::afterInit()
|
|||||||
const auto automodSound =
|
const auto automodSound =
|
||||||
QUrl(getSettings()->automodHighlightSoundUrl.getValue());
|
QUrl(getSettings()->automodHighlightSoundUrl.getValue());
|
||||||
setFilePathItem(automodRow[Column::SoundPath], automodSound, false);
|
setFilePathItem(automodRow[Column::SoundPath], automodSound, false);
|
||||||
|
auto automodColor =
|
||||||
automodRow[Column::Color]->setFlags(Qt::ItemFlag::NoItemFlags);
|
ColorProvider::instance().color(ColorType::AutomodHighlight);
|
||||||
|
setColorItem(automodRow[Column::Color], *automodColor, false);
|
||||||
|
|
||||||
this->insertCustomRow(automodRow, HighlightRowIndexes::AutomodRow);
|
this->insertCustomRow(automodRow, HighlightRowIndexes::AutomodRow);
|
||||||
}
|
}
|
||||||
@@ -322,6 +324,11 @@ void HighlightModel::customRowSetData(const std::vector<QStandardItem *> &row,
|
|||||||
getSettings()->showThreadHighlightInMentions.setValue(
|
getSettings()->showThreadHighlightInMentions.setValue(
|
||||||
value.toBool());
|
value.toBool());
|
||||||
}
|
}
|
||||||
|
else if (rowIndex == HighlightRowIndexes::AutomodRow)
|
||||||
|
{
|
||||||
|
getSettings()->showAutomodInMentions.setValue(
|
||||||
|
value.toBool());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -502,6 +509,11 @@ void HighlightModel::customRowSetData(const std::vector<QStandardItem *> &row,
|
|||||||
setColor(getSettings()->threadHighlightColor,
|
setColor(getSettings()->threadHighlightColor,
|
||||||
ColorType::ThreadMessageHighlight);
|
ColorType::ThreadMessageHighlight);
|
||||||
}
|
}
|
||||||
|
else if (rowIndex == HighlightRowIndexes::AutomodRow)
|
||||||
|
{
|
||||||
|
setColor(getSettings()->automodHighlightColor,
|
||||||
|
ColorType::AutomodHighlight);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ QColor HighlightPhrase::FALLBACK_ELEVATED_MESSAGE_HIGHLIGHT_COLOR =
|
|||||||
QColor HighlightPhrase::FALLBACK_THREAD_HIGHLIGHT_COLOR =
|
QColor HighlightPhrase::FALLBACK_THREAD_HIGHLIGHT_COLOR =
|
||||||
QColor(143, 48, 24, 60);
|
QColor(143, 48, 24, 60);
|
||||||
QColor HighlightPhrase::FALLBACK_SUB_COLOR = QColor(196, 102, 255, 100);
|
QColor HighlightPhrase::FALLBACK_SUB_COLOR = QColor(196, 102, 255, 100);
|
||||||
|
QColor HighlightPhrase::FALLBACK_AUTOMOD_HIGHLIGHT_COLOR = QColor(64, 64, 64);
|
||||||
|
|
||||||
bool HighlightPhrase::operator==(const HighlightPhrase &other) const
|
bool HighlightPhrase::operator==(const HighlightPhrase &other) const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ public:
|
|||||||
static QColor FALLBACK_FIRST_MESSAGE_HIGHLIGHT_COLOR;
|
static QColor FALLBACK_FIRST_MESSAGE_HIGHLIGHT_COLOR;
|
||||||
static QColor FALLBACK_ELEVATED_MESSAGE_HIGHLIGHT_COLOR;
|
static QColor FALLBACK_ELEVATED_MESSAGE_HIGHLIGHT_COLOR;
|
||||||
static QColor FALLBACK_THREAD_HIGHLIGHT_COLOR;
|
static QColor FALLBACK_THREAD_HIGHLIGHT_COLOR;
|
||||||
|
static QColor FALLBACK_AUTOMOD_HIGHLIGHT_COLOR;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString pattern_;
|
QString pattern_;
|
||||||
|
|||||||
@@ -69,6 +69,14 @@ ScrollbarHighlight Message::getScrollBarHighlight() const
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this->flags.has(MessageFlag::AutoModOffendingMessage) ||
|
||||||
|
this->flags.has(MessageFlag::AutoModOffendingMessageHeader))
|
||||||
|
{
|
||||||
|
return {
|
||||||
|
ColorProvider::instance().color(ColorType::AutomodHighlight),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,15 +51,17 @@ enum class MessageFlag : int64_t {
|
|||||||
LiveUpdatesAdd = (1LL << 28),
|
LiveUpdatesAdd = (1LL << 28),
|
||||||
LiveUpdatesRemove = (1LL << 29),
|
LiveUpdatesRemove = (1LL << 29),
|
||||||
LiveUpdatesUpdate = (1LL << 30),
|
LiveUpdatesUpdate = (1LL << 30),
|
||||||
|
/// The header of a message caught by AutoMod containing allow/disallow
|
||||||
|
AutoModOffendingMessageHeader = (1LL << 31),
|
||||||
/// The message caught by AutoMod containing the user who sent the message & its contents
|
/// The message caught by AutoMod containing the user who sent the message & its contents
|
||||||
AutoModOffendingMessage = (1LL << 31),
|
AutoModOffendingMessage = (1LL << 32),
|
||||||
LowTrustUsers = (1LL << 32),
|
LowTrustUsers = (1LL << 33),
|
||||||
/// The message is sent by a user marked as restricted with Twitch's "Low Trust"/"Suspicious User" feature
|
/// The message is sent by a user marked as restricted with Twitch's "Low Trust"/"Suspicious User" feature
|
||||||
RestrictedMessage = (1LL << 33),
|
RestrictedMessage = (1LL << 34),
|
||||||
/// The message is sent by a user marked as monitor with Twitch's "Low Trust"/"Suspicious User" feature
|
/// The message is sent by a user marked as monitor with Twitch's "Low Trust"/"Suspicious User" feature
|
||||||
MonitoredMessage = (1LL << 34),
|
MonitoredMessage = (1LL << 35),
|
||||||
/// The message is an ACTION message (/me)
|
/// The message is an ACTION message (/me)
|
||||||
Action = (1LL << 35),
|
Action = (1LL << 36),
|
||||||
};
|
};
|
||||||
using MessageFlags = FlagsEnum<MessageFlag>;
|
using MessageFlags = FlagsEnum<MessageFlag>;
|
||||||
|
|
||||||
|
|||||||
@@ -373,7 +373,19 @@ void MessageLayout::updateBuffer(QPixmap *buffer,
|
|||||||
else if (this->message_->flags.has(MessageFlag::AutoMod) ||
|
else if (this->message_->flags.has(MessageFlag::AutoMod) ||
|
||||||
this->message_->flags.has(MessageFlag::LowTrustUsers))
|
this->message_->flags.has(MessageFlag::LowTrustUsers))
|
||||||
{
|
{
|
||||||
backgroundColor = QColor("#404040");
|
if (ctx.preferences.enableAutomodHighlight &&
|
||||||
|
(this->message_->flags.has(MessageFlag::AutoModOffendingMessage) ||
|
||||||
|
this->message_->flags.has(
|
||||||
|
MessageFlag::AutoModOffendingMessageHeader)))
|
||||||
|
{
|
||||||
|
backgroundColor = blendColors(
|
||||||
|
backgroundColor,
|
||||||
|
*ctx.colorProvider.color(ColorType::AutomodHighlight));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
backgroundColor = QColor("#404040");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (this->message_->flags.has(MessageFlag::Debug))
|
else if (this->message_->flags.has(MessageFlag::Debug))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -128,6 +128,9 @@ void ColorProvider::initTypeColorMap()
|
|||||||
initColor(ColorType::ThreadMessageHighlight,
|
initColor(ColorType::ThreadMessageHighlight,
|
||||||
getSettings()->threadHighlightColor,
|
getSettings()->threadHighlightColor,
|
||||||
HighlightPhrase::FALLBACK_THREAD_HIGHLIGHT_COLOR);
|
HighlightPhrase::FALLBACK_THREAD_HIGHLIGHT_COLOR);
|
||||||
|
|
||||||
|
initColor(ColorType::AutomodHighlight, getSettings()->automodHighlightColor,
|
||||||
|
HighlightPhrase::FALLBACK_AUTOMOD_HIGHLIGHT_COLOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorProvider::initDefaultColors()
|
void ColorProvider::initDefaultColors()
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ enum class ColorType {
|
|||||||
ThreadMessageHighlight,
|
ThreadMessageHighlight,
|
||||||
// Used in automatic highlights of your own messages
|
// Used in automatic highlights of your own messages
|
||||||
SelfMessageHighlight,
|
SelfMessageHighlight,
|
||||||
|
AutomodHighlight,
|
||||||
};
|
};
|
||||||
|
|
||||||
class ColorProvider
|
class ColorProvider
|
||||||
|
|||||||
@@ -2009,6 +2009,7 @@ std::pair<MessagePtr, MessagePtr> TwitchMessageBuilder::makeAutomodMessage(
|
|||||||
builder.message().flags.set(MessageFlag::PubSub);
|
builder.message().flags.set(MessageFlag::PubSub);
|
||||||
builder.message().flags.set(MessageFlag::Timeout);
|
builder.message().flags.set(MessageFlag::Timeout);
|
||||||
builder.message().flags.set(MessageFlag::AutoMod);
|
builder.message().flags.set(MessageFlag::AutoMod);
|
||||||
|
builder.message().flags.set(MessageFlag::AutoModOffendingMessageHeader);
|
||||||
|
|
||||||
// AutoMod shield badge
|
// AutoMod shield badge
|
||||||
builder.emplace<BadgeElement>(makeAutoModBadge(),
|
builder.emplace<BadgeElement>(makeAutoModBadge(),
|
||||||
|
|||||||
@@ -394,6 +394,10 @@ public:
|
|||||||
"/highlighting/automod/enabled",
|
"/highlighting/automod/enabled",
|
||||||
true,
|
true,
|
||||||
};
|
};
|
||||||
|
BoolSetting showAutomodInMentions = {
|
||||||
|
"/highlighting/automod/showInMentions",
|
||||||
|
false,
|
||||||
|
};
|
||||||
BoolSetting enableAutomodHighlightSound = {
|
BoolSetting enableAutomodHighlightSound = {
|
||||||
"/highlighting/automod/enableSound",
|
"/highlighting/automod/enableSound",
|
||||||
false,
|
false,
|
||||||
@@ -406,6 +410,7 @@ public:
|
|||||||
"/highlighting/automod/soundUrl",
|
"/highlighting/automod/soundUrl",
|
||||||
"",
|
"",
|
||||||
};
|
};
|
||||||
|
QStringSetting automodHighlightColor = {"/highlighting/automod/color", ""};
|
||||||
|
|
||||||
BoolSetting enableThreadHighlight = {
|
BoolSetting enableThreadHighlight = {
|
||||||
"/highlighting/thread/nameIsHighlightKeyword", true};
|
"/highlighting/thread/nameIsHighlightKeyword", true};
|
||||||
|
|||||||
Reference in New Issue
Block a user