diff options
Diffstat (limited to 'rbutil/rbutilqt/configure.cpp')
-rw-r--r-- | rbutil/rbutilqt/configure.cpp | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/rbutil/rbutilqt/configure.cpp b/rbutil/rbutilqt/configure.cpp index 7669a103ae..fae537b367 100644 --- a/rbutil/rbutilqt/configure.cpp +++ b/rbutil/rbutilqt/configure.cpp | |||
@@ -85,7 +85,7 @@ Config::Config(QWidget *parent,int index) : QDialog(parent) | |||
85 | connect(ui.configEncoder, SIGNAL(clicked()), this, SLOT(configEnc())); | 85 | connect(ui.configEncoder, SIGNAL(clicked()), this, SLOT(configEnc())); |
86 | connect(ui.comboTts, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTtsState(int))); | 86 | connect(ui.comboTts, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTtsState(int))); |
87 | connect(ui.treeDevices, SIGNAL(itemSelectionChanged()), this, SLOT(updateEncState())); | 87 | connect(ui.treeDevices, SIGNAL(itemSelectionChanged()), this, SLOT(updateEncState())); |
88 | 88 | connect(ui.testTTS,SIGNAL(clicked()),this,SLOT(testTts())); | |
89 | setUserSettings(); | 89 | setUserSettings(); |
90 | setDevices(); | 90 | setDevices(); |
91 | } | 91 | } |
@@ -660,6 +660,39 @@ void Config::configTts() | |||
660 | updateTtsState(ui.comboTts->currentIndex()); | 660 | updateTtsState(ui.comboTts->currentIndex()); |
661 | } | 661 | } |
662 | 662 | ||
663 | void Config::testTts() | ||
664 | { | ||
665 | QString errstr; | ||
666 | int index = ui.comboTts->currentIndex(); | ||
667 | TTSBase* tts = TTSBase::getTTS(this,ui.comboTts->itemData(index).toString()); | ||
668 | if(!tts->configOk()) | ||
669 | { | ||
670 | QMessageBox::warning(this,tr("TTS configuration invalid"),tr("TTS configuration invalid. \n Please configure TTS engine.")); | ||
671 | return; | ||
672 | } | ||
673 | |||
674 | if(!tts->start(&errstr)) | ||
675 | { | ||
676 | QMessageBox::warning(this,tr("Could not start TTS engine"),tr("Could not start TTS engine.\n") + errstr | ||
677 | +tr("\nPlease configure TTS engine.")); | ||
678 | return; | ||
679 | } | ||
680 | |||
681 | QTemporaryFile file(this); | ||
682 | file.open(); | ||
683 | QString filename = file.fileName(); | ||
684 | file.close(); | ||
685 | |||
686 | if(tts->voice(tr("Rockbox Utility Voice Test"),filename,&errstr) == FatalError) | ||
687 | { | ||
688 | tts->stop(); | ||
689 | QMessageBox::warning(this,tr("Could not voice test string"),tr("Could not voice test string.\n") + errstr | ||
690 | +tr("\nPlease configure TTS engine.")); | ||
691 | return; | ||
692 | } | ||
693 | tts->stop(); | ||
694 | QSound::play(filename); | ||
695 | } | ||
663 | 696 | ||
664 | void Config::configEnc() | 697 | void Config::configEnc() |
665 | { | 698 | { |