refined highlight and added bits highlights

This commit is contained in:
fourtf
2020-04-15 23:15:45 +02:00
parent ebfcb49e8c
commit 097f4ccb3a
16 changed files with 164 additions and 22 deletions
+67 -11
View File
@@ -2,6 +2,7 @@
#include "Application.hpp"
#include "singletons/Settings.hpp"
#include "singletons/WindowManager.hpp"
#include "util/StandardItemHelper.hpp"
namespace chatterino {
@@ -88,10 +89,11 @@ void HighlightModel::afterInit()
QUrl(getSettings()->whisperHighlightSoundUrl.getValue());
setFilePathItem(whisperRow[Column::SoundPath], whisperSound, false);
auto whisperColor = ColorProvider::instance().color(ColorType::Whisper);
setColorItem(whisperRow[Column::Color], *whisperColor, false);
// auto whisperColor = ColorProvider::instance().color(ColorType::Whisper);
// setColorItem(whisperRow[Column::Color], *whisperColor, false);
whisperRow[Column::Color]->setFlags(Qt::ItemFlag::NoItemFlags);
this->insertCustomRow(whisperRow, 1);
this->insertCustomRow(whisperRow, WHISPER_ROW);
// Highlight settings for subscription messages
std::vector<QStandardItem *> subRow = this->createRow();
@@ -113,6 +115,31 @@ void HighlightModel::afterInit()
setColorItem(subRow[Column::Color], *subColor, false);
this->insertCustomRow(subRow, 2);
// Highlight settings for redeemed highlight messages
std::vector<QStandardItem *> redeemedRow = this->createRow();
setBoolItem(redeemedRow[Column::Pattern],
getSettings()->enableRedeemedHighlight.getValue(), true, false);
redeemedRow[Column::Pattern]->setData("Highlights redeemed with Bits",
Qt::DisplayRole);
setBoolItem(redeemedRow[Column::FlashTaskbar],
getSettings()->enableRedeemedHighlightTaskbar.getValue(), true,
false);
setBoolItem(redeemedRow[Column::PlaySound],
getSettings()->enableRedeemedHighlightSound.getValue(), true,
false);
redeemedRow[Column::UseRegex]->setFlags(0);
redeemedRow[Column::CaseSensitive]->setFlags(0);
QUrl RedeemedSound =
QUrl(getSettings()->redeemedHighlightSoundUrl.getValue());
setFilePathItem(redeemedRow[Column::SoundPath], RedeemedSound, false);
auto RedeemedColor =
ColorProvider::instance().color(ColorType::RedeemedHighlight);
setColorItem(redeemedRow[Column::Color], *RedeemedColor, false);
this->insertCustomRow(redeemedRow, 3);
}
void HighlightModel::customRowSetData(const std::vector<QStandardItem *> &row,
@@ -128,7 +155,7 @@ void HighlightModel::customRowSetData(const std::vector<QStandardItem *> &row,
{
getSettings()->enableSelfHighlight.setValue(value.toBool());
}
else if (rowIndex == 1)
else if (rowIndex == WHISPER_ROW)
{
getSettings()->enableWhisperHighlight.setValue(
value.toBool());
@@ -137,6 +164,11 @@ void HighlightModel::customRowSetData(const std::vector<QStandardItem *> &row,
{
getSettings()->enableSubHighlight.setValue(value.toBool());
}
else if (rowIndex == 3)
{
getSettings()->enableRedeemedHighlight.setValue(
value.toBool());
}
}
}
break;
@@ -148,7 +180,7 @@ void HighlightModel::customRowSetData(const std::vector<QStandardItem *> &row,
getSettings()->enableSelfHighlightTaskbar.setValue(
value.toBool());
}
else if (rowIndex == 1)
else if (rowIndex == WHISPER_ROW)
{
getSettings()->enableWhisperHighlightTaskbar.setValue(
value.toBool());
@@ -158,6 +190,11 @@ void HighlightModel::customRowSetData(const std::vector<QStandardItem *> &row,
getSettings()->enableSubHighlightTaskbar.setValue(
value.toBool());
}
else if (rowIndex == 3)
{
getSettings()->enableRedeemedHighlightTaskbar.setValue(
value.toBool());
}
}
}
break;
@@ -169,7 +206,7 @@ void HighlightModel::customRowSetData(const std::vector<QStandardItem *> &row,
getSettings()->enableSelfHighlightSound.setValue(
value.toBool());
}
else if (rowIndex == 1)
else if (rowIndex == WHISPER_ROW)
{
getSettings()->enableWhisperHighlightSound.setValue(
value.toBool());
@@ -179,6 +216,11 @@ void HighlightModel::customRowSetData(const std::vector<QStandardItem *> &row,
getSettings()->enableSubHighlightSound.setValue(
value.toBool());
}
else if (rowIndex == 3)
{
getSettings()->enableRedeemedHighlightSound.setValue(
value.toBool());
}
}
}
break;
@@ -199,7 +241,7 @@ void HighlightModel::customRowSetData(const std::vector<QStandardItem *> &row,
getSettings()->selfHighlightSoundUrl.setValue(
value.toString());
}
else if (rowIndex == 1)
else if (rowIndex == WHISPER_ROW)
{
getSettings()->whisperHighlightSoundUrl.setValue(
value.toString());
@@ -209,6 +251,11 @@ void HighlightModel::customRowSetData(const std::vector<QStandardItem *> &row,
getSettings()->subHighlightSoundUrl.setValue(
value.toString());
}
else if (rowIndex == 3)
{
getSettings()->redeemedHighlightSoundUrl.setValue(
value.toString());
}
}
}
break;
@@ -221,18 +268,27 @@ void HighlightModel::customRowSetData(const std::vector<QStandardItem *> &row,
{
getSettings()->selfHighlightColor.setValue(colorName);
}
else if (rowIndex == 1)
{
getSettings()->whisperHighlightColor.setValue(colorName);
}
// else if (rowIndex == WHISPER_ROW)
// {
// getSettings()->whisperHighlightColor.setValue(colorName);
// }
else if (rowIndex == 2)
{
getSettings()->subHighlightColor.setValue(colorName);
}
else if (rowIndex == 3)
{
getSettings()->redeemedHighlightColor.setValue(colorName);
const_cast<ColorProvider &>(ColorProvider::instance())
.updateColor(ColorType::RedeemedHighlight,
QColor(colorName));
}
}
}
break;
}
getApp()->windows->forceLayoutChannelViews();
}
} // namespace chatterino