mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
commit
bfa002d3a1
8 changed files with 82 additions and 9 deletions
|
@ -385,6 +385,7 @@ HEADERS += \
|
|||
src/widgets/splits/ClosedSplits.hpp \
|
||||
src/providers/ffz/FfzModBadge.hpp \
|
||||
src/widgets/settingspages/GeneralPage.hpp \
|
||||
src/messages/HistoricMessageAppearance.hpp
|
||||
|
||||
RESOURCES += \
|
||||
resources/resources.qrc \
|
||||
|
|
10
src/messages/HistoricMessageAppearance.hpp
Normal file
10
src/messages/HistoricMessageAppearance.hpp
Normal file
|
@ -0,0 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
namespace chatterino {
|
||||
|
||||
enum HistoricMessageAppearance {
|
||||
Crossed = (1 << 0),
|
||||
Greyed = (1 << 1),
|
||||
};
|
||||
|
||||
} // namespace chatterino
|
|
@ -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>;
|
||||
|
||||
|
|
|
@ -209,6 +209,22 @@ void MessageLayout::paint(QPainter &painter, int width, int y, int messageIndex,
|
|||
}
|
||||
}
|
||||
|
||||
if (this->message_->flags.has(MessageFlag::RecentMessage))
|
||||
{
|
||||
const auto &historicMessageAppearance =
|
||||
getSettings()->historicMessagesAppearance.getValue();
|
||||
if (historicMessageAppearance & HistoricMessageAppearance::Crossed)
|
||||
{
|
||||
painter.fillRect(0, y, pixmap->width(), pixmap->height(),
|
||||
QBrush(QColor(255, 0, 0, 63), Qt::BDiagPattern));
|
||||
}
|
||||
if (historicMessageAppearance & HistoricMessageAppearance::Greyed)
|
||||
{
|
||||
painter.fillRect(0, y, pixmap->width(), pixmap->height(),
|
||||
app->themes->messages.disabled);
|
||||
}
|
||||
}
|
||||
|
||||
// draw selection
|
||||
if (!selection.isEmpty())
|
||||
{
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "controllers/highlights/HighlightPhrase.hpp"
|
||||
#include "controllers/moderationactions/ModerationAction.hpp"
|
||||
#include "messages/HistoricMessageAppearance.hpp"
|
||||
|
||||
#include <pajlada/settings/setting.hpp>
|
||||
#include <pajlada/settings/settinglistener.hpp>
|
||||
|
@ -31,8 +32,9 @@ public:
|
|||
Qt::VerPattern};
|
||||
QStringSetting lastMessageColor = {"/appearance/messages/lastMessageColor",
|
||||
""};
|
||||
BoolSetting greyOutHistoricMessages = {
|
||||
"/appearance/messages/greyOutHistoricMessages", true};
|
||||
IntSetting historicMessagesAppearance = {
|
||||
"/appearance/messages/historicMessagesAppearance",
|
||||
HistoricMessageAppearance::Crossed | HistoricMessageAppearance::Greyed};
|
||||
BoolSetting showEmptyInput = {"/appearance/showEmptyInputBox", true};
|
||||
BoolSetting showMessageLength = {"/appearance/messages/showMessageLength",
|
||||
false};
|
||||
|
|
|
@ -263,7 +263,49 @@ 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<int>(
|
||||
"Historic messages appearance",
|
||||
{"Crossed and Greyed", "Crossed", "Greyed", "No change"},
|
||||
s.historicMessagesAppearance,
|
||||
[](auto val) {
|
||||
if (val & HistoricMessageAppearance::Crossed &&
|
||||
val & HistoricMessageAppearance::Greyed)
|
||||
{
|
||||
return QString("Crossed and Greyed");
|
||||
}
|
||||
else if (val & HistoricMessageAppearance::Crossed)
|
||||
{
|
||||
return QString("Crossed");
|
||||
}
|
||||
else if (val & HistoricMessageAppearance::Greyed)
|
||||
{
|
||||
return QString("Greyed");
|
||||
}
|
||||
else
|
||||
{
|
||||
return QString("No Change");
|
||||
}
|
||||
},
|
||||
[](auto args) -> int {
|
||||
switch (args.index)
|
||||
{
|
||||
default:
|
||||
case 0:
|
||||
return HistoricMessageAppearance::Crossed |
|
||||
HistoricMessageAppearance::Greyed;
|
||||
break;
|
||||
case 1:
|
||||
return HistoricMessageAppearance::Crossed;
|
||||
break;
|
||||
case 2:
|
||||
return HistoricMessageAppearance::Greyed;
|
||||
break;
|
||||
case 3:
|
||||
return 0;
|
||||
break;
|
||||
}
|
||||
},
|
||||
false);
|
||||
layout.addCheckbox("Emphasize deleted messages", s.redDisabledMessages);
|
||||
|
||||
/*
|
||||
|
@ -298,7 +340,7 @@ void GeneralPage::initLayout(SettingsLayout &layout)
|
|||
"Medium", "Low", "Audio only"});
|
||||
layout.addDropdown("Command line arguments", {"..."});
|
||||
*/
|
||||
}
|
||||
} // namespace chatterino
|
||||
|
||||
void GeneralPage::initExtra()
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue