2008-01-11 23:59:12 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007 by Dominik Riebeling
|
|
|
|
* $Id: createvoicewindow.cpp 15932 2007-12-15 13:13:57Z 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 "createvoicewindow.h"
|
|
|
|
#include "ui_createvoicefrm.h"
|
|
|
|
|
|
|
|
#include "browsedirtree.h"
|
|
|
|
#include "configure.h"
|
|
|
|
|
|
|
|
CreateVoiceWindow::CreateVoiceWindow(QWidget *parent) : QDialog(parent)
|
|
|
|
{
|
|
|
|
ui.setupUi(this);
|
|
|
|
voicecreator = new VoiceFileCreator(this);
|
|
|
|
|
|
|
|
connect(ui.change,SIGNAL(clicked()),this,SLOT(change()));
|
|
|
|
}
|
|
|
|
|
|
|
|
void CreateVoiceWindow::change()
|
|
|
|
{
|
|
|
|
Config *cw = new Config(this,4);
|
2008-01-25 00:12:25 +00:00
|
|
|
cw->setSettings(settings);
|
2008-01-11 23:59:12 +00:00
|
|
|
cw->show();
|
|
|
|
connect(cw, SIGNAL(settingsUpdated()), this, SIGNAL(settingsUpdated()));
|
|
|
|
}
|
|
|
|
|
|
|
|
void CreateVoiceWindow::accept()
|
|
|
|
{
|
|
|
|
logger = new ProgressLoggerGui(this);
|
|
|
|
logger->show();
|
|
|
|
connect(logger,SIGNAL(closed()),this,SLOT(close()));
|
|
|
|
|
2008-02-03 11:49:29 +00:00
|
|
|
QString lang = ui.comboLanguage->currentText();
|
2008-01-19 18:33:33 +00:00
|
|
|
int wvThreshold = ui.wavtrimthreshold->value();
|
2008-01-11 23:59:12 +00:00
|
|
|
|
|
|
|
//safe selected language
|
2008-01-25 00:12:25 +00:00
|
|
|
settings->setVoiceLanguage(lang);
|
|
|
|
settings->setWavtrimTh(wvThreshold);
|
|
|
|
settings->sync();
|
2008-01-11 23:59:12 +00:00
|
|
|
|
|
|
|
//configure voicecreator
|
2008-01-25 00:12:25 +00:00
|
|
|
voicecreator->setSettings(settings);
|
|
|
|
voicecreator->setMountPoint(settings->mountpoint());
|
|
|
|
voicecreator->setTargetId(settings->curTargetId());
|
2008-01-11 23:59:12 +00:00
|
|
|
voicecreator->setLang(lang);
|
|
|
|
voicecreator->setProxy(m_proxy);
|
2008-01-19 18:33:33 +00:00
|
|
|
voicecreator->setWavtrimThreshold(wvThreshold);
|
2008-01-11 23:59:12 +00:00
|
|
|
|
|
|
|
//start creating
|
|
|
|
voicecreator->createVoiceFile(logger);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-01-25 00:12:25 +00:00
|
|
|
void CreateVoiceWindow::setSettings(RbSettings* sett)
|
2008-01-11 23:59:12 +00:00
|
|
|
{
|
2008-01-25 00:12:25 +00:00
|
|
|
settings = sett;
|
2008-01-11 23:59:12 +00:00
|
|
|
|
|
|
|
// fill in language combobox
|
2008-02-03 20:04:34 +00:00
|
|
|
QStringList languages = settings->allLanguages();
|
2008-01-13 13:51:33 +00:00
|
|
|
languages.sort();
|
2008-01-11 23:59:12 +00:00
|
|
|
ui.comboLanguage->addItems(languages);
|
|
|
|
// set saved lang
|
2008-02-03 20:04:34 +00:00
|
|
|
int sel = ui.comboLanguage->findText(settings->voiceLanguage());
|
|
|
|
// if no saved language is found try to figure the language from the UI lang
|
|
|
|
if(sel == -1) {
|
|
|
|
QString f = settings->curLang();
|
|
|
|
// if no language is set default to english. Make sure not to check an empty string.
|
|
|
|
if(f.isEmpty()) f = "english";
|
|
|
|
sel = ui.comboLanguage->findText(f, Qt::MatchStartsWith);
|
|
|
|
qDebug() << "sel =" << sel;
|
|
|
|
// still nothing found?
|
|
|
|
if(sel == -1)
|
|
|
|
sel = ui.comboLanguage->findText("english", Qt::MatchStartsWith);
|
|
|
|
}
|
|
|
|
ui.comboLanguage->setCurrentIndex(sel);
|
2008-01-11 23:59:12 +00:00
|
|
|
|
2008-01-25 00:12:25 +00:00
|
|
|
QString ttsName = settings->curTTS();
|
2008-02-12 21:45:50 +00:00
|
|
|
TTSBase* tts = TTSBase::getTTS(ttsName);
|
2008-01-25 00:12:25 +00:00
|
|
|
tts->setCfg(settings);
|
2008-01-11 23:59:12 +00:00
|
|
|
if(tts->configOk())
|
2008-02-12 21:45:50 +00:00
|
|
|
ui.labelTtsProfile->setText(tr("Selected TTS engine : <b>%1</b>").arg(TTSBase::getTTSName(ttsName)));
|
2008-01-11 23:59:12 +00:00
|
|
|
else
|
|
|
|
ui.labelTtsProfile->setText(tr("Selected TTS Engine: <b>%1</b>").arg("Invalid TTS configuration!"));
|
|
|
|
|
2008-01-25 00:12:25 +00:00
|
|
|
QString encoder = settings->curEncoder();
|
2008-02-02 21:34:39 +00:00
|
|
|
// only proceed if encoder setting is set
|
2008-02-13 18:11:09 +00:00
|
|
|
EncBase* enc = EncBase::getEncoder(encoder);
|
2008-02-03 11:49:29 +00:00
|
|
|
if(enc != NULL) {
|
2008-02-02 21:34:39 +00:00
|
|
|
enc->setCfg(settings);
|
|
|
|
if(enc->configOk())
|
2008-02-13 18:11:09 +00:00
|
|
|
ui.labelEncProfile->setText(tr("Selected Encoder: <b>%1</b>").arg(EncBase::getEncoderName(encoder)));
|
2008-02-02 21:34:39 +00:00
|
|
|
else
|
|
|
|
ui.labelEncProfile->setText(tr("Selected Encoder: <b>%1</b>").arg("Invalid encoder configuration!"));
|
|
|
|
}
|
2008-01-11 23:59:12 +00:00
|
|
|
else
|
|
|
|
ui.labelEncProfile->setText(tr("Selected Encoder: <b>%1</b>").arg("Invalid encoder configuration!"));
|
2008-02-02 21:34:39 +00:00
|
|
|
ui.wavtrimthreshold->setValue(settings->wavtrimTh());
|
2008-02-03 20:04:34 +00:00
|
|
|
|
2008-01-11 23:59:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-01-19 18:33:33 +00:00
|
|
|
|
|
|
|
|