forked from len0rd/rockbox
rbutilQt: added Talkfile creation.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14197 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
1d9f693658
commit
e70f7f4ca8
12 changed files with 1001 additions and 23 deletions
|
@ -152,27 +152,26 @@ void InstallBl::done(bool error)
|
||||||
void InstallBl::setDeviceSettings(QSettings *dev)
|
void InstallBl::setDeviceSettings(QSettings *dev)
|
||||||
{
|
{
|
||||||
devices = dev;
|
devices = dev;
|
||||||
|
|
||||||
if(userSettings->value("defaults/platform").toString() == "h100" ||
|
|
||||||
userSettings->value("defaults/platform").toString() == "h120" ||
|
|
||||||
userSettings->value("defaults/platform").toString() == "h300")
|
|
||||||
{
|
|
||||||
ui.buttonBrowseOF->show();
|
|
||||||
ui.lineOriginalFirmware->show();
|
|
||||||
ui.label_3->show();
|
|
||||||
needextrafile = true;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ui.buttonBrowseOF->hide();
|
|
||||||
ui.lineOriginalFirmware->hide();
|
|
||||||
ui.label_3->hide();
|
|
||||||
needextrafile = false;
|
|
||||||
}
|
|
||||||
qDebug() << "Install::setDeviceSettings:" << devices;
|
qDebug() << "Install::setDeviceSettings:" << devices;
|
||||||
}
|
}
|
||||||
|
|
||||||
void InstallBl::setUserSettings(QSettings *user)
|
void InstallBl::setUserSettings(QSettings *user)
|
||||||
{
|
{
|
||||||
userSettings = user;
|
userSettings = user;
|
||||||
|
if(userSettings->value("defaults/platform").toString() == "h100" ||
|
||||||
|
userSettings->value("defaults/platform").toString() == "h120" ||
|
||||||
|
userSettings->value("defaults/platform").toString() == "h300")
|
||||||
|
{
|
||||||
|
ui.buttonBrowseOF->show();
|
||||||
|
ui.lineOriginalFirmware->show();
|
||||||
|
ui.label_3->show();
|
||||||
|
needextrafile = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui.buttonBrowseOF->hide();
|
||||||
|
ui.lineOriginalFirmware->hide();
|
||||||
|
ui.label_3->hide();
|
||||||
|
needextrafile = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
268
rbutil/rbutilqt/installtalkfrm.ui
Normal file
268
rbutil/rbutilqt/installtalkfrm.ui
Normal file
|
@ -0,0 +1,268 @@
|
||||||
|
<ui version="4.0" >
|
||||||
|
<class>InstallTalkFrm</class>
|
||||||
|
<widget class="QDialog" name="InstallTalkFrm" >
|
||||||
|
<property name="windowModality" >
|
||||||
|
<enum>Qt::WindowModal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="geometry" >
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>681</width>
|
||||||
|
<height>516</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle" >
|
||||||
|
<string>Install Talk Files</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" >
|
||||||
|
<item rowspan="5" row="0" column="0" >
|
||||||
|
<widget class="QLabel" name="label" >
|
||||||
|
<property name="text" >
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="pixmap" >
|
||||||
|
<pixmap resource="rbutilqt.qrc" >:/icons/icons/wizard.xpm</pixmap>
|
||||||
|
</property>
|
||||||
|
<property name="alignment" >
|
||||||
|
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1" colspan="5" >
|
||||||
|
<widget class="QLabel" name="label_2" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Select the Folder to generate Talkfiles for.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1" colspan="4" >
|
||||||
|
<widget class="QLineEdit" name="lineTalkFolder" />
|
||||||
|
</item>
|
||||||
|
<item row="1" column="5" >
|
||||||
|
<widget class="QPushButton" name="buttonBrowse" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>&Browse</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon" >
|
||||||
|
<iconset resource="rbutilqt.qrc" >:/icons/icons/system-search.png</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1" colspan="5" >
|
||||||
|
<widget class="QGroupBox" name="groupBox" >
|
||||||
|
<property name="title" >
|
||||||
|
<string>TTS Engine</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" >
|
||||||
|
<item row="0" column="0" colspan="2" >
|
||||||
|
<widget class="QLabel" name="label_3" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Select a TTS Engine</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" colspan="2" >
|
||||||
|
<widget class="QComboBox" name="TTScbx" />
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0" colspan="2" >
|
||||||
|
<widget class="QLabel" name="label_4" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Select the TTS executable in your Filesystem</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0" >
|
||||||
|
<widget class="QLineEdit" name="TTSpath" />
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1" >
|
||||||
|
<widget class="QPushButton" name="buttonBrowseTTS" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Browse</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0" >
|
||||||
|
<widget class="QLabel" name="label_7" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>TTS Options</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0" colspan="2" >
|
||||||
|
<widget class="QLineEdit" name="TTSOptions" />
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1" colspan="5" >
|
||||||
|
<widget class="QGroupBox" name="groupBox_2" >
|
||||||
|
<property name="title" >
|
||||||
|
<string>Encoder Engine</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QGridLayout" >
|
||||||
|
<item row="0" column="0" colspan="2" >
|
||||||
|
<widget class="QLabel" name="label_5" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Select an Encoder</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" colspan="2" >
|
||||||
|
<widget class="QComboBox" name="Encodercbx" />
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0" colspan="2" >
|
||||||
|
<widget class="QLabel" name="label_6" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Select the Encoder executable in your Filesystem</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0" >
|
||||||
|
<widget class="QLineEdit" name="Encoderpath" />
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1" >
|
||||||
|
<widget class="QPushButton" name="buttonBrowseEncoder" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Browse</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0" >
|
||||||
|
<widget class="QLabel" name="label_8" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Encoder Options</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0" colspan="2" >
|
||||||
|
<widget class="QLineEdit" name="EncoderOptions" />
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1" >
|
||||||
|
<widget class="QCheckBox" name="OverwriteWav" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Overwrite Wavefiles</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="2" >
|
||||||
|
<widget class="QCheckBox" name="RemoveWav" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Remove Wavefiles</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="3" colspan="2" >
|
||||||
|
<widget class="QCheckBox" name="recursive" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Run recursive</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="1" >
|
||||||
|
<widget class="QCheckBox" name="OverwriteTalk" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Overwrite Talkfiles</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="2" >
|
||||||
|
<widget class="QCheckBox" name="StripExtensions" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Strip Extensions</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="4" >
|
||||||
|
<spacer>
|
||||||
|
<property name="orientation" >
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" >
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>111</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="1" colspan="3" >
|
||||||
|
<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="6" column="4" colspan="2" >
|
||||||
|
<layout class="QHBoxLayout" >
|
||||||
|
<item>
|
||||||
|
<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>
|
||||||
|
<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>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="rbutilqt.qrc" />
|
||||||
|
</resources>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonOk</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>InstallTalkFrm</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel" >
|
||||||
|
<x>472</x>
|
||||||
|
<y>418</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel" >
|
||||||
|
<x>382</x>
|
||||||
|
<y>328</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonCancel</sender>
|
||||||
|
<signal>clicked()</signal>
|
||||||
|
<receiver>InstallTalkFrm</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel" >
|
||||||
|
<x>561</x>
|
||||||
|
<y>428</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel" >
|
||||||
|
<x>522</x>
|
||||||
|
<y>332</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
</ui>
|
264
rbutil/rbutilqt/installtalkwindow.cpp
Normal file
264
rbutil/rbutilqt/installtalkwindow.cpp
Normal file
|
@ -0,0 +1,264 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
*
|
||||||
|
* Copyright (C) 2007 by Dominik Riebeling
|
||||||
|
* $Id: installtalkwindow.cpp 14151 2007-08-02 22:27:51Z bluebrother $
|
||||||
|
*
|
||||||
|
* All files in this archive are subject to the GNU General Public License.
|
||||||
|
* See the file COPYING in the source tree root for full license agreement.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "installtalkwindow.h"
|
||||||
|
#include "ui_installtalkfrm.h"
|
||||||
|
|
||||||
|
InstallTalkWindow::InstallTalkWindow(QWidget *parent) : QDialog(parent)
|
||||||
|
{
|
||||||
|
ui.setupUi(this);
|
||||||
|
talkcreator = new TalkFileCreator(this);
|
||||||
|
|
||||||
|
connect(ui.buttonBrowse, SIGNAL(clicked()), this, SLOT(browseFolder()));
|
||||||
|
connect(ui.buttonBrowseTTS, SIGNAL(clicked()), this, SLOT(browseTTS()));
|
||||||
|
connect(ui.buttonBrowseEncoder, SIGNAL(clicked()), this, SLOT(browseEncoder()));
|
||||||
|
|
||||||
|
connect(ui.Encodercbx,SIGNAL(currentIndexChanged(int)),this,SLOT(setEncoderOptions(int)));
|
||||||
|
connect(ui.TTScbx,SIGNAL(currentIndexChanged(int)),this,SLOT(setTTSOptions(int)));
|
||||||
|
|
||||||
|
ui.OverwriteWav->setChecked(true);
|
||||||
|
ui.RemoveWav->setChecked(true);
|
||||||
|
ui.recursive->setChecked(true);
|
||||||
|
ui.OverwriteTalk->setChecked(true);
|
||||||
|
ui.StripExtensions->setChecked(true);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void InstallTalkWindow::browseFolder()
|
||||||
|
{
|
||||||
|
QFileDialog browser(this);
|
||||||
|
if(QFileInfo(ui.lineTalkFolder->text()).isDir())
|
||||||
|
browser.setDirectory(ui.lineTalkFolder->text());
|
||||||
|
else
|
||||||
|
browser.setDirectory("/media");
|
||||||
|
browser.setReadOnly(true);
|
||||||
|
browser.setFileMode(QFileDialog::DirectoryOnly);
|
||||||
|
browser.setAcceptMode(QFileDialog::AcceptOpen);
|
||||||
|
if(browser.exec()) {
|
||||||
|
qDebug() << browser.directory();
|
||||||
|
QStringList files = browser.selectedFiles();
|
||||||
|
setTalkFolder(files.at(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void InstallTalkWindow::setTalkFolder(QString folder)
|
||||||
|
{
|
||||||
|
ui.lineTalkFolder->clear();
|
||||||
|
ui.lineTalkFolder->insert(folder);
|
||||||
|
}
|
||||||
|
|
||||||
|
void InstallTalkWindow::browseTTS()
|
||||||
|
{
|
||||||
|
QFileDialog browser(this);
|
||||||
|
if(QFileInfo(ui.TTSpath->text()).isDir())
|
||||||
|
browser.setDirectory(ui.TTSpath->text());
|
||||||
|
else
|
||||||
|
browser.setDirectory("/media");
|
||||||
|
browser.setReadOnly(true);
|
||||||
|
browser.setFileMode(QFileDialog::ExistingFile);
|
||||||
|
browser.setAcceptMode(QFileDialog::AcceptOpen);
|
||||||
|
if(browser.exec()) {
|
||||||
|
qDebug() << browser.directory();
|
||||||
|
QStringList files = browser.selectedFiles();
|
||||||
|
setTTSExec(files.at(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void InstallTalkWindow::setTTSExec(QString path)
|
||||||
|
{
|
||||||
|
ui.TTSpath->clear();
|
||||||
|
ui.TTSpath->insert(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
void InstallTalkWindow::browseEncoder()
|
||||||
|
{
|
||||||
|
QFileDialog browser(this);
|
||||||
|
if(QFileInfo(ui.Encoderpath->text()).isDir())
|
||||||
|
browser.setDirectory(ui.Encoderpath->text());
|
||||||
|
else
|
||||||
|
browser.setDirectory("/media");
|
||||||
|
browser.setReadOnly(true);
|
||||||
|
browser.setFileMode(QFileDialog::ExistingFile);
|
||||||
|
browser.setAcceptMode(QFileDialog::AcceptOpen);
|
||||||
|
if(browser.exec()) {
|
||||||
|
qDebug() << browser.directory();
|
||||||
|
QStringList files = browser.selectedFiles();
|
||||||
|
setEncoderExec(files.at(0));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void InstallTalkWindow::setEncoderExec(QString path)
|
||||||
|
{
|
||||||
|
ui.Encoderpath->clear();
|
||||||
|
ui.Encoderpath->insert(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
void InstallTalkWindow::setEncoderOptions(int index)
|
||||||
|
{
|
||||||
|
QString options = talkcreator->getEncOpts(ui.Encodercbx->itemText(index));
|
||||||
|
setEncoderOptions(options);
|
||||||
|
}
|
||||||
|
void InstallTalkWindow::setEncoderOptions(QString options)
|
||||||
|
{
|
||||||
|
ui.EncoderOptions->clear();
|
||||||
|
ui.EncoderOptions->insert(options);
|
||||||
|
}
|
||||||
|
void InstallTalkWindow::setTTSOptions(QString options)
|
||||||
|
{
|
||||||
|
ui.TTSOptions->clear();
|
||||||
|
ui.TTSOptions->insert(options);
|
||||||
|
}
|
||||||
|
void InstallTalkWindow::setTTSOptions(int index)
|
||||||
|
{
|
||||||
|
QString options = talkcreator->getTTsOpts(ui.TTScbx->itemText(index));
|
||||||
|
setEncoderOptions(options);
|
||||||
|
}
|
||||||
|
|
||||||
|
void InstallTalkWindow::accept()
|
||||||
|
{
|
||||||
|
logger = new ProgressLoggerGui(this);
|
||||||
|
logger->show();
|
||||||
|
|
||||||
|
QString folderToTalk = ui.lineTalkFolder->text();
|
||||||
|
QString pathEncoder = ui.Encoderpath->text();
|
||||||
|
QString pathTTS = ui.TTSpath->text();
|
||||||
|
|
||||||
|
if(!QFileInfo(folderToTalk).isDir())
|
||||||
|
{
|
||||||
|
logger->addItem(tr("The Folder to Talk is wrong!"),LOGERROR);
|
||||||
|
logger->abort();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!QFileInfo(pathEncoder).exists())
|
||||||
|
{
|
||||||
|
logger->addItem(tr("Path to Encoder is wrong!"),LOGERROR);
|
||||||
|
logger->abort();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!QFileInfo(pathTTS).exists())
|
||||||
|
{
|
||||||
|
logger->addItem(tr("Path to TTS is wrong!"),LOGERROR);
|
||||||
|
logger->abort();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
userSettings->setValue("defaults/folderToTalk",folderToTalk);
|
||||||
|
userSettings->setValue("defaults/pathEncoder",pathEncoder);
|
||||||
|
userSettings->setValue("defaults/pathTTS",pathTTS);
|
||||||
|
|
||||||
|
userSettings->sync();
|
||||||
|
|
||||||
|
talkcreator->setDir(folderToTalk);
|
||||||
|
talkcreator->setTTSexe(pathTTS);
|
||||||
|
talkcreator->setEncexe(pathEncoder);
|
||||||
|
talkcreator->setEncOpts(ui.EncoderOptions->text());
|
||||||
|
talkcreator->setTTsOpts(ui.TTSOptions->text());
|
||||||
|
talkcreator->setTTsType(ui.TTScbx->currentText());
|
||||||
|
talkcreator->setEncType(ui.Encodercbx->currentText());
|
||||||
|
|
||||||
|
talkcreator->setOverwriteTalk(ui.OverwriteTalk->isChecked());
|
||||||
|
talkcreator->setOverwriteWav(ui.OverwriteWav->isChecked());
|
||||||
|
talkcreator->setRemoveWav(ui.RemoveWav->isChecked());
|
||||||
|
talkcreator->setRecursive(ui.recursive->isChecked());
|
||||||
|
talkcreator->setStripExtensions(ui.StripExtensions->isChecked());
|
||||||
|
|
||||||
|
talkcreator->createTalkFiles(logger);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void InstallTalkWindow::setDeviceSettings(QSettings *dev)
|
||||||
|
{
|
||||||
|
devices = dev;
|
||||||
|
qDebug() << "Install::setDeviceSettings:" << devices;
|
||||||
|
|
||||||
|
QStringList encoders;
|
||||||
|
QStringList encodersOpts;
|
||||||
|
QStringList encodersTemplates;
|
||||||
|
|
||||||
|
QStringList tts;
|
||||||
|
QStringList ttsOpts;
|
||||||
|
QStringList ttsTemplates;
|
||||||
|
|
||||||
|
devices->beginGroup("encoders");
|
||||||
|
QStringList keys = devices->allKeys();
|
||||||
|
qDebug() << keys;
|
||||||
|
for(int i=0; i < keys.size();i++)
|
||||||
|
{
|
||||||
|
encoders << devices->value(keys.at(i),"null").toString();
|
||||||
|
}
|
||||||
|
qDebug() << encoders;
|
||||||
|
devices->endGroup();
|
||||||
|
for(int i=0; i < encoders.size();i++)
|
||||||
|
{
|
||||||
|
devices->beginGroup(encoders.at(i));
|
||||||
|
encodersOpts << devices->value("options","null").toString();
|
||||||
|
encodersTemplates << devices->value("template","null").toString();
|
||||||
|
devices->endGroup();
|
||||||
|
}
|
||||||
|
qDebug() << encodersOpts;
|
||||||
|
qDebug() << encodersTemplates;
|
||||||
|
|
||||||
|
devices->beginGroup("tts");
|
||||||
|
keys = devices->allKeys();
|
||||||
|
qDebug() << keys;
|
||||||
|
for(int i=0; i < keys.size();i++)
|
||||||
|
{
|
||||||
|
tts << devices->value(keys.at(i),"null").toString();
|
||||||
|
}
|
||||||
|
qDebug() << tts;
|
||||||
|
devices->endGroup();
|
||||||
|
for(int i= 0; i < tts.size();i++)
|
||||||
|
{
|
||||||
|
devices->beginGroup(tts.at(i));
|
||||||
|
ttsOpts << devices->value("options","null").toString();
|
||||||
|
ttsTemplates << devices->value("template","null").toString();
|
||||||
|
devices->endGroup();
|
||||||
|
}
|
||||||
|
qDebug() << ttsOpts;
|
||||||
|
qDebug() << ttsTemplates;
|
||||||
|
|
||||||
|
talkcreator->setSupportedEnc(encoders);
|
||||||
|
talkcreator->setSupportedEncOptions(encodersOpts);
|
||||||
|
talkcreator->setSupportedEncTemplates(encodersTemplates);
|
||||||
|
|
||||||
|
talkcreator->setSupportedTTS(tts);
|
||||||
|
talkcreator->setSupportedTTSOptions(ttsOpts);
|
||||||
|
talkcreator->setSupportedTTSTemplates(ttsTemplates);
|
||||||
|
|
||||||
|
ui.Encodercbx->insertItems(0,talkcreator->getSupportedEnc());
|
||||||
|
ui.TTScbx->insertItems(0,talkcreator->getSupportedTTS());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void InstallTalkWindow::setUserSettings(QSettings *user)
|
||||||
|
{
|
||||||
|
userSettings = user;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
setTalkFolder(userSettings->value("defaults/folderToTalk").toString());
|
||||||
|
setEncoderExec(userSettings->value("defaults/pathEncoder").toString());
|
||||||
|
setTTSExec(userSettings->value("defaults/pathTTS").toString());
|
||||||
|
}
|
66
rbutil/rbutilqt/installtalkwindow.h
Normal file
66
rbutil/rbutilqt/installtalkwindow.h
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
*
|
||||||
|
* Copyright (C) 2007 by Dominik Wenger
|
||||||
|
* $Id: installtalkwindow.h 14151 2007-08-02 22:27:51Z domonoky $
|
||||||
|
*
|
||||||
|
* All files in this archive are subject to the GNU General Public License.
|
||||||
|
* See the file COPYING in the source tree root for full license agreement.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#ifndef INSTALLTALKWINDOW_H
|
||||||
|
#define INSTALLTALKWINDOW_H
|
||||||
|
|
||||||
|
#include <QtGui>
|
||||||
|
|
||||||
|
#include <QSettings>
|
||||||
|
|
||||||
|
#include "ui_installtalkfrm.h"
|
||||||
|
#include "progressloggergui.h"
|
||||||
|
#include "talkfile.h"
|
||||||
|
|
||||||
|
class InstallTalkWindow : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
InstallTalkWindow(QWidget *parent = 0);
|
||||||
|
void setUserSettings(QSettings*);
|
||||||
|
void setDeviceSettings(QSettings*);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void accept(void);
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void browseFolder(void);
|
||||||
|
void browseTTS(void);
|
||||||
|
void browseEncoder(void);
|
||||||
|
|
||||||
|
void setTalkFolder(QString folder);
|
||||||
|
void setTTSExec(QString path);
|
||||||
|
void setEncoderExec(QString path);
|
||||||
|
|
||||||
|
void setEncoderOptions(int index);
|
||||||
|
void setTTSOptions(int index);
|
||||||
|
void setEncoderOptions(QString options);
|
||||||
|
void setTTSOptions(QString options);
|
||||||
|
|
||||||
|
private:
|
||||||
|
TalkFileCreator* talkcreator;
|
||||||
|
Ui::InstallTalkFrm ui;
|
||||||
|
ProgressLoggerGui* logger;
|
||||||
|
QSettings *devices;
|
||||||
|
QSettings *userSettings;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
|
@ -337,3 +337,21 @@ resolution=176x220x16
|
||||||
manualname=
|
manualname=
|
||||||
brand=Sandisk
|
brand=Sandisk
|
||||||
|
|
||||||
|
[encoders]
|
||||||
|
encoder01 = lame
|
||||||
|
|
||||||
|
[tts]
|
||||||
|
tts01 = espeak
|
||||||
|
tts02 = flite
|
||||||
|
|
||||||
|
[lame]
|
||||||
|
options = ""
|
||||||
|
template = "\"%exe\" %options \"%input\" \"%output\""
|
||||||
|
|
||||||
|
[espeak]
|
||||||
|
options = ""
|
||||||
|
template = "\"%exe\" %options -w \"%wavfile\" \"%text\""
|
||||||
|
|
||||||
|
[flite]
|
||||||
|
options = ""
|
||||||
|
template = "\"%exe\" %options -o \"%wavfile\" \"%text\""
|
|
@ -26,6 +26,7 @@
|
||||||
#include "configure.h"
|
#include "configure.h"
|
||||||
#include "install.h"
|
#include "install.h"
|
||||||
#include "installbl.h"
|
#include "installbl.h"
|
||||||
|
#include "installtalkwindow.h"
|
||||||
#include "httpget.h"
|
#include "httpget.h"
|
||||||
#include "installbootloader.h"
|
#include "installbootloader.h"
|
||||||
|
|
||||||
|
@ -78,7 +79,9 @@ RbUtilQt::RbUtilQt(QWidget *parent) : QMainWindow(parent)
|
||||||
connect(ui.buttonBootloader, SIGNAL(clicked()), this, SLOT(installBl()));
|
connect(ui.buttonBootloader, SIGNAL(clicked()), this, SLOT(installBl()));
|
||||||
connect(ui.buttonFonts, SIGNAL(clicked()), this, SLOT(installFonts()));
|
connect(ui.buttonFonts, SIGNAL(clicked()), this, SLOT(installFonts()));
|
||||||
connect(ui.buttonGames, SIGNAL(clicked()), this, SLOT(installDoom()));
|
connect(ui.buttonGames, SIGNAL(clicked()), this, SLOT(installDoom()));
|
||||||
|
connect(ui.buttonTalk, SIGNAL(clicked()), this, SLOT(createTalkFiles()));
|
||||||
|
|
||||||
|
|
||||||
// disable unimplemented stuff
|
// disable unimplemented stuff
|
||||||
ui.buttonThemes->setEnabled(false);
|
ui.buttonThemes->setEnabled(false);
|
||||||
ui.buttonSmall->setEnabled(false);
|
ui.buttonSmall->setEnabled(false);
|
||||||
|
@ -345,3 +348,12 @@ void RbUtilQt::installDoom()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void RbUtilQt::createTalkFiles(void)
|
||||||
|
{
|
||||||
|
InstallTalkWindow *installWindow = new InstallTalkWindow(this);
|
||||||
|
installWindow->setUserSettings(userSettings);
|
||||||
|
installWindow->setDeviceSettings(devices);
|
||||||
|
installWindow->show();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -59,6 +59,7 @@ class RbUtilQt : public QMainWindow
|
||||||
void installBl(void);
|
void installBl(void);
|
||||||
void installFonts(void);
|
void installFonts(void);
|
||||||
void installDoom(void);
|
void installDoom(void);
|
||||||
|
void createTalkFiles(void);
|
||||||
void downloadDone(bool);
|
void downloadDone(bool);
|
||||||
void downloadDone(int, bool);
|
void downloadDone(int, bool);
|
||||||
void downloadInfo(void);
|
void downloadInfo(void);
|
||||||
|
|
|
@ -9,6 +9,8 @@ SOURCES += rbutilqt.cpp \
|
||||||
installbootloader.cpp \
|
installbootloader.cpp \
|
||||||
installbl.cpp \
|
installbl.cpp \
|
||||||
progressloggergui.cpp \
|
progressloggergui.cpp \
|
||||||
|
installtalkwindow.cpp \
|
||||||
|
talkfile.cpp \
|
||||||
../ipodpatcher/ipodpatcher.c \
|
../ipodpatcher/ipodpatcher.c \
|
||||||
../sansapatcher/sansapatcher.c \
|
../sansapatcher/sansapatcher.c \
|
||||||
irivertools/irivertools.cpp \
|
irivertools/irivertools.cpp \
|
||||||
|
@ -29,6 +31,8 @@ HEADERS += rbutilqt.h \
|
||||||
installzip.h \
|
installzip.h \
|
||||||
installbootloader.h \
|
installbootloader.h \
|
||||||
installbl.h \
|
installbl.h \
|
||||||
|
installtalkwindow.h \
|
||||||
|
talkfile.h \
|
||||||
progressloggerinterface.h \
|
progressloggerinterface.h \
|
||||||
progressloggergui.h \
|
progressloggergui.h \
|
||||||
../ipodpatcher/ipodpatcher.h \
|
../ipodpatcher/ipodpatcher.h \
|
||||||
|
@ -55,7 +59,8 @@ FORMS += rbutilqtfrm.ui \
|
||||||
installfrm.ui \
|
installfrm.ui \
|
||||||
installprogressfrm.ui \
|
installprogressfrm.ui \
|
||||||
configurefrm.ui \
|
configurefrm.ui \
|
||||||
installbootloaderfrm.ui
|
installbootloaderfrm.ui \
|
||||||
|
installtalkfrm.ui
|
||||||
|
|
||||||
|
|
||||||
RESOURCES += rbutilqt.qrc
|
RESOURCES += rbutilqt.qrc
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
<file>icons/rembootloader_btn.png</file>
|
<file>icons/rembootloader_btn.png</file>
|
||||||
<file>icons/remrb_btn.png</file>
|
<file>icons/remrb_btn.png</file>
|
||||||
<file>icons/system-search.png</file>
|
<file>icons/system-search.png</file>
|
||||||
|
<file>icons/talkfile_btn.png</file>
|
||||||
<file>icons/themes_btn.png</file>
|
<file>icons/themes_btn.png</file>
|
||||||
<file>icons/wizard.xpm</file>
|
<file>icons/wizard.xpm</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
|
|
|
@ -130,7 +130,7 @@ p, li { white-space: pre-wrap; }
|
||||||
<item row="2" column="0" >
|
<item row="2" column="0" >
|
||||||
<widget class="QTabWidget" name="tabWidget" >
|
<widget class="QTabWidget" name="tabWidget" >
|
||||||
<property name="currentIndex" >
|
<property name="currentIndex" >
|
||||||
<number>0</number>
|
<number>2</number>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="quickStart" >
|
<widget class="QWidget" name="quickStart" >
|
||||||
<attribute name="title" >
|
<attribute name="title" >
|
||||||
|
@ -436,7 +436,7 @@ p, li { white-space: pre-wrap; }
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0" >
|
<item row="4" column="0" >
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation" >
|
<property name="orientation" >
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
|
@ -449,7 +449,7 @@ p, li { white-space: pre-wrap; }
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1" >
|
<item row="4" column="1" >
|
||||||
<spacer>
|
<spacer>
|
||||||
<property name="orientation" >
|
<property name="orientation" >
|
||||||
<enum>Qt::Vertical</enum>
|
<enum>Qt::Vertical</enum>
|
||||||
|
@ -462,6 +462,33 @@ p, li { white-space: pre-wrap; }
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="3" column="0" >
|
||||||
|
<widget class="QToolButton" name="buttonTalk" >
|
||||||
|
<property name="text" >
|
||||||
|
<string>Install Talk files</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon" >
|
||||||
|
<iconset resource="rbutilqt.qrc" >:/icons/icons/talkfile_btn.png</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="iconSize" >
|
||||||
|
<size>
|
||||||
|
<width>56</width>
|
||||||
|
<height>46</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1" >
|
||||||
|
<widget class="QLabel" name="label" >
|
||||||
|
<property name="text" >
|
||||||
|
<string><html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||||
|
p, li { white-space: pre-wrap; }
|
||||||
|
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
|
||||||
|
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><span style=" font-weight:600;">Create Talk Files</span></p>
|
||||||
|
<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-weight:600;"><span style=" font-weight:400;">Talkfiles are needed to let Rockbox speak File and Foldernames</span></p></body></html></string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QWidget" name="uninstall" >
|
<widget class="QWidget" name="uninstall" >
|
||||||
|
@ -675,7 +702,7 @@ p, li { white-space: pre-wrap; }
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>600</width>
|
<width>600</width>
|
||||||
<height>29</height>
|
<height>21</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QMenu" name="menu_File" >
|
<widget class="QMenu" name="menu_File" >
|
||||||
|
|
212
rbutil/rbutilqt/talkfile.cpp
Normal file
212
rbutil/rbutilqt/talkfile.cpp
Normal file
|
@ -0,0 +1,212 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
*
|
||||||
|
* Copyright (C) 2007 by Dominik Wenger
|
||||||
|
* $Id: talkfile.cpp 14027 2007-07-27 17:42:49Z domonoky $
|
||||||
|
*
|
||||||
|
* All files in this archive are subject to the GNU General Public License.
|
||||||
|
* See the file COPYING in the source tree root for full license agreement.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
#include "talkfile.h"
|
||||||
|
|
||||||
|
TalkFileCreator::TalkFileCreator(QObject* parent): QObject(parent)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void TalkFileCreator::setTTsType(QString tts)
|
||||||
|
{
|
||||||
|
m_curTTS = tts;
|
||||||
|
int index = m_supportedTTS.indexOf(m_curTTS);
|
||||||
|
m_curTTSTemplate = m_supportedTTSTemplates.at(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
void TalkFileCreator::setEncType(QString enc)
|
||||||
|
{
|
||||||
|
m_curEnc = enc;
|
||||||
|
int index = m_supportedEnc.indexOf(m_curEnc);
|
||||||
|
m_curEncTemplate = m_supportedEncTemplates.at(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TalkFileCreator::initEncoder()
|
||||||
|
{
|
||||||
|
QFileInfo enc(m_EncExec);
|
||||||
|
if(enc.exists())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TalkFileCreator::initTTS()
|
||||||
|
{
|
||||||
|
QFileInfo tts(m_TTSexec);
|
||||||
|
|
||||||
|
if(tts.exists())
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TalkFileCreator::createTalkFiles(ProgressloggerInterface* logger)
|
||||||
|
{
|
||||||
|
m_abort = false;
|
||||||
|
m_logger = logger;
|
||||||
|
m_logger->addItem("Starting Talkfile generation",LOGINFO);
|
||||||
|
if(!initTTS())
|
||||||
|
{
|
||||||
|
m_logger->addItem("Init of TTS engine failed",LOGERROR);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if(!initEncoder())
|
||||||
|
{
|
||||||
|
m_logger->addItem("Init of encoder failed",LOGERROR);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
QApplication::processEvents();
|
||||||
|
|
||||||
|
connect(logger,SIGNAL(aborted()),this,SLOT(abort()));
|
||||||
|
m_logger->setProgressMax(0);
|
||||||
|
QDirIterator it(m_dir,QDirIterator::Subdirectories);
|
||||||
|
// iterate over all entrys
|
||||||
|
while (it.hasNext())
|
||||||
|
{
|
||||||
|
if(m_abort)
|
||||||
|
{
|
||||||
|
m_logger->addItem("Talkfile creation aborted",LOGERROR);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QApplication::processEvents();
|
||||||
|
QFileInfo fileInf = it.fileInfo();
|
||||||
|
QString toSpeak;
|
||||||
|
QString filename;
|
||||||
|
QString wavfilename;
|
||||||
|
|
||||||
|
if(fileInf.fileName() == "." || fileInf.fileName() == ".." || fileInf.suffix() == "talk")
|
||||||
|
{
|
||||||
|
it.next();
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if(fileInf.isDir()) // if it is a dir
|
||||||
|
{
|
||||||
|
toSpeak = fileInf.fileName();
|
||||||
|
filename = fileInf.absolutePath() + "/_dirname.talk";
|
||||||
|
}
|
||||||
|
else // if it is a file
|
||||||
|
{
|
||||||
|
if(m_stripExtensions)
|
||||||
|
toSpeak = fileInf.baseName();
|
||||||
|
else
|
||||||
|
toSpeak = fileInf.fileName();
|
||||||
|
filename = fileInf.absoluteFilePath() + ".talk";
|
||||||
|
}
|
||||||
|
wavfilename = filename + ".wav";
|
||||||
|
|
||||||
|
QFileInfo filenameInf(filename);
|
||||||
|
QFileInfo wavfilenameInf(wavfilename);
|
||||||
|
|
||||||
|
if(!filenameInf.exists() || m_overwriteTalk)
|
||||||
|
{
|
||||||
|
if(!wavfilenameInf.exists() || m_overwriteWav)
|
||||||
|
{
|
||||||
|
m_logger->addItem("Voicing of " + toSpeak,LOGINFO);
|
||||||
|
if(!voice(toSpeak,wavfilename))
|
||||||
|
{
|
||||||
|
m_logger->addItem("Voicing of " + toSpeak + " failed",LOGERROR);
|
||||||
|
m_logger->abort();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_logger->addItem("Encoding of " + toSpeak,LOGINFO);
|
||||||
|
if(!encode(wavfilename,filename))
|
||||||
|
{
|
||||||
|
m_logger->addItem("Encoding of " + wavfilename + " failed",LOGERROR);
|
||||||
|
m_logger->abort();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(m_removeWav)
|
||||||
|
{
|
||||||
|
QFile wavfile(wavfilename);
|
||||||
|
wavfile.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
it.next();
|
||||||
|
}
|
||||||
|
|
||||||
|
m_logger->addItem("Finished creating Talkfiles",LOGOK);
|
||||||
|
m_logger->setProgressMax(1);
|
||||||
|
m_logger->setProgressValue(1);
|
||||||
|
m_logger->abort();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void TalkFileCreator::abort()
|
||||||
|
{
|
||||||
|
m_abort = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TalkFileCreator::voice(QString text,QString wavfile)
|
||||||
|
{
|
||||||
|
|
||||||
|
QString execstring = m_curTTSTemplate;
|
||||||
|
|
||||||
|
execstring.replace("%exe",m_TTSexec);
|
||||||
|
execstring.replace("%options",m_TTSOpts);
|
||||||
|
execstring.replace("%wavfile",wavfile);
|
||||||
|
execstring.replace("%text",text);
|
||||||
|
|
||||||
|
QProcess::execute(execstring);
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TalkFileCreator::encode(QString input,QString output)
|
||||||
|
{
|
||||||
|
QString execstring = m_curEncTemplate;
|
||||||
|
|
||||||
|
execstring.replace("%exe",m_EncExec);
|
||||||
|
execstring.replace("%options",m_EncOpts);
|
||||||
|
execstring.replace("%input",input);
|
||||||
|
execstring.replace("%output",output);
|
||||||
|
|
||||||
|
QProcess::execute(execstring);
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
QString TalkFileCreator::getTTsOpts(QString ttsname)
|
||||||
|
{
|
||||||
|
int index = m_supportedTTS.indexOf(ttsname);
|
||||||
|
|
||||||
|
return m_supportedTTSOpts.at(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString TalkFileCreator::getEncOpts(QString encname)
|
||||||
|
{
|
||||||
|
int index = m_supportedEnc.indexOf(encname);
|
||||||
|
|
||||||
|
return m_supportedEncOpts.at(index);
|
||||||
|
}
|
||||||
|
|
105
rbutil/rbutilqt/talkfile.h
Normal file
105
rbutil/rbutilqt/talkfile.h
Normal file
|
@ -0,0 +1,105 @@
|
||||||
|
/***************************************************************************
|
||||||
|
* __________ __ ___.
|
||||||
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||||
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||||
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||||
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||||
|
* \/ \/ \/ \/ \/
|
||||||
|
*
|
||||||
|
* Copyright (C) 2007 by Dominik Wenger
|
||||||
|
* $Id: talkfile.h 14027 2007-07-27 17:42:49Z domonoky $
|
||||||
|
*
|
||||||
|
* All files in this archive are subject to the GNU General Public License.
|
||||||
|
* See the file COPYING in the source tree root for full license agreement.
|
||||||
|
*
|
||||||
|
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||||
|
* KIND, either express or implied.
|
||||||
|
*
|
||||||
|
****************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef TALKFILE_H
|
||||||
|
#define TALKFILE_H
|
||||||
|
|
||||||
|
#include "progressloggerinterface.h"
|
||||||
|
|
||||||
|
class TalkFileCreator :public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
TalkFileCreator(QObject* parent=0);
|
||||||
|
|
||||||
|
bool createTalkFiles(ProgressloggerInterface* logger);
|
||||||
|
|
||||||
|
void setTTSexe(QString exe){m_TTSexec=exe;}
|
||||||
|
void setEncexe(QString exe){m_EncExec=exe;}
|
||||||
|
|
||||||
|
void setSupportedTTS(QStringList list) {m_supportedTTS=list;}
|
||||||
|
void setSupportedTTSOptions(QStringList list) {m_supportedTTSOpts=list;}
|
||||||
|
void setSupportedTTSTemplates(QStringList list) {m_supportedTTSTemplates=list;}
|
||||||
|
|
||||||
|
QStringList getSupportedTTS(){return m_supportedTTS;}
|
||||||
|
void setTTsType(QString tts);
|
||||||
|
QString getTTsOpts(QString ttsname);
|
||||||
|
void setTTsOpts(QString opts) {m_TTSOpts=opts;}
|
||||||
|
|
||||||
|
void setSupportedEnc(QStringList list) {m_supportedEnc=list;}
|
||||||
|
void setSupportedEncOptions(QStringList list) {m_supportedEncOpts=list;}
|
||||||
|
void setSupportedEncTemplates(QStringList list) {m_supportedEncTemplates=list;}
|
||||||
|
|
||||||
|
QStringList getSupportedEnc(){return m_supportedEnc;}
|
||||||
|
void setEncType(QString enc);
|
||||||
|
QString getEncOpts(QString encname);
|
||||||
|
void setEncOpts(QString opts) {m_EncOpts=opts;}
|
||||||
|
|
||||||
|
void setDir(QString dir){m_dir = dir; }
|
||||||
|
|
||||||
|
void setOverwriteTalk(bool ov) {m_overwriteTalk = ov;}
|
||||||
|
void setOverwriteWav(bool ov) {m_overwriteWav = ov;}
|
||||||
|
void setRemoveWav(bool ov) {m_removeWav = ov;}
|
||||||
|
void setRecursive(bool ov) {m_recursive = ov;}
|
||||||
|
void setStripExtensions(bool ov) {m_stripExtensions = ov;}
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void abort();
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
bool initTTS();
|
||||||
|
bool stopTTS();
|
||||||
|
bool initEncoder();
|
||||||
|
|
||||||
|
bool encode(QString input,QString output);
|
||||||
|
bool voice(QString text,QString wavfile);
|
||||||
|
|
||||||
|
QString m_dir;
|
||||||
|
|
||||||
|
QString m_curTTS;
|
||||||
|
QString m_TTSexec;
|
||||||
|
QStringList m_supportedTTS;
|
||||||
|
QStringList m_supportedTTSOpts;
|
||||||
|
QStringList m_supportedTTSTemplates;
|
||||||
|
QString m_TTSOpts;
|
||||||
|
QString m_curTTSTemplate;
|
||||||
|
|
||||||
|
QString m_curEnc;
|
||||||
|
QString m_EncExec;
|
||||||
|
QStringList m_supportedEnc;
|
||||||
|
QStringList m_supportedEncOpts;
|
||||||
|
QStringList m_supportedEncTemplates;
|
||||||
|
QString m_EncOpts;
|
||||||
|
QString m_curEncTemplate;
|
||||||
|
|
||||||
|
bool m_overwriteTalk;
|
||||||
|
bool m_overwriteWav;
|
||||||
|
bool m_removeWav;
|
||||||
|
bool m_recursive;
|
||||||
|
bool m_stripExtensions;
|
||||||
|
|
||||||
|
ProgressloggerInterface* m_logger;
|
||||||
|
|
||||||
|
bool m_abort;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
Loading…
Add table
Add a link
Reference in a new issue