Historic messages behaviour

"Crossed and Greyed" -> default (and is current default)
"Crossed" -> just crossed
"Greyed" -> just greyed
"No change" -> no change in appearance
This commit is contained in:
hemirt 2019-01-27 22:15:59 +01:00
parent 498fb3717e
commit 441f6189a1
6 changed files with 39 additions and 8 deletions

View file

@ -29,6 +29,7 @@ enum class MessageFlag : uint16_t {
Subscription = (1 << 12),
Notification = (1 << 13),
AutoMod = (1 << 14),
RecentMessage = (1 << 15),
};
using MessageFlags = FlagsEnum<MessageFlag>;

View file

@ -205,6 +205,32 @@ void MessageLayout::paint(QPainter &painter, int width, int y, int messageIndex,
// app->themes->messages.disabled);
}
if (this->message_->flags.has(MessageFlag::RecentMessage))
{
const auto &setting =
getSettings()->historicMessagesAppearance.getValue();
/// hemirt: for options check the options associated with the setting
/// historicMessagesAppearance in GeneralPage.cpp (and default in
/// Settings.hpp)
if (setting == "Crossed and Greyed")
{
painter.fillRect(0, y, pixmap->width(), pixmap->height(),
QBrush(QColor(255, 0, 0, 63), Qt::BDiagPattern));
painter.fillRect(0, y, pixmap->width(), pixmap->height(),
app->themes->messages.disabled);
}
else if (setting == "Crossed")
{
painter.fillRect(0, y, pixmap->width(), pixmap->height(),
QBrush(QColor(255, 0, 0, 63), Qt::BDiagPattern));
}
else if (setting == "Greyed")
{
painter.fillRect(0, y, pixmap->width(), pixmap->height(),
app->themes->messages.disabled);
}
}
// draw selection
if (!selection.isEmpty())
{

View file

@ -48,8 +48,7 @@ namespace {
MessageParseArgs args;
TwitchMessageBuilder builder(channel.get(), privMsg, args);
if (getSettings()->greyOutHistoricMessages)
builder.message().flags.set(MessageFlag::Disabled);
builder.message().flags.set(MessageFlag::RecentMessage);
if (!builder.isIgnored())
messages.push_back(builder.build());

View file

@ -31,8 +31,9 @@ public:
Qt::VerPattern};
QStringSetting lastMessageColor = {"/appearance/messages/lastMessageColor",
""};
BoolSetting greyOutHistoricMessages = {
"/appearance/messages/greyOutHistoricMessages", true};
QStringSetting historicMessagesAppearance = {
"/appearance/messages/historicMessagesAppearance",
"Crossed and Greyed"};
BoolSetting showEmptyInput = {"/appearance/showEmptyInputBox", true};
BoolSetting showMessageLength = {"/appearance/messages/showMessageLength",
false};

View file

@ -263,7 +263,9 @@ void GeneralPage::initLayout(SettingsLayout &layout)
layout.addTitle2("Misc");
layout.addCheckbox("Show twitch whispers inline", s.inlineWhispers);
layout.addCheckbox("Grey out historic messages", s.greyOutHistoricMessages);
layout.addDropdown("Historic messages appearance",
{"Crossed and Greyed", "Crossed", "Greyed", "No change"},
s.historicMessagesAppearance);
/*
layout.addTitle2("Cache");

View file

@ -182,9 +182,11 @@ void LookPage::addMessageTab(LayoutCreator<QVBoxLayout> layout)
layout.append(
this->createCheckBox("Compact emotes", getSettings()->compactEmotes));
layout.append(this->createCheckBox("Grey out historic messages",
getSettings()->greyOutHistoricMessages));
/// greyOutHistoricMessages setting changed by hemirt from checkbox to
/// historicMessagesBehaviour dropdown QString option
// layout.append(this->createCheckBox("Grey out historic messages",
// getSettings()->greyOutHistoricMessages));
///
// --
layout.emplace<Line>(false);