mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 13:15:18 -05:00
rbutil: added builtin rbspeex encoder. Reworked encoder configuration.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15925 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
ed047d9db1
commit
815504b449
10 changed files with 284 additions and 230 deletions
|
|
@ -23,6 +23,7 @@
|
||||||
#include "autodetection.h"
|
#include "autodetection.h"
|
||||||
#include "ui_configurefrm.h"
|
#include "ui_configurefrm.h"
|
||||||
#include "browsedirtree.h"
|
#include "browsedirtree.h"
|
||||||
|
#include "encoders.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#if defined(Q_OS_WIN32)
|
#if defined(Q_OS_WIN32)
|
||||||
|
|
@ -75,9 +76,10 @@ Config::Config(QWidget *parent) : QDialog(parent)
|
||||||
connect(ui.buttonCacheBrowse, SIGNAL(clicked()), this, SLOT(browseCache()));
|
connect(ui.buttonCacheBrowse, SIGNAL(clicked()), this, SLOT(browseCache()));
|
||||||
connect(ui.buttonCacheClear, SIGNAL(clicked()), this, SLOT(cacheClear()));
|
connect(ui.buttonCacheClear, SIGNAL(clicked()), this, SLOT(cacheClear()));
|
||||||
connect(ui.browseTts, SIGNAL(clicked()), this, SLOT(browseTts()));
|
connect(ui.browseTts, SIGNAL(clicked()), this, SLOT(browseTts()));
|
||||||
connect(ui.browseEncoder, SIGNAL(clicked()), this, SLOT(browseEnc()));
|
connect(ui.configEncoder, SIGNAL(clicked()), this, SLOT(configEnc()));
|
||||||
connect(ui.comboEncoder, SIGNAL(currentIndexChanged(int)), this, SLOT(updateEncOpts(int)));
|
|
||||||
connect(ui.comboTts, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTtsOpts(int)));
|
connect(ui.comboTts, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTtsOpts(int)));
|
||||||
|
connect(ui.comboEncoder, SIGNAL(currentIndexChanged(int)), this, SLOT(updateEncState(int)));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -144,20 +146,9 @@ void Config::accept()
|
||||||
devices->endGroup();
|
devices->endGroup();
|
||||||
userSettings->endGroup();
|
userSettings->endGroup();
|
||||||
|
|
||||||
//encoder settings
|
//encoder settings
|
||||||
preset = ui.comboEncoder->itemData(ui.comboEncoder->currentIndex(), Qt::UserRole).toString();
|
userSettings->setValue("encoder",ui.comboEncoder->currentText());
|
||||||
userSettings->setValue("encpreset", preset);
|
|
||||||
userSettings->beginGroup(preset);
|
|
||||||
|
|
||||||
if(QFileInfo(ui.encoderExecutable->text()).isExecutable())
|
|
||||||
userSettings->setValue("binary", ui.encoderExecutable->text());
|
|
||||||
userSettings->setValue("options", ui.encoderOptions->text());
|
|
||||||
devices->beginGroup(preset);
|
|
||||||
userSettings->setValue("template", devices->value("template").toString());
|
|
||||||
userSettings->setValue("type", devices->value("tts").toString());
|
|
||||||
devices->endGroup();
|
|
||||||
userSettings->endGroup();
|
|
||||||
|
|
||||||
// sync settings
|
// sync settings
|
||||||
userSettings->sync();
|
userSettings->sync();
|
||||||
this->close();
|
this->close();
|
||||||
|
|
@ -314,17 +305,19 @@ void Config::setDevices(QSettings *dev)
|
||||||
ui.treeDevices->setCurrentItem(w3); // hilight old selection
|
ui.treeDevices->setCurrentItem(w3); // hilight old selection
|
||||||
|
|
||||||
// tts / encoder tab
|
// tts / encoder tab
|
||||||
QStringList keys;
|
|
||||||
|
//encoders
|
||||||
devices->beginGroup("encoders");
|
ui.comboEncoder->addItems(getEncoderList());
|
||||||
keys = devices->allKeys();
|
|
||||||
for(int i=0; i < keys.size();i++)
|
//update index of combobox
|
||||||
ui.comboEncoder->addItem(devices->value(keys.at(i), "null").toString(),
|
int index = ui.comboEncoder->findText(userSettings->value("encoder").toString(),Qt::MatchExactly);
|
||||||
keys.at(i));
|
if(index < 0) index = 0;
|
||||||
devices->endGroup();
|
ui.comboEncoder->setCurrentIndex(index);
|
||||||
|
updateEncState(index);
|
||||||
|
|
||||||
|
//tts
|
||||||
devices->beginGroup("tts");
|
devices->beginGroup("tts");
|
||||||
keys = devices->allKeys();
|
QStringList keys = devices->allKeys();
|
||||||
for(int i=0; i < keys.size();i++)
|
for(int i=0; i < keys.size();i++)
|
||||||
{
|
{
|
||||||
devices->endGroup();
|
devices->endGroup();
|
||||||
|
|
@ -343,67 +336,13 @@ void Config::setDevices(QSettings *dev)
|
||||||
}
|
}
|
||||||
devices->endGroup();
|
devices->endGroup();
|
||||||
|
|
||||||
int index;
|
|
||||||
index = ui.comboTts->findData(userSettings->value("ttspreset").toString(),
|
index = ui.comboTts->findData(userSettings->value("ttspreset").toString(),
|
||||||
Qt::UserRole, Qt::MatchExactly);
|
Qt::UserRole, Qt::MatchExactly);
|
||||||
if(index < 0) index = 0;
|
if(index < 0) index = 0;
|
||||||
ui.comboTts->setCurrentIndex(index);
|
ui.comboTts->setCurrentIndex(index);
|
||||||
updateTtsOpts(index);
|
updateTtsOpts(index);
|
||||||
|
|
||||||
index = ui.comboEncoder->findData(userSettings->value("encpreset").toString(),
|
|
||||||
Qt::UserRole, Qt::MatchExactly);
|
|
||||||
if(index < 0) index = 0;
|
|
||||||
ui.comboEncoder->setCurrentIndex(index);
|
|
||||||
updateEncOpts(index);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void Config::updateEncOpts(int index)
|
|
||||||
{
|
|
||||||
qDebug() << "updateEncOpts()";
|
|
||||||
QString e;
|
|
||||||
bool edit;
|
|
||||||
QString c = ui.comboEncoder->itemData(index, Qt::UserRole).toString();
|
|
||||||
devices->beginGroup(c);
|
|
||||||
ui.encoderOptions->setText(devices->value("options").toString());
|
|
||||||
edit = devices->value("edit").toBool();
|
|
||||||
ui.encoderOptions->setEnabled(edit);
|
|
||||||
e = devices->value("encoder").toString();
|
|
||||||
devices->endGroup();
|
|
||||||
|
|
||||||
// try to autodetect encoder
|
|
||||||
#if defined(Q_OS_LINUX) || defined(Q_OS_MACX)
|
|
||||||
QStringList path = QString(getenv("PATH")).split(":", QString::SkipEmptyParts);
|
|
||||||
#elif defined(Q_OS_WIN)
|
|
||||||
QStringList path = QString(getenv("PATH")).split(";", QString::SkipEmptyParts);
|
|
||||||
#endif
|
|
||||||
qDebug() << path;
|
|
||||||
ui.encoderExecutable->setEnabled(true);
|
|
||||||
for(int i = 0; i < path.size(); i++) {
|
|
||||||
QString executable = QDir::fromNativeSeparators(path.at(i)) + "/" + e;
|
|
||||||
#if defined(Q_OS_WIN)
|
|
||||||
executable += ".exe";
|
|
||||||
QStringList ex = executable.split("\"", QString::SkipEmptyParts);
|
|
||||||
executable = ex.join("");
|
|
||||||
#endif
|
|
||||||
if(QFileInfo(executable).isExecutable()) {
|
|
||||||
qDebug() << "found:" << executable;
|
|
||||||
ui.encoderExecutable->setText(QDir::toNativeSeparators(executable));
|
|
||||||
// disallow changing the detected path if non-customizable profile
|
|
||||||
if(!edit)
|
|
||||||
ui.encoderExecutable->setEnabled(false);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//user settings
|
|
||||||
userSettings->beginGroup(c);
|
|
||||||
QString temp = userSettings->value("binary","null").toString();
|
|
||||||
if(temp != "null") ui.encoderExecutable->setText(temp);
|
|
||||||
temp = userSettings->value("options","null").toString();
|
|
||||||
if(temp != "null") ui.encoderOptions->setText(temp);
|
|
||||||
userSettings->endGroup();
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -459,6 +398,23 @@ void Config::updateTtsOpts(int index)
|
||||||
userSettings->endGroup();
|
userSettings->endGroup();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Config::updateEncState(int index)
|
||||||
|
{
|
||||||
|
QString encoder = ui.comboEncoder->itemText(index);
|
||||||
|
EncBase* enc = getEncoder(encoder);
|
||||||
|
enc->setUserCfg(userSettings);
|
||||||
|
|
||||||
|
if(enc->configOk())
|
||||||
|
{
|
||||||
|
ui.configstatus->setText("Configuration OK");
|
||||||
|
ui.configstatusimg->setPixmap(QPixmap(QString::fromUtf8(":/icons/icons/go-next.png")));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui.configstatus->setText("Configuration INVALID");
|
||||||
|
ui.configstatusimg->setPixmap(QPixmap(QString::fromUtf8(":/icons/icons/dialog-error.png")));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Config::setNoProxy(bool checked)
|
void Config::setNoProxy(bool checked)
|
||||||
{
|
{
|
||||||
|
|
@ -741,22 +697,11 @@ void Config::browseTts()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Config::browseEnc()
|
void Config::configEnc()
|
||||||
{
|
{
|
||||||
BrowseDirtree browser(this);
|
EncBase* enc =getEncoder(ui.comboEncoder->currentText());
|
||||||
browser.setFilter(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot);
|
|
||||||
|
enc->setUserCfg(userSettings);
|
||||||
if(QFileInfo(ui.encoderExecutable->text()).isDir())
|
enc->showCfg();
|
||||||
{
|
updateEncState(ui.comboEncoder->currentIndex());
|
||||||
browser.setDir(ui.encoderExecutable->text());
|
|
||||||
}
|
|
||||||
if(browser.exec() == QDialog::Accepted)
|
|
||||||
{
|
|
||||||
qDebug() << browser.getSelected();
|
|
||||||
QString exe = browser.getSelected();
|
|
||||||
if(!QFileInfo(exe).isExecutable())
|
|
||||||
return;
|
|
||||||
ui.encoderExecutable->setText(exe);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,9 +65,9 @@ class Config : public QDialog
|
||||||
void setCache(QString);
|
void setCache(QString);
|
||||||
void cacheClear(void);
|
void cacheClear(void);
|
||||||
void browseTts(void);
|
void browseTts(void);
|
||||||
void browseEnc(void);
|
void configEnc(void);
|
||||||
void updateTtsOpts(int);
|
void updateTtsOpts(int);
|
||||||
void updateEncOpts(int);
|
void updateEncState(int);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -359,7 +359,7 @@
|
||||||
<iconset resource="rbutilqt.qrc" >:/icons/icons/audio-input-microphone.png</iconset>
|
<iconset resource="rbutilqt.qrc" >:/icons/icons/audio-input-microphone.png</iconset>
|
||||||
</attribute>
|
</attribute>
|
||||||
<layout class="QGridLayout" >
|
<layout class="QGridLayout" >
|
||||||
<item row="0" column="0" colspan="2" >
|
<item row="0" column="0" >
|
||||||
<widget class="QGroupBox" name="groupBox_2" >
|
<widget class="QGroupBox" name="groupBox_2" >
|
||||||
<property name="title" >
|
<property name="title" >
|
||||||
<string>TTS Engine</string>
|
<string>TTS Engine</string>
|
||||||
|
|
@ -427,7 +427,7 @@
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item rowspan="2" row="1" column="0" colspan="2" >
|
<item row="1" column="0" >
|
||||||
<widget class="QGroupBox" name="groupBox_3" >
|
<widget class="QGroupBox" name="groupBox_3" >
|
||||||
<property name="title" >
|
<property name="title" >
|
||||||
<string>Encoder Engine</string>
|
<string>Encoder Engine</string>
|
||||||
|
|
@ -436,64 +436,62 @@
|
||||||
<item row="0" column="0" >
|
<item row="0" column="0" >
|
||||||
<widget class="QLabel" name="labelEncoder" >
|
<widget class="QLabel" name="labelEncoder" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Select &encoder profile</string>
|
<string>Select &encoder</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="buddy" >
|
<property name="buddy" >
|
||||||
<cstring>comboEncoder</cstring>
|
<cstring>comboEncoder</cstring>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="0" column="1" colspan="2" >
|
<item row="0" column="1" colspan="3" >
|
||||||
<widget class="QComboBox" name="comboEncoder" />
|
<widget class="QComboBox" name="comboEncoder" />
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0" >
|
<item row="1" column="0" >
|
||||||
<widget class="QLabel" name="labelEncoderExecutable" >
|
<widget class="QLabel" name="labelEncoderExecutable" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>Encoder executable</string>
|
<string>Configure encoder</string>
|
||||||
</property>
|
|
||||||
<property name="buddy" >
|
|
||||||
<cstring>encoderExecutable</cstring>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1" >
|
<item row="1" column="1" >
|
||||||
<widget class="QLineEdit" name="encoderExecutable" />
|
<widget class="QLabel" name="configstatus" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Configuration invalid !</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="2" >
|
<item row="1" column="2" >
|
||||||
<widget class="QPushButton" name="browseEncoder" >
|
<widget class="QLabel" name="configstatusimg" >
|
||||||
<property name="text" >
|
<property name="text" >
|
||||||
<string>B&rowse</string>
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="pixmap" >
|
||||||
|
<pixmap resource="rbutilqt.qrc" >:/icons/icons/dialog-error.png</pixmap>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="3" >
|
||||||
|
<widget class="QPushButton" name="configEncoder" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>&Configure</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon" >
|
<property name="icon" >
|
||||||
<iconset resource="rbutilqt.qrc" >:/icons/icons/edit-find.png</iconset>
|
<iconset resource="rbutilqt.qrc" >:/icons/icons/edit-find.png</iconset>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0" >
|
|
||||||
<widget class="QLabel" name="labelEncoderOptions" >
|
|
||||||
<property name="text" >
|
|
||||||
<string>Encoder options</string>
|
|
||||||
</property>
|
|
||||||
<property name="buddy" >
|
|
||||||
<cstring>encoderOptions</cstring>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1" colspan="2" >
|
|
||||||
<widget class="QLineEdit" name="encoderOptions" />
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0" >
|
<item row="2" column="0" >
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation" >
|
<property name="orientation" >
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizeHint" >
|
<property name="sizeHint" >
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>226</width>
|
||||||
<height>40</height>
|
<height>51</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
|
|
|
||||||
|
|
@ -114,6 +114,7 @@ void InstallTalkWindow::accept()
|
||||||
|
|
||||||
userSettings->sync();
|
userSettings->sync();
|
||||||
|
|
||||||
|
talkcreator->setUserSettings(userSettings);
|
||||||
talkcreator->setDir(QDir(folderToTalk));
|
talkcreator->setDir(QDir(folderToTalk));
|
||||||
talkcreator->setMountPoint(userSettings->value("mountpoint").toString());
|
talkcreator->setMountPoint(userSettings->value("mountpoint").toString());
|
||||||
talkcreator->setTTSexe(pathTTS);
|
talkcreator->setTTSexe(pathTTS);
|
||||||
|
|
@ -121,11 +122,6 @@ void InstallTalkWindow::accept()
|
||||||
talkcreator->setTTsLanguage(ttsLanguage);
|
talkcreator->setTTsLanguage(ttsLanguage);
|
||||||
talkcreator->setTTsType(ttsType);
|
talkcreator->setTTsType(ttsType);
|
||||||
talkcreator->setTTsTemplate(ttsTemplate);
|
talkcreator->setTTsTemplate(ttsTemplate);
|
||||||
|
|
||||||
talkcreator->setEncexe(pathEncoder);
|
|
||||||
talkcreator->setEncOpts(encOpts);
|
|
||||||
talkcreator->setEncTemplate(encTemplate);
|
|
||||||
talkcreator->setEncType(encType);
|
|
||||||
|
|
||||||
talkcreator->setOverwriteTalk(ui.OverwriteTalk->isChecked());
|
talkcreator->setOverwriteTalk(ui.OverwriteTalk->isChecked());
|
||||||
talkcreator->setOverwriteWav(ui.OverwriteWav->isChecked());
|
talkcreator->setOverwriteWav(ui.OverwriteWav->isChecked());
|
||||||
|
|
@ -152,17 +148,16 @@ void InstallTalkWindow::setDeviceSettings(QSettings *dev)
|
||||||
.arg(devices->value(profile, tr("Invalid TTS profile!")).toString()));
|
.arg(devices->value(profile, tr("Invalid TTS profile!")).toString()));
|
||||||
qDebug() << profile;
|
qDebug() << profile;
|
||||||
devices->endGroup();
|
devices->endGroup();
|
||||||
profile = userSettings->value("encpreset", "none").toString();
|
|
||||||
devices->beginGroup("encoders");
|
QString encoder = userSettings->value("encoder", "none").toString();
|
||||||
ui.labelEncProfile->setText(tr("Encoder Profile: <b>%1</b>")
|
EncBase* enc = getEncoder(encoder);
|
||||||
.arg(devices->value(profile, tr("Invalid encoder profile!")).toString()));
|
enc->setUserCfg(userSettings);
|
||||||
qDebug() << profile;
|
if(enc->configOk())
|
||||||
devices->endGroup();
|
ui.labelEncProfile->setText(tr("Selected Encoder: <b>%1</b>").arg(encoder));
|
||||||
|
else
|
||||||
|
ui.labelEncProfile->setText(tr("Selected Encoder: <b>%1</b>").arg("Invalid encoder configuration!"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void InstallTalkWindow::setUserSettings(QSettings *user)
|
void InstallTalkWindow::setUserSettings(QSettings *user)
|
||||||
{
|
{
|
||||||
userSettings = user;
|
userSettings = user;
|
||||||
|
|
|
||||||
154
rbutil/rbutilqt/rbspeexcfgfrm.ui
Normal file
154
rbutil/rbutilqt/rbspeexcfgfrm.ui
Normal file
|
|
@ -0,0 +1,154 @@
|
||||||
|
<ui version="4.0" >
|
||||||
|
<class>RbSpeexCfgFrm</class>
|
||||||
|
<widget class="QDialog" name="RbSpeexCfgFrm" >
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>408</width>
|
||||||
|
<height>173</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle" >
|
||||||
|
<string>Configuration</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" >
|
||||||
|
<item row="0" column="0" colspan="4" >
|
||||||
|
<widget class="QLabel" name="labelTitle" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Configure RbSpeex Encoder</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" >
|
||||||
|
<widget class="QDoubleSpinBox" name="volume" >
|
||||||
|
<property name="value" >
|
||||||
|
<double>1.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1" >
|
||||||
|
<widget class="QLabel" name="label_2" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Volume</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2" colspan="2" >
|
||||||
|
<widget class="QCheckBox" name="narrowband" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Narrowband</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0" >
|
||||||
|
<widget class="QDoubleSpinBox" name="quality" >
|
||||||
|
<property name="singleStep" >
|
||||||
|
<double>1.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="value" >
|
||||||
|
<double>8.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1" >
|
||||||
|
<widget class="QLabel" name="label" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Quality</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0" >
|
||||||
|
<widget class="QSpinBox" name="complexity" >
|
||||||
|
<property name="value" >
|
||||||
|
<number>3</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1" >
|
||||||
|
<widget class="QLabel" name="label_3" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Complexity</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1" >
|
||||||
|
<spacer>
|
||||||
|
<property name="orientation" >
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" >
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="2" >
|
||||||
|
<widget class="QPushButton" name="buttonOk" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>&Ok</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon" >
|
||||||
|
<iconset resource="rbutilqt.qrc" >:/icons/icons/go-next.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="3" >
|
||||||
|
<widget class="QPushButton" name="buttonCancel" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>&Cancel</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon" >
|
||||||
|
<iconset resource="rbutilqt.qrc" >:/icons/icons/process-stop.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0" >
|
||||||
|
<widget class="QPushButton" name="reset" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Reset</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="rbutilqt.qrc" />
|
||||||
|
</resources>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonOk</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>RbSpeexCfgFrm</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel" >
|
||||||
|
<x>253</x>
|
||||||
|
<y>147</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel" >
|
||||||
|
<x>203</x>
|
||||||
|
<y>86</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonCancel</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>RbSpeexCfgFrm</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel" >
|
||||||
|
<x>352</x>
|
||||||
|
<y>147</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel" >
|
||||||
|
<x>203</x>
|
||||||
|
<y>86</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
||||||
|
|
@ -378,36 +378,6 @@ resolution=132x80x16
|
||||||
manualname=
|
manualname=
|
||||||
brand=Sandisk
|
brand=Sandisk
|
||||||
|
|
||||||
[encoders]
|
|
||||||
encpreset01 = "Lame (default)"
|
|
||||||
encpreset02 = "Lame (user-adjusted)"
|
|
||||||
encpreset03 = "RbSpeex (default)"
|
|
||||||
encpreset04 = "RbSpeex (user-adjusted)"
|
|
||||||
|
|
||||||
[encpreset01]
|
|
||||||
encoder = lame
|
|
||||||
options = ""
|
|
||||||
template = "\"%exe\" %options \"%input\" \"%output\""
|
|
||||||
edit = false
|
|
||||||
|
|
||||||
[encpreset02]
|
|
||||||
encoder = lame
|
|
||||||
options = ""
|
|
||||||
template = "\"%exe\" %options \"%input\" \"%output\""
|
|
||||||
edit = true
|
|
||||||
|
|
||||||
[encpreset03]
|
|
||||||
encoder = rbspeex
|
|
||||||
options = ""
|
|
||||||
template = "\"%exe\" %options \"%input\" \"%output\""
|
|
||||||
edit = false
|
|
||||||
|
|
||||||
[encpreset04]
|
|
||||||
encoder = rbspeex
|
|
||||||
options = ""
|
|
||||||
template = "\"%exe\" %options \"%input\" \"%output\""
|
|
||||||
edit = true
|
|
||||||
|
|
||||||
[tts]
|
[tts]
|
||||||
ttspreset01 = "espeak (default)"
|
ttspreset01 = "espeak (default)"
|
||||||
ttspreset02 = "espeak (user-adjusted)"
|
ttspreset02 = "espeak (user-adjusted)"
|
||||||
|
|
|
||||||
|
|
@ -31,6 +31,7 @@
|
||||||
#include "installthemes.h"
|
#include "installthemes.h"
|
||||||
#include "uninstallwindow.h"
|
#include "uninstallwindow.h"
|
||||||
#include "browseof.h"
|
#include "browseof.h"
|
||||||
|
#include "encoders.h"
|
||||||
|
|
||||||
#if defined(Q_OS_LINUX)
|
#if defined(Q_OS_LINUX)
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
@ -119,6 +120,7 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent)
|
||||||
initIpodpatcher();
|
initIpodpatcher();
|
||||||
initSansapatcher();
|
initSansapatcher();
|
||||||
downloadInfo();
|
downloadInfo();
|
||||||
|
initEncoderList();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -35,7 +35,8 @@ SOURCES += rbutilqt.cpp \
|
||||||
uninstallwindow.cpp \
|
uninstallwindow.cpp \
|
||||||
utils.cpp \
|
utils.cpp \
|
||||||
browseof.cpp \
|
browseof.cpp \
|
||||||
preview.cpp
|
preview.cpp \
|
||||||
|
encoders.cpp
|
||||||
|
|
||||||
HEADERS += rbutilqt.h \
|
HEADERS += rbutilqt.h \
|
||||||
install.h \
|
install.h \
|
||||||
|
|
@ -71,11 +72,14 @@ HEADERS += rbutilqt.h \
|
||||||
uninstallwindow.h \
|
uninstallwindow.h \
|
||||||
utils.h \
|
utils.h \
|
||||||
browseof.h \
|
browseof.h \
|
||||||
preview.h
|
preview.h \
|
||||||
|
encoders.h
|
||||||
|
|
||||||
# Needed by QT on Win
|
# Needed by QT on Win
|
||||||
INCLUDEPATH = . irivertools zip zlib ../ipodpatcher ../sansapatcher
|
INCLUDEPATH = . irivertools zip zlib ../ipodpatcher ../sansapatcher ../../tools/rbspeex
|
||||||
|
|
||||||
|
LIBS += -L../../tools/rbspeex -lrbspeex
|
||||||
|
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
dbg {
|
dbg {
|
||||||
CONFIG += debug thread qt warn_on
|
CONFIG += debug thread qt warn_on
|
||||||
|
|
@ -100,7 +104,9 @@ FORMS += rbutilqtfrm.ui \
|
||||||
installthemesfrm.ui \
|
installthemesfrm.ui \
|
||||||
uninstallfrm.ui \
|
uninstallfrm.ui \
|
||||||
browseoffrm.ui \
|
browseoffrm.ui \
|
||||||
previewfrm.ui
|
previewfrm.ui \
|
||||||
|
rbspeexcfgfrm.ui \
|
||||||
|
encexescfgfrm.ui
|
||||||
|
|
||||||
RESOURCES += rbutilqt.qrc
|
RESOURCES += rbutilqt.qrc
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,21 +24,6 @@ TalkFileCreator::TalkFileCreator(QObject* parent): QObject(parent)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TalkFileCreator::initEncoder()
|
|
||||||
{
|
|
||||||
QFileInfo enc(m_EncExec);
|
|
||||||
if(enc.exists())
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger)
|
bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger)
|
||||||
{
|
{
|
||||||
m_abort = false;
|
m_abort = false;
|
||||||
|
|
@ -60,12 +45,18 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger)
|
||||||
m_logger->addItem("Init of TTS engine failed",LOGERROR);
|
m_logger->addItem("Init of TTS engine failed",LOGERROR);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if(!initEncoder())
|
|
||||||
|
// Encoder
|
||||||
|
m_enc = getEncoder(userSettings->value("encoder").toString());
|
||||||
|
m_enc->setUserCfg(userSettings);
|
||||||
|
|
||||||
|
if(!m_enc->start())
|
||||||
{
|
{
|
||||||
m_logger->addItem("Init of encoder failed",LOGERROR);
|
m_logger->addItem("Init of Encoder engine failed",LOGERROR);
|
||||||
m_tts->stop();
|
m_tts->stop();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QApplication::processEvents();
|
QApplication::processEvents();
|
||||||
|
|
||||||
connect(logger,SIGNAL(aborted()),this,SLOT(abort()));
|
connect(logger,SIGNAL(aborted()),this,SLOT(abort()));
|
||||||
|
|
@ -88,13 +79,16 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger)
|
||||||
QString toSpeak;
|
QString toSpeak;
|
||||||
QString filename;
|
QString filename;
|
||||||
QString wavfilename;
|
QString wavfilename;
|
||||||
|
|
||||||
//! skip dotdot and .talk files
|
QString path = fileInf.filePath();
|
||||||
if(fileInf.fileName() == ".." || fileInf.suffix() == "talk")
|
qDebug() << path;
|
||||||
|
|
||||||
|
if( path.endsWith("..") || path.endsWith(".talk") )
|
||||||
{
|
{
|
||||||
it.next();
|
it.next();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! if it is a dir
|
//! if it is a dir
|
||||||
if(fileInf.isDir())
|
if(fileInf.isDir())
|
||||||
{
|
{
|
||||||
|
|
@ -103,9 +97,14 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger)
|
||||||
{
|
{
|
||||||
it.next();
|
it.next();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
toSpeak = fileInf.absoluteDir().dirName();
|
int index1 = path.lastIndexOf("/");
|
||||||
filename = fileInf.absolutePath() + "/_dirname.talk";
|
int index2 = path.lastIndexOf("/",index1-1);
|
||||||
|
|
||||||
|
toSpeak = path.mid(index2+1,(index1-index2)-1);
|
||||||
|
|
||||||
|
filename = path.left(index1) + "/_dirname.talk";
|
||||||
|
qDebug() << "toSpeak: " << toSpeak << "filename: " << filename;
|
||||||
}
|
}
|
||||||
else // if it is a file
|
else // if it is a file
|
||||||
{
|
{
|
||||||
|
|
@ -137,15 +136,17 @@ bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger)
|
||||||
m_logger->addItem("Voicing of " + toSpeak + " failed",LOGERROR);
|
m_logger->addItem("Voicing of " + toSpeak + " failed",LOGERROR);
|
||||||
m_logger->abort();
|
m_logger->abort();
|
||||||
m_tts->stop();
|
m_tts->stop();
|
||||||
|
m_enc->stop();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_logger->addItem("Encoding of " + toSpeak,LOGINFO);
|
m_logger->addItem("Encoding of " + toSpeak,LOGINFO);
|
||||||
if(!encode(wavfilename,filename))
|
if(!m_enc->encode(wavfilename,filename))
|
||||||
{
|
{
|
||||||
m_logger->addItem("Encoding of " + wavfilename + " failed",LOGERROR);
|
m_logger->addItem("Encoding of " + wavfilename + " failed",LOGERROR);
|
||||||
m_logger->abort();
|
m_logger->abort();
|
||||||
m_tts->stop();
|
m_tts->stop();
|
||||||
|
m_enc->stop();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -182,21 +183,6 @@ void TalkFileCreator::abort()
|
||||||
m_abort = true;
|
m_abort = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TalkFileCreator::encode(QString input,QString output)
|
|
||||||
{
|
|
||||||
qDebug() << "encoding..";
|
|
||||||
QString execstring = m_curEncTemplate;
|
|
||||||
|
|
||||||
execstring.replace("%exe",m_EncExec);
|
|
||||||
execstring.replace("%options",m_EncOpts);
|
|
||||||
execstring.replace("%input",input);
|
|
||||||
execstring.replace("%output",output);
|
|
||||||
qDebug() << execstring;
|
|
||||||
QProcess::execute(execstring);
|
|
||||||
return true;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TTSSapi::start()
|
bool TTSSapi::start()
|
||||||
{
|
{
|
||||||
QFileInfo tts(m_TTSexec);
|
QFileInfo tts(m_TTSexec);
|
||||||
|
|
@ -257,7 +243,7 @@ bool TTSExes::voice(QString text,QString wavfile)
|
||||||
execstring.replace("%options",m_TTSOpts);
|
execstring.replace("%options",m_TTSOpts);
|
||||||
execstring.replace("%wavfile",wavfile);
|
execstring.replace("%wavfile",wavfile);
|
||||||
execstring.replace("%text",text);
|
execstring.replace("%text",text);
|
||||||
qDebug() << "voicing" << execstring;
|
//qDebug() << "voicing" << execstring;
|
||||||
QProcess::execute(execstring);
|
QProcess::execute(execstring);
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,8 +21,12 @@
|
||||||
#ifndef TALKFILE_H
|
#ifndef TALKFILE_H
|
||||||
#define TALKFILE_H
|
#define TALKFILE_H
|
||||||
|
|
||||||
|
#include <QtGui>
|
||||||
#include "progressloggerinterface.h"
|
#include "progressloggerinterface.h"
|
||||||
|
|
||||||
|
#include "encoders.h"
|
||||||
|
|
||||||
|
|
||||||
class TTSBase : public QObject
|
class TTSBase : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
@ -55,18 +59,16 @@ public:
|
||||||
|
|
||||||
bool createTalkFiles(ProgressloggerInterface* logger);
|
bool createTalkFiles(ProgressloggerInterface* logger);
|
||||||
|
|
||||||
|
void setUserSettings(QSettings* setting) { userSettings = setting;}
|
||||||
|
|
||||||
void setTTSexe(QString exe){m_TTSexec=exe;}
|
void setTTSexe(QString exe){m_TTSexec=exe;}
|
||||||
void setEncexe(QString exe){m_EncExec=exe;}
|
|
||||||
|
|
||||||
void setTTsType(QString tts) { m_curTTS = tts; }
|
void setTTsType(QString tts) { m_curTTS = tts; }
|
||||||
void setTTsOpts(QString opts) {m_TTSOpts=opts;}
|
void setTTsOpts(QString opts) {m_TTSOpts=opts;}
|
||||||
void setTTsLanguage(QString language) {m_TTSLanguage = language;}
|
void setTTsLanguage(QString language) {m_TTSLanguage = language;}
|
||||||
void setTTsTemplate(QString t) { m_curTTSTemplate = t; }
|
void setTTsTemplate(QString t) { m_curTTSTemplate = t; }
|
||||||
|
|
||||||
void setEncType(QString enc) { m_curEnc = enc; }
|
|
||||||
void setEncOpts(QString opts) {m_EncOpts=opts;}
|
|
||||||
void setEncTemplate(QString t) { m_curEncTemplate = t; }
|
|
||||||
|
|
||||||
void setDir(QDir dir){m_dir = dir; }
|
void setDir(QDir dir){m_dir = dir; }
|
||||||
void setMountPoint(QString mountpoint) {m_mountpoint =mountpoint; }
|
void setMountPoint(QString mountpoint) {m_mountpoint =mountpoint; }
|
||||||
|
|
||||||
|
|
@ -83,10 +85,9 @@ private slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TTSBase* m_tts;
|
TTSBase* m_tts;
|
||||||
bool initEncoder();
|
EncBase* m_enc;
|
||||||
|
QSettings *userSettings;
|
||||||
bool encode(QString input,QString output);
|
|
||||||
|
|
||||||
QDir m_dir;
|
QDir m_dir;
|
||||||
QString m_mountpoint;
|
QString m_mountpoint;
|
||||||
QString m_curTTS;
|
QString m_curTTS;
|
||||||
|
|
@ -95,11 +96,6 @@ private:
|
||||||
QString m_TTSLanguage;
|
QString m_TTSLanguage;
|
||||||
QString m_curTTSTemplate;
|
QString m_curTTSTemplate;
|
||||||
|
|
||||||
QString m_curEnc;
|
|
||||||
QString m_EncExec;
|
|
||||||
QString m_EncOpts;
|
|
||||||
QString m_curEncTemplate;
|
|
||||||
|
|
||||||
bool m_overwriteTalk;
|
bool m_overwriteTalk;
|
||||||
bool m_overwriteWav;
|
bool m_overwriteWav;
|
||||||
bool m_removeWav;
|
bool m_removeWav;
|
||||||
|
|
@ -137,5 +133,7 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue