Skip to content
Permalink
Browse files

Do not show TTS options when speechd is disabled.

A new define, USE_NO_TTS is added. For now, this define
is set when no TTS engine is available on Linux.

Fixes #961
  • Loading branch information...
susnux authored and mkrautz committed Mar 21, 2015
1 parent 57396fa commit 67ed33f32859906c7b10aad4456ddcf762f4f473
Showing with 35 additions and 5 deletions.
  1. +8 −1 src/mumble/AudioWizard.cpp
  2. +20 −4 src/mumble/Log.cpp
  3. +5 −0 src/mumble/MainWindow.cpp
  4. +2 −0 src/mumble/mumble.pro
@@ -119,14 +119,21 @@ AudioWizard::AudioWizard(QWidget *p) : QWizard(p) {
iMessage |= (g.s.qmMessages[i] & (Settings::LogSoundfile | Settings::LogTTS));
}

#ifdef USE_NO_TTS
qrbNotificationCustom->setChecked(false);
qrbNotificationCustom->setDisabled(true);
qrbNotificationTTS->setChecked(false);
qrbNotificationTTS->setDisabled(true);
qrbNotificationSounds->setChecked(true);
#else
if (iMessage == Settings::LogTTS && g.s.bTTS)
qrbNotificationTTS->setChecked(true);
else if (iMessage == Settings::LogSoundfile)
qrbNotificationSounds->setChecked(true);
else // If we find mixed message types or only tts with main tts disable assume custom
qrbNotificationCustom->setChecked(true);

qrbNotificationCustom->setVisible(qrbNotificationCustom->isChecked());
#endif

qrbQualityCustom->setVisible(qrbQualityCustom->isChecked());
qlQualityCustom->setVisible(qrbQualityCustom->isChecked());
@@ -52,6 +52,10 @@ static ConfigRegistrar registrar(4000, LogConfigDialogNew);
LogConfig::LogConfig(Settings &st) : ConfigWidget(st) {
setupUi(this);

#ifdef USE_NO_TTS
qgbTTS->setDisabled(true);
#endif

#if QT_VERSION >= 0x050000
qtwMessages->header()->setSectionResizeMode(ColMessage, QHeaderView::Stretch);
qtwMessages->header()->setSectionResizeMode(ColConsole, QHeaderView::ResizeToContents);
@@ -76,20 +80,22 @@ LogConfig::LogConfig(Settings &st) : ConfigWidget(st) {
twi->setText(ColMessage, messageName);
twi->setCheckState(ColConsole, Qt::Unchecked);
twi->setCheckState(ColNotification, Qt::Unchecked);
twi->setCheckState(ColTTS, 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(ColTTS, tr("Toggle Text-To-Speech 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(ColTTS, tr("Click here to toggle Text-To-Speech for %1 events.<br />If checked, Mumble uses Text-To-Speech to read %1 events out loud to you. Text-To-Speech is also able to read the contents of the event which is not true for sound files. Text-To-Speech and sound files cannot be used at the same time.").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
twi->setCheckState(ColTTS, Qt::Unchecked);
twi->setToolTip(ColTTS, tr("Toggle Text-To-Speech for %1 events").arg(messageName));
twi->setWhatsThis(ColTTS, tr("Click here to toggle Text-To-Speech for %1 events.<br />If checked, Mumble uses Text-To-Speech to read %1 events out loud to you. Text-To-Speech is also able to read the contents of the event which is not true for sound files. Text-To-Speech and sound files cannot be used at the same time.").arg(messageName));
#endif
}
}

@@ -110,16 +116,22 @@ 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);
#ifndef USE_NO_TTS
i->setCheckState(ColTTS, (ml & Settings::LogTTS) ? Qt::Checked : Qt::Unchecked);
#endif
i->setCheckState(ColStaticSound, (ml & Settings::LogSoundfile) ? Qt::Checked : Qt::Unchecked);
i->setText(ColStaticSoundPath, r.qmMessageSounds.value(mt));
}

qsbMaxBlocks->setValue(r.iMaxLogBlocks);

#ifdef USE_NO_TTS
qtwMessages->hideColumn(ColTTS);
#else
loadSlider(qsVolume, r.iTTSVolume);
qsbThreshold->setValue(r.iTTSThreshold);
qcbReadBackOwn->setChecked(r.bTTSMessageReadBack);
#endif
qcbWhisperFriends->setChecked(r.bWhisperFriends);
}

@@ -133,18 +145,22 @@ void LogConfig::save() const {
v |= Settings::LogConsole;
if (i->checkState(ColNotification) == Qt::Checked)
v |= Settings::LogBalloon;
#ifndef USE_NO_TTS
if (i->checkState(ColTTS) == Qt::Checked)
v |= Settings::LogTTS;
#endif
if (i->checkState(ColStaticSound) == Qt::Checked)
v |= Settings::LogSoundfile;
s.qmMessages[mt] = v;
s.qmMessageSounds[mt] = i->text(ColStaticSoundPath);
}
s.iMaxLogBlocks = qsbMaxBlocks->value();

#ifndef USE_NO_TTS
s.iTTSVolume=qsVolume->value();
s.iTTSThreshold=qsbThreshold->value();
s.bTTSMessageReadBack = qcbReadBackOwn->isChecked();
#endif
s.bWhisperFriends = qcbWhisperFriends->isChecked();
}

@@ -285,7 +285,12 @@ void MainWindow::setupGui() {

qaAudioMute->setChecked(g.s.bMute);
qaAudioDeaf->setChecked(g.s.bDeaf);
#ifdef USE_NO_TTS
qaAudioTTS->setChecked(false);
qaAudioTTS->setDisabled(true);
#else
qaAudioTTS->setChecked(g.s.bTTS);
#endif
qaFilterToggle->setChecked(g.s.bFilterActive);

qaHelpWhatsThis->setShortcuts(QKeySequence::WhatsThis);
@@ -437,6 +437,8 @@ unix {

!CONFIG(no-speechd) {
CONFIG *= speechd
} else {
DEFINES *= USE_NO_TTS
}
}
}

0 comments on commit 67ed33f

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