Compare commits

...

7 commits

Author SHA1 Message Date
pajlada
e85d8da9f5
Merge 56ba1ca2ee into eeb797c03f 2024-11-13 16:42:40 +01:00
nerix
eeb797c03f
chore: keep GDI fontengine on Windows for now (#5710) 2024-11-12 22:20:40 +00:00
Rasmus Karlsson
56ba1ca2ee
oopsie 2 2024-11-06 18:08:07 +01:00
Rasmus Karlsson
8a69861ead
opsie 2024-11-06 17:36:38 +01:00
Rasmus Karlsson
40490a90fb
remove unused include 2024-11-06 17:16:12 +01:00
Rasmus Karlsson
1199f5e763
clean up reason generation 2024-11-06 17:14:32 +01:00
Rasmus Karlsson
12fa816564
improve automod blocked term messaging 2024-11-06 16:58:00 +01:00
14 changed files with 99 additions and 12 deletions

View file

@ -129,6 +129,7 @@
- Dev: Fixed some compiler warnings. (#5672) - Dev: Fixed some compiler warnings. (#5672)
- Dev: Unified parsing of historic and live IRC messages. (#5678) - Dev: Unified parsing of historic and live IRC messages. (#5678)
- Dev: 7TV's `entitlement.reset` is now explicitly ignored. (#5685) - Dev: 7TV's `entitlement.reset` is now explicitly ignored. (#5685)
- Dev: Qt 6.8 and later now default to the GDI fontengine. (#5710)
## 2.5.1 ## 2.5.1

View file

@ -32,6 +32,7 @@ option(BUILD_TRANSLATIONS "" OFF)
option(BUILD_SHARED_LIBS "" OFF) option(BUILD_SHARED_LIBS "" OFF)
option(CHATTERINO_LTO "Enable LTO for all targets" OFF) option(CHATTERINO_LTO "Enable LTO for all targets" OFF)
option(CHATTERINO_PLUGINS "Enable ALPHA plugin support in Chatterino" OFF) option(CHATTERINO_PLUGINS "Enable ALPHA plugin support in Chatterino" OFF)
option(CHATTERINO_USE_GDI_FONTENGINE "Use the legacy GDI fontengine instead of the new DirectWrite one on Windows (Qt 6.8.0 and later)" ON)
option(CHATTERINO_UPDATER "Enable update checks" ON) option(CHATTERINO_UPDATER "Enable update checks" ON)
mark_as_advanced(CHATTERINO_UPDATER) mark_as_advanced(CHATTERINO_UPDATER)

View file

@ -88,6 +88,15 @@ if (WIN32)
list(APPEND RES_AUTOGEN_FILES "${CMAKE_BINARY_DIR}/autogen/windows.rc") list(APPEND RES_AUTOGEN_FILES "${CMAKE_BINARY_DIR}/autogen/windows.rc")
endif () endif ()
set(WINDOWS_ARGUMENTS "@Invalid()") # empty QVariant() in QSettings
if (CHATTERINO_USE_GDI_FONTENGINE AND Qt${MAJOR_QT_VERSION}_VERSION VERSION_GREATER_EQUAL "6.8.0")
message(STATUS "Using legacy GDI fontengine")
set(WINDOWS_ARGUMENTS "fontengine=gdi")
endif ()
configure_file("${CMAKE_CURRENT_LIST_DIR}/qt.conf.in" "${CMAKE_SOURCE_DIR}/resources/qt.conf")
list(APPEND RES_AUTOGEN_FILES "${CMAKE_SOURCE_DIR}/resources/qt.conf")
list(APPEND RES_AUTOGEN_FILES list(APPEND RES_AUTOGEN_FILES
"${CMAKE_SOURCE_DIR}/resources/resources_autogenerated.qrc" "${CMAKE_SOURCE_DIR}/resources/resources_autogenerated.qrc"
"${CMAKE_BINARY_DIR}/autogen/ResourcesAutogen.cpp" "${CMAKE_BINARY_DIR}/autogen/ResourcesAutogen.cpp"

View file

@ -0,0 +1,2 @@
[Platforms]
WindowsArguments = ${WINDOWS_ARGUMENTS}

View file

@ -6,4 +6,7 @@
<qresource prefix="/"> <qresource prefix="/">
@RES_RESOURCES_CONTENT@ @RES_RESOURCES_CONTENT@
</qresource> </qresource>
<qresource prefix="/qt/etc">
<file>qt.conf</file>
</qresource>
</RCC> </RCC>

View file

@ -1 +1,2 @@
linuxinstall linuxinstall
/qt.conf

View file

@ -1,2 +0,0 @@
[Platforms]
WindowArguments = dpiawareness=2

View file

@ -1,5 +0,0 @@
<RCC>
<qresource prefix="/qt/etc">
<file>qt.conf</file>
</qresource>
</RCC>

View file

@ -740,8 +740,6 @@ set(SOURCE_FILES
widgets/splits/SplitInput.hpp widgets/splits/SplitInput.hpp
widgets/splits/SplitOverlay.cpp widgets/splits/SplitOverlay.cpp
widgets/splits/SplitOverlay.hpp widgets/splits/SplitOverlay.hpp
${CMAKE_SOURCE_DIR}/resources/resources.qrc
) )
if (APPLE) if (APPLE)

View file

@ -4,6 +4,7 @@
#include "common/Channel.hpp" #include "common/Channel.hpp"
#include "common/Common.hpp" #include "common/Common.hpp"
#include "common/Env.hpp" #include "common/Env.hpp"
#include "common/Literals.hpp"
#include "common/QLogging.hpp" #include "common/QLogging.hpp"
#include "controllers/accounts/AccountController.hpp" #include "controllers/accounts/AccountController.hpp"
#include "messages/LimitedQueueSnapshot.hpp" #include "messages/LimitedQueueSnapshot.hpp"
@ -147,6 +148,8 @@ bool shouldSendHelixChat()
namespace chatterino { namespace chatterino {
using namespace literals;
TwitchIrcServer::TwitchIrcServer() TwitchIrcServer::TwitchIrcServer()
: whispersChannel(new Channel("/whispers", Channel::Type::TwitchWhispers)) : whispersChannel(new Channel("/whispers", Channel::Type::TwitchWhispers))
, mentionsChannel(new Channel("/mentions", Channel::Type::TwitchMentions)) , mentionsChannel(new Channel("/mentions", Channel::Type::TwitchMentions))
@ -488,9 +491,49 @@ void TwitchIrcServer::initialize()
if (msg.status == "PENDING") if (msg.status == "PENDING")
{ {
AutomodAction action(msg.data, channelID); AutomodAction action(msg.data, channelID);
action.reason = QString("%1 level %2") if (msg.reason ==
.arg(msg.contentCategory) PubSubAutoModQueueMessage::Reason::BlockedTerm)
.arg(msg.contentLevel); {
auto numBlockedTermsMatched =
msg.blockedTermsFound.count();
auto hideBlockedTerms =
getSettings()
->streamerModeHideBlockedTermText &&
getApp()->getStreamerMode()->isEnabled();
if (!msg.blockedTermsFound.isEmpty())
{
if (hideBlockedTerms)
{
action.reason =
u"matches %1 blocked term%2"_s
.arg(numBlockedTermsMatched)
.arg(numBlockedTermsMatched > 1
? u"s"
: u"");
}
else
{
action.reason =
u"matches %1 blocked term%2 \"%3\""_s
.arg(numBlockedTermsMatched)
.arg(numBlockedTermsMatched > 1
? u"s"
: u"")
.arg(msg.blockedTermsFound.join(
u"\", \""));
}
}
else
{
action.reason = "blocked term usage";
}
}
else
{
action.reason = QString("%1 level %2")
.arg(msg.contentCategory)
.arg(msg.contentLevel);
}
action.msgID = msg.messageID; action.msgID = msg.messageID;
action.message = msg.messageText; action.message = msg.messageText;

View file

@ -2,6 +2,8 @@
#include "util/QMagicEnum.hpp" #include "util/QMagicEnum.hpp"
#include <QJsonArray>
namespace chatterino { namespace chatterino {
PubSubAutoModQueueMessage::PubSubAutoModQueueMessage(const QJsonObject &root) PubSubAutoModQueueMessage::PubSubAutoModQueueMessage(const QJsonObject &root)
@ -9,6 +11,7 @@ PubSubAutoModQueueMessage::PubSubAutoModQueueMessage(const QJsonObject &root)
, data(root.value("data").toObject()) , data(root.value("data").toObject())
, status(this->data.value("status").toString()) , status(this->data.value("status").toString())
{ {
qInfo() << "XXX: automod message over pubsub:" << root;
auto oType = qmagicenum::enumCast<Type>(this->typeString); auto oType = qmagicenum::enumCast<Type>(this->typeString);
if (oType.has_value()) if (oType.has_value())
{ {
@ -41,6 +44,27 @@ PubSubAutoModQueueMessage::PubSubAutoModQueueMessage(const QJsonObject &root)
messageSender.value("display_name").toString(); messageSender.value("display_name").toString();
this->senderUserChatColor = this->senderUserChatColor =
QColor(messageSender.value("chat_color").toString()); QColor(messageSender.value("chat_color").toString());
if (this->reason == Reason::BlockedTerm)
{
// Attempt to read the blocked term(s) that caused this message to be blocked
const auto caughtMessageReason =
data.value("caught_message_reason").toObject();
const auto blockedTermFailure =
caughtMessageReason.value("blocked_term_failure").toObject();
const auto termsFound =
blockedTermFailure.value("terms_found").toArray();
for (const auto &termValue : termsFound)
{
const auto term = termValue.toObject();
const auto termText = term.value("text").toString();
if (!termText.isEmpty())
{
this->blockedTermsFound.push_back(termText);
}
}
}
} }
} // namespace chatterino } // namespace chatterino

View file

@ -4,6 +4,7 @@
#include <QColor> #include <QColor>
#include <QJsonObject> #include <QJsonObject>
#include <QString> #include <QString>
#include <QStringList>
namespace chatterino { namespace chatterino {
@ -40,6 +41,8 @@ struct PubSubAutoModQueueMessage {
QString senderUserDisplayName; QString senderUserDisplayName;
QColor senderUserChatColor; QColor senderUserChatColor;
QStringList blockedTermsFound;
PubSubAutoModQueueMessage() = default; PubSubAutoModQueueMessage() = default;
explicit PubSubAutoModQueueMessage(const QJsonObject &root); explicit PubSubAutoModQueueMessage(const QJsonObject &root);
}; };

View file

@ -337,6 +337,10 @@ public:
"/streamerMode/supressLiveNotifications", false}; "/streamerMode/supressLiveNotifications", false};
BoolSetting streamerModeSuppressInlineWhispers = { BoolSetting streamerModeSuppressInlineWhispers = {
"/streamerMode/suppressInlineWhispers", true}; "/streamerMode/suppressInlineWhispers", true};
BoolSetting streamerModeHideBlockedTermText = {
"/streamerMode/hideBlockedTermText",
true,
};
/// Ignored Phrases /// Ignored Phrases
QStringSetting ignoredPhraseReplace = {"/ignore/ignoredPhraseReplace", QStringSetting ignoredPhraseReplace = {"/ignore/ignoredPhraseReplace",

View file

@ -667,6 +667,11 @@ void GeneralPage::initLayout(GeneralPageView &layout)
layout.addCheckbox( layout.addCheckbox(
"Hide moderation actions", s.streamerModeHideModActions, false, "Hide moderation actions", s.streamerModeHideModActions, false,
"Hide bans, timeouts, and automod messages from appearing in chat."); "Hide bans, timeouts, and automod messages from appearing in chat.");
layout.addCheckbox(
"Hide blocked terms", s.streamerModeHideBlockedTermText, false,
"Hide blocked terms from showing up in places like AutoMod messages. "
"This can be useful in case you have some blocked terms that you don't "
"want to show on stream.");
layout.addCheckbox("Mute mention sounds", s.streamerModeMuteMentions, false, layout.addCheckbox("Mute mention sounds", s.streamerModeMuteMentions, false,
"Mute your ping sound from playing."); "Mute your ping sound from playing.");
layout.addCheckbox( layout.addCheckbox(