Rockbox open source high quality audio player as a Music Player Daemon
mpris rockbox mpd libadwaita audio rust zig deno
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

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

+69 -66
+21 -15
rbutil/rbutilqt/configure.cpp
··· 134 134 settings->setCacheOffline(ui.cacheOfflineMode->isChecked()); 135 135 136 136 // tts settings 137 - settings->setCurTTS(ui.comboTts->currentText()); 137 + int i = ui.comboTts->currentIndex(); 138 + settings->setCurTTS(ui.comboTts->itemData(i).toString()); 138 139 //encoder settings 139 - settings->setCurEncoder(ui.comboEncoder->currentText()); 140 + i = ui.comboEncoder->currentIndex(); 141 + settings->setCurEncoder(ui.comboEncoder->itemData(i).toString()); 140 142 141 143 // sync settings 142 144 settings->sync(); ··· 286 288 // tts / encoder tab 287 289 288 290 //encoders 289 - ui.comboEncoder->addItems(getEncoderList()); 290 - 291 + int index; 292 + QStringList encoders = getEncoderList(); 293 + for(int a = 0; a < encoders.size(); a++) 294 + ui.comboEncoder->addItem(getEncoderName(encoders.at(a)), encoders.at(a)); 291 295 //update index of combobox 292 - int index = ui.comboEncoder->findText(settings->curEncoder(),Qt::MatchExactly); 296 + index = ui.comboEncoder->findData(settings->curEncoder()); 293 297 if(index < 0) index = 0; 294 298 ui.comboEncoder->setCurrentIndex(index); 295 299 updateEncState(index); 296 - 300 + 297 301 //tts 298 - ui.comboTts->addItems(getTTSList()); 299 - 300 - 302 + QStringList ttslist = getTTSList(); 303 + for(int a = 0; a < ttslist.size(); a++) 304 + ui.comboTts->addItem(getTTSName(ttslist.at(a)), ttslist.at(a)); 301 305 //update index of combobox 302 - index = ui.comboTts->findText(settings->curTTS(),Qt::MatchExactly); 306 + index = ui.comboTts->findData(settings->curTTS()); 303 307 if(index < 0) index = 0; 304 308 ui.comboTts->setCurrentIndex(index); 305 309 updateTtsState(index); ··· 309 313 310 314 void Config::updateTtsState(int index) 311 315 { 312 - QString ttsName = ui.comboTts->itemText(index); 316 + QString ttsName = ui.comboTts->itemData(index).toString(); 313 317 TTSBase* tts = getTTS(ttsName); 314 318 tts->setCfg(settings); 315 319 ··· 322 326 { 323 327 ui.configTTSstatus->setText("Configuration INVALID"); 324 328 ui.configTTSstatusimg->setPixmap(QPixmap(QString::fromUtf8(":/icons/icons/dialog-error.png"))); 325 - } 329 + } 326 330 } 327 331 328 332 void Config::updateEncState(int index) 329 333 { 330 - QString encoder = ui.comboEncoder->itemText(index); 334 + QString encoder = ui.comboEncoder->itemData(index).toString(); 331 335 EncBase* enc = getEncoder(encoder); 332 336 enc->setCfg(settings); 333 337 ··· 583 587 584 588 void Config::configTts() 585 589 { 586 - TTSBase* tts =getTTS(ui.comboTts->currentText()); 590 + int index = ui.comboTts->currentIndex(); 591 + TTSBase* tts = getTTS(ui.comboTts->itemData(index).toString()); 587 592 588 593 tts->setCfg(settings); 589 594 tts->showCfg(); ··· 593 598 594 599 void Config::configEnc() 595 600 { 596 - EncBase* enc =getEncoder(ui.comboEncoder->currentText()); 601 + int index = ui.comboEncoder->currentIndex(); 602 + EncBase* enc = getEncoder(ui.comboEncoder->itemData(index).toString()); 597 603 598 604 enc->setCfg(settings); 599 605 enc->showCfg();
+2 -2
rbutil/rbutilqt/createvoicewindow.cpp
··· 94 94 TTSBase* tts = getTTS(ttsName); 95 95 tts->setCfg(settings); 96 96 if(tts->configOk()) 97 - ui.labelTtsProfile->setText(tr("Selected TTS engine : <b>%1</b>").arg(ttsName)); 97 + ui.labelTtsProfile->setText(tr("Selected TTS engine : <b>%1</b>").arg(getTTSName(ttsName))); 98 98 else 99 99 ui.labelTtsProfile->setText(tr("Selected TTS Engine: <b>%1</b>").arg("Invalid TTS configuration!")); 100 100 ··· 104 104 if(enc != NULL) { 105 105 enc->setCfg(settings); 106 106 if(enc->configOk()) 107 - ui.labelEncProfile->setText(tr("Selected Encoder: <b>%1</b>").arg(encoder)); 107 + ui.labelEncProfile->setText(tr("Selected Encoder: <b>%1</b>").arg(getEncoderName(encoder))); 108 108 else 109 109 ui.labelEncProfile->setText(tr("Selected Encoder: <b>%1</b>").arg("Invalid encoder configuration!")); 110 110 }
+24 -25
rbutil/rbutilqt/encoders.cpp
··· 26 26 27 27 static QMap<QString,QString> encoderList; 28 28 static QMap<QString,EncBase*> encoderCache; 29 - 30 - void initEncoderList() 29 + 30 + 31 + // initialize list of encoders 32 + void initEncodernamesList() 31 33 { 32 34 encoderList["rbspeex"] = "Rockbox Speex Encoder"; 33 35 encoderList["lame"] = "Lame Mp3 Encoder"; 34 36 } 35 37 36 - // function to get a specific encoder 37 - EncBase* getEncoder(QString encname) 38 + 39 + // get nice name for a specific encoder 40 + QString getEncoderName(QString encoder) 41 + { 42 + if(encoderList.isEmpty()) 43 + initEncodernamesList(); 44 + return encoderList.value(encoder); 45 + } 46 + 47 + 48 + // get a specific encoder object 49 + EncBase* getEncoder(QString encoder) 38 50 { 39 - // init list if its empty 40 - if(encoderList.count() == 0) initEncoderList(); 41 - 42 - QString encoder = encoderList.key(encname); 43 - 44 51 // check cache 45 52 if(encoderCache.contains(encoder)) 46 53 return encoderCache.value(encoder); 47 - 48 - EncBase* enc; 54 + 55 + EncBase* enc; 49 56 if(encoder == "rbspeex") 50 57 { 51 58 enc = new EncRbSpeex(); 52 - encoderCache[encoder] = enc; 59 + encoderCache[encoder] = enc; 53 60 return enc; 54 61 } 55 62 else if(encoder == "lame") 56 63 { 57 64 enc = new EncExes(encoder); 58 - encoderCache[encoder] = enc; 65 + encoderCache[encoder] = enc; 59 66 return enc; 60 67 } 61 68 else 62 69 return NULL; 63 70 } 64 71 65 - // get the list of encoders, nice names 72 + 66 73 QStringList getEncoderList() 67 74 { 68 - // init list if its empty 69 - if(encoderList.count() == 0) initEncoderList(); 70 - 71 - QStringList encList; 72 - QMapIterator<QString, QString> i(encoderList); 73 - while (i.hasNext()) { 74 - i.next(); 75 - encList << i.value(); 76 - } 77 - 78 - return encList; 75 + if(encoderList.isEmpty()) 76 + initEncodernamesList(); 77 + return encoderList.keys(); 79 78 } 80 79 81 80
+5 -3
rbutil/rbutilqt/encoders.h
··· 32 32 class EncBase; 33 33 34 34 //inits the encoder List 35 - void initEncoderList(); 35 + void initEncodernamesList(void); 36 36 // function to get a specific encoder 37 37 EncBase* getEncoder(QString encname); 38 38 // get the list of encoders, nice names 39 - QStringList getEncoderList(); 39 + QString getEncoderName(QString encoder); 40 + QStringList getEncoderList(void); 40 41 41 42 42 43 class EncBase : public QDialog ··· 45 46 public: 46 47 EncBase(QWidget *parent ); 47 48 48 - virtual bool encode(QString input,QString output){return false;} 49 + virtual bool encode(QString input,QString output) 50 + {(void)input; (void)output; return false;} 49 51 virtual bool start(){return false;} 50 52 virtual bool stop(){return false;} 51 53 virtual void showCfg(){}
+2 -2
rbutil/rbutilqt/installtalkwindow.cpp
··· 114 114 TTSBase* tts = getTTS(ttsName); 115 115 tts->setCfg(settings); 116 116 if(tts->configOk()) 117 - ui.labelTtsProfile->setText(tr("Selected TTS engine : <b>%1</b>").arg(ttsName)); 117 + ui.labelTtsProfile->setText(tr("Selected TTS engine : <b>%1</b>").arg(getTTSName(ttsName))); 118 118 else 119 119 ui.labelTtsProfile->setText(tr("Selected TTS Engine: <b>%1</b>").arg("Invalid TTS configuration!")); 120 120 ··· 123 123 if(enc != NULL) { 124 124 enc->setCfg(settings); 125 125 if(enc->configOk()) 126 - ui.labelEncProfile->setText(tr("Selected Encoder: <b>%1</b>").arg(encoder)); 126 + ui.labelEncProfile->setText(tr("Selected Encoder: <b>%1</b>").arg(getEncoderName(encoder))); 127 127 else 128 128 ui.labelEncProfile->setText(tr("Selected Encoder: <b>%1</b>").arg("Invalid encoder configuration!")); 129 129 }
+12 -17
rbutil/rbutilqt/tts.cpp
··· 36 36 } 37 37 38 38 // function to get a specific encoder 39 - TTSBase* getTTS(QString ttsname) 39 + TTSBase* getTTS(QString ttsName) 40 40 { 41 - // init list if its empty 42 - if(ttsList.count() == 0) initTTSList(); 43 - 44 - QString ttsName = ttsList.key(ttsname); 45 - 46 41 // check cache 47 42 if(ttsCache.contains(ttsName)) 48 43 return ttsCache.value(ttsName); 49 - 50 - TTSBase* tts; 44 + 45 + TTSBase* tts; 51 46 if(ttsName == "sapi") 52 47 { 53 48 tts = new TTSSapi(); ··· 66 61 QStringList getTTSList() 67 62 { 68 63 // init list if its empty 69 - if(ttsList.count() == 0) initTTSList(); 64 + if(ttsList.count() == 0) 65 + initTTSList(); 70 66 71 - QStringList ttsNameList; 72 - QMapIterator<QString, QString> i(ttsList); 73 - while (i.hasNext()) { 74 - i.next(); 75 - ttsNameList << i.value(); 76 - } 77 - 78 - return ttsNameList; 67 + return ttsList.keys(); 79 68 } 80 69 70 + QString getTTSName(QString tts) 71 + { 72 + if(ttsList.isEmpty()) 73 + initTTSList(); 74 + return ttsList.value(tts); 75 + } 81 76 82 77 /********************************************************************* 83 78 * TTS Base
+3 -2
rbutil/rbutilqt/tts.h
··· 37 37 TTSBase* getTTS(QString ttsname); 38 38 // get the list of tts, nice names 39 39 QStringList getTTSList(); 40 + QString getTTSName(QString tts); 40 41 41 42 42 43 class TTSBase : public QObject ··· 44 45 Q_OBJECT 45 46 public: 46 47 TTSBase(); 47 - virtual bool voice(QString text,QString wavfile) {return false;} 48 - virtual bool start(QString *errStr){return false;} 48 + virtual bool voice(QString text,QString wavfile) {(void)text; (void)wavfile; return false;} 49 + virtual bool start(QString *errStr){(void)errStr; return false;} 49 50 virtual bool stop(){return false;} 50 51 virtual void showCfg(){} 51 52 virtual bool configOk(){return false;}