diff options
author | Markus S <Reaper@gmx.at> | 2013-01-02 21:01:21 +0400 |
---|---|---|
committer | Stefan Hacker <dd0t@users.sourceforge.net> | 2014-09-20 15:26:08 +0400 |
commit | f0fc66b650e254e4a8a67779d85993a56ec7767d (patch) | |
tree | e2349146dc6fee88b28eac9d2b8161681f2e7b3c /src | |
parent | 90925af55f9536980f8100ae2d051aca1e901b9a (diff) |
Self muted/deafened message seperated into self muted, self unmuted, self deafened, self undeafened.
Grants an audio feedback what mute/deaf-state is active. (global keys)
Moved the new message-events to the back of the message-list to prevent old config files becoming imcompatible.
Added an array that allows to choose the order of the messages in the settingsscreen
Diffstat (limited to 'src')
-rw-r--r-- | src/mumble/Log.cpp | 46 | ||||
-rw-r--r-- | src/mumble/Log.h | 8 | ||||
-rw-r--r-- | src/mumble/MainWindow.cpp | 10 | ||||
-rw-r--r-- | src/mumble/Settings.cpp | 10 |
4 files changed, 57 insertions, 17 deletions
diff --git a/src/mumble/Log.cpp b/src/mumble/Log.cpp index b4dd7b153..2f7079446 100644 --- a/src/mumble/Log.cpp +++ b/src/mumble/Log.cpp @@ -68,11 +68,13 @@ LogConfig::LogConfig(Settings &st) : ConfigWidget(st) { QTreeWidgetItem *twi; for (int i = Log::firstMsgType; i <= Log::lastMsgType; ++i) { - Log::MsgType t = static_cast<Log::MsgType>(i); + int iListIndex = Log::msgOrder[i]; //- Order messages according to array + + Log::MsgType t = static_cast<Log::MsgType>(iListIndex); const QString messageName = g.l->msgName(t); twi = new QTreeWidgetItem(qtwMessages); - twi->setData(ColMessage, Qt::UserRole, i); + twi->setData(ColMessage, Qt::UserRole, iListIndex); twi->setText(ColMessage, messageName); twi->setCheckState(ColConsole, Qt::Unchecked); twi->setCheckState(ColNotification, Qt::Unchecked); @@ -103,6 +105,7 @@ QIcon LogConfig::icon() const { void LogConfig::load(const Settings &r) { QList<QTreeWidgetItem *> qlItems = qtwMessages->findItems(QString(), Qt::MatchContains); + foreach(QTreeWidgetItem *i, qlItems) { Log::MsgType mt = static_cast<Log::MsgType>(i->data(ColMessage, Qt::UserRole).toInt()); Settings::MessageLog ml = static_cast<Settings::MessageLog>(r.qmMessages.value(mt)); @@ -113,6 +116,7 @@ void LogConfig::load(const Settings &r) { i->setCheckState(ColStaticSound, (ml & Settings::LogSoundfile) ? Qt::Checked : Qt::Unchecked); i->setText(ColStaticSoundPath, r.qmMessageSounds.value(mt)); } + qsbMaxBlocks->setValue(r.iMaxLogBlocks); loadSlider(qsVolume, r.iTTSVolume); @@ -205,6 +209,33 @@ Log::Log(QObject *p) : QObject(p) { qdDate = QDate::currentDate(); } +//- Displayorder in settingsscreen, allows to insert new events without breaking config-compatibility with older versions (Top = 0) +const int Log::msgOrder[] = { + 0, //- DebugInfo + 1, //- CriticalError + 2, //- Warning + 3, //- Information + 4, //- ServerConnected + 5, //- ServerDisconnected + 6, //- UserJoin + 7, //- UserLeave + 8, //- Recording + 9, //- YouKicked + 10, //- UserKicked + 11, //- SelfMute + 20, //- SelfUnmute + 21, //- SelfDeaf + 22, //- SelfUndeaf + 12, //- OtherSelfMute + 13, //- YouMuted + 14, //- YouMutedOther + 15, //- OtherMutedOther + 16, //- ChannelJoin + 17, //- ChannelLeave + 18, //- PermissionDenied + 19 //- TextMessage +}; + const char *Log::msgNames[] = { QT_TRANSLATE_NOOP("Log", "Debug"), QT_TRANSLATE_NOOP("Log", "Critical"), @@ -217,7 +248,7 @@ const char *Log::msgNames[] = { QT_TRANSLATE_NOOP("Log", "User recording state changed"), QT_TRANSLATE_NOOP("Log", "User kicked (you or by you)"), QT_TRANSLATE_NOOP("Log", "User kicked"), - QT_TRANSLATE_NOOP("Log", "You self-muted/deafened"), + QT_TRANSLATE_NOOP("Log", "You self-muted"), QT_TRANSLATE_NOOP("Log", "Other self-muted/deafened"), QT_TRANSLATE_NOOP("Log", "User muted (you)"), QT_TRANSLATE_NOOP("Log", "User muted (by you)"), @@ -225,7 +256,10 @@ const char *Log::msgNames[] = { QT_TRANSLATE_NOOP("Log", "User Joined Channel"), QT_TRANSLATE_NOOP("Log", "User Left Channel"), QT_TRANSLATE_NOOP("Log", "Permission Denied"), - QT_TRANSLATE_NOOP("Log", "Text Message") + 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") }; QString Log::msgName(MsgType t) const { @@ -488,8 +522,8 @@ void Log::log(MsgType mt, const QString &console, const QString &terse, bool own if ((flags & Settings::LogBalloon) && !(g.mw->isActiveWindow() && g.mw->qdwLog->isVisible())) postNotification(mt, console, plain); - // Don't make any noise if we are self deafened - if (g.s.bDeaf) + // Don't make any noise if we are self deafened (Unless it is the sound for activating self deaf) + if (g.s.bDeaf && mt != Log::SelfDeaf) return; // Message notification with static sounds diff --git a/src/mumble/Log.h b/src/mumble/Log.h index 484140081..cabac2cfd 100644 --- a/src/mumble/Log.h +++ b/src/mumble/Log.h @@ -71,10 +71,14 @@ 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 }; + 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 LogColorType { Time, Server, Privilege, Source, Target }; static const MsgType firstMsgType = DebugInfo; - static const MsgType lastMsgType = TextMessage; + static const MsgType lastMsgType = SelfUndeaf; + + //- Displayorder in settingsscreen, allows to insert new events without breaking config-compatibility with older versions (Top = 0) + static const int msgOrder[]; + protected: QHash<MsgType, int> qmIgnore; static const char *msgNames[]; diff --git a/src/mumble/MainWindow.cpp b/src/mumble/MainWindow.cpp index 0c32d8a54..5660839c2 100644 --- a/src/mumble/MainWindow.cpp +++ b/src/mumble/MainWindow.cpp @@ -1994,9 +1994,9 @@ void MainWindow::on_qaAudioMute_triggered() { if (! g.s.bMute && g.s.bDeaf) { g.s.bDeaf = false; qaAudioDeaf->setChecked(false); - g.l->log(Log::SelfMute, tr("Unmuted and undeafened.")); + g.l->log(Log::SelfUndeaf, tr("Unmuted and undeafened.")); } else if (! g.s.bMute) { - g.l->log(Log::SelfMute, tr("Unmuted.")); + g.l->log(Log::SelfUnmute, tr("Unmuted.")); } else { g.l->log(Log::SelfMute, tr("Muted.")); } @@ -2029,12 +2029,12 @@ void MainWindow::on_qaAudioDeaf_triggered() { bAutoUnmute = true; g.s.bMute = true; qaAudioMute->setChecked(true); - g.l->log(Log::SelfMute, tr("Muted and deafened.")); + g.l->log(Log::SelfDeaf, tr("Muted and deafened.")); } else if (g.s.bDeaf) { - g.l->log(Log::SelfMute, tr("Deafened.")); + g.l->log(Log::SelfDeaf, tr("Deafened.")); bAutoUnmute = false; } else { - g.l->log(Log::SelfMute, tr("Undeafened.")); + g.l->log(Log::SelfUndeaf, tr("Undeafened.")); } if (g.sh) { diff --git a/src/mumble/Settings.cpp b/src/mumble/Settings.cpp index d6aad00bb..8323730f6 100644 --- a/src/mumble/Settings.cpp +++ b/src/mumble/Settings.cpp @@ -405,16 +405,18 @@ Settings::Settings() { bShortcutEnable = true; bSuppressMacEventTapWarning = false; - - for (int i=Log::firstMsgType; i<=Log::lastMsgType; ++i) + + for (int i=Log::firstMsgType; i<=Log::lastMsgType; ++i) { qmMessages.insert(i, Settings::LogConsole | Settings::LogBalloon | Settings::LogTTS); - - for (int i=Log::firstMsgType; i<=Log::lastMsgType; ++i) qmMessageSounds.insert(i, QString()); + } qmMessageSounds[Log::CriticalError] = QLatin1String(":/Critical.ogg"); qmMessageSounds[Log::PermissionDenied] = QLatin1String(":/PermissionDenied.ogg"); qmMessageSounds[Log::SelfMute] = QLatin1String(":/SelfMutedDeafened.ogg"); + qmMessageSounds[Log::SelfUnmute] = QLatin1String(":/SelfMutedDeafened.ogg"); + qmMessageSounds[Log::SelfDeaf] = QLatin1String(":/SelfMutedDeafened.ogg"); + qmMessageSounds[Log::SelfUndeaf] = QLatin1String(":/SelfMutedDeafened.ogg"); qmMessageSounds[Log::ServerConnected] = QLatin1String(":/ServerConnected.ogg"); qmMessageSounds[Log::ServerDisconnected] = QLatin1String(":/ServerDisconnected.ogg"); qmMessageSounds[Log::TextMessage] = QLatin1String(":/TextMessage.ogg"); |