Add UserRenamed MsgType

Categorise rename logmessages for themselves allowing users to filter
them how they please. Closes mumble-voip/mumble#1728
This commit is contained in:
Will Tange 2015-06-27 13:02:12 +02:00 committed by Mikkel Krautz
parent b4d48ef43d
commit 46cb8a371b
4 changed files with 7 additions and 4 deletions

View File

@ -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 {

View File

@ -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[];

View File

@ -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)));
}
}

View File

@ -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 {