1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Dominik Riebeling 2011-03-13 14:57:58 +00:00
parent 1177651d56
commit 92183d2dd0

View file

@ -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()