1
0
Fork 0
forked from len0rd/rockbox

Code police:

- kill trailing whitespace
- replace tabs by spaces


git-svn-id: svn://svn.rockbox.org/rockbox/trunk@20623 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dominik Riebeling 2009-04-05 12:46:41 +00:00
parent f3af25f5b7
commit baef133f5f
6 changed files with 474 additions and 469 deletions

View file

@ -58,9 +58,9 @@ TTSBase* TTSBase::getTTS(QString ttsName)
#if defined(Q_OS_LINUX)
if (ttsName == "festival")
{
tts = new TTSFestival();
ttsCache[ttsName] = tts;
return tts;
tts = new TTSFestival();
ttsCache[ttsName] = tts;
return tts;
}
else
#endif
@ -169,7 +169,7 @@ bool TTSExes::start(QString *errStr)
TTSStatus TTSExes::voice(QString text,QString wavfile, QString *errStr)
{
(void) errStr;
(void) errStr;
QString execstring = m_TTSTemplate;
execstring.replace("%exe",m_TTSexec);
@ -187,7 +187,7 @@ void TTSExes::showCfg()
#ifndef CONSOLE
TTSExesGui gui;
#else
TTSExesGuiCli gui;
TTSExesGuiCli gui;
#endif
gui.setCfg(settings);
gui.showCfg(m_name);
@ -308,10 +308,11 @@ QStringList TTSSapi::getVoiceList(QString language)
delete voicescript;
QFile::setPermissions(QDir::tempPath() +"/sapi_voice.vbs",QFile::ReadOwner |QFile::WriteOwner|QFile::ExeOwner
|QFile::ReadUser| QFile::WriteUser| QFile::ExeUser
|QFile::ReadGroup |QFile::WriteGroup |QFile::ExeGroup
|QFile::ReadOther |QFile::WriteOther |QFile::ExeOther );
QFile::setPermissions(QDir::tempPath() +"/sapi_voice.vbs",
QFile::ReadOwner |QFile::WriteOwner |QFile::ExeOwner
|QFile::ReadUser |QFile::WriteUser |QFile::ExeUser
|QFile::ReadGroup |QFile::WriteGroup |QFile::ExeGroup
|QFile::ReadOther |QFile::WriteOther |QFile::ExeOther);
QFile::remove(QDir::tempPath() +"/sapi_voice.vbs");
return result;
@ -321,7 +322,7 @@ QStringList TTSSapi::getVoiceList(QString language)
TTSStatus TTSSapi::voice(QString text,QString wavfile, QString *errStr)
{
(void) errStr;
(void) errStr;
QString query = "SPEAK\t"+wavfile+"\t"+text+"\r\n";
qDebug() << "voicing" << query;
*voicestream << query;
@ -339,10 +340,11 @@ bool TTSSapi::stop()
voicescript->waitForFinished();
delete voicestream;
delete voicescript;
QFile::setPermissions(QDir::tempPath() +"/sapi_voice.vbs",QFile::ReadOwner |QFile::WriteOwner|QFile::ExeOwner
|QFile::ReadUser| QFile::WriteUser| QFile::ExeUser
|QFile::ReadGroup |QFile::WriteGroup |QFile::ExeGroup
|QFile::ReadOther |QFile::WriteOther |QFile::ExeOther );
QFile::setPermissions(QDir::tempPath() +"/sapi_voice.vbs",
QFile::ReadOwner |QFile::WriteOwner |QFile::ExeOwner
|QFile::ReadUser |QFile::WriteUser |QFile::ExeUser
|QFile::ReadGroup |QFile::WriteGroup |QFile::ExeGroup
|QFile::ReadOther |QFile::WriteOther |QFile::ExeOther);
QFile::remove(QDir::tempPath() +"/sapi_voice.vbs");
return true;
}
@ -353,7 +355,7 @@ void TTSSapi::showCfg()
#ifndef CONSOLE
TTSSapiGui gui(this);
#else
TTSSapiGuiCli gui(this);
TTSSapiGuiCli gui(this);
#endif
gui.setCfg(settings);
gui.showCfg();
@ -370,104 +372,104 @@ bool TTSSapi::configOk()
**********************************************************************/
TTSFestival::~TTSFestival()
{
stop();
stop();
}
void TTSFestival::startServer()
{
if(!configOk())
return;
if(!configOk())
return;
QStringList paths = settings->ttsPath("festival").split(":");
QStringList paths = settings->ttsPath("festival").split(":");
serverProcess.start(QString("%1 --server").arg(paths[0]));
serverProcess.waitForStarted();
serverProcess.start(QString("%1 --server").arg(paths[0]));
serverProcess.waitForStarted();
queryServer("(getpid)");
if(serverProcess.state() == QProcess::Running)
qDebug() << "Festival is up and running";
else
qDebug() << "Festival failed to start";
queryServer("(getpid)");
if(serverProcess.state() == QProcess::Running)
qDebug() << "Festival is up and running";
else
qDebug() << "Festival failed to start";
}
void TTSFestival::ensureServerRunning()
{
if(serverProcess.state() != QProcess::Running)
{
// least common denominator for all the server startup code paths
QProgressDialog progressDialog(tr(""), tr(""), 0, 0);
progressDialog.setWindowTitle(tr("Starting festival"));
progressDialog.setModal(true);
progressDialog.setLabel(0);
progressDialog.setCancelButton(0);
progressDialog.show();
if(serverProcess.state() != QProcess::Running)
{
// least common denominator for all the server startup code paths
QProgressDialog progressDialog(tr(""), tr(""), 0, 0);
progressDialog.setWindowTitle(tr("Starting festival"));
progressDialog.setModal(true);
progressDialog.setLabel(0);
progressDialog.setCancelButton(0);
progressDialog.show();
QApplication::processEvents(); // actually show the dialog
QApplication::processEvents(); // actually show the dialog
startServer();
}
startServer();
}
}
bool TTSFestival::start(QString* errStr)
{
(void) errStr;
ensureServerRunning();
if (!settings->ttsVoice("festival").isEmpty())
queryServer(QString("(voice.select '%1)").arg(settings->ttsVoice("festival")));
(void) errStr;
ensureServerRunning();
if (!settings->ttsVoice("festival").isEmpty())
queryServer(QString("(voice.select '%1)").arg(settings->ttsVoice("festival")));
return true;
return true;
}
bool TTSFestival::stop()
{
serverProcess.terminate();
serverProcess.kill();
serverProcess.terminate();
serverProcess.kill();
return true;
return true;
}
TTSStatus TTSFestival::voice(QString text, QString wavfile, QString* errStr)
{
qDebug() << text << "->" << wavfile;
qDebug() << text << "->" << wavfile;
QStringList paths = settings->ttsPath("festival").split(":");
QString cmd = QString("%1 --server localhost --otype riff --ttw --withlisp --output \"%2\" - ").arg(paths[1]).arg(wavfile);
qDebug() << cmd;
QStringList paths = settings->ttsPath("festival").split(":");
QString cmd = QString("%1 --server localhost --otype riff --ttw --withlisp --output \"%2\" - ").arg(paths[1]).arg(wavfile);
qDebug() << cmd;
QProcess clientProcess;
clientProcess.start(cmd);
clientProcess.write(QString("%1.\n").arg(text).toAscii());
clientProcess.waitForBytesWritten();
clientProcess.closeWriteChannel();
clientProcess.waitForReadyRead();
QString response = clientProcess.readAll();
response = response.trimmed();
if(!response.contains("Utterance"))
{
qDebug() << "Could not voice string: " << response;
*errStr = tr("engine could not voice string");
return Warning;
/* do not stop the voicing process because of a single string
TODO: needs proper settings */
}
clientProcess.closeReadChannel(QProcess::StandardError);
clientProcess.closeReadChannel(QProcess::StandardOutput);
clientProcess.terminate();
clientProcess.kill();
QProcess clientProcess;
clientProcess.start(cmd);
clientProcess.write(QString("%1.\n").arg(text).toAscii());
clientProcess.waitForBytesWritten();
clientProcess.closeWriteChannel();
clientProcess.waitForReadyRead();
QString response = clientProcess.readAll();
response = response.trimmed();
if(!response.contains("Utterance"))
{
qDebug() << "Could not voice string: " << response;
*errStr = tr("engine could not voice string");
return Warning;
/* do not stop the voicing process because of a single string
TODO: needs proper settings */
}
clientProcess.closeReadChannel(QProcess::StandardError);
clientProcess.closeReadChannel(QProcess::StandardOutput);
clientProcess.terminate();
clientProcess.kill();
return NoError;
return NoError;
}
bool TTSFestival::configOk()
{
QStringList paths = settings->ttsPath("festival").split(":");
if(paths.size() != 2)
return false;
bool ret = QFileInfo(paths[0]).isExecutable() &&
QFileInfo(paths[1]).isExecutable();
if(settings->ttsVoice("festival").size() > 0 && voices.size() > 0)
ret = ret && (voices.indexOf(settings->ttsVoice("festival")) != -1);
return ret;
QStringList paths = settings->ttsPath("festival").split(":");
if(paths.size() != 2)
return false;
bool ret = QFileInfo(paths[0]).isExecutable() &&
QFileInfo(paths[1]).isExecutable();
if(settings->ttsVoice("festival").size() > 0 && voices.size() > 0)
ret = ret && (voices.indexOf(settings->ttsVoice("festival")) != -1);
return ret;
}
void TTSFestival::showCfg()
@ -481,138 +483,138 @@ void TTSFestival::showCfg()
QStringList TTSFestival::getVoiceList()
{
if(!configOk())
return QStringList();
if(!configOk())
return QStringList();
if(voices.size() > 0)
{
qDebug() << "Using voice cache";
return voices;
}
QString response = queryServer("(voice.list)");
if(voices.size() > 0)
{
qDebug() << "Using voice cache";
return voices;
}
QString response = queryServer("(voice.list)");
// get the 2nd line. It should be (<voice_name>, <voice_name>)
response = response.mid(response.indexOf('\n') + 1, -1);
response = response.left(response.indexOf('\n')).trimmed();
// get the 2nd line. It should be (<voice_name>, <voice_name>)
response = response.mid(response.indexOf('\n') + 1, -1);
response = response.left(response.indexOf('\n')).trimmed();
voices = response.mid(1, response.size()-2).split(' ');
voices = response.mid(1, response.size()-2).split(' ');
voices.sort();
if (voices.size() == 1 && voices[0].size() == 0)
voices.removeAt(0);
if (voices.size() > 0)
qDebug() << "Voices: " << voices;
else
qDebug() << "No voices.";
return voices;
voices.sort();
if (voices.size() == 1 && voices[0].size() == 0)
voices.removeAt(0);
if (voices.size() > 0)
qDebug() << "Voices: " << voices;
else
qDebug() << "No voices.";
return voices;
}
QString TTSFestival::getVoiceInfo(QString voice)
{
if(!configOk())
return "";
if(!configOk())
return "";
if(!getVoiceList().contains(voice))
return "";
if(!getVoiceList().contains(voice))
return "";
if(voiceDescriptions.contains(voice))
return voiceDescriptions[voice];
if(voiceDescriptions.contains(voice))
return voiceDescriptions[voice];
QString response = queryServer(QString("(voice.description '%1)").arg(voice), 3000);
QString response = queryServer(QString("(voice.description '%1)").arg(voice), 3000);
if (response == "")
{
voiceDescriptions[voice]=tr("No description available");
}
else
{
response = response.remove(QRegExp("(description \"*\")", Qt::CaseInsensitive, QRegExp::Wildcard));
qDebug() << "voiceInfo w/o descr: " << response;
response = response.remove(')');
QStringList responseLines = response.split('(', QString::SkipEmptyParts);
responseLines.removeAt(0); // the voice name itself
if (response == "")
{
voiceDescriptions[voice]=tr("No description available");
}
else
{
response = response.remove(QRegExp("(description \"*\")", Qt::CaseInsensitive, QRegExp::Wildcard));
qDebug() << "voiceInfo w/o descr: " << response;
response = response.remove(')');
QStringList responseLines = response.split('(', QString::SkipEmptyParts);
responseLines.removeAt(0); // the voice name itself
QString description;
foreach(QString line, responseLines)
{
line = line.remove('(');
line = line.simplified();
QString description;
foreach(QString line, responseLines)
{
line = line.remove('(');
line = line.simplified();
line[0] = line[0].toUpper(); // capitalize the key
line[0] = line[0].toUpper(); // capitalize the key
int firstSpace = line.indexOf(' ');
if (firstSpace > 0)
{
line = line.insert(firstSpace, ':'); // add a colon between the key and the value
line[firstSpace+2] = line[firstSpace+2].toUpper(); // capitalize the value
}
int firstSpace = line.indexOf(' ');
if (firstSpace > 0)
{
line = line.insert(firstSpace, ':'); // add a colon between the key and the value
line[firstSpace+2] = line[firstSpace+2].toUpper(); // capitalize the value
}
description += line + "\n";
}
voiceDescriptions[voice] = description.trimmed();
}
return voiceDescriptions[voice];
description += line + "\n";
}
voiceDescriptions[voice] = description.trimmed();
}
return voiceDescriptions[voice];
}
QString TTSFestival::queryServer(QString query, int timeout)
{
if(!configOk())
return "";
if(!configOk())
return "";
ensureServerRunning();
ensureServerRunning();
qDebug() << "queryServer with " << query;
QString response;
qDebug() << "queryServer with " << query;
QString response;
QDateTime endTime;
if(timeout > 0)
endTime = QDateTime::currentDateTime().addMSecs(timeout);
QDateTime endTime;
if(timeout > 0)
endTime = QDateTime::currentDateTime().addMSecs(timeout);
/* Festival is *extremely* unreliable. Although at this
* point we are sure that SIOD is accepting commands,
* we might end up with an empty response. Hence, the loop.
*/
while(true)
{
QApplication::processEvents(QEventLoop::AllEvents, 50);
QTcpSocket socket;
/* Festival is *extremely* unreliable. Although at this
* point we are sure that SIOD is accepting commands,
* we might end up with an empty response. Hence, the loop.
*/
while(true)
{
QApplication::processEvents(QEventLoop::AllEvents, 50);
QTcpSocket socket;
socket.connectToHost("localhost", 1314);
socket.waitForConnected();
socket.connectToHost("localhost", 1314);
socket.waitForConnected();
if(socket.state() == QAbstractSocket::ConnectedState)
{
socket.write(QString("%1\n").arg(query).toAscii());
socket.waitForBytesWritten();
socket.waitForReadyRead();
if(socket.state() == QAbstractSocket::ConnectedState)
{
socket.write(QString("%1\n").arg(query).toAscii());
socket.waitForBytesWritten();
socket.waitForReadyRead();
response = socket.readAll().trimmed();
response = socket.readAll().trimmed();
if (response != "LP" && response != "")
break;
}
socket.abort();
socket.disconnectFromHost();
if (response != "LP" && response != "")
break;
}
socket.abort();
socket.disconnectFromHost();
if(timeout > 0 && QDateTime::currentDateTime() >= endTime)
return "";
if(timeout > 0 && QDateTime::currentDateTime() >= endTime)
return "";
/* make sure we wait a little as we don't want to flood the server with requests */
QDateTime tmpEndTime = QDateTime::currentDateTime().addMSecs(500);
while(QDateTime::currentDateTime() < tmpEndTime)
QApplication::processEvents(QEventLoop::AllEvents);
}
if(response == "nil")
return "";
/* make sure we wait a little as we don't want to flood the server with requests */
QDateTime tmpEndTime = QDateTime::currentDateTime().addMSecs(500);
while(QDateTime::currentDateTime() < tmpEndTime)
QApplication::processEvents(QEventLoop::AllEvents);
}
if(response == "nil")
return "";
QStringList lines = response.split('\n');
if(lines.size() > 2)
{
lines.removeFirst();
lines.removeLast();
}
else
qDebug() << "Response too short: " << response;
return lines.join("\n");
QStringList lines = response.split('\n');
if(lines.size() > 2)
{
lines.removeFirst();
lines.removeLast();
}
else
qDebug() << "Response too short: " << response;
return lines.join("\n");
}

View file

@ -60,8 +60,8 @@ class TTSBase : public QObject
static QStringList getTTSList();
static QString getTTSName(QString tts);
public slots:
virtual void accept(void){}
public slots:
virtual void accept(void){}
virtual void reject(void){}
virtual void reset(void){}
@ -77,7 +77,7 @@ class TTSBase : public QObject
class TTSSapi : public TTSBase
{
Q_OBJECT
Q_OBJECT
public:
TTSSapi();
virtual TTSStatus voice(QString text,QString wavfile, QString *errStr);
@ -125,24 +125,24 @@ class TTSExes : public TTSBase
class TTSFestival : public TTSBase
{
Q_OBJECT
public:
~TTSFestival();
virtual bool configOk();
virtual bool start(QString *errStr);
virtual bool stop();
virtual void showCfg();
virtual TTSStatus voice(QString text,QString wavfile, QString *errStr);
Q_OBJECT
public:
~TTSFestival();
virtual bool configOk();
virtual bool start(QString *errStr);
virtual bool stop();
virtual void showCfg();
virtual TTSStatus voice(QString text,QString wavfile, QString *errStr);
QStringList getVoiceList();
QString getVoiceInfo(QString voice);
private:
inline void startServer();
inline void ensureServerRunning();
QString queryServer(QString query, int timeout = -1);
QProcess serverProcess;
QStringList voices;
QMap<QString, QString> voiceDescriptions;
QStringList getVoiceList();
QString getVoiceInfo(QString voice);
private:
inline void startServer();
inline void ensureServerRunning();
QString queryServer(QString query, int timeout = -1);
QProcess serverProcess;
QStringList voices;
QMap<QString, QString> voiceDescriptions;
};
#endif

View file

@ -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");
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();
// 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]);
}
// 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->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);
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);
}
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);
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);
}
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);
/* 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();
}
if(newPath != oldPath)
{
qDebug() << "Using new paths for getVoiceList";
settings->setTTSPath("festival", newPath);
settings->sync();
}
updateVoices();
updateVoices();
if(newPath != oldPath)
{
settings->setTTSPath("festival", oldPath);
settings->sync();
}
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));
}
}

View file

@ -34,71 +34,72 @@ class TTSFestival;
class TTSSapiGui : public QDialog
{
Q_OBJECT
public:
TTSSapiGui(TTSSapi* sapi,QDialog* parent = NULL);
Q_OBJECT
public:
TTSSapiGui(TTSSapi* sapi,QDialog* parent = NULL);
void showCfg();
void setCfg(RbSettings* sett){settings = sett;}
public slots:
void showCfg();
void setCfg(RbSettings* sett){settings = sett;}
public slots:
virtual void accept(void);
virtual void reject(void);
virtual void reset(void);
void updateVoices(QString language);
void useSapi4Changed(int);
private:
Ui::SapiCfgFrm ui;
RbSettings* settings;
TTSSapi* m_sapi;
virtual void accept(void);
virtual void reject(void);
virtual void reset(void);
void updateVoices(QString language);
void useSapi4Changed(int);
private:
Ui::SapiCfgFrm ui;
RbSettings* settings;
TTSSapi* m_sapi;
};
class TTSExesGui : public QDialog
{
Q_OBJECT
public:
TTSExesGui(QDialog* parent = NULL);
Q_OBJECT
public:
TTSExesGui(QDialog* parent = NULL);
void showCfg(QString m_name);
void setCfg(RbSettings* sett){settings = sett;}
void showCfg(QString m_name);
void setCfg(RbSettings* sett){settings = sett;}
public slots:
virtual void accept(void);
virtual void reject(void);
virtual void reset(void);
void browse(void);
private:
Ui::TTSExesCfgFrm ui;
RbSettings* settings;
QString m_name;
public slots:
virtual void accept(void);
virtual void reject(void);
virtual void reset(void);
void browse(void);
private:
Ui::TTSExesCfgFrm ui;
RbSettings* settings;
QString m_name;
};
class TTSFestivalGui : public QDialog
{
Q_OBJECT
public:
TTSFestivalGui(TTSFestival* festival, QDialog* parent = NULL);
Q_OBJECT
public:
TTSFestivalGui(TTSFestival* festival, QDialog* parent = NULL);
void showCfg();
void setCfg(RbSettings* sett){settings = sett;}
void showCfg();
void setCfg(RbSettings* sett){settings = sett;}
public slots:
virtual void accept(void);
virtual void reject(void);
//virtual void reset(void);
public slots:
virtual void accept(void);
virtual void reject(void);
//virtual void reset(void);
void onRefreshButton();
void onShowDescription(int state);
void onBrowseServer();
void onBrowseClient();
private:
Ui::TTSFestivalCfgFrm ui;
RbSettings* settings;
TTSFestival* festival;
void onRefreshButton();
void onShowDescription(int state);
void onBrowseServer();
void onBrowseClient();
private:
Ui::TTSFestivalCfgFrm ui;
RbSettings* settings;
TTSFestival* festival;
void updateVoices();
private slots:
void updateDescription(QString value);
void updateVoices();
private slots:
void updateDescription(QString value);
};
#endif

View file

@ -81,3 +81,4 @@ private:
};
#endif