summaryrefslogtreecommitdiffstats
path: root/rbutil/rbutilqt/base/ttsexes.cpp
diff options
context:
space:
mode:
authorDominik Riebeling <Dominik.Riebeling@gmail.com>2012-01-29 15:36:52 +0100
committerDominik Riebeling <Dominik.Riebeling@gmail.com>2012-01-29 22:55:18 +0100
commit4105c82e6bb6cf5407256af736405ddff437c25f (patch)
tree6924252f8aa128bd6d9aae3a46932e8075861bec /rbutil/rbutilqt/base/ttsexes.cpp
parent0ae49c2719b9b2cceab33ad1c6b44873b38e71b1 (diff)
downloadrockbox-4105c82e6bb6cf5407256af736405ddff437c25f.tar.gz
rockbox-4105c82e6bb6cf5407256af736405ddff437c25f.tar.bz2
rockbox-4105c82e6bb6cf5407256af736405ddff437c25f.zip
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
Diffstat (limited to 'rbutil/rbutilqt/base/ttsexes.cpp')
-rw-r--r--rbutil/rbutilqt/base/ttsexes.cpp31
1 files changed, 18 insertions, 13 deletions
diff --git a/rbutil/rbutilqt/base/ttsexes.cpp b/rbutil/rbutilqt/base/ttsexes.cpp
index 5e06b950bd..9e24044e5b 100644
--- a/rbutil/rbutilqt/base/ttsexes.cpp
+++ b/rbutil/rbutilqt/base/ttsexes.cpp
@@ -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;
}
+