diff options
-rw-r--r-- | rbutil/rbutilqt/configure.cpp | 141 | ||||
-rw-r--r-- | rbutil/rbutilqt/configure.h | 4 | ||||
-rw-r--r-- | rbutil/rbutilqt/configurefrm.ui | 46 | ||||
-rw-r--r-- | rbutil/rbutilqt/installtalkwindow.cpp | 23 | ||||
-rw-r--r-- | rbutil/rbutilqt/rbspeexcfgfrm.ui | 154 | ||||
-rw-r--r-- | rbutil/rbutilqt/rbutil.ini | 30 | ||||
-rw-r--r-- | rbutil/rbutilqt/rbutilqt.cpp | 2 | ||||
-rw-r--r-- | rbutil/rbutilqt/rbutilqt.pro | 14 | ||||
-rw-r--r-- | rbutil/rbutilqt/talkfile.cpp | 66 | ||||
-rw-r--r-- | rbutil/rbutilqt/talkfile.h | 28 |
10 files changed, 281 insertions, 227 deletions
diff --git a/rbutil/rbutilqt/configure.cpp b/rbutil/rbutilqt/configure.cpp index d2ce59eff8..810435ab68 100644 --- a/rbutil/rbutilqt/configure.cpp +++ b/rbutil/rbutilqt/configure.cpp | |||
@@ -23,6 +23,7 @@ | |||
23 | #include "autodetection.h" | 23 | #include "autodetection.h" |
24 | #include "ui_configurefrm.h" | 24 | #include "ui_configurefrm.h" |
25 | #include "browsedirtree.h" | 25 | #include "browsedirtree.h" |
26 | #include "encoders.h" | ||
26 | 27 | ||
27 | #include <stdio.h> | 28 | #include <stdio.h> |
28 | #if defined(Q_OS_WIN32) | 29 | #if defined(Q_OS_WIN32) |
@@ -75,9 +76,10 @@ Config::Config(QWidget *parent) : QDialog(parent) | |||
75 | connect(ui.buttonCacheBrowse, SIGNAL(clicked()), this, SLOT(browseCache())); | 76 | connect(ui.buttonCacheBrowse, SIGNAL(clicked()), this, SLOT(browseCache())); |
76 | connect(ui.buttonCacheClear, SIGNAL(clicked()), this, SLOT(cacheClear())); | 77 | connect(ui.buttonCacheClear, SIGNAL(clicked()), this, SLOT(cacheClear())); |
77 | connect(ui.browseTts, SIGNAL(clicked()), this, SLOT(browseTts())); | 78 | connect(ui.browseTts, SIGNAL(clicked()), this, SLOT(browseTts())); |
78 | connect(ui.browseEncoder, SIGNAL(clicked()), this, SLOT(browseEnc())); | 79 | connect(ui.configEncoder, SIGNAL(clicked()), this, SLOT(configEnc())); |
79 | connect(ui.comboEncoder, SIGNAL(currentIndexChanged(int)), this, SLOT(updateEncOpts(int))); | ||
80 | connect(ui.comboTts, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTtsOpts(int))); | 80 | connect(ui.comboTts, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTtsOpts(int))); |
81 | connect(ui.comboEncoder, SIGNAL(currentIndexChanged(int)), this, SLOT(updateEncState(int))); | ||
82 | |||
81 | } | 83 | } |
82 | 84 | ||
83 | 85 | ||
@@ -144,20 +146,9 @@ void Config::accept() | |||
144 | devices->endGroup(); | 146 | devices->endGroup(); |
145 | userSettings->endGroup(); | 147 | userSettings->endGroup(); |
146 | 148 | ||
147 | //encoder settings | 149 | //encoder settings |
148 | preset = ui.comboEncoder->itemData(ui.comboEncoder->currentIndex(), Qt::UserRole).toString(); | 150 | userSettings->setValue("encoder",ui.comboEncoder->currentText()); |
149 | userSettings->setValue("encpreset", preset); | 151 | |
150 | userSettings->beginGroup(preset); | ||
151 | |||
152 | if(QFileInfo(ui.encoderExecutable->text()).isExecutable()) | ||
153 | userSettings->setValue("binary", ui.encoderExecutable->text()); | ||
154 | userSettings->setValue("options", ui.encoderOptions->text()); | ||
155 | devices->beginGroup(preset); | ||
156 | userSettings->setValue("template", devices->value("template").toString()); | ||
157 | userSettings->setValue("type", devices->value("tts").toString()); | ||
158 | devices->endGroup(); | ||
159 | userSettings->endGroup(); | ||
160 | |||
161 | // sync settings | 152 | // sync settings |
162 | userSettings->sync(); | 153 | userSettings->sync(); |
163 | this->close(); | 154 | this->close(); |
@@ -314,17 +305,19 @@ void Config::setDevices(QSettings *dev) | |||
314 | ui.treeDevices->setCurrentItem(w3); // hilight old selection | 305 | ui.treeDevices->setCurrentItem(w3); // hilight old selection |
315 | 306 | ||
316 | // tts / encoder tab | 307 | // tts / encoder tab |
317 | QStringList keys; | 308 | |
318 | 309 | //encoders | |
319 | devices->beginGroup("encoders"); | 310 | ui.comboEncoder->addItems(getEncoderList()); |
320 | keys = devices->allKeys(); | 311 | |
321 | for(int i=0; i < keys.size();i++) | 312 | //update index of combobox |
322 | ui.comboEncoder->addItem(devices->value(keys.at(i), "null").toString(), | 313 | int index = ui.comboEncoder->findText(userSettings->value("encoder").toString(),Qt::MatchExactly); |
323 | keys.at(i)); | 314 | if(index < 0) index = 0; |
324 | devices->endGroup(); | 315 | ui.comboEncoder->setCurrentIndex(index); |
325 | 316 | updateEncState(index); | |
317 | |||
318 | //tts | ||
326 | devices->beginGroup("tts"); | 319 | devices->beginGroup("tts"); |
327 | keys = devices->allKeys(); | 320 | QStringList keys = devices->allKeys(); |
328 | for(int i=0; i < keys.size();i++) | 321 | for(int i=0; i < keys.size();i++) |
329 | { | 322 | { |
330 | devices->endGroup(); | 323 | devices->endGroup(); |
@@ -343,67 +336,13 @@ void Config::setDevices(QSettings *dev) | |||
343 | } | 336 | } |
344 | devices->endGroup(); | 337 | devices->endGroup(); |
345 | 338 | ||
346 | int index; | 339 | |
347 | index = ui.comboTts->findData(userSettings->value("ttspreset").toString(), | 340 | index = ui.comboTts->findData(userSettings->value("ttspreset").toString(), |
348 | Qt::UserRole, Qt::MatchExactly); | 341 | Qt::UserRole, Qt::MatchExactly); |
349 | if(index < 0) index = 0; | 342 | if(index < 0) index = 0; |
350 | ui.comboTts->setCurrentIndex(index); | 343 | ui.comboTts->setCurrentIndex(index); |
351 | updateTtsOpts(index); | 344 | updateTtsOpts(index); |
352 | 345 | ||
353 | index = ui.comboEncoder->findData(userSettings->value("encpreset").toString(), | ||
354 | Qt::UserRole, Qt::MatchExactly); | ||
355 | if(index < 0) index = 0; | ||
356 | ui.comboEncoder->setCurrentIndex(index); | ||
357 | updateEncOpts(index); | ||
358 | |||
359 | } | ||
360 | |||
361 | |||
362 | void Config::updateEncOpts(int index) | ||
363 | { | ||
364 | qDebug() << "updateEncOpts()"; | ||
365 | QString e; | ||
366 | bool edit; | ||
367 | QString c = ui.comboEncoder->itemData(index, Qt::UserRole).toString(); | ||
368 | devices->beginGroup(c); | ||
369 | ui.encoderOptions->setText(devices->value("options").toString()); | ||
370 | edit = devices->value("edit").toBool(); | ||
371 | ui.encoderOptions->setEnabled(edit); | ||
372 | e = devices->value("encoder").toString(); | ||
373 | devices->endGroup(); | ||
374 | |||
375 | // try to autodetect encoder | ||
376 | #if defined(Q_OS_LINUX) || defined(Q_OS_MACX) | ||
377 | QStringList path = QString(getenv("PATH")).split(":", QString::SkipEmptyParts); | ||
378 | #elif defined(Q_OS_WIN) | ||
379 | QStringList path = QString(getenv("PATH")).split(";", QString::SkipEmptyParts); | ||
380 | #endif | ||
381 | qDebug() << path; | ||
382 | ui.encoderExecutable->setEnabled(true); | ||
383 | for(int i = 0; i < path.size(); i++) { | ||
384 | QString executable = QDir::fromNativeSeparators(path.at(i)) + "/" + e; | ||
385 | #if defined(Q_OS_WIN) | ||
386 | executable += ".exe"; | ||
387 | QStringList ex = executable.split("\"", QString::SkipEmptyParts); | ||
388 | executable = ex.join(""); | ||
389 | #endif | ||
390 | if(QFileInfo(executable).isExecutable()) { | ||
391 | qDebug() << "found:" << executable; | ||
392 | ui.encoderExecutable->setText(QDir::toNativeSeparators(executable)); | ||
393 | // disallow changing the detected path if non-customizable profile | ||
394 | if(!edit) | ||
395 | ui.encoderExecutable->setEnabled(false); | ||
396 | break; | ||
397 | } | ||
398 | } | ||
399 | |||
400 | //user settings | ||
401 | userSettings->beginGroup(c); | ||
402 | QString temp = userSettings->value("binary","null").toString(); | ||
403 | if(temp != "null") ui.encoderExecutable->setText(temp); | ||
404 | temp = userSettings->value("options","null").toString(); | ||
405 | if(temp != "null") ui.encoderOptions->setText(temp); | ||
406 | userSettings->endGroup(); | ||
407 | 346 | ||
408 | } | 347 | } |
409 | 348 | ||
@@ -459,6 +398,23 @@ void Config::updateTtsOpts(int index) | |||
459 | userSettings->endGroup(); | 398 | userSettings->endGroup(); |
460 | } | 399 | } |
461 | 400 | ||
401 | void Config::updateEncState(int index) | ||
402 | { | ||
403 | QString encoder = ui.comboEncoder->itemText(index); | ||
404 | EncBase* enc = getEncoder(encoder); | ||
405 | enc->setUserCfg(userSettings); | ||
406 | |||
407 | if(enc->configOk()) | ||
408 | { | ||
409 | ui.configstatus->setText("Configuration OK"); | ||
410 | ui.configstatusimg->setPixmap(QPixmap(QString::fromUtf8(":/icons/icons/go-next.png"))); | ||
411 | } | ||
412 | else | ||
413 | { | ||
414 | ui.configstatus->setText("Configuration INVALID"); | ||
415 | ui.configstatusimg->setPixmap(QPixmap(QString::fromUtf8(":/icons/icons/dialog-error.png"))); | ||
416 | } | ||
417 | } | ||
462 | 418 | ||
463 | void Config::setNoProxy(bool checked) | 419 | void Config::setNoProxy(bool checked) |
464 | { | 420 | { |
@@ -741,22 +697,11 @@ void Config::browseTts() | |||
741 | } | 697 | } |
742 | 698 | ||
743 | 699 | ||
744 | void Config::browseEnc() | 700 | void Config::configEnc() |
745 | { | 701 | { |
746 | BrowseDirtree browser(this); | 702 | EncBase* enc =getEncoder(ui.comboEncoder->currentText()); |
747 | browser.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot); | 703 | |
748 | 704 | enc->setUserCfg(userSettings); | |
749 | if(QFileInfo(ui.encoderExecutable->text()).isDir()) | 705 | enc->showCfg(); |
750 | { | 706 | updateEncState(ui.comboEncoder->currentIndex()); |
751 | browser.setDir(ui.encoderExecutable->text()); | ||
752 | } | ||
753 | if(browser.exec() == QDialog::Accepted) | ||
754 | { | ||
755 | qDebug() << browser.getSelected(); | ||
756 | QString exe = browser.getSelected(); | ||
757 | if(!QFileInfo(exe).isExecutable()) | ||
758 | return; | ||
759 | ui.encoderExecutable->setText(exe); | ||
760 | } | ||
761 | |||
762 | } | 707 | } |
diff --git a/rbutil/rbutilqt/configure.h b/rbutil/rbutilqt/configure.h index a0e5977706..07c6e19eb5 100644 --- a/rbutil/rbutilqt/configure.h +++ b/rbutil/rbutilqt/configure.h | |||
@@ -65,9 +65,9 @@ class Config : public QDialog | |||
65 | void setCache(QString); | 65 | void setCache(QString); |
66 | void cacheClear(void); | 66 | void cacheClear(void); |
67 | void browseTts(void); | 67 | void browseTts(void); |
68 | void browseEnc(void); | 68 | void configEnc(void); |
69 | void updateTtsOpts(int); | 69 | void updateTtsOpts(int); |
70 | void updateEncOpts(int); | 70 | void updateEncState(int); |
71 | }; | 71 | }; |
72 | 72 | ||
73 | #endif | 73 | #endif |
diff --git a/rbutil/rbutilqt/configurefrm.ui b/rbutil/rbutilqt/configurefrm.ui index c68ea42dfc..78bb929af0 100644 --- a/rbutil/rbutilqt/configurefrm.ui +++ b/rbutil/rbutilqt/configurefrm.ui | |||
@@ -359,7 +359,7 @@ | |||
359 | <iconset resource="rbutilqt.qrc" >:/icons/icons/audio-input-microphone.png</iconset> | 359 | <iconset resource="rbutilqt.qrc" >:/icons/icons/audio-input-microphone.png</iconset> |
360 | </attribute> | 360 | </attribute> |
361 | <layout class="QGridLayout" > | 361 | <layout class="QGridLayout" > |
362 | <item row="0" column="0" colspan="2" > | 362 | <item row="0" column="0" > |
363 | <widget class="QGroupBox" name="groupBox_2" > | 363 | <widget class="QGroupBox" name="groupBox_2" > |
364 | <property name="title" > | 364 | <property name="title" > |
365 | <string>TTS Engine</string> | 365 | <string>TTS Engine</string> |
@@ -427,7 +427,7 @@ | |||
427 | </layout> | 427 | </layout> |
428 | </widget> | 428 | </widget> |
429 | </item> | 429 | </item> |
430 | <item rowspan="2" row="1" column="0" colspan="2" > | 430 | <item row="1" column="0" > |
431 | <widget class="QGroupBox" name="groupBox_3" > | 431 | <widget class="QGroupBox" name="groupBox_3" > |
432 | <property name="title" > | 432 | <property name="title" > |
433 | <string>Encoder Engine</string> | 433 | <string>Encoder Engine</string> |
@@ -436,64 +436,62 @@ | |||
436 | <item row="0" column="0" > | 436 | <item row="0" column="0" > |
437 | <widget class="QLabel" name="labelEncoder" > | 437 | <widget class="QLabel" name="labelEncoder" > |
438 | <property name="text" > | 438 | <property name="text" > |
439 | <string>Select &encoder profile</string> | 439 | <string>Select &encoder</string> |
440 | </property> | 440 | </property> |
441 | <property name="buddy" > | 441 | <property name="buddy" > |
442 | <cstring>comboEncoder</cstring> | 442 | <cstring>comboEncoder</cstring> |
443 | </property> | 443 | </property> |
444 | </widget> | 444 | </widget> |
445 | </item> | 445 | </item> |
446 | <item row="0" column="1" colspan="2" > | 446 | <item row="0" column="1" colspan="3" > |
447 | <widget class="QComboBox" name="comboEncoder" /> | 447 | <widget class="QComboBox" name="comboEncoder" /> |
448 | </item> | 448 | </item> |
449 | <item row="1" column="0" > | 449 | <item row="1" column="0" > |
450 | <widget class="QLabel" name="labelEncoderExecutable" > | 450 | <widget class="QLabel" name="labelEncoderExecutable" > |
451 | <property name="text" > | 451 | <property name="text" > |
452 | <string>Encoder executable</string> | 452 | <string>Configure encoder</string> |
453 | </property> | ||
454 | <property name="buddy" > | ||
455 | <cstring>encoderExecutable</cstring> | ||
456 | </property> | 453 | </property> |
457 | </widget> | 454 | </widget> |
458 | </item> | 455 | </item> |
459 | <item row="1" column="1" > | 456 | <item row="1" column="1" > |
460 | <widget class="QLineEdit" name="encoderExecutable" /> | 457 | <widget class="QLabel" name="configstatus" > |
458 | <property name="text" > | ||
459 | <string>Configuration invalid !</string> | ||
460 | </property> | ||
461 | </widget> | ||
461 | </item> | 462 | </item> |
462 | <item row="1" column="2" > | 463 | <item row="1" column="2" > |
463 | <widget class="QPushButton" name="browseEncoder" > | 464 | <widget class="QLabel" name="configstatusimg" > |
464 | <property name="text" > | 465 | <property name="text" > |
465 | <string>B&rowse</string> | 466 | <string/> |
466 | </property> | 467 | </property> |
467 | <property name="icon" > | 468 | <property name="pixmap" > |
468 | <iconset resource="rbutilqt.qrc" >:/icons/icons/edit-find.png</iconset> | 469 | <pixmap resource="rbutilqt.qrc" >:/icons/icons/dialog-error.png</pixmap> |
469 | </property> | 470 | </property> |
470 | </widget> | 471 | </widget> |
471 | </item> | 472 | </item> |
472 | <item row="2" column="0" > | 473 | <item row="1" column="3" > |
473 | <widget class="QLabel" name="labelEncoderOptions" > | 474 | <widget class="QPushButton" name="configEncoder" > |
474 | <property name="text" > | 475 | <property name="text" > |
475 | <string>Encoder options</string> | 476 | <string>&Configure</string> |
476 | </property> | 477 | </property> |
477 | <property name="buddy" > | 478 | <property name="icon" > |
478 | <cstring>encoderOptions</cstring> | 479 | <iconset resource="rbutilqt.qrc" >:/icons/icons/edit-find.png</iconset> |
479 | </property> | 480 | </property> |
480 | </widget> | 481 | </widget> |
481 | </item> | 482 | </item> |
482 | <item row="2" column="1" colspan="2" > | ||
483 | <widget class="QLineEdit" name="encoderOptions" /> | ||
484 | </item> | ||
485 | </layout> | 483 | </layout> |
486 | </widget> | 484 | </widget> |
487 | </item> | 485 | </item> |
488 | <item row="3" column="0" > | 486 | <item row="2" column="0" > |
489 | <spacer> | 487 | <spacer> |
490 | <property name="orientation" > | 488 | <property name="orientation" > |
491 | <enum>Qt::Vertical</enum> | 489 | <enum>Qt::Vertical</enum> |
492 | </property> | 490 | </property> |
493 | <property name="sizeHint" > | 491 | <property name="sizeHint" > |
494 | <size> | 492 | <size> |
495 | <width>20</width> | 493 | <width>226</width> |
496 | <height>40</height> | 494 | <height>51</height> |
497 | </size> | 495 | </size> |
498 | </property> | 496 | </property> |
499 | </spacer> | 497 | </spacer> |
diff --git a/rbutil/rbutilqt/installtalkwindow.cpp b/rbutil/rbutilqt/installtalkwindow.cpp index bd05911035..9b8b5d943a 100644 --- a/rbutil/rbutilqt/installtalkwindow.cpp +++ b/rbutil/rbutilqt/installtalkwindow.cpp | |||
@@ -114,6 +114,7 @@ void InstallTalkWindow::accept() | |||
114 | 114 | ||
115 | userSettings->sync(); | 115 | userSettings->sync(); |
116 | 116 | ||
117 | talkcreator->setUserSettings(userSettings); | ||
117 | talkcreator->setDir(QDir(folderToTalk)); | 118 | talkcreator->setDir(QDir(folderToTalk)); |
118 | talkcreator->setMountPoint(userSettings->value("mountpoint").toString()); | 119 | talkcreator->setMountPoint(userSettings->value("mountpoint").toString()); |
119 | talkcreator->setTTSexe(pathTTS); | 120 | talkcreator->setTTSexe(pathTTS); |
@@ -121,11 +122,6 @@ void InstallTalkWindow::accept() | |||
121 | talkcreator->setTTsLanguage(ttsLanguage); | 122 | talkcreator->setTTsLanguage(ttsLanguage); |
122 | talkcreator->setTTsType(ttsType); | 123 | talkcreator->setTTsType(ttsType); |
123 | talkcreator->setTTsTemplate(ttsTemplate); | 124 | talkcreator->setTTsTemplate(ttsTemplate); |
124 | |||
125 | talkcreator->setEncexe(pathEncoder); | ||
126 | talkcreator->setEncOpts(encOpts); | ||
127 | talkcreator->setEncTemplate(encTemplate); | ||
128 | talkcreator->setEncType(encType); | ||
129 | 125 | ||
130 | talkcreator->setOverwriteTalk(ui.OverwriteTalk->isChecked()); | 126 | talkcreator->setOverwriteTalk(ui.OverwriteTalk->isChecked()); |
131 | talkcreator->setOverwriteWav(ui.OverwriteWav->isChecked()); | 127 | talkcreator->setOverwriteWav(ui.OverwriteWav->isChecked()); |
@@ -152,17 +148,16 @@ void InstallTalkWindow::setDeviceSettings(QSettings *dev) | |||
152 | .arg(devices->value(profile, tr("Invalid TTS profile!")).toString())); | 148 | .arg(devices->value(profile, tr("Invalid TTS profile!")).toString())); |
153 | qDebug() << profile; | 149 | qDebug() << profile; |
154 | devices->endGroup(); | 150 | devices->endGroup(); |
155 | profile = userSettings->value("encpreset", "none").toString(); | 151 | |
156 | devices->beginGroup("encoders"); | 152 | QString encoder = userSettings->value("encoder", "none").toString(); |
157 | ui.labelEncProfile->setText(tr("Encoder Profile: <b>%1</b>") | 153 | EncBase* enc = getEncoder(encoder); |
158 | .arg(devices->value(profile, tr("Invalid encoder profile!")).toString())); | 154 | enc->setUserCfg(userSettings); |
159 | qDebug() << profile; | 155 | if(enc->configOk()) |
160 | devices->endGroup(); | 156 | ui.labelEncProfile->setText(tr("Selected Encoder: <b>%1</b>").arg(encoder)); |
157 | else | ||
158 | ui.labelEncProfile->setText(tr("Selected Encoder: <b>%1</b>").arg("Invalid encoder configuration!")); | ||
161 | } | 159 | } |
162 | 160 | ||
163 | |||
164 | |||
165 | |||
166 | void InstallTalkWindow::setUserSettings(QSettings *user) | 161 | void InstallTalkWindow::setUserSettings(QSettings *user) |
167 | { | 162 | { |
168 | userSettings = user; | 163 | userSettings = user; |
diff --git a/rbutil/rbutilqt/rbspeexcfgfrm.ui b/rbutil/rbutilqt/rbspeexcfgfrm.ui new file mode 100644 index 0000000000..ac57819fb0 --- /dev/null +++ b/rbutil/rbutilqt/rbspeexcfgfrm.ui | |||
@@ -0,0 +1,154 @@ | |||
1 | <ui version="4.0" > | ||
2 | <class>RbSpeexCfgFrm</class> | ||
3 | <widget class="QDialog" name="RbSpeexCfgFrm" > | ||
4 | <property name="geometry" > | ||
5 | <rect> | ||
6 | <x>0</x> | ||
7 | <y>0</y> | ||
8 | <width>408</width> | ||
9 | <height>173</height> | ||
10 | </rect> | ||
11 | </property> | ||
12 | <property name="windowTitle" > | ||
13 | <string>Configuration</string> | ||
14 | </property> | ||
15 | <layout class="QGridLayout" > | ||
16 | <item row="0" column="0" colspan="4" > | ||
17 | <widget class="QLabel" name="labelTitle" > | ||
18 | <property name="text" > | ||
19 | <string>Configure RbSpeex Encoder</string> | ||
20 | </property> | ||
21 | </widget> | ||
22 | </item> | ||
23 | <item row="1" column="0" > | ||
24 | <widget class="QDoubleSpinBox" name="volume" > | ||
25 | <property name="value" > | ||
26 | <double>1.000000000000000</double> | ||
27 | </property> | ||
28 | </widget> | ||
29 | </item> | ||
30 | <item row="1" column="1" > | ||
31 | <widget class="QLabel" name="label_2" > | ||
32 | <property name="text" > | ||
33 | <string>Volume</string> | ||
34 | </property> | ||
35 | </widget> | ||
36 | </item> | ||
37 | <item row="1" column="2" colspan="2" > | ||
38 | <widget class="QCheckBox" name="narrowband" > | ||
39 | <property name="text" > | ||
40 | <string>Narrowband</string> | ||
41 | </property> | ||
42 | </widget> | ||
43 | </item> | ||
44 | <item row="2" column="0" > | ||
45 | <widget class="QDoubleSpinBox" name="quality" > | ||
46 | <property name="singleStep" > | ||
47 | <double>1.000000000000000</double> | ||
48 | </property> | ||
49 | <property name="value" > | ||
50 | <double>8.000000000000000</double> | ||
51 | </property> | ||
52 | </widget> | ||
53 | </item> | ||
54 | <item row="2" column="1" > | ||
55 | <widget class="QLabel" name="label" > | ||
56 | <property name="text" > | ||
57 | <string>Quality</string> | ||
58 | </property> | ||
59 | </widget> | ||
60 | </item> | ||
61 | <item row="3" column="0" > | ||
62 | <widget class="QSpinBox" name="complexity" > | ||
63 | <property name="value" > | ||
64 | <number>3</number> | ||
65 | </property> | ||
66 | </widget> | ||
67 | </item> | ||
68 | <item row="3" column="1" > | ||
69 | <widget class="QLabel" name="label_3" > | ||
70 | <property name="text" > | ||
71 | <string>Complexity</string> | ||
72 | </property> | ||
73 | </widget> | ||
74 | </item> | ||
75 | <item row="4" column="1" > | ||
76 | <spacer> | ||
77 | <property name="orientation" > | ||
78 | <enum>Qt::Horizontal</enum> | ||
79 | </property> | ||
80 | <property name="sizeHint" > | ||
81 | <size> | ||
82 | <width>40</width> | ||
83 | <height>20</height> | ||
84 | </size> | ||
85 | </property> | ||
86 | </spacer> | ||
87 | </item> | ||
88 | <item row="4" column="2" > | ||
89 | <widget class="QPushButton" name="buttonOk" > | ||
90 | <property name="text" > | ||
91 | <string>&Ok</string> | ||
92 | </property> | ||
93 | <property name="icon" > | ||
94 | <iconset resource="rbutilqt.qrc" >:/icons/icons/go-next.png</iconset> | ||
95 | </property> | ||
96 | </widget> | ||
97 | </item> | ||
98 | <item row="4" column="3" > | ||
99 | <widget class="QPushButton" name="buttonCancel" > | ||
100 | <property name="text" > | ||
101 | <string>&Cancel</string> | ||
102 | </property> | ||
103 | <property name="icon" > | ||
104 | <iconset resource="rbutilqt.qrc" >:/icons/icons/process-stop.png</iconset> | ||
105 | </property> | ||
106 | </widget> | ||
107 | </item> | ||
108 | <item row="4" column="0" > | ||
109 | <widget class="QPushButton" name="reset" > | ||
110 | <property name="text" > | ||
111 | <string>Reset</string> | ||
112 | </property> | ||
113 | </widget> | ||
114 | </item> | ||
115 | </layout> | ||
116 | </widget> | ||
117 | <resources> | ||
118 | <include location="rbutilqt.qrc" /> | ||
119 | </resources> | ||
120 | <connections> | ||
121 | <connection> | ||
122 | <sender>buttonOk</sender> | ||
123 | <signal>clicked()</signal> | ||
124 | <receiver>RbSpeexCfgFrm</receiver> | ||
125 | <slot>accept()</slot> | ||
126 | <hints> | ||
127 | <hint type="sourcelabel" > | ||
128 | <x>253</x> | ||
129 | <y>147</y> | ||
130 | </hint> | ||
131 | <hint type="destinationlabel" > | ||
132 | <x>203</x> | ||
133 | <y>86</y> | ||
134 | </hint> | ||
135 | </hints> | ||
136 | </connection> | ||
137 | <connection> | ||
138 | <sender>buttonCancel</sender> | ||
139 | <signal>clicked()</signal> | ||
140 | <receiver>RbSpeexCfgFrm</receiver> | ||
141 | <slot>reject()</slot> | ||
142 | <hints> | ||
143 | <hint type="sourcelabel" > | ||
144 | <x>352</x> | ||
145 | <y>147</y> | ||
146 | </hint> | ||
147 | <hint type="destinationlabel" > | ||
148 | <x>203</x> | ||
149 | <y>86</y> | ||
150 | </hint> | ||
151 | </hints> | ||
152 | </connection> | ||
153 | </connections> | ||
154 | </ui> | ||
diff --git a/rbutil/rbutilqt/rbutil.ini b/rbutil/rbutilqt/rbutil.ini index e096faa862..9bd7902fc3 100644 --- a/rbutil/rbutilqt/rbutil.ini +++ b/rbutil/rbutilqt/rbutil.ini | |||
@@ -378,36 +378,6 @@ resolution=132x80x16 | |||
378 | manualname= | 378 | manualname= |
379 | brand=Sandisk | 379 | brand=Sandisk |
380 | 380 | ||
381 | [encoders] | ||
382 | encpreset01 = "Lame (default)" | ||
383 | encpreset02 = "Lame (user-adjusted)" | ||
384 | encpreset03 = "RbSpeex (default)" | ||
385 | encpreset04 = "RbSpeex (user-adjusted)" | ||
386 | |||
387 | [encpreset01] | ||
388 | encoder = lame | ||
389 | options = "" | ||
390 | template = "\"%exe\" %options \"%input\" \"%output\"" | ||
391 | edit = false | ||
392 | |||
393 | [encpreset02] | ||
394 | encoder = lame | ||
395 | options = "" | ||
396 | template = "\"%exe\" %options \"%input\" \"%output\"" | ||
397 | edit = true | ||
398 | |||
399 | [encpreset03] | ||
400 | encoder = rbspeex | ||
401 | options = "" | ||
402 | template = "\"%exe\" %options \"%input\" \"%output\"" | ||
403 | edit = false | ||
404 | |||
405 | [encpreset04] | ||
406 | encoder = rbspeex | ||
407 | options = "" | ||
408 | template = "\"%exe\" %options \"%input\" \"%output\"" | ||
409 | edit = true | ||
410 | |||
411 | [tts] | 381 | [tts] |
412 | ttspreset01 = "espeak (default)" | 382 | ttspreset01 = "espeak (default)" |
413 | ttspreset02 = "espeak (user-adjusted)" | 383 | ttspreset02 = "espeak (user-adjusted)" |
diff --git a/rbutil/rbutilqt/rbutilqt.cpp b/rbutil/rbutilqt/rbutilqt.cpp index 10f28f8fc8..30f5477885 100644 --- a/rbutil/rbutilqt/rbutilqt.cpp +++ b/rbutil/rbutilqt/rbutilqt.cpp | |||
@@ -31,6 +31,7 @@ | |||
31 | #include "installthemes.h" | 31 | #include "installthemes.h" |
32 | #include "uninstallwindow.h" | 32 | #include "uninstallwindow.h" |
33 | #include "browseof.h" | 33 | #include "browseof.h" |
34 | #include "encoders.h" | ||
34 | 35 | ||
35 | #if defined(Q_OS_LINUX) | 36 | #if defined(Q_OS_LINUX) |
36 | #include <stdio.h> | 37 | #include <stdio.h> |
@@ -119,6 +120,7 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent) | |||
119 | initIpodpatcher(); | 120 | initIpodpatcher(); |
120 | initSansapatcher(); | 121 | initSansapatcher(); |
121 | downloadInfo(); | 122 | downloadInfo(); |
123 | initEncoderList(); | ||
122 | 124 | ||
123 | } | 125 | } |
124 | 126 | ||
diff --git a/rbutil/rbutilqt/rbutilqt.pro b/rbutil/rbutilqt/rbutilqt.pro index 79af79d359..85f76f350b 100644 --- a/rbutil/rbutilqt/rbutilqt.pro +++ b/rbutil/rbutilqt/rbutilqt.pro | |||
@@ -35,7 +35,8 @@ SOURCES += rbutilqt.cpp \ | |||
35 | uninstallwindow.cpp \ | 35 | uninstallwindow.cpp \ |
36 | utils.cpp \ | 36 | utils.cpp \ |
37 | browseof.cpp \ | 37 | browseof.cpp \ |
38 | preview.cpp | 38 | preview.cpp \ |
39 | encoders.cpp | ||
39 | 40 | ||
40 | HEADERS += rbutilqt.h \ | 41 | HEADERS += rbutilqt.h \ |
41 | install.h \ | 42 | install.h \ |
@@ -71,11 +72,14 @@ HEADERS += rbutilqt.h \ | |||
71 | uninstallwindow.h \ | 72 | uninstallwindow.h \ |
72 | utils.h \ | 73 | utils.h \ |
73 | browseof.h \ | 74 | browseof.h \ |
74 | preview.h | 75 | preview.h \ |
76 | encoders.h | ||
75 | 77 | ||
76 | # Needed by QT on Win | 78 | # Needed by QT on Win |
77 | INCLUDEPATH = . irivertools zip zlib ../ipodpatcher ../sansapatcher | 79 | INCLUDEPATH = . irivertools zip zlib ../ipodpatcher ../sansapatcher ../../tools/rbspeex |
78 | 80 | ||
81 | LIBS += -L../../tools/rbspeex -lrbspeex | ||
82 | |||
79 | TEMPLATE = app | 83 | TEMPLATE = app |
80 | dbg { | 84 | dbg { |
81 | CONFIG += debug thread qt warn_on | 85 | CONFIG += debug thread qt warn_on |
@@ -100,7 +104,9 @@ FORMS += rbutilqtfrm.ui \ | |||
100 | installthemesfrm.ui \ | 104 | installthemesfrm.ui \ |
101 | uninstallfrm.ui \ | 105 | uninstallfrm.ui \ |
102 | browseoffrm.ui \ | 106 | browseoffrm.ui \ |
103 | previewfrm.ui | 107 | previewfrm.ui \ |
108 | rbspeexcfgfrm.ui \ | ||
109 | encexescfgfrm.ui | ||
104 | 110 | ||
105 | RESOURCES += rbutilqt.qrc | 111 | RESOURCES += rbutilqt.qrc |
106 | 112 | ||
diff --git a/rbutil/rbutilqt/talkfile.cpp b/rbutil/rbutilqt/talkfile.cpp index e13647deb2..141af0b5ec 100644 --- a/rbutil/rbutilqt/talkfile.cpp +++ b/rbutil/rbutilqt/talkfile.cpp | |||
@@ -24,21 +24,6 @@ TalkFileCreator::TalkFileCreator(QObject* parent): QObject(parent) | |||
24 | 24 | ||
25 | } | 25 | } |
26 | 26 | ||
27 | |||
28 | bool TalkFileCreator::initEncoder() | ||
29 | { | ||
30 | QFileInfo enc(m_EncExec); | ||
31 | if(enc.exists()) | ||
32 | { | ||
33 | return true; | ||
34 | } | ||
35 | else | ||
36 | { | ||
37 | return false; | ||
38 | } | ||
39 | } | ||
40 | |||
41 | |||
42 | bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger) | 27 | bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger) |
43 | { | 28 | { |
44 | m_abort = false; | 29 | m_abort = false; |
@@ -60,12 +45,18 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger) | |||
60 | m_logger->addItem("Init of TTS engine failed",LOGERROR); | 45 | m_logger->addItem("Init of TTS engine failed",LOGERROR); |
61 | return false; | 46 | return false; |
62 | } | 47 | } |
63 | if(!initEncoder()) | 48 | |
49 | // Encoder | ||
50 | m_enc = getEncoder(userSettings->value("encoder").toString()); | ||
51 | m_enc->setUserCfg(userSettings); | ||
52 | |||
53 | if(!m_enc->start()) | ||
64 | { | 54 | { |
65 | m_logger->addItem("Init of encoder failed",LOGERROR); | 55 | m_logger->addItem("Init of Encoder engine failed",LOGERROR); |
66 | m_tts->stop(); | 56 | m_tts->stop(); |
67 | return false; | 57 | return false; |
68 | } | 58 | } |
59 | |||
69 | QApplication::processEvents(); | 60 | QApplication::processEvents(); |
70 | 61 | ||
71 | connect(logger,SIGNAL(aborted()),this,SLOT(abort())); | 62 | connect(logger,SIGNAL(aborted()),this,SLOT(abort())); |
@@ -88,13 +79,16 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger) | |||
88 | QString toSpeak; | 79 | QString toSpeak; |
89 | QString filename; | 80 | QString filename; |
90 | QString wavfilename; | 81 | QString wavfilename; |
91 | 82 | ||
92 | //! skip dotdot and .talk files | 83 | QString path = fileInf.filePath(); |
93 | if(fileInf.fileName() == ".." || fileInf.suffix() == "talk") | 84 | qDebug() << path; |
85 | |||
86 | if( path.endsWith("..") || path.endsWith(".talk") ) | ||
94 | { | 87 | { |
95 | it.next(); | 88 | it.next(); |
96 | continue; | 89 | continue; |
97 | } | 90 | } |
91 | |||
98 | //! if it is a dir | 92 | //! if it is a dir |
99 | if(fileInf.isDir()) | 93 | if(fileInf.isDir()) |
100 | { | 94 | { |
@@ -103,9 +97,14 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger) | |||
103 | { | 97 | { |
104 | it.next(); | 98 | it.next(); |
105 | continue; | 99 | continue; |
106 | } | 100 | } |
107 | toSpeak = fileInf.absoluteDir().dirName(); | 101 | int index1 = path.lastIndexOf("/"); |
108 | filename = fileInf.absolutePath() + "/_dirname.talk"; | 102 | int index2 = path.lastIndexOf("/",index1-1); |
103 | |||
104 | toSpeak = path.mid(index2+1,(index1-index2)-1); | ||
105 | |||
106 | filename = path.left(index1) + "/_dirname.talk"; | ||
107 | qDebug() << "toSpeak: " << toSpeak << "filename: " << filename; | ||
109 | } | 108 | } |
110 | else // if it is a file | 109 | else // if it is a file |
111 | { | 110 | { |
@@ -137,15 +136,17 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger) | |||
137 | m_logger->addItem("Voicing of " + toSpeak + " failed",LOGERROR); | 136 | m_logger->addItem("Voicing of " + toSpeak + " failed",LOGERROR); |
138 | m_logger->abort(); | 137 | m_logger->abort(); |
139 | m_tts->stop(); | 138 | m_tts->stop(); |
139 | m_enc->stop(); | ||
140 | return false; | 140 | return false; |
141 | } | 141 | } |
142 | } | 142 | } |
143 | m_logger->addItem("Encoding of " + toSpeak,LOGINFO); | 143 | m_logger->addItem("Encoding of " + toSpeak,LOGINFO); |
144 | if(!encode(wavfilename,filename)) | 144 | if(!m_enc->encode(wavfilename,filename)) |
145 | { | 145 | { |
146 | m_logger->addItem("Encoding of " + wavfilename + " failed",LOGERROR); | 146 | m_logger->addItem("Encoding of " + wavfilename + " failed",LOGERROR); |
147 | m_logger->abort(); | 147 | m_logger->abort(); |
148 | m_tts->stop(); | 148 | m_tts->stop(); |
149 | m_enc->stop(); | ||
149 | return false; | 150 | return false; |
150 | } | 151 | } |
151 | } | 152 | } |
@@ -182,21 +183,6 @@ void TalkFileCreator::abort() | |||
182 | m_abort = true; | 183 | m_abort = true; |
183 | } | 184 | } |
184 | 185 | ||
185 | bool TalkFileCreator::encode(QString input,QString output) | ||
186 | { | ||
187 | qDebug() << "encoding.."; | ||
188 | QString execstring = m_curEncTemplate; | ||
189 | |||
190 | execstring.replace("%exe",m_EncExec); | ||
191 | execstring.replace("%options",m_EncOpts); | ||
192 | execstring.replace("%input",input); | ||
193 | execstring.replace("%output",output); | ||
194 | qDebug() << execstring; | ||
195 | QProcess::execute(execstring); | ||
196 | return true; | ||
197 | |||
198 | } | ||
199 | |||
200 | bool TTSSapi::start() | 186 | bool TTSSapi::start() |
201 | { | 187 | { |
202 | QFileInfo tts(m_TTSexec); | 188 | QFileInfo tts(m_TTSexec); |
@@ -257,7 +243,7 @@ bool TTSExes::voice(QString text,QString wavfile) | |||
257 | execstring.replace("%options",m_TTSOpts); | 243 | execstring.replace("%options",m_TTSOpts); |
258 | execstring.replace("%wavfile",wavfile); | 244 | execstring.replace("%wavfile",wavfile); |
259 | execstring.replace("%text",text); | 245 | execstring.replace("%text",text); |
260 | qDebug() << "voicing" << execstring; | 246 | //qDebug() << "voicing" << execstring; |
261 | QProcess::execute(execstring); | 247 | QProcess::execute(execstring); |
262 | return true; | 248 | return true; |
263 | 249 | ||
diff --git a/rbutil/rbutilqt/talkfile.h b/rbutil/rbutilqt/talkfile.h index 54819c80f8..2e2c3d7a01 100644 --- a/rbutil/rbutilqt/talkfile.h +++ b/rbutil/rbutilqt/talkfile.h | |||
@@ -21,8 +21,12 @@ | |||
21 | #ifndef TALKFILE_H | 21 | #ifndef TALKFILE_H |
22 | #define TALKFILE_H | 22 | #define TALKFILE_H |
23 | 23 | ||
24 | #include <QtGui> | ||
24 | #include "progressloggerinterface.h" | 25 | #include "progressloggerinterface.h" |
25 | 26 | ||
27 | #include "encoders.h" | ||
28 | |||
29 | |||
26 | class TTSBase : public QObject | 30 | class TTSBase : public QObject |
27 | { | 31 | { |
28 | Q_OBJECT | 32 | Q_OBJECT |
@@ -55,18 +59,16 @@ public: | |||
55 | 59 | ||
56 | bool createTalkFiles(ProgressloggerInterface* logger); | 60 | bool createTalkFiles(ProgressloggerInterface* logger); |
57 | 61 | ||
62 | void setUserSettings(QSettings* setting) { userSettings = setting;} | ||
63 | |||
58 | void setTTSexe(QString exe){m_TTSexec=exe;} | 64 | void setTTSexe(QString exe){m_TTSexec=exe;} |
59 | void setEncexe(QString exe){m_EncExec=exe;} | 65 | |
60 | |||
61 | void setTTsType(QString tts) { m_curTTS = tts; } | 66 | void setTTsType(QString tts) { m_curTTS = tts; } |
62 | void setTTsOpts(QString opts) {m_TTSOpts=opts;} | 67 | void setTTsOpts(QString opts) {m_TTSOpts=opts;} |
63 | void setTTsLanguage(QString language) {m_TTSLanguage = language;} | 68 | void setTTsLanguage(QString language) {m_TTSLanguage = language;} |
64 | void setTTsTemplate(QString t) { m_curTTSTemplate = t; } | 69 | void setTTsTemplate(QString t) { m_curTTSTemplate = t; } |
65 | 70 | ||
66 | void setEncType(QString enc) { m_curEnc = enc; } | 71 | |
67 | void setEncOpts(QString opts) {m_EncOpts=opts;} | ||
68 | void setEncTemplate(QString t) { m_curEncTemplate = t; } | ||
69 | |||
70 | void setDir(QDir dir){m_dir = dir; } | 72 | void setDir(QDir dir){m_dir = dir; } |
71 | void setMountPoint(QString mountpoint) {m_mountpoint =mountpoint; } | 73 | void setMountPoint(QString mountpoint) {m_mountpoint =mountpoint; } |
72 | 74 | ||
@@ -83,10 +85,9 @@ private slots: | |||
83 | 85 | ||
84 | private: | 86 | private: |
85 | TTSBase* m_tts; | 87 | TTSBase* m_tts; |
86 | bool initEncoder(); | 88 | EncBase* m_enc; |
87 | 89 | QSettings *userSettings; | |
88 | bool encode(QString input,QString output); | 90 | |
89 | |||
90 | QDir m_dir; | 91 | QDir m_dir; |
91 | QString m_mountpoint; | 92 | QString m_mountpoint; |
92 | QString m_curTTS; | 93 | QString m_curTTS; |
@@ -95,11 +96,6 @@ private: | |||
95 | QString m_TTSLanguage; | 96 | QString m_TTSLanguage; |
96 | QString m_curTTSTemplate; | 97 | QString m_curTTSTemplate; |
97 | 98 | ||
98 | QString m_curEnc; | ||
99 | QString m_EncExec; | ||
100 | QString m_EncOpts; | ||
101 | QString m_curEncTemplate; | ||
102 | |||
103 | bool m_overwriteTalk; | 99 | bool m_overwriteTalk; |
104 | bool m_overwriteWav; | 100 | bool m_overwriteWav; |
105 | bool m_removeWav; | 101 | bool m_removeWav; |
@@ -137,5 +133,7 @@ private: | |||
137 | 133 | ||
138 | }; | 134 | }; |
139 | 135 | ||
136 | |||
137 | |||
140 | #endif | 138 | #endif |
141 | 139 | ||