Centralize settings for executable based TTS systems.
The configuration values for executable based TTS systems is stored in member variables. Instead of reading them multiple times provide a function for that and move searching the executable to the loading function. Previously the executable was only searched in the path when opening the TTS configuration. Having this in the loading function removes that unnecessary step in case the TTS is in the path (and doesn't require additional configuration). Change-Id: I06799b55545dcb719ee3c916795b20e01c248a15
This commit is contained in:
parent
0ae49c2719
commit
4105c82e6b
2 changed files with 19 additions and 13 deletions
|
@ -37,13 +37,11 @@ TTSBase::Capabilities TTSExes::capabilities()
|
|||
|
||||
void TTSExes::generateSettings()
|
||||
{
|
||||
QString exepath =RbSettings::subValue(m_name,RbSettings::TtsPath).toString();
|
||||
if(exepath == "") exepath = Utils::findExecutable(m_name);
|
||||
|
||||
insertSetting(eEXEPATH,new EncTtsSetting(this,EncTtsSetting::eSTRING,
|
||||
tr("Path to TTS engine:"),exepath,EncTtsSetting::eBROWSEBTN));
|
||||
insertSetting(eOPTIONS,new EncTtsSetting(this,EncTtsSetting::eSTRING,
|
||||
tr("TTS engine options:"),RbSettings::subValue(m_name,RbSettings::TtsOptions)));
|
||||
loadSettings();
|
||||
insertSetting(eEXEPATH, new EncTtsSetting(this, EncTtsSetting::eSTRING,
|
||||
tr("Path to TTS engine:"), m_TTSexec, EncTtsSetting::eBROWSEBTN));
|
||||
insertSetting(eOPTIONS, new EncTtsSetting(this, EncTtsSetting::eSTRING,
|
||||
tr("TTS engine options:"), m_TTSOpts));
|
||||
}
|
||||
|
||||
void TTSExes::saveSettings()
|
||||
|
@ -55,11 +53,18 @@ void TTSExes::saveSettings()
|
|||
RbSettings::sync();
|
||||
}
|
||||
|
||||
bool TTSExes::start(QString *errStr)
|
||||
|
||||
void TTSExes::loadSettings(void)
|
||||
{
|
||||
m_TTSexec = RbSettings::subValue(m_name,RbSettings::TtsPath).toString();
|
||||
if(m_TTSexec.isEmpty()) m_TTSexec = Utils::findExecutable(m_name);
|
||||
m_TTSOpts = RbSettings::subValue(m_name,RbSettings::TtsOptions).toString();
|
||||
}
|
||||
|
||||
|
||||
bool TTSExes::start(QString *errStr)
|
||||
{
|
||||
loadSettings();
|
||||
m_TTSTemplate = m_TemplateMap.value(m_name);
|
||||
|
||||
QFileInfo tts(m_TTSexec);
|
||||
|
@ -96,10 +101,10 @@ TTSStatus TTSExes::voice(QString text,QString wavfile, QString *errStr)
|
|||
|
||||
bool TTSExes::configOk()
|
||||
{
|
||||
QString path = RbSettings::subValue(m_name,RbSettings::TtsPath).toString();
|
||||
|
||||
if (QFileInfo(path).exists())
|
||||
loadSettings();
|
||||
if (QFileInfo(m_TTSexec).exists())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ class TTSExes : public TTSBase
|
|||
bool configOk();
|
||||
|
||||
private:
|
||||
void loadSettings(void);
|
||||
QString m_name;
|
||||
QString m_TTSexec;
|
||||
QString m_TTSOpts;
|
||||
|
|
Loading…
Reference in a new issue