diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2011-03-13 14:57:58 +0000 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2011-03-13 14:57:58 +0000 |
commit | 92183d2dd0275ed91a635733cc5f3d85902a9373 (patch) | |
tree | f4264e5f7c664a908a0740bda2941d6893ee1a59 /rbutil | |
parent | 1177651d56a9e3f4cb24e0e1925809490e4196e1 (diff) | |
download | rockbox-92183d2dd0275ed91a635733cc5f3d85902a9373.tar.gz rockbox-92183d2dd0275ed91a635733cc5f3d85902a9373.zip |
Improve visual feedback when testing TTS.
Disable the "Test TTS" button during a running test and on invalid TTS
configuration.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@29581 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil')
-rw-r--r-- | rbutil/rbutilqt/configure.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/rbutil/rbutilqt/configure.cpp b/rbutil/rbutilqt/configure.cpp index e5ea699257..d775eec172 100644 --- a/rbutil/rbutilqt/configure.cpp +++ b/rbutil/rbutilqt/configure.cpp @@ -396,11 +396,13 @@ void Config::updateTtsState(int index) { ui.configTTSstatus->setText(tr("Configuration OK")); ui.configTTSstatusimg->setPixmap(QPixmap(QString::fromUtf8(":/icons/go-next.png"))); + ui.testTTS->setEnabled(true); } else { ui.configTTSstatus->setText(tr("Configuration INVALID")); ui.configTTSstatusimg->setPixmap(QPixmap(QString::fromUtf8(":/icons/dialog-error.png"))); + ui.testTTS->setEnabled(false); } delete tts; /* Config objects are never deleted (in fact, they are leaked..), so we can't rely on QObject, @@ -718,8 +720,9 @@ void Config::configTts() EncTtsCfgGui gui(this,tts,TTSBase::getTTSName(ui.comboTts->itemData(index).toString())); gui.exec(); updateTtsState(ui.comboTts->currentIndex()); - delete tts; /* Config objects are never deleted (in fact, they are leaked..), so we can't rely on QObject, - since that would delete the TTSBase instance on application exit*/ + delete tts; /* Config objects are never deleted (in fact, they are + leaked..), so we can't rely on QObject, since that would + delete the TTSBase instance on application exit */ } void Config::testTts() @@ -733,26 +736,28 @@ void Config::testTts() tr("TTS configuration invalid. \n Please configure TTS engine.")); return; } - + ui.testTTS->setEnabled(false); if(!tts->start(&errstr)) { QMessageBox::warning(this,tr("Could not start TTS engine."), tr("Could not start TTS engine.\n") + errstr + tr("\nPlease configure TTS engine.")); + ui.testTTS->setEnabled(true); return; } - + QTemporaryFile file(this); file.open(); QString filename = file.fileName(); file.close(); - + if(tts->voice(tr("Rockbox Utility Voice Test"),filename,&errstr) == FatalError) { tts->stop(); QMessageBox::warning(this,tr("Could not voice test string."), tr("Could not voice test string.\n") + errstr + tr("\nPlease configure TTS engine.")); + ui.testTTS->setEnabled(false); return; } tts->stop(); @@ -766,9 +771,10 @@ void Config::testTts() #else QSound::play(filename); #endif - - delete tts; /* Config objects are never deleted (in fact, they are leaked..), so we can't rely on QObject, - since that would delete the TTSBase instance on application exit*/ + ui.testTTS->setEnabled(true); + delete tts; /* Config objects are never deleted (in fact, they are + leaked..), so we can't rely on QObject, since that would + delete the TTSBase instance on application exit */ } void Config::configEnc() |