rbutil: remove encoder selection and bind it to selected device. (ie. lame for old archos, rbspeex for all others)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17439 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Dominik Wenger 2008-05-10 15:23:15 +00:00
parent a7a2baa97f
commit 251db06294
7 changed files with 125 additions and 73 deletions

View file

@ -80,8 +80,7 @@ Config::Config(QWidget *parent,int index) : QDialog(parent)
connect(ui.configTts, SIGNAL(clicked()), this, SLOT(configTts()));
connect(ui.configEncoder, SIGNAL(clicked()), this, SLOT(configEnc()));
connect(ui.comboTts, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTtsState(int)));
connect(ui.comboEncoder, SIGNAL(currentIndexChanged(int)), this, SLOT(updateEncState(int)));
}
@ -136,10 +135,7 @@ void Config::accept()
// tts settings
int i = ui.comboTts->currentIndex();
settings->setCurTTS(ui.comboTts->itemData(i).toString());
//encoder settings
i = ui.comboEncoder->currentIndex();
settings->setCurEncoder(ui.comboEncoder->itemData(i).toString());
// sync settings
settings->sync();
this->close();
@ -288,22 +284,14 @@ void Config::setDevices()
// tts / encoder tab
//encoders
int index;
QStringList encoders = EncBase::getEncoderList();
for(int a = 0; a < encoders.size(); a++)
ui.comboEncoder->addItem(EncBase::getEncoderName(encoders.at(a)), encoders.at(a));
//update index of combobox
index = ui.comboEncoder->findData(settings->curEncoder());
if(index < 0) index = 0;
ui.comboEncoder->setCurrentIndex(index);
updateEncState(index);
updateEncState();
//tts
QStringList ttslist = TTSBase::getTTSList();
for(int a = 0; a < ttslist.size(); a++)
ui.comboTts->addItem(TTSBase::getTTSName(ttslist.at(a)), ttslist.at(a));
//update index of combobox
index = ui.comboTts->findData(settings->curTTS());
int index = ui.comboTts->findData(settings->curTTS());
if(index < 0) index = 0;
ui.comboTts->setCurrentIndex(index);
updateTtsState(index);
@ -329,9 +317,10 @@ void Config::updateTtsState(int index)
}
}
void Config::updateEncState(int index)
void Config::updateEncState()
{
QString encoder = ui.comboEncoder->itemData(index).toString();
ui.encoderName->setText(EncBase::getEncoderName(settings->curEncoder()));
QString encoder = settings->curEncoder();
EncBase* enc = EncBase::getEncoder(encoder);
enc->setCfg(settings);
@ -612,10 +601,9 @@ void Config::configTts()
void Config::configEnc()
{
int index = ui.comboEncoder->currentIndex();
EncBase* enc = EncBase::getEncoder(ui.comboEncoder->itemData(index).toString());
EncBase* enc = EncBase::getEncoder(settings->curEncoder());
enc->setCfg(settings);
enc->showCfg();
updateEncState(ui.comboEncoder->currentIndex());
updateEncState();
}

View file

@ -70,7 +70,7 @@ class Config : public QDialog
void configTts(void);
void configEnc(void);
void updateTtsState(int);
void updateEncState(int);
void updateEncState();
};
#endif

View file

@ -26,11 +26,20 @@
<number>0</number>
</property>
<widget class="QWidget" name="tabDevice" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>476</width>
<height>366</height>
</rect>
</property>
<attribute name="title" >
<string>&amp;Device</string>
</attribute>
<attribute name="icon" >
<iconset resource="rbutilqt.qrc" >:/icons/rbutil.png</iconset>
<iconset resource="rbutilqt.qrc" >
<normaloff>:/icons/rbutil.png</normaloff>:/icons/rbutil.png</iconset>
</attribute>
<layout class="QGridLayout" >
<item row="0" column="0" >
@ -54,7 +63,8 @@
<string>&amp;Browse</string>
</property>
<property name="icon" >
<iconset resource="rbutilqt.qrc" >:/icons/system-search.png</iconset>
<iconset resource="rbutilqt.qrc" >
<normaloff>:/icons/system-search.png</normaloff>:/icons/system-search.png</iconset>
</property>
</widget>
</item>
@ -84,7 +94,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
@ -98,18 +108,28 @@
<string>&amp;Autodetect</string>
</property>
<property name="icon" >
<iconset resource="rbutilqt.qrc" >:/icons/edit-find.png</iconset>
<iconset resource="rbutilqt.qrc" >
<normaloff>:/icons/edit-find.png</normaloff>:/icons/edit-find.png</iconset>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabProxy" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>476</width>
<height>366</height>
</rect>
</property>
<attribute name="title" >
<string>&amp;Proxy</string>
</attribute>
<attribute name="icon" >
<iconset resource="rbutilqt.qrc" >:/icons/network-idle.png</iconset>
<iconset resource="rbutilqt.qrc" >
<normaloff>:/icons/network-idle.png</normaloff>:/icons/network-idle.png</iconset>
</attribute>
<layout class="QGridLayout" >
<item row="0" column="0" >
@ -210,7 +230,7 @@
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>40</height>
@ -221,11 +241,20 @@
</layout>
</widget>
<widget class="QWidget" name="tabLanguage" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>476</width>
<height>366</height>
</rect>
</property>
<attribute name="title" >
<string>&amp;Language</string>
</attribute>
<attribute name="icon" >
<iconset resource="rbutilqt.qrc" >:/icons/preferences-desktop-locale.png</iconset>
<iconset resource="rbutilqt.qrc" >
<normaloff>:/icons/preferences-desktop-locale.png</normaloff>:/icons/preferences-desktop-locale.png</iconset>
</attribute>
<layout class="QGridLayout" >
<item row="0" column="0" >
@ -234,11 +263,20 @@
</layout>
</widget>
<widget class="QWidget" name="tabCache" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>476</width>
<height>366</height>
</rect>
</property>
<attribute name="title" >
<string>Cac&amp;he</string>
</attribute>
<attribute name="icon" >
<iconset resource="rbutilqt.qrc" >:/icons/package-x-generic.png</iconset>
<iconset resource="rbutilqt.qrc" >
<normaloff>:/icons/package-x-generic.png</normaloff>:/icons/package-x-generic.png</iconset>
</attribute>
<attribute name="toolTip" >
<string>Download cache settings</string>
@ -286,7 +324,8 @@
<string>&amp;Browse</string>
</property>
<property name="icon" >
<iconset resource="rbutilqt.qrc" >:/icons/edit-find.png</iconset>
<iconset resource="rbutilqt.qrc" >
<normaloff>:/icons/edit-find.png</normaloff>:/icons/edit-find.png</iconset>
</property>
</widget>
</item>
@ -318,7 +357,7 @@
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>20</width>
<height>61</height>
@ -331,7 +370,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
@ -345,18 +384,28 @@
<string>Clean cache &amp;now</string>
</property>
<property name="icon" >
<iconset resource="rbutilqt.qrc" >:/icons/user-trash-full.png</iconset>
<iconset resource="rbutilqt.qrc" >
<normaloff>:/icons/user-trash-full.png</normaloff>:/icons/user-trash-full.png</iconset>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabTts" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>476</width>
<height>366</height>
</rect>
</property>
<attribute name="title" >
<string>&amp;TTS &amp;&amp; Encoder</string>
</attribute>
<attribute name="icon" >
<iconset resource="rbutilqt.qrc" >:/icons/audio-input-microphone.png</iconset>
<iconset resource="rbutilqt.qrc" >
<normaloff>:/icons/audio-input-microphone.png</normaloff>:/icons/audio-input-microphone.png</iconset>
</attribute>
<layout class="QVBoxLayout" >
<item>
@ -408,7 +457,8 @@
<string>Configure &amp;TTS</string>
</property>
<property name="icon" >
<iconset resource="rbutilqt.qrc" >:/icons/edit-find.png</iconset>
<iconset resource="rbutilqt.qrc" >
<normaloff>:/icons/edit-find.png</normaloff>:/icons/edit-find.png</iconset>
</property>
</widget>
</item>
@ -421,34 +471,14 @@
<string>Encoder Engine</string>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="labelEncoder" >
<property name="text" >
<string>Select &amp;encoder</string>
</property>
<property name="buddy" >
<cstring>comboEncoder</cstring>
</property>
</widget>
</item>
<item row="0" column="1" colspan="3" >
<widget class="QComboBox" name="comboEncoder" />
</item>
<item row="1" column="0" >
<widget class="QLabel" name="labelEncoderExecutable" >
<property name="text" >
<string>Configure encoder</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<item row="0" column="1" >
<widget class="QLabel" name="configEncstatus" >
<property name="text" >
<string>Configuration invalid !</string>
</property>
</widget>
</item>
<item row="1" column="2" >
<item row="0" column="2" >
<widget class="QLabel" name="configEncstatusimg" >
<property name="text" >
<string/>
@ -458,13 +488,21 @@
</property>
</widget>
</item>
<item row="1" column="3" >
<item row="0" column="3" >
<widget class="QPushButton" name="configEncoder" >
<property name="text" >
<string> Configure &amp;Enc</string>
</property>
<property name="icon" >
<iconset resource="rbutilqt.qrc" >:/icons/edit-find.png</iconset>
<iconset resource="rbutilqt.qrc" >
<normaloff>:/icons/edit-find.png</normaloff>:/icons/edit-find.png</iconset>
</property>
</widget>
</item>
<item row="0" column="0" >
<widget class="QLabel" name="encoderName" >
<property name="text" >
<string>encoder name</string>
</property>
</widget>
</item>
@ -476,7 +514,7 @@
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>458</width>
<height>131</height>
@ -493,7 +531,7 @@
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
@ -507,7 +545,8 @@
<string>&amp;Ok</string>
</property>
<property name="icon" >
<iconset resource="rbutilqt.qrc" >:/icons/go-next.png</iconset>
<iconset resource="rbutilqt.qrc" >
<normaloff>:/icons/go-next.png</normaloff>:/icons/go-next.png</iconset>
</property>
</widget>
</item>
@ -517,7 +556,8 @@
<string>&amp;Cancel</string>
</property>
<property name="icon" >
<iconset resource="rbutilqt.qrc" >:/icons/process-stop.png</iconset>
<iconset resource="rbutilqt.qrc" >
<normaloff>:/icons/process-stop.png</normaloff>:/icons/process-stop.png</iconset>
</property>
</widget>
</item>

View file

@ -253,7 +253,7 @@ QString RbSettings::curLang()
QString RbSettings::curEncoder()
{
return userSettings->value("encoder").toString();
return deviceSettingCurGet("encoder").toString();
}
QString RbSettings::curTTS()
@ -529,11 +529,6 @@ void RbSettings::setCurTTS(QString tts)
userSettings->setValue("tts",tts);
}
void RbSettings::setCurEncoder(QString enc)
{
userSettings->setValue("encoder",enc);
}
void RbSettings::setTTSPath(QString tts, QString path)
{
userSettingsGroupSet(tts,"ttspath",path);

View file

@ -116,7 +116,6 @@ class RbSettings : public QObject
void setCacheDisable(bool on);
void setCacheOffline(bool on);
void setCurTTS(QString tts);
void setCurEncoder(QString enc);
void setTTSPath(QString tts, QString path);
void setTTSOptions(QString tts, QString options);
void setTTSSpeed(QString tts, int speed);

View file

@ -62,6 +62,7 @@ manualname=
brand=Archos
voicename=player
targetid=1
encoder=lame
[recorder]
name="Jukebox Recorder 6 / 10 / 15 / 20"
@ -75,6 +76,7 @@ manualname=
brand=Archos
voicename=recorder
targetid=2
encoder=lame
[recorder8mb]
name="Jukebox Recorder 6 / 10 / 15 / 20 (with 8MiB memory)"
@ -88,6 +90,7 @@ manualname=rockbox-recorder
brand=Archos
voicename=recorder
targetid=2
encoder=lame
[recorderv2]
name="Jukebox Recorder v2 (20GB)"
@ -101,6 +104,7 @@ manualname=
brand=Archos
voicename=recorderv2
targetid=4
encoder=lame
[fmrecorder]
name="Jukebox Recorder FM"
@ -114,6 +118,7 @@ manualname=
brand=Archos
voicename=fmrecorder
targetid=3
encoder=lame
[fmrecorder8mb]
name="Jukebox Recorder FM (with 8MiB memory)"
@ -127,6 +132,7 @@ manualname=rockbox-fmrecorder
brand=Archos
voicename=fmrecorder
targetid=3
encoder=lame
[ondiosp]
name="Ondio SP"
@ -140,6 +146,7 @@ manualname=
brand=Archos
voicename=ondiosp
targetid=7
encoder=lame
[ondiofm]
name="Ondio FM"
@ -153,6 +160,7 @@ manualname=
brand=Archos
voicename=ondiofm
targetid=8
encoder=lame
[h100]
name="iHP100 / iHP110"
@ -167,6 +175,7 @@ brand=Iriver
usbid=0x10063001
voicename=h100
targetid=11
encoder=rbspeex
[h120]
name="iHP120 / iHP140 / H120 / H140"
@ -181,6 +190,7 @@ brand=Iriver
usbid=0x10063002
voicename=h120
targetid=9
encoder=rbspeex
[h300]
name="H320 / H340"
@ -195,6 +205,7 @@ brand=Iriver
usbid=0x10063003
voicename=h300
targetid=10
encoder=rbspeex
[h10_5gbums]
name="H10 (5 / 6GB) UMS"
@ -209,6 +220,7 @@ brand=Iriver
usbid=0x41022002
voicename=h10_5gb
targetid=24
encoder=rbspeex
[h10_5gbmtp]
name="H10 (5 / 6GB) MTP"
@ -223,6 +235,7 @@ brand=Iriver
usbid=0x41022105
voicename=h10_5gb
targetid=24
encoder=rbspeex
[h10]
name="H10 (20GB)"
@ -238,6 +251,7 @@ usbid=0x0b7000ba
usberror=0x41022101
voicename=h10
targetid=22
encoder=rbspeex
[ipod1g2g]
name="Ipod (1st / 2nd gen)"
@ -251,6 +265,7 @@ manualname=
brand=Apple
voicename=ipod1g2g
targetid=29
encoder=rbspeex
[ipodcolor]
name="Ipod Colour / Photo / U2 (4th gen)"
@ -264,6 +279,7 @@ manualname=
brand=Apple
voicename=ipodcolor
targetid=13
encoder=rbspeex
[ipodnano]
name="Ipod Nano (1st gen)"
@ -278,6 +294,7 @@ brand=Apple
usbincompat=0x05ac1260
voicename=ipodnano
targetid=14
encoder=rbspeex
[ipod4gray]
name="Ipod (4th gen, greyscale)"
@ -291,6 +308,7 @@ manualname=
brand=Apple
voicename=ipod4gray
targetid=17
encoder=rbspeex
[ipodvideo]
name="Ipod Video (5th gen) 30GB"
@ -304,6 +322,7 @@ manualname=
brand=Apple
voicename=ipodvideo
targetid=15
encoder=rbspeex
[ipodvideo64mb]
name="Ipod Video (5th gen) 60/80GB"
@ -318,6 +337,7 @@ brand=Apple
voicename=ipodvideo
usbincompat=0x05ac1261
targetid=15
encoder=rbspeex
[ipod3g]
name="Ipod (3rd gen)"
@ -332,6 +352,7 @@ brand=Apple
usbid=0x05ac1201
voicename=ipod3g
targetid=16
encoder=rbspeex
[ipodmini1g]
name="Ipod Mini (1st gen)"
@ -345,6 +366,7 @@ manualname=rockbox-ipodmini2g
brand=Apple
voicename=ipodmini1g
targetid=18
encoder=rbspeex
[ipodmini2g]
name="Ipod Mini (2nd gen)"
@ -358,6 +380,7 @@ manualname=rockbox-ipodmini2g
brand=Apple
voicename=ipodmini2g
targetid=21
encoder=rbspeex
[iaudiox5]
name="iAudio X5 / X5L"
@ -372,6 +395,7 @@ brand=Cowon
usbid=0x0e210510, 0x0e210513
voicename=iaudiox5
targetid=12
encoder=rbspeex
[iaudiox5v]
name="iAudio X5V"
@ -385,6 +409,7 @@ manualname=
brand=Cowon
voicename=iaudiox5v
targetid=12
encoder=rbspeex
[iaudiom5]
name="iAudio M5 / M5L"
@ -399,6 +424,7 @@ brand=Cowon
usbid=0x0e210520
voicename=iaudiom5
targetid=28
encoder=rbspeex
[iaudiom3]
name="iAudio M3 / M3L"
@ -413,7 +439,7 @@ brand=Cowon
usbid=0x0e210500
voicename=iaudiom3
targetid=37
encoder=rbspeex
[gigabeatf]
name="Gigabeat F / X"
@ -427,6 +453,7 @@ brand=Toshiba
usbid=0x09300009
voicename=gigabeatf
targetid=20
encoder=rbspeex
[sansae200]
name="Sansa E200"
@ -443,6 +470,7 @@ usberror=0x07810720
usbincompat=0x07817422, 0x07817423
voicename=sansae200
targetid=23
encoder=rbspeex
[sansac200]
name="Sansa C200"
@ -457,6 +485,7 @@ brand=Sandisk
usbid=0x07817450, 0x07817451
voicename=sansac200
targetid=30
encoder=rbspeex
[mrobe100]
name="m:robe100"
@ -471,6 +500,7 @@ brand=Olympus
usbid=0x07b40280
voicename=mrobe100
targetid=33
encoder=rbspeex
[languages]
lang1=africaans

View file

@ -203,7 +203,7 @@ bool TTSSapi::start(QString *errStr)
return false;
}
if(!voicescript->waitForReadyRead(100))
if(!voicescript->waitForReadyRead(300))
{
*errStr = voicescript->readAllStandardError();
if(*errStr != "")