From 46cb8a371b1be08e013ed25e41cbf871c347f946 Mon Sep 17 00:00:00 2001 From: Will Tange Date: Sat, 27 Jun 2015 13:02:12 +0200 Subject: [PATCH] Add `UserRenamed` `MsgType` Categorise rename logmessages for themselves allowing users to filter them how they please. Closes mumble-voip/mumble#1728 --- src/mumble/Log.cpp | 4 +++- src/mumble/Log.h | 4 ++-- src/mumble/Messages.cpp | 2 +- src/mumble/Settings.cpp | 1 + 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/mumble/Log.cpp b/src/mumble/Log.cpp index e30f522b5..e3bf40af4 100644 --- a/src/mumble/Log.cpp +++ b/src/mumble/Log.cpp @@ -230,6 +230,7 @@ const Log::MsgType Log::msgOrder[] = { UserJoin, UserLeave, Recording, YouKicked, UserKicked, + UserRenamed, SelfMute, SelfUnmute, SelfDeaf, SelfUndeaf, OtherSelfMute, YouMuted, YouMutedOther, OtherMutedOther, ChannelJoin, ChannelLeave, @@ -260,7 +261,8 @@ const char *Log::msgNames[] = { QT_TRANSLATE_NOOP("Log", "Text Message"), QT_TRANSLATE_NOOP("Log", "You self-unmuted"), QT_TRANSLATE_NOOP("Log", "You self-deafened"), - QT_TRANSLATE_NOOP("Log", "You self-undeafened") + QT_TRANSLATE_NOOP("Log", "You self-undeafened"), + QT_TRANSLATE_NOOP("Log", "User renamed") }; QString Log::msgName(MsgType t) const { diff --git a/src/mumble/Log.h b/src/mumble/Log.h index 9c2e93ad3..4f9c00a79 100644 --- a/src/mumble/Log.h +++ b/src/mumble/Log.h @@ -71,10 +71,10 @@ class Log : public QObject { Q_OBJECT Q_DISABLE_COPY(Log) public: - enum MsgType { DebugInfo, CriticalError, Warning, Information, ServerConnected, ServerDisconnected, UserJoin, UserLeave, Recording, YouKicked, UserKicked, SelfMute, OtherSelfMute, YouMuted, YouMutedOther, OtherMutedOther, ChannelJoin, ChannelLeave, PermissionDenied, TextMessage, SelfUnmute, SelfDeaf, SelfUndeaf }; + enum MsgType { DebugInfo, CriticalError, Warning, Information, ServerConnected, ServerDisconnected, UserJoin, UserLeave, Recording, YouKicked, UserKicked, SelfMute, OtherSelfMute, YouMuted, YouMutedOther, OtherMutedOther, ChannelJoin, ChannelLeave, PermissionDenied, TextMessage, SelfUnmute, SelfDeaf, SelfUndeaf, UserRenamed }; enum LogColorType { Time, Server, Privilege, Source, Target }; static const MsgType firstMsgType = DebugInfo; - static const MsgType lastMsgType = SelfUndeaf; + static const MsgType lastMsgType = UserRenamed; // Display order in settingsscreen, allows to insert new events without breaking config-compatibility with older versions. static const MsgType msgOrder[]; diff --git a/src/mumble/Messages.cpp b/src/mumble/Messages.cpp index 0ff69aa42..9362f2e8e 100644 --- a/src/mumble/Messages.cpp +++ b/src/mumble/Messages.cpp @@ -522,7 +522,7 @@ void MainWindow::msgUserState(const MumbleProto::UserState &msg) { QString newName = u8(msg.name()); pmModel->renameUser(pDst, newName); if (! oldName.isNull() && oldName != newName) { - g.l->log(Log::Information, tr("%1 renamed to %2.").arg(Log::formatClientUser(pDst, Log::Target, oldName), + g.l->log(Log::UserRenamed, tr("%1 renamed to %2.").arg(Log::formatClientUser(pDst, Log::Target, oldName), Log::formatClientUser(pDst, Log::Target))); } } diff --git a/src/mumble/Settings.cpp b/src/mumble/Settings.cpp index 2c0c43b85..acfcc14df 100644 --- a/src/mumble/Settings.cpp +++ b/src/mumble/Settings.cpp @@ -442,6 +442,7 @@ Settings::Settings() { qmMessages[Log::UserKicked] = Settings::LogConsole; qmMessages[Log::OtherSelfMute] = Settings::LogConsole; qmMessages[Log::OtherMutedOther] = Settings::LogConsole; + qmMessages[Log::UserRenamed] = Settings::LogConsole; } bool Settings::doEcho() const {