From 251db062949edf0adb89ae609a53919d9a348e6e Mon Sep 17 00:00:00 2001 From: Dominik Wenger Date: Sat, 10 May 2008 15:23:15 +0000 Subject: [PATCH] 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 --- rbutil/rbutilqt/configure.cpp | 30 +++----- rbutil/rbutilqt/configure.h | 2 +- rbutil/rbutilqt/configurefrm.ui | 124 +++++++++++++++++++++----------- rbutil/rbutilqt/rbsettings.cpp | 7 +- rbutil/rbutilqt/rbsettings.h | 1 - rbutil/rbutilqt/rbutil.ini | 32 ++++++++- rbutil/rbutilqt/tts.cpp | 2 +- 7 files changed, 125 insertions(+), 73 deletions(-) diff --git a/rbutil/rbutilqt/configure.cpp b/rbutil/rbutilqt/configure.cpp index ab926f1aa0..68b8fb571d 100644 --- a/rbutil/rbutilqt/configure.cpp +++ b/rbutil/rbutilqt/configure.cpp @@ -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(); } diff --git a/rbutil/rbutilqt/configure.h b/rbutil/rbutilqt/configure.h index 55f2838537..22adc29b71 100644 --- a/rbutil/rbutilqt/configure.h +++ b/rbutil/rbutilqt/configure.h @@ -70,7 +70,7 @@ class Config : public QDialog void configTts(void); void configEnc(void); void updateTtsState(int); - void updateEncState(int); + void updateEncState(); }; #endif diff --git a/rbutil/rbutilqt/configurefrm.ui b/rbutil/rbutilqt/configurefrm.ui index 4c2d3c9b68..943eb238f1 100644 --- a/rbutil/rbutilqt/configurefrm.ui +++ b/rbutil/rbutilqt/configurefrm.ui @@ -26,11 +26,20 @@ 0 + + + 0 + 0 + 476 + 366 + + &Device - :/icons/rbutil.png + + :/icons/rbutil.png:/icons/rbutil.png @@ -54,7 +63,8 @@ &Browse - :/icons/system-search.png + + :/icons/system-search.png:/icons/system-search.png @@ -84,7 +94,7 @@ Qt::Horizontal - + 40 20 @@ -98,18 +108,28 @@ &Autodetect - :/icons/edit-find.png + + :/icons/edit-find.png:/icons/edit-find.png + + + 0 + 0 + 476 + 366 + + &Proxy - :/icons/network-idle.png + + :/icons/network-idle.png:/icons/network-idle.png @@ -210,7 +230,7 @@ Qt::Vertical - + 20 40 @@ -221,11 +241,20 @@ + + + 0 + 0 + 476 + 366 + + &Language - :/icons/preferences-desktop-locale.png + + :/icons/preferences-desktop-locale.png:/icons/preferences-desktop-locale.png @@ -234,11 +263,20 @@ + + + 0 + 0 + 476 + 366 + + Cac&he - :/icons/package-x-generic.png + + :/icons/package-x-generic.png:/icons/package-x-generic.png Download cache settings @@ -286,7 +324,8 @@ &Browse - :/icons/edit-find.png + + :/icons/edit-find.png:/icons/edit-find.png @@ -318,7 +357,7 @@ Qt::Vertical - + 20 61 @@ -331,7 +370,7 @@ Qt::Horizontal - + 40 20 @@ -345,18 +384,28 @@ Clean cache &now - :/icons/user-trash-full.png + + :/icons/user-trash-full.png:/icons/user-trash-full.png + + + 0 + 0 + 476 + 366 + + &TTS && Encoder - :/icons/audio-input-microphone.png + + :/icons/audio-input-microphone.png:/icons/audio-input-microphone.png @@ -408,7 +457,8 @@ Configure &TTS - :/icons/edit-find.png + + :/icons/edit-find.png:/icons/edit-find.png @@ -421,34 +471,14 @@ Encoder Engine - - - - Select &encoder - - - comboEncoder - - - - - - - - - - Configure encoder - - - - + Configuration invalid ! - + @@ -458,13 +488,21 @@ - + Configure &Enc - :/icons/edit-find.png + + :/icons/edit-find.png:/icons/edit-find.png + + + + + + + encoder name @@ -476,7 +514,7 @@ Qt::Vertical - + 458 131 @@ -493,7 +531,7 @@ Qt::Horizontal - + 40 20 @@ -507,7 +545,8 @@ &Ok - :/icons/go-next.png + + :/icons/go-next.png:/icons/go-next.png @@ -517,7 +556,8 @@ &Cancel - :/icons/process-stop.png + + :/icons/process-stop.png:/icons/process-stop.png diff --git a/rbutil/rbutilqt/rbsettings.cpp b/rbutil/rbutilqt/rbsettings.cpp index 4d1e56aef1..1bb0f73db7 100644 --- a/rbutil/rbutilqt/rbsettings.cpp +++ b/rbutil/rbutilqt/rbsettings.cpp @@ -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); diff --git a/rbutil/rbutilqt/rbsettings.h b/rbutil/rbutilqt/rbsettings.h index d650471682..f833c5320f 100644 --- a/rbutil/rbutilqt/rbsettings.h +++ b/rbutil/rbutilqt/rbsettings.h @@ -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); diff --git a/rbutil/rbutilqt/rbutil.ini b/rbutil/rbutilqt/rbutil.ini index bcdbf25723..ae56e9375a 100644 --- a/rbutil/rbutilqt/rbutil.ini +++ b/rbutil/rbutilqt/rbutil.ini @@ -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 diff --git a/rbutil/rbutilqt/tts.cpp b/rbutil/rbutilqt/tts.cpp index 538ac257f9..c377cb2dc5 100644 --- a/rbutil/rbutilqt/tts.cpp +++ b/rbutil/rbutilqt/tts.cpp @@ -203,7 +203,7 @@ bool TTSSapi::start(QString *errStr) return false; } - if(!voicescript->waitForReadyRead(100)) + if(!voicescript->waitForReadyRead(300)) { *errStr = voicescript->readAllStandardError(); if(*errStr != "")