mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
Allow customization of whisper colors in settings (#5053)
This commit is contained in:
parent
60d79ef57e
commit
9a2c27d258
|
@ -18,6 +18,7 @@
|
||||||
- Minor: Updated the flatpakref link included with nightly builds to point to up-to-date flathub-beta builds. (#5008)
|
- Minor: Updated the flatpakref link included with nightly builds to point to up-to-date flathub-beta builds. (#5008)
|
||||||
- Minor: Add a new completion API for experimental plugins feature. (#5000, #5047)
|
- Minor: Add a new completion API for experimental plugins feature. (#5000, #5047)
|
||||||
- Minor: Re-enabled _Restart on crash_ option on Windows. (#5012)
|
- Minor: Re-enabled _Restart on crash_ option on Windows. (#5012)
|
||||||
|
- Minor: The whisper highlight color can now be configured through the settings. (#5053)
|
||||||
- Bugfix: Fixed an issue where certain emojis did not send to Twitch chat correctly. (#4840)
|
- Bugfix: Fixed an issue where certain emojis did not send to Twitch chat correctly. (#4840)
|
||||||
- Bugfix: Fixed capitalized channel names in log inclusion list not being logged. (#4848)
|
- Bugfix: Fixed capitalized channel names in log inclusion list not being logged. (#4848)
|
||||||
- Bugfix: Trimmed custom streamlink paths on all platforms making sure you don't accidentally add spaces at the beginning or end of its path. (#4834)
|
- Bugfix: Trimmed custom streamlink paths on all platforms making sure you don't accidentally add spaces at the beginning or end of its path. (#4834)
|
||||||
|
|
|
@ -98,9 +98,8 @@ void HighlightModel::afterInit()
|
||||||
QUrl(getSettings()->whisperHighlightSoundUrl.getValue());
|
QUrl(getSettings()->whisperHighlightSoundUrl.getValue());
|
||||||
setFilePathItem(whisperRow[Column::SoundPath], whisperSound, false);
|
setFilePathItem(whisperRow[Column::SoundPath], whisperSound, false);
|
||||||
|
|
||||||
// auto whisperColor = ColorProvider::instance().color(ColorType::Whisper);
|
auto whisperColor = ColorProvider::instance().color(ColorType::Whisper);
|
||||||
// setColorItem(whisperRow[Column::Color], *whisperColor, false);
|
setColorItem(whisperRow[Column::Color], *whisperColor, false);
|
||||||
whisperRow[Column::Color]->setFlags(Qt::ItemFlag::NoItemFlags);
|
|
||||||
|
|
||||||
this->insertCustomRow(whisperRow, HighlightRowIndexes::WhisperRow);
|
this->insertCustomRow(whisperRow, HighlightRowIndexes::WhisperRow);
|
||||||
|
|
||||||
|
@ -463,48 +462,47 @@ void HighlightModel::customRowSetData(const std::vector<QStandardItem *> &row,
|
||||||
// Custom color
|
// Custom color
|
||||||
if (role == Qt::DecorationRole)
|
if (role == Qt::DecorationRole)
|
||||||
{
|
{
|
||||||
auto colorName = value.value<QColor>().name(QColor::HexArgb);
|
const auto setColor = [&](auto &setting, ColorType ty) {
|
||||||
|
auto color = value.value<QColor>();
|
||||||
|
setting.setValue(color.name(QColor::HexArgb));
|
||||||
|
const_cast<ColorProvider &>(ColorProvider::instance())
|
||||||
|
.updateColor(ty, color);
|
||||||
|
};
|
||||||
|
|
||||||
if (rowIndex == HighlightRowIndexes::SelfHighlightRow)
|
if (rowIndex == HighlightRowIndexes::SelfHighlightRow)
|
||||||
{
|
{
|
||||||
getSettings()->selfHighlightColor.setValue(colorName);
|
setColor(getSettings()->selfHighlightColor,
|
||||||
|
ColorType::SelfHighlight);
|
||||||
|
}
|
||||||
|
else if (rowIndex == HighlightRowIndexes::WhisperRow)
|
||||||
|
{
|
||||||
|
setColor(getSettings()->whisperHighlightColor,
|
||||||
|
ColorType::Whisper);
|
||||||
}
|
}
|
||||||
// else if (rowIndex == HighlightRowIndexes::WhisperRow)
|
|
||||||
// {
|
|
||||||
// getSettings()->whisperHighlightColor.setValue(colorName);
|
|
||||||
// }
|
|
||||||
else if (rowIndex == HighlightRowIndexes::SubRow)
|
else if (rowIndex == HighlightRowIndexes::SubRow)
|
||||||
{
|
{
|
||||||
getSettings()->subHighlightColor.setValue(colorName);
|
setColor(getSettings()->subHighlightColor,
|
||||||
|
ColorType::Subscription);
|
||||||
}
|
}
|
||||||
else if (rowIndex == HighlightRowIndexes::RedeemedRow)
|
else if (rowIndex == HighlightRowIndexes::RedeemedRow)
|
||||||
{
|
{
|
||||||
getSettings()->redeemedHighlightColor.setValue(colorName);
|
setColor(getSettings()->redeemedHighlightColor,
|
||||||
const_cast<ColorProvider &>(ColorProvider::instance())
|
ColorType::RedeemedHighlight);
|
||||||
.updateColor(ColorType::RedeemedHighlight,
|
|
||||||
QColor(colorName));
|
|
||||||
}
|
}
|
||||||
else if (rowIndex == HighlightRowIndexes::FirstMessageRow)
|
else if (rowIndex == HighlightRowIndexes::FirstMessageRow)
|
||||||
{
|
{
|
||||||
getSettings()->firstMessageHighlightColor.setValue(
|
setColor(getSettings()->firstMessageHighlightColor,
|
||||||
colorName);
|
ColorType::FirstMessageHighlight);
|
||||||
const_cast<ColorProvider &>(ColorProvider::instance())
|
|
||||||
.updateColor(ColorType::FirstMessageHighlight,
|
|
||||||
QColor(colorName));
|
|
||||||
}
|
}
|
||||||
else if (rowIndex == HighlightRowIndexes::ElevatedMessageRow)
|
else if (rowIndex == HighlightRowIndexes::ElevatedMessageRow)
|
||||||
{
|
{
|
||||||
getSettings()->elevatedMessageHighlightColor.setValue(
|
setColor(getSettings()->elevatedMessageHighlightColor,
|
||||||
colorName);
|
ColorType::ElevatedMessageHighlight);
|
||||||
const_cast<ColorProvider &>(ColorProvider::instance())
|
|
||||||
.updateColor(ColorType::ElevatedMessageHighlight,
|
|
||||||
QColor(colorName));
|
|
||||||
}
|
}
|
||||||
else if (rowIndex == HighlightRowIndexes::ThreadMessageRow)
|
else if (rowIndex == HighlightRowIndexes::ThreadMessageRow)
|
||||||
{
|
{
|
||||||
getSettings()->threadHighlightColor.setValue(colorName);
|
setColor(getSettings()->threadHighlightColor,
|
||||||
const_cast<ColorProvider &>(ColorProvider::instance())
|
ColorType::ThreadMessageHighlight);
|
||||||
.updateColor(ColorType::ThreadMessageHighlight,
|
|
||||||
QColor(colorName));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -340,28 +340,6 @@ void HighlightingPage::openColorDialog(const QModelIndex &clicked,
|
||||||
if (selected.isValid())
|
if (selected.isValid())
|
||||||
{
|
{
|
||||||
view->getModel()->setData(clicked, selected, Qt::DecorationRole);
|
view->getModel()->setData(clicked, selected, Qt::DecorationRole);
|
||||||
|
|
||||||
if (tab == HighlightTab::Messages)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* For preset highlights in the "Messages" tab, we need to
|
|
||||||
* manually update the color map.
|
|
||||||
*/
|
|
||||||
auto instance = ColorProvider::instance();
|
|
||||||
switch (clicked.row())
|
|
||||||
{
|
|
||||||
case 0:
|
|
||||||
instance.updateColor(ColorType::SelfHighlight,
|
|
||||||
selected);
|
|
||||||
break;
|
|
||||||
case 1:
|
|
||||||
instance.updateColor(ColorType::Whisper, selected);
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
instance.updateColor(ColorType::Subscription, selected);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue