Added option to highlight your own messages (#3833)
* Removed magic numbers when checking rowIndex * Swap from static ints to enum * Referred enum members by enum name * Fixed formatting * Added highlight option for self messages * Update CHANGELOG.md * Made disabled by default * Moved setting from Messages tab to Users tab * Moved checks to HighlightController * Set row index to 0 sillE silly me * Update CHANGELOG.md * Moved check outside of loop * Improved naming and documentation on variables * Fixed formatting * Fix compile errors * Update ColorProvider self message highlight color when it's changed Use the ColorProvider self message highlight color instead of rolling our own non-updating color * Update changelog entry * Remove unused `customColor` from user highlights builder * Use explicit lambda capture * Update comment for the color provider color * HighlightModelHpp: Future-proof custom row enum B) * Document UserHighlightModel color changes * Update colorprovider comment * Update enabled, show in mentions & color setting paths * Rename settings from `selfMessagesHighlight` to `selfMessageHighlight` --------- Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -210,6 +210,35 @@ void rebuildUserHighlights(Settings &settings,
|
||||
{
|
||||
auto userHighlights = settings.highlightedUsers.readOnly();
|
||||
|
||||
if (settings.enableSelfMessageHighlight)
|
||||
{
|
||||
bool showInMentions = settings.showSelfMessageHighlightInMentions;
|
||||
|
||||
checks.emplace_back(HighlightCheck{
|
||||
[showInMentions](
|
||||
const auto &args, const auto &badges, const auto &senderName,
|
||||
const auto &originalMessage, const auto &flags,
|
||||
const auto self) -> boost::optional<HighlightResult> {
|
||||
(void)args; //unused
|
||||
(void)badges; //unused
|
||||
(void)senderName; //unused
|
||||
(void)flags; //unused
|
||||
(void)originalMessage; //unused
|
||||
|
||||
if (!self)
|
||||
{
|
||||
return boost::none;
|
||||
}
|
||||
|
||||
// Highlight color is provided by the ColorProvider and will be updated accordingly
|
||||
auto highlightColor = ColorProvider::instance().color(
|
||||
ColorType::SelfMessageHighlight);
|
||||
|
||||
return HighlightResult{false, false, (QUrl) nullptr,
|
||||
highlightColor, showInMentions};
|
||||
}});
|
||||
}
|
||||
|
||||
for (const auto &highlight : *userHighlights)
|
||||
{
|
||||
checks.emplace_back(HighlightCheck{
|
||||
@@ -391,6 +420,11 @@ void HighlightController::initialize(Settings &settings, Paths & /*paths*/)
|
||||
this->rebuildListener_.addSetting(settings.enableSubHighlight);
|
||||
this->rebuildListener_.addSetting(settings.enableSubHighlightSound);
|
||||
this->rebuildListener_.addSetting(settings.enableSubHighlightTaskbar);
|
||||
this->rebuildListener_.addSetting(settings.enableSelfMessageHighlight);
|
||||
this->rebuildListener_.addSetting(
|
||||
settings.showSelfMessageHighlightInMentions);
|
||||
// We do not need to rebuild the listener for the selfMessagesHighlightColor
|
||||
// The color is dynamically fetched any time the self message highlight is triggered
|
||||
this->rebuildListener_.addSetting(settings.subHighlightSoundUrl);
|
||||
|
||||
this->rebuildListener_.addSetting(settings.enableThreadHighlight);
|
||||
|
||||
Reference in New Issue
Block a user