Better Highlights: Fix Unintentional Color Update (#1522)

* HighlightPhrase: Fix wrong documentation

* Use right constructor for new HighlightPhrases

* Fix preset highlights changing unintentionally

Prior to this commit, the callback for reacting to user input on the
highlight table (namely, `HighlightingPage::tableCellClicked`) only
checked for the row number in order to determine whether preset
highlights (self highlights, whispers, and subscriptions) need to be
updated. Hence, changing rows 0 through 2 in the "User Highlights" tab
would also update the preset highlights.

This commit adds a check to determine whether the callback was triggered
by the "Messages" highlight tab, or not.
This commit is contained in:
Leon Richardt
2020-01-27 00:16:09 +01:00
committed by pajlada
parent bfee75ec58
commit 497ce2d2f2
3 changed files with 35 additions and 24 deletions
@@ -12,11 +12,6 @@ bool HighlightPhrase::operator==(const HighlightPhrase &other) const
other.soundUrl_, other.color_);
}
/**
* @brief Create a new HighlightPhrase.
*
* Use this constructor when updating an existing HighlightPhrase's color.
*/
HighlightPhrase::HighlightPhrase(const QString &pattern, bool hasAlert,
bool hasSound, bool isRegex,
bool isCaseSensitive, const QString &soundUrl,
@@ -36,11 +31,6 @@ HighlightPhrase::HighlightPhrase(const QString &pattern, bool hasAlert,
this->color_ = std::make_shared<QColor>(color);
}
/**
* @brief Create a new HighlightPhrase.
*
* Use this constructor when creating a new HighlightPhrase.
*/
HighlightPhrase::HighlightPhrase(const QString &pattern, bool hasAlert,
bool hasSound, bool isRegex,
bool isCaseSensitive, const QString &soundUrl,
@@ -15,10 +15,20 @@ class HighlightPhrase
public:
bool operator==(const HighlightPhrase &other) const;
/**
* @brief Create a new HighlightPhrase.
*
* Use this constructor when creating a new HighlightPhrase.
*/
HighlightPhrase(const QString &pattern, bool hasAlert, bool hasSound,
bool isRegex, bool isCaseSensitive, const QString &soundUrl,
QColor color);
/**
* @brief Create a new HighlightPhrase.
*
* Use this constructor when updating an existing HighlightPhrase's color.
*/
HighlightPhrase(const QString &pattern, bool hasAlert, bool hasSound,
bool isRegex, bool isCaseSensitive, const QString &soundUrl,
std::shared_ptr<QColor> color);