mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-21 22:24:07 +01:00
added setting to show unhandled irc commands
This commit is contained in:
parent
765a75f158
commit
07133166d9
5 changed files with 33 additions and 16 deletions
|
@ -32,6 +32,7 @@ enum class MessageFlag : uint32_t {
|
|||
RecentMessage = (1 << 15),
|
||||
Whisper = (1 << 16),
|
||||
HighlightedWhisper = (1 << 17),
|
||||
Debug = (1 << 18),
|
||||
};
|
||||
using MessageFlags = FlagsEnum<MessageFlag>;
|
||||
|
||||
|
|
|
@ -269,6 +269,10 @@ void MessageLayout::updateBuffer(QPixmap *buffer, int /*messageIndex*/,
|
|||
{
|
||||
backgroundColor = QColor("#404040");
|
||||
}
|
||||
else if (this->message_->flags.has(MessageFlag::Debug))
|
||||
{
|
||||
backgroundColor = QColor("#4A273D");
|
||||
}
|
||||
|
||||
painter.fillRect(buffer->rect(), backgroundColor);
|
||||
|
||||
|
|
|
@ -3,9 +3,11 @@
|
|||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
|
||||
#include "messages/Message.hpp"
|
||||
#include "messages/MessageBuilder.hpp"
|
||||
#include "providers/irc/Irc2.hpp"
|
||||
#include "providers/irc/IrcChannel2.hpp"
|
||||
#include "singletons/Settings.hpp"
|
||||
#include "util/QObjectRef.hpp"
|
||||
|
||||
namespace chatterino {
|
||||
|
@ -233,23 +235,25 @@ void IrcServer::readConnectionMessageReceived(Communi::IrcMessage *message)
|
|||
case Communi::IrcMessage::Notice:
|
||||
return;
|
||||
|
||||
default:;
|
||||
default:
|
||||
if (getSettings()->showUnhandledIrcMessages)
|
||||
{
|
||||
MessageBuilder builder;
|
||||
|
||||
builder.emplace<TimestampElement>();
|
||||
builder.emplace<TextElement>(message->toData(),
|
||||
MessageElementFlag::Text);
|
||||
builder->flags.set(MessageFlag::Debug);
|
||||
|
||||
auto msg = builder.release();
|
||||
|
||||
for (auto &&weak : this->channels)
|
||||
{
|
||||
if (auto shared = weak.lock())
|
||||
shared->addMessage(msg);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#ifdef QT_DEBUG
|
||||
MessageBuilder builder;
|
||||
|
||||
builder.emplace<TimestampElement>();
|
||||
builder.emplace<TextElement>(message->toData(), MessageElementFlag::Text);
|
||||
|
||||
auto msg = builder.release();
|
||||
|
||||
for (auto &&weak : this->channels)
|
||||
{
|
||||
if (auto shared = weak.lock())
|
||||
shared->addMessage(msg);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace chatterino
|
||||
|
|
|
@ -211,7 +211,12 @@ public:
|
|||
|
||||
QStringSetting cachePath = {"/cache/path", ""};
|
||||
|
||||
/// Debug
|
||||
BoolSetting showUnhandledIrcMessages = {"/debug/showUnhandledIrcMessages",
|
||||
false};
|
||||
|
||||
/// UI
|
||||
// Purely QOL settings are here (like last item in a list).
|
||||
IntSetting lastSelectChannelTab = {"/ui/lastSelectChannelTab", 0};
|
||||
IntSetting lastSelectIrcConn = {"/ui/lastSelectIrcConn", 0};
|
||||
|
||||
|
|
|
@ -422,6 +422,9 @@ void GeneralPage::initLayout(SettingsLayout &layout)
|
|||
layout.addCheckbox("Load message history on connect",
|
||||
s.loadTwitchMessageHistoryOnConnect);
|
||||
|
||||
layout.addCheckbox("Show unhandled irc messages",
|
||||
s.showUnhandledIrcMessages);
|
||||
|
||||
layout.addTitle("Cache");
|
||||
layout.addDescription(
|
||||
"Files that are used often (such as emotes) are saved to disk to "
|
||||
|
|
Loading…
Reference in a new issue