Skip to content
Permalink
Browse files

Merge PR #3354: Add per-notification setting to toggle window highlig…

…ht (if not active)
  • Loading branch information...
davidebeatrici committed Mar 2, 2018
2 parents 651e4d0 + dcdf069 commit ce8fd36dab2c055dd8b4de62f0be76755754d9a8
Showing with 47 additions and 11 deletions.
  1. +19 −3 src/mumble/Log.cpp
  2. +1 −1 src/mumble/Log.h
  3. +5 −0 src/mumble/Log.ui
  4. +1 −1 src/mumble/Settings.h
  5. +21 −6 src/mumble/mumble_en.ts
@@ -34,12 +34,14 @@ LogConfig::LogConfig(Settings &st) : ConfigWidget(st) {
qtwMessages->header()->setSectionResizeMode(ColMessage, QHeaderView::Stretch);
qtwMessages->header()->setSectionResizeMode(ColConsole, QHeaderView::ResizeToContents);
qtwMessages->header()->setSectionResizeMode(ColNotification, QHeaderView::ResizeToContents);
qtwMessages->header()->setSectionResizeMode(ColHighlight, QHeaderView::ResizeToContents);
qtwMessages->header()->setSectionResizeMode(ColTTS, QHeaderView::ResizeToContents);
qtwMessages->header()->setSectionResizeMode(ColStaticSound, QHeaderView::ResizeToContents);
#else
qtwMessages->header()->setResizeMode(ColMessage, QHeaderView::Stretch);
qtwMessages->header()->setResizeMode(ColConsole, QHeaderView::ResizeToContents);
qtwMessages->header()->setResizeMode(ColNotification, QHeaderView::ResizeToContents);
qtwMessages->header()->setResizeMode(ColHighlight, QHeaderView::ResizeToContents);
qtwMessages->header()->setResizeMode(ColTTS, QHeaderView::ResizeToContents);
qtwMessages->header()->setResizeMode(ColStaticSound, QHeaderView::ResizeToContents);
#endif
@@ -54,15 +56,18 @@ LogConfig::LogConfig(Settings &st) : ConfigWidget(st) {
twi->setText(ColMessage, messageName);
twi->setCheckState(ColConsole, Qt::Unchecked);
twi->setCheckState(ColNotification, Qt::Unchecked);
twi->setCheckState(ColHighlight, Qt::Unchecked);
twi->setCheckState(ColStaticSound, Qt::Unchecked);

twi->setToolTip(ColConsole, tr("Toggle console for %1 events").arg(messageName));
twi->setToolTip(ColNotification, tr("Toggle pop-up notifications for %1 events").arg(messageName));
twi->setToolTip(ColHighlight, tr("Toggle window highlight (if not active) for %1 events").arg(messageName));
twi->setToolTip(ColStaticSound, tr("Click here to toggle sound notification for %1 events").arg(messageName));
twi->setToolTip(ColStaticSoundPath, tr("Path to sound file used for sound notifications in the case of %1 events<br />Single click to play<br />Double-click to change").arg(messageName));

twi->setWhatsThis(ColConsole, tr("Click here to toggle console output for %1 events.<br />If checked, this option makes Mumble output all %1 events in its message log.").arg(messageName));
twi->setWhatsThis(ColNotification, tr("Click here to toggle pop-up notifications for %1 events.<br />If checked, a notification pop-up will be created by Mumble for every %1 event.").arg(messageName));
twi->setWhatsThis(ColHighlight, tr("Click here to toggle window highlight for %1 events.<br />If checked, Mumble's window will be highlighted for every %1 event, if not active.").arg(messageName));
twi->setWhatsThis(ColStaticSound, tr("Click here to toggle sound notification for %1 events.<br />If checked, Mumble uses a sound file predefined by you to indicate %1 events. Sound files and Text-To-Speech cannot be used at the same time.").arg(messageName));
twi->setWhatsThis(ColStaticSoundPath, tr("Path to sound file used for sound notifications in the case of %1 events.<br />Single click to play<br />Double-click to change<br />Ensure that sound notifications for these events are enabled or this field will not have any effect.").arg(messageName));
#ifndef USE_NO_TTS
@@ -90,6 +95,7 @@ void LogConfig::load(const Settings &r) {

i->setCheckState(ColConsole, (ml & Settings::LogConsole) ? Qt::Checked : Qt::Unchecked);
i->setCheckState(ColNotification, (ml & Settings::LogBalloon) ? Qt::Checked : Qt::Unchecked);
i->setCheckState(ColHighlight, (ml & Settings::LogHighlight) ? Qt::Checked : Qt::Unchecked);
#ifndef USE_NO_TTS
i->setCheckState(ColTTS, (ml & Settings::LogTTS) ? Qt::Checked : Qt::Unchecked);
#endif
@@ -119,6 +125,8 @@ void LogConfig::save() const {
v |= Settings::LogConsole;
if (i->checkState(ColNotification) == Qt::Checked)
v |= Settings::LogBalloon;
if (i->checkState(ColHighlight) == Qt::Checked)
v |= Settings::LogHighlight;
#ifndef USE_NO_TTS
if (i->checkState(ColTTS) == Qt::Checked)
v |= Settings::LogTTS;
@@ -491,9 +499,17 @@ void Log::log(MsgType mt, const QString &console, const QString &terse, bool own
if (!g.s.bTTSMessageReadBack && ownMessage)
return;

// Message notification with balloon tooltips
if ((flags & Settings::LogBalloon) && !(g.mw->isActiveWindow() && g.mw->qdwLog->isVisible()))
postNotification(mt, plain);
if (!(g.mw->isActiveWindow() && g.mw->qdwLog->isVisible())) {
// Message notification with window highlight
if (flags & Settings::LogHighlight) {
QApplication::alert(g.mw);
}

// Message notification with balloon tooltips
if (flags & Settings::LogBalloon) {
postNotification(mt, plain);
}
}

// 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)
@@ -20,7 +20,7 @@ class LogConfig : public ConfigWidget, public Ui::LogConfig {
Q_OBJECT
Q_DISABLE_COPY(LogConfig)
public:
enum Column { ColMessage, ColConsole, ColNotification, ColTTS, ColStaticSound, ColStaticSoundPath };
enum Column { ColMessage, ColConsole, ColNotification, ColHighlight, ColTTS, ColStaticSound, ColStaticSoundPath };
LogConfig(Settings &st);
QString title() const Q_DECL_OVERRIDE;
QIcon icon() const Q_DECL_OVERRIDE;
@@ -46,6 +46,11 @@
<string>Notification</string>
</property>
</column>
<column>
<property name="text">
<string>Highlight</string>
</property>
</column>
<column>
<property name="text">
<string>Text-To-Speech</string>
@@ -273,7 +273,7 @@ struct Settings {
bool bEnableUIAccess;
QList<Shortcut> qlShortcuts;

enum MessageLog { LogNone = 0x00, LogConsole = 0x01, LogTTS = 0x02, LogBalloon = 0x04, LogSoundfile = 0x08};
enum MessageLog { LogNone = 0x00, LogConsole = 0x01, LogTTS = 0x02, LogBalloon = 0x04, LogSoundfile = 0x08, LogHighlight = 0x10 };
int iMaxLogBlocks;
QMap<int, QString> qmMessageSounds;
QMap<int, quint32> qmMessages;
@@ -3927,7 +3927,7 @@ This field describes the size of an LCD device. The size is given either in pixe
<context>
<name>Log</name>
<message>
<location filename="Log.cpp" line="+213"/>
<location filename="Log.cpp" line="+221"/>
<source>Debug</source>
<translation type="unfinished"></translation>
</message>
@@ -4078,7 +4078,7 @@ This field describes the size of an LCD device. The size is given either in pixe
<translation type="unfinished"></translation>
</message>
<message>
<location line="+66"/>
<location line="+74"/>
<source>link to %1</source>
<translation type="unfinished"></translation>
</message>
@@ -4106,7 +4106,7 @@ This field describes the size of an LCD device. The size is given either in pixe
<context>
<name>LogConfig</name>
<message>
<location line="-482"/>
<location line="-495"/>
<source>Toggle console for %1 events</source>
<translation type="unfinished"></translation>
</message>
@@ -4116,17 +4116,22 @@ This field describes the size of an LCD device. The size is given either in pixe
<translation type="unfinished"></translation>
</message>
<message>
<location line="+10"/>
<location line="+12"/>
<source>Toggle Text-To-Speech for %1 events</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="-9"/>
<location line="-10"/>
<source>Click here to toggle sound notification for %1 events</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+1"/>
<location line="-1"/>
<source>Toggle window highlight (if not active) for %1 events</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>Path to sound file used for sound notifications in the case of %1 events&lt;br /&gt;Single click to play&lt;br /&gt;Double-click to change</source>
<translation type="unfinished"></translation>
</message>
@@ -4141,6 +4146,11 @@ This field describes the size of an LCD device. The size is given either in pixe
<oldsource>Click here to toggle pop-up notifications for %1 events.&lt;br /&gt;If checked, a notification pop-up will be created by mumble for every %1 event.</oldsource>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+1"/>
<source>Click here to toggle window highlight for %1 events.&lt;br /&gt;If checked, Mumble&apos;s window will be highlighted for every %1 event, if not active.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+2"/>
<source>Path to sound file used for sound notifications in the case of %1 events.&lt;br /&gt;Single click to play&lt;br /&gt;Double-click to change&lt;br /&gt;Ensure that sound notifications for these events are enabled or this field will not have any effect.</source>
@@ -4278,6 +4288,11 @@ This field describes the size of an LCD device. The size is given either in pixe
<source> Lines</source>
<translation type="unfinished"></translation>
</message>
<message>
<location/>
<source>Highlight</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>LookConfig</name>

0 comments on commit ce8fd36

Please sign in to comment.
You can’t perform that action at this time.