Save the internal name for tts / encoder in the configuration file, not the displayed nice name. Additionally, kill a few warnings.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16233 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dominik Riebeling 2008-02-06 21:51:35 +00:00
parent cd31193948
commit c789f3a8a2
7 changed files with 69 additions and 66 deletions

View file

@ -26,56 +26,55 @@
static QMap<QString,QString> encoderList;
static QMap<QString,EncBase*> encoderCache;
void initEncoderList()
// initialize list of encoders
void initEncodernamesList()
{
encoderList["rbspeex"] = "Rockbox Speex Encoder";
encoderList["lame"] = "Lame Mp3 Encoder";
}
// function to get a specific encoder
EncBase* getEncoder(QString encname)
// get nice name for a specific encoder
QString getEncoderName(QString encoder)
{
if(encoderList.isEmpty())
initEncodernamesList();
return encoderList.value(encoder);
}
// get a specific encoder object
EncBase* getEncoder(QString encoder)
{
// init list if its empty
if(encoderList.count() == 0) initEncoderList();
QString encoder = encoderList.key(encname);
// check cache
if(encoderCache.contains(encoder))
return encoderCache.value(encoder);
EncBase* enc;
EncBase* enc;
if(encoder == "rbspeex")
{
enc = new EncRbSpeex();
encoderCache[encoder] = enc;
encoderCache[encoder] = enc;
return enc;
}
else if(encoder == "lame")
{
enc = new EncExes(encoder);
encoderCache[encoder] = enc;
encoderCache[encoder] = enc;
return enc;
}
else
return NULL;
}
// get the list of encoders, nice names
QStringList getEncoderList()
{
// init list if its empty
if(encoderList.count() == 0) initEncoderList();
QStringList encList;
QMapIterator<QString, QString> i(encoderList);
while (i.hasNext()) {
i.next();
encList << i.value();
}
return encList;
if(encoderList.isEmpty())
initEncodernamesList();
return encoderList.keys();
}