summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/ttsgui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'rbutil/rbutilqt/ttsgui.cpp')
-rw-r--r--rbutil/rbutilqt/ttsgui.cpp235
1 files changed, 118 insertions, 117 deletions
diff --git a/rbutil/rbutilqt/ttsgui.cpp b/rbutil/rbutilqt/ttsgui.cpp
index 45dd3a86ef..cd4dab1fcf 100644
--- a/rbutil/rbutilqt/ttsgui.cpp
+++ b/rbutil/rbutilqt/ttsgui.cpp
@@ -16,13 +16,13 @@
* KIND, either express or implied.
*
****************************************************************************/
-
+
#include "ttsgui.h"
#include "rbsettings.h"
#include "tts.h"
#include "browsedirtree.h"
-
+
TTSSapiGui::TTSSapiGui(TTSSapi* sapi,QDialog* parent) : QDialog(parent)
{
m_sapi= sapi;
@@ -31,46 +31,46 @@ TTSSapiGui::TTSSapiGui(TTSSapi* sapi,QDialog* parent) : QDialog(parent)
connect(ui.reset,SIGNAL(clicked()),this,SLOT(reset()));
connect(ui.languagecombo,SIGNAL(currentIndexChanged(QString)),this,SLOT(updateVoices(QString)));
connect(ui.usesapi4,SIGNAL(stateChanged(int)),this,SLOT(useSapi4Changed(int)));
-}
+}
void TTSSapiGui::showCfg()
{
// try to get config from settings
- ui.ttsoptions->setText(settings->ttsOptions("sapi"));
+ ui.ttsoptions->setText(settings->ttsOptions("sapi"));
QString selLang = settings->ttsLang("sapi");
- QString selVoice = settings->ttsVoice("sapi");
+ QString selVoice = settings->ttsVoice("sapi");
ui.speed->setValue(settings->ttsSpeed("sapi"));
if(settings->ttsUseSapi4())
ui.usesapi4->setCheckState(Qt::Checked);
else
ui.usesapi4->setCheckState(Qt::Unchecked);
-
+
// fill in language combobox
QStringList languages = settings->allLanguages();
-
+
languages.sort();
ui.languagecombo->clear();
ui.languagecombo->addItems(languages);
-
+
// set saved lang
ui.languagecombo->setCurrentIndex(ui.languagecombo->findText(selLang));
- // fill in voice combobox
+ // fill in voice combobox
updateVoices(selLang);
-
+
// set saved lang
- ui.voicecombo->setCurrentIndex(ui.voicecombo->findText(selVoice));
-
+ ui.voicecombo->setCurrentIndex(ui.voicecombo->findText(selVoice));
+
//show dialog
this->exec();
-
+
}
void TTSSapiGui::reset()
{
- ui.ttsoptions->setText("");
- ui.languagecombo->setCurrentIndex(ui.languagecombo->findText("english"));
+ ui.ttsoptions->setText("");
+ ui.languagecombo->setCurrentIndex(ui.languagecombo->findText("english"));
}
@@ -101,7 +101,7 @@ void TTSSapiGui::updateVoices(QString language)
{
QStringList Voices = m_sapi->getVoiceList(language);
ui.voicecombo->clear();
- ui.voicecombo->addItems(Voices);
+ ui.voicecombo->addItems(Voices);
}
@@ -114,7 +114,7 @@ void TTSSapiGui::useSapi4Changed(int)
// sync settings
settings->sync();
updateVoices(ui.languagecombo->currentText());
-
+
}
TTSExesGui::TTSExesGui(QDialog* parent) : QDialog(parent)
@@ -129,7 +129,7 @@ TTSExesGui::TTSExesGui(QDialog* parent) : QDialog(parent)
void TTSExesGui::reset()
{
ui.ttspath->setText("");
- ui.ttsoptions->setText("");
+ ui.ttsoptions->setText("");
}
void TTSExesGui::showCfg(QString name)
@@ -137,12 +137,12 @@ void TTSExesGui::showCfg(QString name)
m_name = name;
// try to get config from settings
QString exepath =settings->ttsPath(m_name);
- ui.ttsoptions->setText(settings->ttsOptions(m_name));
+ ui.ttsoptions->setText(settings->ttsOptions(m_name));
ui.ttspath->setText(exepath);
-
+
//show dialog
this->exec();
-
+
}
void TTSExesGui::accept(void)
@@ -152,7 +152,7 @@ void TTSExesGui::accept(void)
settings->setTTSOptions(m_name,ui.ttsoptions->text());
// sync settings
settings->sync();
-
+
this->done(0);
}
@@ -182,7 +182,7 @@ void TTSExesGui::browse()
}
TTSFestivalGui::TTSFestivalGui(TTSFestival* api, QDialog* parent) :
- QDialog(parent), festival(api)
+ QDialog(parent), festival(api)
{
ui.setupUi(this);
this->setModal(true);
@@ -199,31 +199,31 @@ TTSFestivalGui::TTSFestivalGui(TTSFestival* api, QDialog* parent) :
void TTSFestivalGui::showCfg()
{
- qDebug() << "show\tpaths: " << settings->ttsPath("festival") << "\n"
- << "\tvoice: " << settings->ttsVoice("festival");
-
- // will populate the voices if the paths are correct,
- // otherwise, it will require the user to press Refresh
- updateVoices();
-
- // try to get config from settings
- QStringList paths = settings->ttsPath("festival").split(":");
- if(paths.size() == 2)
- {
- ui.serverPath->setText(paths[0]);
- ui.clientPath->setText(paths[1]);
- }
-
- this->setEnabled(true);
+ qDebug() << "show\tpaths: " << settings->ttsPath("festival") << "\n"
+ << "\tvoice: " << settings->ttsVoice("festival");
+
+ // will populate the voices if the paths are correct,
+ // otherwise, it will require the user to press Refresh
+ updateVoices();
+
+ // try to get config from settings
+ QStringList paths = settings->ttsPath("festival").split(":");
+ if(paths.size() == 2)
+ {
+ ui.serverPath->setText(paths[0]);
+ ui.clientPath->setText(paths[1]);
+ }
+
+ this->setEnabled(true);
this->exec();
}
void TTSFestivalGui::accept(void)
{
//save settings in user config
- QString newPath = QString("%1:%2").arg(ui.serverPath->text().trimmed()).arg(ui.clientPath->text().trimmed());
- qDebug() << "set\tpaths: " << newPath << "\n\tvoice: " << ui.voicesBox->currentText();
- settings->setTTSPath("festival", newPath);
+ QString newPath = QString("%1:%2").arg(ui.serverPath->text().trimmed()).arg(ui.clientPath->text().trimmed());
+ qDebug() << "set\tpaths: " << newPath << "\n\tvoice: " << ui.voicesBox->currentText();
+ settings->setTTSPath("festival", newPath);
settings->setTTSVoice("festival", ui.voicesBox->currentText());
settings->sync();
@@ -238,102 +238,103 @@ void TTSFestivalGui::reject(void)
void TTSFestivalGui::onBrowseClient()
{
- BrowseDirtree browser(this);
- browser.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
-
- QFileInfo currentPath(ui.clientPath->text().trimmed());
- if(currentPath.isDir())
- {
- browser.setDir(ui.clientPath->text());
- }
- else if (currentPath.isFile())
- {
- browser.setDir(currentPath.dir().absolutePath());
- }
- if(browser.exec() == QDialog::Accepted)
- {
- qDebug() << browser.getSelected();
- QString exe = browser.getSelected();
- if(!QFileInfo(exe).isExecutable())
- return;
- ui.clientPath->setText(exe);
- }
+ BrowseDirtree browser(this);
+ browser.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
+
+ QFileInfo currentPath(ui.clientPath->text().trimmed());
+ if(currentPath.isDir())
+ {
+ browser.setDir(ui.clientPath->text());
+ }
+ else if (currentPath.isFile())
+ {
+ browser.setDir(currentPath.dir().absolutePath());
+ }
+ if(browser.exec() == QDialog::Accepted)
+ {
+ qDebug() << browser.getSelected();
+ QString exe = browser.getSelected();
+ if(!QFileInfo(exe).isExecutable())
+ return;
+ ui.clientPath->setText(exe);
+ }
}
void TTSFestivalGui::onBrowseServer()
{
- BrowseDirtree browser(this);
- browser.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
-
- QFileInfo currentPath(ui.serverPath->text().trimmed());
- if(currentPath.isDir())
- {
- browser.setDir(ui.serverPath->text());
- }
- else if (currentPath.isFile())
- {
- browser.setDir(currentPath.dir().absolutePath());
- }
- if(browser.exec() == QDialog::Accepted)
- {
- qDebug() << browser.getSelected();
- QString exe = browser.getSelected();
- if(!QFileInfo(exe).isExecutable())
- return;
- ui.serverPath->setText(exe);
- }
+ BrowseDirtree browser(this);
+ browser.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
+
+ QFileInfo currentPath(ui.serverPath->text().trimmed());
+ if(currentPath.isDir())
+ {
+ browser.setDir(ui.serverPath->text());
+ }
+ else if (currentPath.isFile())
+ {
+ browser.setDir(currentPath.dir().absolutePath());
+ }
+ if(browser.exec() == QDialog::Accepted)
+ {
+ qDebug() << browser.getSelected();
+ QString exe = browser.getSelected();
+ if(!QFileInfo(exe).isExecutable())
+ return;
+ ui.serverPath->setText(exe);
+ }
}
void TTSFestivalGui::onRefreshButton()
{
- /* Temporarily commit the settings so that we get the new path when we check for voices */
- QString newPath = QString("%1:%2").arg(ui.serverPath->text().trimmed()).arg(ui.clientPath->text().trimmed());
- QString oldPath = settings->ttsPath("festival");
- qDebug() << "new path: " << newPath << "\n" << "old path: " << oldPath << "\nuse new: " << (newPath != oldPath);
-
- if(newPath != oldPath)
- {
- qDebug() << "Using new paths for getVoiceList";
- settings->setTTSPath("festival", newPath);
- settings->sync();
- }
-
- updateVoices();
-
- if(newPath != oldPath)
- {
- settings->setTTSPath("festival", oldPath);
- settings->sync();
- }
+ /* Temporarily commit the settings so that we get the new path when we check for voices */
+ QString newPath = QString("%1:%2").arg(ui.serverPath->text().trimmed()).arg(ui.clientPath->text().trimmed());
+ QString oldPath = settings->ttsPath("festival");
+ qDebug() << "new path: " << newPath << "\n" << "old path: " << oldPath << "\nuse new: " << (newPath != oldPath);
+
+ if(newPath != oldPath)
+ {
+ qDebug() << "Using new paths for getVoiceList";
+ settings->setTTSPath("festival", newPath);
+ settings->sync();
+ }
+
+ updateVoices();
+
+ if(newPath != oldPath)
+ {
+ settings->setTTSPath("festival", oldPath);
+ settings->sync();
+ }
}
void TTSFestivalGui::onShowDescription(int state)
{
- if(state == Qt::Unchecked)
- ui.descriptionLabel->setText("");
- else
- updateDescription(ui.voicesBox->currentText());
+ if(state == Qt::Unchecked)
+ ui.descriptionLabel->setText("");
+ else
+ updateDescription(ui.voicesBox->currentText());
}
void TTSFestivalGui::updateVoices()
{
- ui.voicesBox->clear();
- ui.voicesBox->addItem(tr("Loading.."));
+ ui.voicesBox->clear();
+ ui.voicesBox->addItem(tr("Loading.."));
- QStringList voiceList = festival->getVoiceList();
- ui.voicesBox->clear();
- ui.voicesBox->addItems(voiceList);
+ QStringList voiceList = festival->getVoiceList();
+ ui.voicesBox->clear();
+ ui.voicesBox->addItems(voiceList);
- ui.voicesBox->setCurrentIndex(ui.voicesBox->findText(settings->ttsVoice("festival")));
+ ui.voicesBox->setCurrentIndex(ui.voicesBox->findText(settings->ttsVoice("festival")));
- updateDescription(settings->ttsVoice("festival"));
+ updateDescription(settings->ttsVoice("festival"));
}
void TTSFestivalGui::updateDescription(QString value)
{
- if(ui.showDescriptionCheckbox->checkState() == Qt::Checked)
- {
- ui.descriptionLabel->setText(tr("Querying festival"));
- ui.descriptionLabel->setText(festival->getVoiceInfo(value));
- }
+ if(ui.showDescriptionCheckbox->checkState() == Qt::Checked)
+ {
+ ui.descriptionLabel->setText(tr("Querying festival"));
+ ui.descriptionLabel->setText(festival->getVoiceInfo(value));
+ }
}
+