mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
refined highlight and added bits highlights
This commit is contained in:
parent
ebfcb49e8c
commit
097f4ccb3a
|
@ -120,6 +120,11 @@ int Application::run(QApplication &qtApp)
|
||||||
getSettings()->moderationActions.delayedItemsChanged.connect(
|
getSettings()->moderationActions.delayedItemsChanged.connect(
|
||||||
[this] { this->windows->forceLayoutChannelViews(); });
|
[this] { this->windows->forceLayoutChannelViews(); });
|
||||||
|
|
||||||
|
getSettings()->highlightedMessages.delayedItemsChanged.connect(
|
||||||
|
[this] { this->windows->forceLayoutChannelViews(); });
|
||||||
|
getSettings()->highlightedUsers.delayedItemsChanged.connect(
|
||||||
|
[this] { this->windows->forceLayoutChannelViews(); });
|
||||||
|
|
||||||
return qtApp.exec();
|
return qtApp.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "Application.hpp"
|
#include "Application.hpp"
|
||||||
#include "singletons/Settings.hpp"
|
#include "singletons/Settings.hpp"
|
||||||
|
#include "singletons/WindowManager.hpp"
|
||||||
#include "util/StandardItemHelper.hpp"
|
#include "util/StandardItemHelper.hpp"
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
@ -88,10 +89,11 @@ 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, 1);
|
this->insertCustomRow(whisperRow, WHISPER_ROW);
|
||||||
|
|
||||||
// Highlight settings for subscription messages
|
// Highlight settings for subscription messages
|
||||||
std::vector<QStandardItem *> subRow = this->createRow();
|
std::vector<QStandardItem *> subRow = this->createRow();
|
||||||
|
@ -113,6 +115,31 @@ void HighlightModel::afterInit()
|
||||||
setColorItem(subRow[Column::Color], *subColor, false);
|
setColorItem(subRow[Column::Color], *subColor, false);
|
||||||
|
|
||||||
this->insertCustomRow(subRow, 2);
|
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,
|
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());
|
getSettings()->enableSelfHighlight.setValue(value.toBool());
|
||||||
}
|
}
|
||||||
else if (rowIndex == 1)
|
else if (rowIndex == WHISPER_ROW)
|
||||||
{
|
{
|
||||||
getSettings()->enableWhisperHighlight.setValue(
|
getSettings()->enableWhisperHighlight.setValue(
|
||||||
value.toBool());
|
value.toBool());
|
||||||
|
@ -137,6 +164,11 @@ void HighlightModel::customRowSetData(const std::vector<QStandardItem *> &row,
|
||||||
{
|
{
|
||||||
getSettings()->enableSubHighlight.setValue(value.toBool());
|
getSettings()->enableSubHighlight.setValue(value.toBool());
|
||||||
}
|
}
|
||||||
|
else if (rowIndex == 3)
|
||||||
|
{
|
||||||
|
getSettings()->enableRedeemedHighlight.setValue(
|
||||||
|
value.toBool());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -148,7 +180,7 @@ void HighlightModel::customRowSetData(const std::vector<QStandardItem *> &row,
|
||||||
getSettings()->enableSelfHighlightTaskbar.setValue(
|
getSettings()->enableSelfHighlightTaskbar.setValue(
|
||||||
value.toBool());
|
value.toBool());
|
||||||
}
|
}
|
||||||
else if (rowIndex == 1)
|
else if (rowIndex == WHISPER_ROW)
|
||||||
{
|
{
|
||||||
getSettings()->enableWhisperHighlightTaskbar.setValue(
|
getSettings()->enableWhisperHighlightTaskbar.setValue(
|
||||||
value.toBool());
|
value.toBool());
|
||||||
|
@ -158,6 +190,11 @@ void HighlightModel::customRowSetData(const std::vector<QStandardItem *> &row,
|
||||||
getSettings()->enableSubHighlightTaskbar.setValue(
|
getSettings()->enableSubHighlightTaskbar.setValue(
|
||||||
value.toBool());
|
value.toBool());
|
||||||
}
|
}
|
||||||
|
else if (rowIndex == 3)
|
||||||
|
{
|
||||||
|
getSettings()->enableRedeemedHighlightTaskbar.setValue(
|
||||||
|
value.toBool());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -169,7 +206,7 @@ void HighlightModel::customRowSetData(const std::vector<QStandardItem *> &row,
|
||||||
getSettings()->enableSelfHighlightSound.setValue(
|
getSettings()->enableSelfHighlightSound.setValue(
|
||||||
value.toBool());
|
value.toBool());
|
||||||
}
|
}
|
||||||
else if (rowIndex == 1)
|
else if (rowIndex == WHISPER_ROW)
|
||||||
{
|
{
|
||||||
getSettings()->enableWhisperHighlightSound.setValue(
|
getSettings()->enableWhisperHighlightSound.setValue(
|
||||||
value.toBool());
|
value.toBool());
|
||||||
|
@ -179,6 +216,11 @@ void HighlightModel::customRowSetData(const std::vector<QStandardItem *> &row,
|
||||||
getSettings()->enableSubHighlightSound.setValue(
|
getSettings()->enableSubHighlightSound.setValue(
|
||||||
value.toBool());
|
value.toBool());
|
||||||
}
|
}
|
||||||
|
else if (rowIndex == 3)
|
||||||
|
{
|
||||||
|
getSettings()->enableRedeemedHighlightSound.setValue(
|
||||||
|
value.toBool());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -199,7 +241,7 @@ void HighlightModel::customRowSetData(const std::vector<QStandardItem *> &row,
|
||||||
getSettings()->selfHighlightSoundUrl.setValue(
|
getSettings()->selfHighlightSoundUrl.setValue(
|
||||||
value.toString());
|
value.toString());
|
||||||
}
|
}
|
||||||
else if (rowIndex == 1)
|
else if (rowIndex == WHISPER_ROW)
|
||||||
{
|
{
|
||||||
getSettings()->whisperHighlightSoundUrl.setValue(
|
getSettings()->whisperHighlightSoundUrl.setValue(
|
||||||
value.toString());
|
value.toString());
|
||||||
|
@ -209,6 +251,11 @@ void HighlightModel::customRowSetData(const std::vector<QStandardItem *> &row,
|
||||||
getSettings()->subHighlightSoundUrl.setValue(
|
getSettings()->subHighlightSoundUrl.setValue(
|
||||||
value.toString());
|
value.toString());
|
||||||
}
|
}
|
||||||
|
else if (rowIndex == 3)
|
||||||
|
{
|
||||||
|
getSettings()->redeemedHighlightSoundUrl.setValue(
|
||||||
|
value.toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -221,18 +268,27 @@ void HighlightModel::customRowSetData(const std::vector<QStandardItem *> &row,
|
||||||
{
|
{
|
||||||
getSettings()->selfHighlightColor.setValue(colorName);
|
getSettings()->selfHighlightColor.setValue(colorName);
|
||||||
}
|
}
|
||||||
else if (rowIndex == 1)
|
// else if (rowIndex == WHISPER_ROW)
|
||||||
{
|
// {
|
||||||
getSettings()->whisperHighlightColor.setValue(colorName);
|
// getSettings()->whisperHighlightColor.setValue(colorName);
|
||||||
}
|
// }
|
||||||
else if (rowIndex == 2)
|
else if (rowIndex == 2)
|
||||||
{
|
{
|
||||||
getSettings()->subHighlightColor.setValue(colorName);
|
getSettings()->subHighlightColor.setValue(colorName);
|
||||||
}
|
}
|
||||||
|
else if (rowIndex == 3)
|
||||||
|
{
|
||||||
|
getSettings()->redeemedHighlightColor.setValue(colorName);
|
||||||
|
const_cast<ColorProvider &>(ColorProvider::instance())
|
||||||
|
.updateColor(ColorType::RedeemedHighlight,
|
||||||
|
QColor(colorName));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getApp()->windows->forceLayoutChannelViews();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|
|
@ -23,6 +23,8 @@ public:
|
||||||
Color = 6
|
Color = 6
|
||||||
};
|
};
|
||||||
|
|
||||||
|
constexpr static int WHISPER_ROW = 1;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// turn a vector item into a model row
|
// turn a vector item into a model row
|
||||||
virtual HighlightPhrase getItemFromRow(
|
virtual HighlightPhrase getItemFromRow(
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
QColor HighlightPhrase::FALLBACK_HIGHLIGHT_COLOR = QColor(127, 63, 73, 127);
|
QColor HighlightPhrase::FALLBACK_HIGHLIGHT_COLOR = QColor(127, 63, 73, 127);
|
||||||
|
QColor HighlightPhrase::FALLBACK_REDEEMED_HIGHLIGHT_COLOR =
|
||||||
|
QColor(28, 126, 141, 90);
|
||||||
QColor HighlightPhrase::FALLBACK_SUB_COLOR = QColor(196, 102, 255, 100);
|
QColor HighlightPhrase::FALLBACK_SUB_COLOR = QColor(196, 102, 255, 100);
|
||||||
|
|
||||||
bool HighlightPhrase::operator==(const HighlightPhrase &other) const
|
bool HighlightPhrase::operator==(const HighlightPhrase &other) const
|
||||||
|
|
|
@ -75,6 +75,7 @@ public:
|
||||||
* Qt>=5.13.
|
* Qt>=5.13.
|
||||||
*/
|
*/
|
||||||
static QColor FALLBACK_HIGHLIGHT_COLOR;
|
static QColor FALLBACK_HIGHLIGHT_COLOR;
|
||||||
|
static QColor FALLBACK_REDEEMED_HIGHLIGHT_COLOR;
|
||||||
static QColor FALLBACK_SUB_COLOR;
|
static QColor FALLBACK_SUB_COLOR;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -35,6 +35,12 @@ SBHighlight Message::getScrollBarHighlight() const
|
||||||
return SBHighlight(
|
return SBHighlight(
|
||||||
ColorProvider::instance().color(ColorType::Subscription));
|
ColorProvider::instance().color(ColorType::Subscription));
|
||||||
}
|
}
|
||||||
|
else if (this->flags.has(MessageFlag::RedeemedHighlight))
|
||||||
|
{
|
||||||
|
return SBHighlight(
|
||||||
|
ColorProvider::instance().color(ColorType::RedeemedHighlight),
|
||||||
|
SBHighlight::Default, true);
|
||||||
|
}
|
||||||
return SBHighlight();
|
return SBHighlight();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,7 @@ enum class MessageFlag : uint32_t {
|
||||||
HighlightedWhisper = (1 << 17),
|
HighlightedWhisper = (1 << 17),
|
||||||
Debug = (1 << 18),
|
Debug = (1 << 18),
|
||||||
Similar = (1 << 19),
|
Similar = (1 << 19),
|
||||||
|
RedeemedHighlight = (1 << 20),
|
||||||
};
|
};
|
||||||
using MessageFlags = FlagsEnum<MessageFlag>;
|
using MessageFlags = FlagsEnum<MessageFlag>;
|
||||||
|
|
||||||
|
|
|
@ -263,6 +263,7 @@ void MessageLayout::updateBuffer(QPixmap *buffer, int /*messageIndex*/,
|
||||||
Selection & /*selection*/)
|
Selection & /*selection*/)
|
||||||
{
|
{
|
||||||
auto app = getApp();
|
auto app = getApp();
|
||||||
|
auto settings = getSettings();
|
||||||
|
|
||||||
QPainter painter(buffer);
|
QPainter painter(buffer);
|
||||||
painter.setRenderHint(QPainter::SmoothPixmapTransform);
|
painter.setRenderHint(QPainter::SmoothPixmapTransform);
|
||||||
|
@ -296,6 +297,14 @@ void MessageLayout::updateBuffer(QPixmap *buffer, int /*messageIndex*/,
|
||||||
backgroundColor,
|
backgroundColor,
|
||||||
*ColorProvider::instance().color(ColorType::Subscription));
|
*ColorProvider::instance().color(ColorType::Subscription));
|
||||||
}
|
}
|
||||||
|
else if (this->message_->flags.has(MessageFlag::RedeemedHighlight) &&
|
||||||
|
settings->enableRedeemedHighlight.getValue())
|
||||||
|
{
|
||||||
|
// Blend highlight color with usual background color
|
||||||
|
backgroundColor = blendColors(
|
||||||
|
backgroundColor,
|
||||||
|
*ColorProvider::instance().color(ColorType::RedeemedHighlight));
|
||||||
|
}
|
||||||
else if (this->message_->flags.has(MessageFlag::AutoMod))
|
else if (this->message_->flags.has(MessageFlag::AutoMod))
|
||||||
{
|
{
|
||||||
backgroundColor = QColor("#404040");
|
backgroundColor = QColor("#404040");
|
||||||
|
|
|
@ -105,16 +105,35 @@ void ColorProvider::initTypeColorMap()
|
||||||
std::make_shared<QColor>(
|
std::make_shared<QColor>(
|
||||||
HighlightPhrase::FALLBACK_HIGHLIGHT_COLOR)});
|
HighlightPhrase::FALLBACK_HIGHLIGHT_COLOR)});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
customColor = getSettings()->redeemedHighlightColor;
|
||||||
|
if (QColor(customColor).isValid())
|
||||||
|
{
|
||||||
|
this->typeColorMap_.insert({ColorType::RedeemedHighlight,
|
||||||
|
std::make_shared<QColor>(customColor)});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
this->typeColorMap_.insert(
|
||||||
|
{ColorType::RedeemedHighlight,
|
||||||
|
std::make_shared<QColor>(
|
||||||
|
HighlightPhrase::FALLBACK_REDEEMED_HIGHLIGHT_COLOR)});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ColorProvider::initDefaultColors()
|
void ColorProvider::initDefaultColors()
|
||||||
{
|
{
|
||||||
// Init default colors
|
// Init default colors
|
||||||
this->defaultColors_.emplace_back(31, 141, 43, 127); // Green-ish
|
this->defaultColors_.emplace_back(75, 127, 107, 100); // Teal
|
||||||
this->defaultColors_.emplace_back(28, 126, 141, 127); // Blue-ish
|
this->defaultColors_.emplace_back(105, 127, 63, 100); // Olive
|
||||||
this->defaultColors_.emplace_back(136, 141, 49, 127); // Golden-ish
|
this->defaultColors_.emplace_back(63, 83, 127, 100); // Blue
|
||||||
this->defaultColors_.emplace_back(143, 48, 24, 127); // Red-ish
|
this->defaultColors_.emplace_back(72, 127, 63, 100); // Green
|
||||||
this->defaultColors_.emplace_back(28, 141, 117, 127); // Cyan-ish
|
|
||||||
|
this->defaultColors_.emplace_back(31, 141, 43, 115); // Green
|
||||||
|
this->defaultColors_.emplace_back(28, 126, 141, 90); // Blue
|
||||||
|
this->defaultColors_.emplace_back(136, 141, 49, 90); // Golden
|
||||||
|
this->defaultColors_.emplace_back(143, 48, 24, 127); // Red
|
||||||
|
this->defaultColors_.emplace_back(28, 141, 117, 90); // Cyan
|
||||||
|
|
||||||
this->defaultColors_.push_back(HighlightPhrase::FALLBACK_HIGHLIGHT_COLOR);
|
this->defaultColors_.push_back(HighlightPhrase::FALLBACK_HIGHLIGHT_COLOR);
|
||||||
this->defaultColors_.push_back(HighlightPhrase::FALLBACK_SUB_COLOR);
|
this->defaultColors_.push_back(HighlightPhrase::FALLBACK_SUB_COLOR);
|
||||||
|
|
|
@ -2,7 +2,12 @@
|
||||||
|
|
||||||
namespace chatterino {
|
namespace chatterino {
|
||||||
|
|
||||||
enum class ColorType { SelfHighlight, Subscription, Whisper };
|
enum class ColorType {
|
||||||
|
SelfHighlight,
|
||||||
|
Subscription,
|
||||||
|
Whisper,
|
||||||
|
RedeemedHighlight
|
||||||
|
};
|
||||||
|
|
||||||
class ColorProvider
|
class ColorProvider
|
||||||
{
|
{
|
||||||
|
|
|
@ -295,6 +295,13 @@ MessagePtr TwitchMessageBuilder::build()
|
||||||
|
|
||||||
this->historicalMessage_ = this->tags.contains("historical");
|
this->historicalMessage_ = this->tags.contains("historical");
|
||||||
|
|
||||||
|
if (this->tags.contains("msg-id") &&
|
||||||
|
this->tags["msg-id"].toString().split(';').contains(
|
||||||
|
"highlighted-message"))
|
||||||
|
{
|
||||||
|
this->message().flags.set(MessageFlag::RedeemedHighlight);
|
||||||
|
}
|
||||||
|
|
||||||
// timestamp
|
// timestamp
|
||||||
if (this->historicalMessage_)
|
if (this->historicalMessage_)
|
||||||
{
|
{
|
||||||
|
|
|
@ -205,6 +205,17 @@ public:
|
||||||
QStringSetting whisperHighlightColor = {
|
QStringSetting whisperHighlightColor = {
|
||||||
"/highlighting/whisperHighlightColor", ""};
|
"/highlighting/whisperHighlightColor", ""};
|
||||||
|
|
||||||
|
BoolSetting enableRedeemedHighlight = {
|
||||||
|
"/highlighting/redeemedHighlight/highlighted", true};
|
||||||
|
BoolSetting enableRedeemedHighlightSound = {
|
||||||
|
"/highlighting/redeemedHighlight/enableSound", false};
|
||||||
|
BoolSetting enableRedeemedHighlightTaskbar = {
|
||||||
|
"/highlighting/redeemedHighlight/enableTaskbarFlashing", false};
|
||||||
|
QStringSetting redeemedHighlightSoundUrl = {
|
||||||
|
"/highlighting/redeemedHighlightSoundUrl", ""};
|
||||||
|
QStringSetting redeemedHighlightColor = {
|
||||||
|
"/highlighting/redeemedHighlightColor", ""};
|
||||||
|
|
||||||
BoolSetting enableSubHighlight = {
|
BoolSetting enableSubHighlight = {
|
||||||
"/highlighting/subHighlight/subsHighlighted", true};
|
"/highlighting/subHighlight/subsHighlighted", true};
|
||||||
BoolSetting enableSubHighlightSound = {
|
BoolSetting enableSubHighlightSound = {
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "Application.hpp"
|
#include "Application.hpp"
|
||||||
#include "singletons/Settings.hpp"
|
#include "singletons/Settings.hpp"
|
||||||
#include "singletons/Theme.hpp"
|
#include "singletons/Theme.hpp"
|
||||||
|
#include "singletons/WindowManager.hpp"
|
||||||
#include "widgets/helper/ChannelView.hpp"
|
#include "widgets/helper/ChannelView.hpp"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
@ -242,6 +243,8 @@ void Scrollbar::paintEvent(QPaintEvent *)
|
||||||
QPainter painter(this);
|
QPainter painter(this);
|
||||||
painter.fillRect(rect(), this->theme->scrollbars.background);
|
painter.fillRect(rect(), this->theme->scrollbars.background);
|
||||||
|
|
||||||
|
bool enableRedeemedHighlights = getSettings()->enableRedeemedHighlight;
|
||||||
|
|
||||||
// painter.fillRect(QRect(xOffset, 0, width(), this->buttonHeight),
|
// painter.fillRect(QRect(xOffset, 0, width(), this->buttonHeight),
|
||||||
// this->themeManager->ScrollbarArrow);
|
// this->themeManager->ScrollbarArrow);
|
||||||
// painter.fillRect(QRect(xOffset, height() - this->buttonHeight,
|
// painter.fillRect(QRect(xOffset, height() - this->buttonHeight,
|
||||||
|
@ -274,7 +277,8 @@ void Scrollbar::paintEvent(QPaintEvent *)
|
||||||
int w = this->width();
|
int w = this->width();
|
||||||
float y = 0;
|
float y = 0;
|
||||||
float dY = float(this->height()) / float(snapshotLength);
|
float dY = float(this->height()) / float(snapshotLength);
|
||||||
int highlightHeight = int(std::ceil(dY));
|
int highlightHeight =
|
||||||
|
int(std::ceil(std::max<float>(this->scale() * 2, dY)));
|
||||||
|
|
||||||
for (size_t i = 0; i < snapshotLength; i++)
|
for (size_t i = 0; i < snapshotLength; i++)
|
||||||
{
|
{
|
||||||
|
@ -282,7 +286,13 @@ void Scrollbar::paintEvent(QPaintEvent *)
|
||||||
|
|
||||||
if (!highlight.isNull())
|
if (!highlight.isNull())
|
||||||
{
|
{
|
||||||
|
if (highlight.isRedeemedHighlight() && !enableRedeemedHighlights)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
QColor color = highlight.getColor();
|
QColor color = highlight.getColor();
|
||||||
|
color.setAlpha(255);
|
||||||
|
|
||||||
switch (highlight.getStyle())
|
switch (highlight.getStyle())
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,9 +13,10 @@ ScrollbarHighlight::ScrollbarHighlight()
|
||||||
}
|
}
|
||||||
|
|
||||||
ScrollbarHighlight::ScrollbarHighlight(const std::shared_ptr<QColor> color,
|
ScrollbarHighlight::ScrollbarHighlight(const std::shared_ptr<QColor> color,
|
||||||
Style style)
|
Style style, bool isRedeemedHighlight)
|
||||||
: color_(color)
|
: color_(color)
|
||||||
, style_(style)
|
, style_(style)
|
||||||
|
, isRedeemedHighlight_(isRedeemedHighlight)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,6 +30,11 @@ ScrollbarHighlight::Style ScrollbarHighlight::getStyle() const
|
||||||
return this->style_;
|
return this->style_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ScrollbarHighlight::isRedeemedHighlight() const
|
||||||
|
{
|
||||||
|
return this->isRedeemedHighlight_;
|
||||||
|
}
|
||||||
|
|
||||||
bool ScrollbarHighlight::isNull() const
|
bool ScrollbarHighlight::isNull() const
|
||||||
{
|
{
|
||||||
return this->style_ == None;
|
return this->style_ == None;
|
||||||
|
|
|
@ -17,15 +17,17 @@ public:
|
||||||
ScrollbarHighlight();
|
ScrollbarHighlight();
|
||||||
|
|
||||||
ScrollbarHighlight(const std::shared_ptr<QColor> color,
|
ScrollbarHighlight(const std::shared_ptr<QColor> color,
|
||||||
Style style = Default);
|
Style style = Default, bool isRedeemedHighlight = false);
|
||||||
|
|
||||||
QColor getColor() const;
|
QColor getColor() const;
|
||||||
Style getStyle() const;
|
Style getStyle() const;
|
||||||
|
bool isRedeemedHighlight() const;
|
||||||
bool isNull() const;
|
bool isNull() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::shared_ptr<QColor> color_;
|
std::shared_ptr<QColor> color_;
|
||||||
Style style_;
|
Style style_;
|
||||||
|
bool isRedeemedHighlight_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace chatterino
|
} // namespace chatterino
|
||||||
|
|
|
@ -29,7 +29,6 @@ namespace chatterino {
|
||||||
|
|
||||||
HighlightingPage::HighlightingPage()
|
HighlightingPage::HighlightingPage()
|
||||||
{
|
{
|
||||||
auto app = getApp();
|
|
||||||
LayoutCreator<HighlightingPage> layoutCreator(this);
|
LayoutCreator<HighlightingPage> layoutCreator(this);
|
||||||
|
|
||||||
auto layout = layoutCreator.emplace<QVBoxLayout>().withoutMargin();
|
auto layout = layoutCreator.emplace<QVBoxLayout>().withoutMargin();
|
||||||
|
@ -228,7 +227,8 @@ void HighlightingPage::tableCellClicked(const QModelIndex &clicked,
|
||||||
Qt::CheckStateRole);
|
Qt::CheckStateRole);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (clicked.column() == Column::Color)
|
else if (clicked.column() == Column::Color &&
|
||||||
|
clicked.row() != HighlightModel::WHISPER_ROW)
|
||||||
{
|
{
|
||||||
auto initial =
|
auto initial =
|
||||||
view->getModel()->data(clicked, Qt::DecorationRole).value<QColor>();
|
view->getModel()->data(clicked, Qt::DecorationRole).value<QColor>();
|
||||||
|
|
Loading…
Reference in a new issue