Add highlight color and show in mentions to automod messages (#5215)
This commit is contained in:
@@ -213,6 +213,8 @@ void rebuildMessageHighlights(Settings &settings,
|
||||
settings.enableAutomodHighlightTaskbar.getValue();
|
||||
const auto highlightSoundUrlValue =
|
||||
settings.automodHighlightSoundUrl.getValue();
|
||||
auto highlightColor =
|
||||
ColorProvider::instance().color(ColorType::AutomodHighlight);
|
||||
|
||||
checks.emplace_back(HighlightCheck{
|
||||
[=](const auto & /*args*/, const auto & /*badges*/,
|
||||
@@ -234,7 +236,7 @@ void rebuildMessageHighlights(Settings &settings,
|
||||
highlightAlert, // alert
|
||||
highlightSound, // playSound
|
||||
highlightSoundUrl, // customSoundUrl
|
||||
nullptr, // color
|
||||
highlightColor, // color
|
||||
false, // showInMentions
|
||||
};
|
||||
}});
|
||||
@@ -471,6 +473,7 @@ void HighlightController::initialize(Settings &settings,
|
||||
this->rebuildListener_.addSetting(settings.showThreadHighlightInMentions);
|
||||
|
||||
this->rebuildListener_.addSetting(settings.enableAutomodHighlight);
|
||||
this->rebuildListener_.addSetting(settings.showAutomodInMentions);
|
||||
this->rebuildListener_.addSetting(settings.enableAutomodHighlightSound);
|
||||
this->rebuildListener_.addSetting(settings.enableAutomodHighlightTaskbar);
|
||||
this->rebuildListener_.addSetting(settings.automodHighlightSoundUrl);
|
||||
|
||||
@@ -238,9 +238,10 @@ void HighlightModel::afterInit()
|
||||
const std::vector<QStandardItem *> automodRow = this->createRow();
|
||||
setBoolItem(automodRow[Column::Pattern],
|
||||
getSettings()->enableAutomodHighlight.getValue(), true, false);
|
||||
setBoolItem(automodRow[Column::ShowInMentions],
|
||||
getSettings()->showAutomodInMentions.getValue(), true, false);
|
||||
automodRow[Column::Pattern]->setData("AutoMod Caught Messages",
|
||||
Qt::DisplayRole);
|
||||
automodRow[Column::ShowInMentions]->setFlags({});
|
||||
setBoolItem(automodRow[Column::FlashTaskbar],
|
||||
getSettings()->enableAutomodHighlightTaskbar.getValue(), true,
|
||||
false);
|
||||
@@ -253,8 +254,9 @@ void HighlightModel::afterInit()
|
||||
const auto automodSound =
|
||||
QUrl(getSettings()->automodHighlightSoundUrl.getValue());
|
||||
setFilePathItem(automodRow[Column::SoundPath], automodSound, false);
|
||||
|
||||
automodRow[Column::Color]->setFlags(Qt::ItemFlag::NoItemFlags);
|
||||
auto automodColor =
|
||||
ColorProvider::instance().color(ColorType::AutomodHighlight);
|
||||
setColorItem(automodRow[Column::Color], *automodColor, false);
|
||||
|
||||
this->insertCustomRow(automodRow, HighlightRowIndexes::AutomodRow);
|
||||
}
|
||||
@@ -322,6 +324,11 @@ void HighlightModel::customRowSetData(const std::vector<QStandardItem *> &row,
|
||||
getSettings()->showThreadHighlightInMentions.setValue(
|
||||
value.toBool());
|
||||
}
|
||||
else if (rowIndex == HighlightRowIndexes::AutomodRow)
|
||||
{
|
||||
getSettings()->showAutomodInMentions.setValue(
|
||||
value.toBool());
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -502,6 +509,11 @@ void HighlightModel::customRowSetData(const std::vector<QStandardItem *> &row,
|
||||
setColor(getSettings()->threadHighlightColor,
|
||||
ColorType::ThreadMessageHighlight);
|
||||
}
|
||||
else if (rowIndex == HighlightRowIndexes::AutomodRow)
|
||||
{
|
||||
setColor(getSettings()->automodHighlightColor,
|
||||
ColorType::AutomodHighlight);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -21,6 +21,7 @@ QColor HighlightPhrase::FALLBACK_ELEVATED_MESSAGE_HIGHLIGHT_COLOR =
|
||||
QColor HighlightPhrase::FALLBACK_THREAD_HIGHLIGHT_COLOR =
|
||||
QColor(143, 48, 24, 60);
|
||||
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
|
||||
{
|
||||
|
||||
@@ -86,6 +86,7 @@ public:
|
||||
static QColor FALLBACK_FIRST_MESSAGE_HIGHLIGHT_COLOR;
|
||||
static QColor FALLBACK_ELEVATED_MESSAGE_HIGHLIGHT_COLOR;
|
||||
static QColor FALLBACK_THREAD_HIGHLIGHT_COLOR;
|
||||
static QColor FALLBACK_AUTOMOD_HIGHLIGHT_COLOR;
|
||||
|
||||
private:
|
||||
QString pattern_;
|
||||
|
||||
Reference in New Issue
Block a user