Add highlights for first messages (#3267)
Co-authored-by: Rasmus Karlsson <rasmus.karlsson@pajlada.com>
This commit is contained in:
@@ -150,6 +150,29 @@ void HighlightModel::afterInit()
|
||||
setColorItem(redeemedRow[Column::Color], *RedeemedColor, false);
|
||||
|
||||
this->insertCustomRow(redeemedRow, 3);
|
||||
|
||||
std::vector<QStandardItem *> firstMessageRow = this->createRow();
|
||||
setBoolItem(firstMessageRow[Column::Pattern],
|
||||
getSettings()->enableFirstMessageHighlight.getValue(), true,
|
||||
false);
|
||||
firstMessageRow[Column::Pattern]->setData("First Messages",
|
||||
Qt::DisplayRole);
|
||||
firstMessageRow[Column::ShowInMentions]->setFlags({});
|
||||
firstMessageRow[Column::FlashTaskbar]->setFlags({});
|
||||
firstMessageRow[Column::PlaySound]->setFlags({});
|
||||
firstMessageRow[Column::UseRegex]->setFlags({});
|
||||
firstMessageRow[Column::CaseSensitive]->setFlags({});
|
||||
|
||||
QUrl FirstMessageSound =
|
||||
QUrl(getSettings()->firstMessageHighlightSoundUrl.getValue());
|
||||
setFilePathItem(firstMessageRow[Column::SoundPath], FirstMessageSound,
|
||||
false);
|
||||
|
||||
auto FirstMessageColor =
|
||||
ColorProvider::instance().color(ColorType::FirstMessageHighlight);
|
||||
setColorItem(firstMessageRow[Column::Color], *FirstMessageColor, false);
|
||||
|
||||
this->insertCustomRow(firstMessageRow, 4);
|
||||
}
|
||||
|
||||
void HighlightModel::customRowSetData(const std::vector<QStandardItem *> &row,
|
||||
@@ -304,6 +327,14 @@ void HighlightModel::customRowSetData(const std::vector<QStandardItem *> &row,
|
||||
.updateColor(ColorType::RedeemedHighlight,
|
||||
QColor(colorName));
|
||||
}
|
||||
else if (rowIndex == 4)
|
||||
{
|
||||
getSettings()->firstMessageHighlightColor.setValue(
|
||||
colorName);
|
||||
const_cast<ColorProvider &>(ColorProvider::instance())
|
||||
.updateColor(ColorType::FirstMessageHighlight,
|
||||
QColor(colorName));
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -12,6 +12,8 @@ namespace {
|
||||
QColor HighlightPhrase::FALLBACK_HIGHLIGHT_COLOR = QColor(127, 63, 73, 127);
|
||||
QColor HighlightPhrase::FALLBACK_REDEEMED_HIGHLIGHT_COLOR =
|
||||
QColor(28, 126, 141, 60);
|
||||
QColor HighlightPhrase::FALLBACK_FIRST_MESSAGE_HIGHLIGHT_COLOR =
|
||||
QColor(72, 127, 63, 60);
|
||||
QColor HighlightPhrase::FALLBACK_SUB_COLOR = QColor(196, 102, 255, 100);
|
||||
|
||||
bool HighlightPhrase::operator==(const HighlightPhrase &other) const
|
||||
|
||||
@@ -82,6 +82,7 @@ public:
|
||||
static QColor FALLBACK_HIGHLIGHT_COLOR;
|
||||
static QColor FALLBACK_REDEEMED_HIGHLIGHT_COLOR;
|
||||
static QColor FALLBACK_SUB_COLOR;
|
||||
static QColor FALLBACK_FIRST_MESSAGE_HIGHLIGHT_COLOR;
|
||||
|
||||
private:
|
||||
QString pattern_;
|
||||
|
||||
Reference in New Issue
Block a user