forked from len0rd/rockbox
rbutil: Pull voice-corrections.txt out of voicestrings.zip
If the corrections file is not present on the target, then fall back to the (probably outdated) compile-time builtin version. Change-Id: I9904b81b2f3737149fc8a905ecd03ff54782bbdf
This commit is contained in:
parent
bb20b5c6bf
commit
077f44ca41
6 changed files with 40 additions and 17 deletions
|
|
@ -277,14 +277,12 @@ QString TalkGenerator::correctString(const QString& s)
|
|||
return corrected;
|
||||
}
|
||||
|
||||
void TalkGenerator::setLang(const QString& name)
|
||||
void TalkGenerator::setLang(const QString& name, QFile *correctionsFile)
|
||||
{
|
||||
m_lang = name;
|
||||
|
||||
// re-initialize corrections list
|
||||
m_corrections.clear();
|
||||
QFile correctionsFile(":/builtin/voice-corrections.txt");
|
||||
correctionsFile.open(QIODevice::ReadOnly);
|
||||
correctionsFile->seek(0);
|
||||
|
||||
QString engine = RbSettings::value(RbSettings::Tts).toString();
|
||||
TTSBase* tts = TTSBase::getTTS(this, RbSettings::value(RbSettings::Tts).toString());
|
||||
|
|
@ -300,7 +298,7 @@ void TalkGenerator::setLang(const QString& name)
|
|||
m_lang = "english";
|
||||
LOG_INFO() << "building string corrections list for"
|
||||
<< m_lang << engine << vendor;
|
||||
QTextStream stream(&correctionsFile);
|
||||
QTextStream stream(correctionsFile);
|
||||
while(!stream.atEnd()) {
|
||||
QString line = stream.readLine();
|
||||
if(line.startsWith(" ") || line.length() < 10)
|
||||
|
|
@ -333,5 +331,4 @@ void TalkGenerator::setLang(const QString& name)
|
|||
co.modifier = items.at(5);
|
||||
m_corrections.append(co);
|
||||
}
|
||||
correctionsFile.close();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue