2008-01-11 23:59:12 +00:00
|
|
|
/***************************************************************************
|
|
|
|
* __________ __ ___.
|
|
|
|
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
* \/ \/ \/ \/ \/
|
|
|
|
*
|
|
|
|
* Copyright (C) 2007 by Dominik Riebeling
|
2008-06-30 22:09:45 +00:00
|
|
|
* $Id$
|
2008-01-11 23:59:12 +00:00
|
|
|
*
|
|
|
|
* 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"
|
2009-05-09 16:59:14 +00:00
|
|
|
#include "rbsettings.h"
|
2008-01-11 23:59:12 +00:00
|
|
|
|
|
|
|
CreateVoiceWindow::CreateVoiceWindow(QWidget *parent) : QDialog(parent)
|
|
|
|
{
|
|
|
|
ui.setupUi(this);
|
|
|
|
voicecreator = new VoiceFileCreator(this);
|
2009-05-09 20:04:08 +00:00
|
|
|
updateSettings();
|
2008-01-11 23:59:12 +00:00
|
|
|
connect(ui.change,SIGNAL(clicked()),this,SLOT(change()));
|
|
|
|
}
|
|
|
|
|
|
|
|
void CreateVoiceWindow::change()
|
|
|
|
{
|
|
|
|
Config *cw = new Config(this,4);
|
2008-03-14 18:27:39 +00:00
|
|
|
connect(cw, SIGNAL(settingsUpdated()), this, SLOT(updateSettings()));
|
2008-04-06 19:50:38 +00:00
|
|
|
cw->show();
|
2008-01-11 23:59:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CreateVoiceWindow::accept()
|
|
|
|
{
|
|
|
|
logger = new ProgressLoggerGui(this);
|
|
|
|
connect(logger,SIGNAL(closed()),this,SLOT(close()));
|
2008-04-06 19:50:38 +00:00
|
|
|
logger->show();
|
2008-01-11 23:59:12 +00:00
|
|
|
|
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
|
2009-05-09 16:59:14 +00:00
|
|
|
RbSettings::setValue(RbSettings::Language, lang);
|
|
|
|
RbSettings::setValue(RbSettings::WavtrimThreshold, wvThreshold);
|
|
|
|
RbSettings::sync();
|
2008-01-11 23:59:12 +00:00
|
|
|
|
|
|
|
//configure voicecreator
|
2009-05-09 16:59:14 +00:00
|
|
|
voicecreator->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString());
|
2008-01-11 23:59:12 +00:00
|
|
|
voicecreator->setLang(lang);
|
2008-01-19 18:33:33 +00:00
|
|
|
voicecreator->setWavtrimThreshold(wvThreshold);
|
2008-01-11 23:59:12 +00:00
|
|
|
|
|
|
|
//start creating
|
2009-06-26 20:40:51 +00:00
|
|
|
connect(voicecreator, SIGNAL(done(bool)), logger, SLOT(setFinished()));
|
|
|
|
connect(voicecreator, SIGNAL(logItem(QString, int)), logger, SLOT(addItem(QString, int)));
|
|
|
|
connect(voicecreator, SIGNAL(logProgress(int, int)), logger, SLOT(setProgress(int, int)));
|
|
|
|
connect(logger,SIGNAL(aborted()),voicecreator,SLOT(abort()));
|
|
|
|
voicecreator->createVoiceFile();
|
2008-01-11 23:59:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-03-01 13:42:14 +00:00
|
|
|
/** @brief update displayed settings
|
|
|
|
*/
|
2008-03-14 18:27:39 +00:00
|
|
|
void CreateVoiceWindow::updateSettings(void)
|
2008-03-01 13:42:14 +00:00
|
|
|
{
|
2008-01-11 23:59:12 +00:00
|
|
|
// fill in language combobox
|
2009-05-09 16:59:14 +00:00
|
|
|
QStringList languages = RbSettings::languages();
|
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
|
2009-05-09 16:59:14 +00:00
|
|
|
int sel = ui.comboLanguage->findText(RbSettings::value(RbSettings::VoiceLanguage).toString());
|
2008-02-03 20:04:34 +00:00
|
|
|
// if no saved language is found try to figure the language from the UI lang
|
|
|
|
if(sel == -1) {
|
2009-05-09 16:59:14 +00:00
|
|
|
QString f = RbSettings::value(RbSettings::Language).toString();
|
2008-02-03 20:04:34 +00:00
|
|
|
// 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
|
|
|
|
2009-05-09 16:59:14 +00:00
|
|
|
QString ttsName = RbSettings::value(RbSettings::Tts).toString();
|
2009-04-29 21:27:01 +00:00
|
|
|
TTSBase* tts = TTSBase::getTTS(this,ttsName);
|
2008-01-11 23:59:12 +00:00
|
|
|
if(tts->configOk())
|
2008-07-05 22:14:15 +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
|
2008-07-05 22:14:15 +00:00
|
|
|
ui.labelTtsProfile->setText(tr("Selected TTS engine: <b>%1</b>")
|
|
|
|
.arg("Invalid TTS configuration!"));
|
2008-01-11 23:59:12 +00:00
|
|
|
|
2009-05-09 16:59:14 +00:00
|
|
|
QString encoder = RbSettings::value(RbSettings::CurEncoder).toString();
|
2008-02-02 21:34:39 +00:00
|
|
|
// only proceed if encoder setting is set
|
2009-04-29 21:27:01 +00:00
|
|
|
EncBase* enc = EncBase::getEncoder(this,encoder);
|
2008-02-03 11:49:29 +00:00
|
|
|
if(enc != NULL) {
|
2008-02-02 21:34:39 +00:00
|
|
|
if(enc->configOk())
|
2008-07-05 22:14:15 +00:00
|
|
|
ui.labelEncProfile->setText(tr("Selected encoder: <b>%1</b>")
|
|
|
|
.arg(EncBase::getEncoderName(encoder)));
|
2008-02-02 21:34:39 +00:00
|
|
|
else
|
2008-07-05 22:14:15 +00:00
|
|
|
ui.labelEncProfile->setText(tr("Selected encoder: <b>%1</b>")
|
|
|
|
.arg("Invalid encoder configuration!"));
|
2008-02-02 21:34:39 +00:00
|
|
|
}
|
2008-01-11 23:59:12 +00:00
|
|
|
else
|
2008-07-05 22:14:15 +00:00
|
|
|
ui.labelEncProfile->setText(tr("Selected encoder: <b>%1</b>")
|
|
|
|
.arg("Invalid encoder configuration!"));
|
2009-05-09 16:59:14 +00:00
|
|
|
ui.wavtrimthreshold->setValue(RbSettings::value(RbSettings::WavtrimThreshold).toInt());
|
2008-03-14 18:27:39 +00:00
|
|
|
emit settingsUpdated();
|
2008-01-11 23:59:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2008-01-19 18:33:33 +00:00
|
|
|
|
|
|
|
|