forked from len0rd/rockbox
Split up encoders sources.
Create a separate source / header file for each supported encoder and the base class and rename classes for better readability. This should also make it easier adding new encoders. Remove a few trailing spaces while at it. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31592 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
f860b57143
commit
be0e197190
12 changed files with 337 additions and 239 deletions
75
rbutil/rbutilqt/base/encoderbase.cpp
Normal file
75
rbutil/rbutilqt/base/encoderbase.cpp
Normal file
|
@ -0,0 +1,75 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2007 by Dominik Wenger
|
||||
*
|
||||
* 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 "encoderbase.h"
|
||||
#include "utils.h"
|
||||
#include "rbsettings.h"
|
||||
#include "encoderrbspeex.h"
|
||||
#include "encoderexe.h"
|
||||
|
||||
/*********************************************************************
|
||||
* Encoder Base
|
||||
**********************************************************************/
|
||||
QMap<QString,QString> EncoderBase::encoderList;
|
||||
|
||||
EncoderBase::EncoderBase(QObject *parent): EncTtsSettingInterface(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// initialize list of encoders
|
||||
void EncoderBase::initEncodernamesList()
|
||||
{
|
||||
encoderList["rbspeex"] = "Rockbox Speex Encoder";
|
||||
encoderList["lame"] = "Lame Mp3 Encoder";
|
||||
}
|
||||
|
||||
|
||||
// get nice name for a specific encoder
|
||||
QString EncoderBase::getEncoderName(QString encoder)
|
||||
{
|
||||
if(encoderList.isEmpty())
|
||||
initEncodernamesList();
|
||||
return encoderList.value(encoder);
|
||||
}
|
||||
|
||||
|
||||
// get a specific encoder object
|
||||
EncoderBase* EncoderBase::getEncoder(QObject* parent,QString encoder)
|
||||
{
|
||||
EncoderBase* enc;
|
||||
if(encoder == "lame")
|
||||
{
|
||||
enc = new EncoderExe(encoder,parent);
|
||||
return enc;
|
||||
}
|
||||
else // rbspeex is default
|
||||
{
|
||||
enc = new EncoderRbSpeex(parent);
|
||||
return enc;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QStringList EncoderBase::getEncoderList()
|
||||
{
|
||||
if(encoderList.isEmpty())
|
||||
initEncodernamesList();
|
||||
return encoderList.keys();
|
||||
}
|
||||
|
|
@ -17,21 +17,21 @@
|
|||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
|
||||
#ifndef ENCODERS_H
|
||||
#define ENCODERS_H
|
||||
|
||||
|
||||
#include <QtCore>
|
||||
|
||||
|
||||
#include "encttssettings.h"
|
||||
#include "rbspeex.h"
|
||||
|
||||
|
||||
class EncBase : public EncTtsSettingInterface
|
||||
class EncoderBase : public EncTtsSettingInterface
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
EncBase(QObject *parent );
|
||||
EncoderBase(QObject *parent );
|
||||
|
||||
//! Child class should encode a wav file
|
||||
virtual bool encode(QString input,QString output) =0;
|
||||
|
@ -39,18 +39,18 @@ class EncBase : public EncTtsSettingInterface
|
|||
virtual bool start()=0;
|
||||
//! Child class should stop
|
||||
virtual bool stop()=0;
|
||||
|
||||
|
||||
// settings
|
||||
//! Child class should return true when configuration is ok
|
||||
virtual bool configOk()=0;
|
||||
//! Child class should fill in the setttingsList
|
||||
//! Child class should fill in the setttingsList
|
||||
virtual void generateSettings() = 0;
|
||||
//! Chlid class should commit the from SettingsList to permanent storage
|
||||
virtual void saveSettings() = 0;
|
||||
|
||||
|
||||
// static functions
|
||||
static QString getEncoderName(QString name);
|
||||
static EncBase* getEncoder(QObject* parent,QString name);
|
||||
static EncoderBase* getEncoder(QObject* parent,QString name);
|
||||
static QStringList getEncoderList(void);
|
||||
|
||||
private:
|
||||
|
@ -60,68 +60,5 @@ class EncBase : public EncTtsSettingInterface
|
|||
static QMap<QString,QString> encoderList;
|
||||
};
|
||||
|
||||
|
||||
class EncExes : public EncBase
|
||||
{
|
||||
enum ESettings
|
||||
{
|
||||
eEXEPATH,
|
||||
eEXEOPTIONS
|
||||
};
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
EncExes(QString name,QObject *parent = NULL);
|
||||
bool encode(QString input,QString output);
|
||||
bool start();
|
||||
bool stop() {return true;}
|
||||
|
||||
// setting
|
||||
bool configOk();
|
||||
void generateSettings();
|
||||
void saveSettings();
|
||||
|
||||
private:
|
||||
QString m_name;
|
||||
QString m_EncExec;
|
||||
QString m_EncOpts;
|
||||
QMap<QString,QString> m_TemplateMap;
|
||||
QString m_EncTemplate;
|
||||
};
|
||||
|
||||
class EncRbSpeex : public EncBase
|
||||
{
|
||||
enum ESettings
|
||||
{
|
||||
eVOLUME,
|
||||
eQUALITY,
|
||||
eCOMPLEXITY,
|
||||
eNARROWBAND
|
||||
};
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
EncRbSpeex(QObject *parent = NULL);
|
||||
bool encode(QString input,QString output);
|
||||
bool start();
|
||||
bool stop() {return true;}
|
||||
|
||||
// for settings view
|
||||
bool configOk();
|
||||
void generateSettings();
|
||||
void saveSettings();
|
||||
|
||||
private:
|
||||
float quality;
|
||||
float volume;
|
||||
int complexity;
|
||||
bool narrowband;
|
||||
|
||||
float defaultQuality;
|
||||
float defaultVolume;
|
||||
int defaultComplexity;
|
||||
bool defaultBand;
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
94
rbutil/rbutilqt/base/encoderexe.cpp
Normal file
94
rbutil/rbutilqt/base/encoderexe.cpp
Normal file
|
@ -0,0 +1,94 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2007 by Dominik Wenger
|
||||
*
|
||||
* 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 <QtCore>
|
||||
#include "encoderexe.h"
|
||||
#include "rbsettings.h"
|
||||
#include "utils.h"
|
||||
|
||||
EncoderExe::EncoderExe(QString name,QObject *parent) : EncoderBase(parent)
|
||||
{
|
||||
m_name = name;
|
||||
|
||||
m_TemplateMap["lame"] = "\"%exe\" %options \"%input\" \"%output\"";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void EncoderExe::generateSettings()
|
||||
{
|
||||
QString exepath =RbSettings::subValue(m_name,RbSettings::EncoderPath).toString();
|
||||
if(exepath == "") exepath = Utils::findExecutable(m_name);
|
||||
|
||||
insertSetting(eEXEPATH,new EncTtsSetting(this,EncTtsSetting::eSTRING,
|
||||
tr("Path to Encoder:"),exepath,EncTtsSetting::eBROWSEBTN));
|
||||
insertSetting(eEXEOPTIONS,new EncTtsSetting(this,EncTtsSetting::eSTRING,
|
||||
tr("Encoder options:"),RbSettings::subValue(m_name,RbSettings::EncoderOptions)));
|
||||
}
|
||||
|
||||
void EncoderExe::saveSettings()
|
||||
{
|
||||
RbSettings::setSubValue(m_name,RbSettings::EncoderPath,getSetting(eEXEPATH)->current().toString());
|
||||
RbSettings::setSubValue(m_name,RbSettings::EncoderOptions,getSetting(eEXEOPTIONS)->current().toString());
|
||||
RbSettings::sync();
|
||||
}
|
||||
|
||||
bool EncoderExe::start()
|
||||
{
|
||||
m_EncExec = RbSettings::subValue(m_name, RbSettings::EncoderPath).toString();
|
||||
m_EncOpts = RbSettings::subValue(m_name, RbSettings::EncoderOptions).toString();
|
||||
|
||||
m_EncTemplate = m_TemplateMap.value(m_name);
|
||||
|
||||
QFileInfo enc(m_EncExec);
|
||||
if(enc.exists())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool EncoderExe::encode(QString input,QString output)
|
||||
{
|
||||
//qDebug() << "encoding..";
|
||||
QString execstring = m_EncTemplate;
|
||||
|
||||
execstring.replace("%exe",m_EncExec);
|
||||
execstring.replace("%options",m_EncOpts);
|
||||
execstring.replace("%input",input);
|
||||
execstring.replace("%output",output);
|
||||
qDebug() << "[EncoderExe] cmd: " << execstring;
|
||||
int result = QProcess::execute(execstring);
|
||||
return (result == 0) ? true : false;
|
||||
}
|
||||
|
||||
|
||||
bool EncoderExe::configOk()
|
||||
{
|
||||
QString path = RbSettings::subValue(m_name, RbSettings::EncoderPath).toString();
|
||||
|
||||
if (QFileInfo(path).exists())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
55
rbutil/rbutilqt/base/encoderexe.h
Normal file
55
rbutil/rbutilqt/base/encoderexe.h
Normal file
|
@ -0,0 +1,55 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2007 by Dominik Wenger
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef ENCODEREXES_H
|
||||
#define ENCODEREXES_H
|
||||
|
||||
#include <QtCore>
|
||||
#include "encoderbase.h"
|
||||
|
||||
class EncoderExe : public EncoderBase
|
||||
{
|
||||
enum ESettings
|
||||
{
|
||||
eEXEPATH,
|
||||
eEXEOPTIONS
|
||||
};
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
EncoderExe(QString name,QObject *parent = NULL);
|
||||
bool encode(QString input,QString output);
|
||||
bool start();
|
||||
bool stop() {return true;}
|
||||
|
||||
// setting
|
||||
bool configOk();
|
||||
void generateSettings();
|
||||
void saveSettings();
|
||||
|
||||
private:
|
||||
QString m_name;
|
||||
QString m_EncExec;
|
||||
QString m_EncOpts;
|
||||
QMap<QString,QString> m_TemplateMap;
|
||||
QString m_EncTemplate;
|
||||
};
|
||||
#endif
|
||||
|
|
@ -16,145 +16,16 @@
|
|||
*
|
||||
****************************************************************************/
|
||||
|
||||
#include "encoders.h"
|
||||
#include "utils.h"
|
||||
#include <QtCore>
|
||||
#include "encoderrbspeex.h"
|
||||
#include "rbsettings.h"
|
||||
|
||||
/*********************************************************************
|
||||
* Encoder Base
|
||||
**********************************************************************/
|
||||
QMap<QString,QString> EncBase::encoderList;
|
||||
|
||||
EncBase::EncBase(QObject *parent): EncTtsSettingInterface(parent)
|
||||
EncoderRbSpeex::EncoderRbSpeex(QObject *parent) : EncoderBase(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// initialize list of encoders
|
||||
void EncBase::initEncodernamesList()
|
||||
{
|
||||
encoderList["rbspeex"] = "Rockbox Speex Encoder";
|
||||
encoderList["lame"] = "Lame Mp3 Encoder";
|
||||
}
|
||||
|
||||
|
||||
// get nice name for a specific encoder
|
||||
QString EncBase::getEncoderName(QString encoder)
|
||||
{
|
||||
if(encoderList.isEmpty())
|
||||
initEncodernamesList();
|
||||
return encoderList.value(encoder);
|
||||
}
|
||||
|
||||
|
||||
// get a specific encoder object
|
||||
EncBase* EncBase::getEncoder(QObject* parent,QString encoder)
|
||||
{
|
||||
EncBase* enc;
|
||||
if(encoder == "lame")
|
||||
{
|
||||
enc = new EncExes(encoder,parent);
|
||||
return enc;
|
||||
}
|
||||
else // rbspeex is default
|
||||
{
|
||||
enc = new EncRbSpeex(parent);
|
||||
return enc;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QStringList EncBase::getEncoderList()
|
||||
{
|
||||
if(encoderList.isEmpty())
|
||||
initEncodernamesList();
|
||||
return encoderList.keys();
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************
|
||||
* GEneral Exe Encoder
|
||||
**********************************************************************/
|
||||
EncExes::EncExes(QString name,QObject *parent) : EncBase(parent)
|
||||
{
|
||||
m_name = name;
|
||||
|
||||
m_TemplateMap["lame"] = "\"%exe\" %options \"%input\" \"%output\"";
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
void EncExes::generateSettings()
|
||||
{
|
||||
QString exepath =RbSettings::subValue(m_name,RbSettings::EncoderPath).toString();
|
||||
if(exepath == "") exepath = Utils::findExecutable(m_name);
|
||||
|
||||
insertSetting(eEXEPATH,new EncTtsSetting(this,EncTtsSetting::eSTRING,
|
||||
tr("Path to Encoder:"),exepath,EncTtsSetting::eBROWSEBTN));
|
||||
insertSetting(eEXEOPTIONS,new EncTtsSetting(this,EncTtsSetting::eSTRING,
|
||||
tr("Encoder options:"),RbSettings::subValue(m_name,RbSettings::EncoderOptions)));
|
||||
}
|
||||
|
||||
void EncExes::saveSettings()
|
||||
{
|
||||
RbSettings::setSubValue(m_name,RbSettings::EncoderPath,getSetting(eEXEPATH)->current().toString());
|
||||
RbSettings::setSubValue(m_name,RbSettings::EncoderOptions,getSetting(eEXEOPTIONS)->current().toString());
|
||||
RbSettings::sync();
|
||||
}
|
||||
|
||||
bool EncExes::start()
|
||||
{
|
||||
m_EncExec = RbSettings::subValue(m_name, RbSettings::EncoderPath).toString();
|
||||
m_EncOpts = RbSettings::subValue(m_name, RbSettings::EncoderOptions).toString();
|
||||
|
||||
m_EncTemplate = m_TemplateMap.value(m_name);
|
||||
|
||||
QFileInfo enc(m_EncExec);
|
||||
if(enc.exists())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool EncExes::encode(QString input,QString output)
|
||||
{
|
||||
//qDebug() << "encoding..";
|
||||
QString execstring = m_EncTemplate;
|
||||
|
||||
execstring.replace("%exe",m_EncExec);
|
||||
execstring.replace("%options",m_EncOpts);
|
||||
execstring.replace("%input",input);
|
||||
execstring.replace("%output",output);
|
||||
qDebug() << "[EncExes] cmd: " << execstring;
|
||||
int result = QProcess::execute(execstring);
|
||||
return (result == 0) ? true : false;
|
||||
}
|
||||
|
||||
|
||||
bool EncExes::configOk()
|
||||
{
|
||||
QString path = RbSettings::subValue(m_name, RbSettings::EncoderPath).toString();
|
||||
|
||||
if (QFileInfo(path).exists())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/*********************************************************************
|
||||
* RB SPEEX ENCODER
|
||||
**********************************************************************/
|
||||
EncRbSpeex::EncRbSpeex(QObject *parent) : EncBase(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void EncRbSpeex::generateSettings()
|
||||
void EncoderRbSpeex::generateSettings()
|
||||
{
|
||||
insertSetting(eVOLUME,new EncTtsSetting(this,EncTtsSetting::eDOUBLE,
|
||||
tr("Volume:"),RbSettings::subValue("rbspeex",RbSettings::EncoderVolume),1.0,10.0));
|
||||
|
@ -166,7 +37,7 @@ void EncRbSpeex::generateSettings()
|
|||
tr("Use Narrowband:"),RbSettings::subValue("rbspeex",RbSettings::EncoderNarrowBand)));
|
||||
}
|
||||
|
||||
void EncRbSpeex::saveSettings()
|
||||
void EncoderRbSpeex::saveSettings()
|
||||
{
|
||||
//save settings in user config
|
||||
RbSettings::setSubValue("rbspeex",RbSettings::EncoderVolume,
|
||||
|
@ -181,7 +52,7 @@ void EncRbSpeex::saveSettings()
|
|||
RbSettings::sync();
|
||||
}
|
||||
|
||||
bool EncRbSpeex::start()
|
||||
bool EncoderRbSpeex::start()
|
||||
{
|
||||
|
||||
// try to get config from settings
|
||||
|
@ -194,7 +65,7 @@ bool EncRbSpeex::start()
|
|||
return true;
|
||||
}
|
||||
|
||||
bool EncRbSpeex::encode(QString input,QString output)
|
||||
bool EncoderRbSpeex::encode(QString input,QString output)
|
||||
{
|
||||
qDebug() << "[RbSpeex] Encoding " << input << " to "<< output;
|
||||
char errstr[512];
|
||||
|
@ -224,7 +95,7 @@ bool EncRbSpeex::encode(QString input,QString output)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool EncRbSpeex::configOk()
|
||||
bool EncoderRbSpeex::configOk()
|
||||
{
|
||||
bool result=true;
|
||||
// check config
|
60
rbutil/rbutilqt/base/encoderrbspeex.h
Normal file
60
rbutil/rbutilqt/base/encoderrbspeex.h
Normal file
|
@ -0,0 +1,60 @@
|
|||
/***************************************************************************
|
||||
* __________ __ ___.
|
||||
* Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
||||
* Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
||||
* Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
||||
* Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
||||
* \/ \/ \/ \/ \/
|
||||
*
|
||||
* Copyright (C) 2007 by Dominik Wenger
|
||||
*
|
||||
* 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 ENCODERRBSPEEX_H
|
||||
#define ENCODERRBSPEEX_H
|
||||
|
||||
#include <QtCore>
|
||||
#include "encoderbase.h"
|
||||
|
||||
class EncoderRbSpeex : public EncoderBase
|
||||
{
|
||||
enum ESettings
|
||||
{
|
||||
eVOLUME,
|
||||
eQUALITY,
|
||||
eCOMPLEXITY,
|
||||
eNARROWBAND
|
||||
};
|
||||
|
||||
Q_OBJECT
|
||||
public:
|
||||
EncoderRbSpeex(QObject *parent = NULL);
|
||||
bool encode(QString input,QString output);
|
||||
bool start();
|
||||
bool stop() {return true;}
|
||||
|
||||
// for settings view
|
||||
bool configOk();
|
||||
void generateSettings();
|
||||
void saveSettings();
|
||||
|
||||
private:
|
||||
float quality;
|
||||
float volume;
|
||||
int complexity;
|
||||
bool narrowband;
|
||||
|
||||
float defaultQuality;
|
||||
float defaultVolume;
|
||||
int defaultComplexity;
|
||||
bool defaultBand;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
@ -48,7 +48,7 @@ TalkGenerator::Status TalkGenerator::process(QList<TalkEntry>* list,int wavtrimt
|
|||
|
||||
// Encoder
|
||||
emit logItem(tr("Starting Encoder Engine"),LOGINFO);
|
||||
m_enc = EncBase::getEncoder(this,SystemInfo::value(SystemInfo::CurEncoder).toString());
|
||||
m_enc = EncoderBase::getEncoder(this,SystemInfo::value(SystemInfo::CurEncoder).toString());
|
||||
if(!m_enc->start())
|
||||
{
|
||||
emit logItem(tr("Init of Encoder engine failed"),LOGERROR);
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include <QtCore>
|
||||
#include "progressloggerinterface.h"
|
||||
|
||||
#include "encoders.h"
|
||||
#include "encoderbase.h"
|
||||
#include "ttsbase.h"
|
||||
|
||||
//! \brief Talk generator, generates .wav and .talk files out of a list.
|
||||
|
@ -57,9 +57,9 @@ public:
|
|||
* for error checking */
|
||||
struct
|
||||
{
|
||||
EncBase* encoder;
|
||||
EncoderBase* encoder;
|
||||
TTSBase* tts;
|
||||
TalkGenerator* generator;
|
||||
TalkGenerator* generator;
|
||||
int wavtrim;
|
||||
} refs;
|
||||
};
|
||||
|
@ -92,7 +92,7 @@ private:
|
|||
static void ttsEntryPoint(TalkEntry& entry);
|
||||
|
||||
TTSBase* m_tts;
|
||||
EncBase* m_enc;
|
||||
EncoderBase* m_enc;
|
||||
|
||||
bool m_ttsWarnings;
|
||||
bool m_userAborted;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "configure.h"
|
||||
#include "autodetection.h"
|
||||
#include "ui_configurefrm.h"
|
||||
#include "encoders.h"
|
||||
#include "encoderbase.h"
|
||||
#include "ttsbase.h"
|
||||
#include "system.h"
|
||||
#include "encttscfggui.h"
|
||||
|
@ -40,6 +40,8 @@
|
|||
#endif
|
||||
#include "rbutilqt.h"
|
||||
|
||||
#include "systrace.h"
|
||||
|
||||
#define DEFAULT_LANG "English (en)"
|
||||
#define DEFAULT_LANG_CODE "en"
|
||||
|
||||
|
@ -436,10 +438,10 @@ void Config::updateEncState()
|
|||
QString devname = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString();
|
||||
QString encoder = SystemInfo::platformValue(devname,
|
||||
SystemInfo::CurEncoder).toString();
|
||||
ui.encoderName->setText(EncBase::getEncoderName(SystemInfo::platformValue(devname,
|
||||
ui.encoderName->setText(EncoderBase::getEncoderName(SystemInfo::platformValue(devname,
|
||||
SystemInfo::CurEncoder).toString()));
|
||||
|
||||
EncBase* enc = EncBase::getEncoder(this,encoder);
|
||||
EncoderBase* enc = EncoderBase::getEncoder(this,encoder);
|
||||
|
||||
if(enc->configOk())
|
||||
{
|
||||
|
@ -893,13 +895,13 @@ void Config::configEnc()
|
|||
QString devname = ui.treeDevices->selectedItems().at(0)->data(0, Qt::UserRole).toString();
|
||||
QString encoder = SystemInfo::platformValue(devname,
|
||||
SystemInfo::CurEncoder).toString();
|
||||
ui.encoderName->setText(EncBase::getEncoderName(SystemInfo::platformValue(devname,
|
||||
ui.encoderName->setText(EncoderBase::getEncoderName(SystemInfo::platformValue(devname,
|
||||
SystemInfo::CurEncoder).toString()));
|
||||
|
||||
|
||||
EncBase* enc = EncBase::getEncoder(this,encoder);
|
||||
EncoderBase* enc = EncoderBase::getEncoder(this,encoder);
|
||||
|
||||
EncTtsCfgGui gui(this,enc,EncBase::getEncoderName(encoder));
|
||||
EncTtsCfgGui gui(this,enc,EncoderBase::getEncoderName(encoder));
|
||||
gui.exec();
|
||||
|
||||
updateEncState();
|
||||
|
|
|
@ -99,14 +99,14 @@ void CreateVoiceWindow::updateSettings(void)
|
|||
else
|
||||
ui.labelTtsProfile->setText(tr("Selected TTS engine: <b>%1</b>")
|
||||
.arg("Invalid TTS configuration!"));
|
||||
|
||||
|
||||
QString encoder = SystemInfo::value(SystemInfo::CurEncoder).toString();
|
||||
// only proceed if encoder setting is set
|
||||
EncBase* enc = EncBase::getEncoder(this,encoder);
|
||||
EncoderBase* enc = EncoderBase::getEncoder(this,encoder);
|
||||
if(enc != NULL) {
|
||||
if(enc->configOk())
|
||||
ui.labelEncProfile->setText(tr("Selected encoder: <b>%1</b>")
|
||||
.arg(EncBase::getEncoderName(encoder)));
|
||||
.arg(EncoderBase::getEncoderName(encoder)));
|
||||
else
|
||||
ui.labelEncProfile->setText(tr("Selected encoder: <b>%1</b>")
|
||||
.arg("Invalid encoder configuration!"));
|
||||
|
|
|
@ -34,7 +34,7 @@ InstallTalkWindow::InstallTalkWindow(QWidget *parent) : QDialog(parent)
|
|||
ui.recursive->setChecked(true);
|
||||
ui.GenerateOnlyNew->setChecked(true);
|
||||
ui.StripExtensions->setChecked(true);
|
||||
|
||||
|
||||
updateSettings();
|
||||
}
|
||||
|
||||
|
@ -62,28 +62,28 @@ void InstallTalkWindow::browseFolder()
|
|||
void InstallTalkWindow::change()
|
||||
{
|
||||
Config *cw = new Config(this,4);
|
||||
|
||||
|
||||
// make sure the current selected folder doesn't get lost on settings
|
||||
// changes. If the current selection is invalid don't accept it so
|
||||
// it gets reset to the old value after closing the settings dialog.
|
||||
// it gets reset to the old value after closing the settings dialog.
|
||||
QString folderToTalk = ui.lineTalkFolder->text();
|
||||
if(QFileInfo(folderToTalk).isDir())
|
||||
RbSettings::setValue(RbSettings::LastTalkedFolder, folderToTalk);
|
||||
connect(cw, SIGNAL(settingsUpdated()), this, SLOT(updateSettings()));
|
||||
|
||||
|
||||
cw->show();
|
||||
}
|
||||
|
||||
void InstallTalkWindow::accept()
|
||||
{
|
||||
logger = new ProgressLoggerGui(this);
|
||||
|
||||
|
||||
connect(logger,SIGNAL(closed()),this,SLOT(close()));
|
||||
logger->show();
|
||||
|
||||
|
||||
|
||||
QString folderToTalk = ui.lineTalkFolder->text();
|
||||
|
||||
|
||||
if(!QFileInfo(folderToTalk).isDir())
|
||||
{
|
||||
logger->addItem(tr("The Folder to Talk is wrong!"),LOGERROR);
|
||||
|
@ -97,19 +97,19 @@ void InstallTalkWindow::accept()
|
|||
|
||||
talkcreator->setDir(QDir(folderToTalk));
|
||||
talkcreator->setMountPoint(RbSettings::value(RbSettings::Mountpoint).toString());
|
||||
|
||||
|
||||
talkcreator->setGenerateOnlyNew(ui.GenerateOnlyNew->isChecked());
|
||||
talkcreator->setRecursive(ui.recursive->isChecked());
|
||||
talkcreator->setStripExtensions(ui.StripExtensions->isChecked());
|
||||
talkcreator->setTalkFolders(ui.talkFolders->isChecked());
|
||||
talkcreator->setTalkFiles(ui.talkFiles->isChecked());
|
||||
talkcreator->setIgnoreFiles(ui.ignoreFiles->text().split(",",QString::SkipEmptyParts));
|
||||
|
||||
|
||||
connect(talkcreator, SIGNAL(done(bool)), logger, SLOT(setFinished()));
|
||||
connect(talkcreator, SIGNAL(logItem(QString, int)), logger, SLOT(addItem(QString, int)));
|
||||
connect(talkcreator, SIGNAL(logProgress(int, int)), logger, SLOT(setProgress(int, int)));
|
||||
connect(logger,SIGNAL(aborted()),talkcreator,SLOT(abort()));
|
||||
|
||||
|
||||
talkcreator->createTalkFiles();
|
||||
}
|
||||
|
||||
|
@ -124,13 +124,13 @@ void InstallTalkWindow::updateSettings(void)
|
|||
else
|
||||
ui.labelTtsProfile->setText(tr("Selected TTS engine: <b>%1</b>")
|
||||
.arg("Invalid TTS configuration!"));
|
||||
|
||||
|
||||
QString encoder = SystemInfo::value(SystemInfo::CurEncoder).toString();
|
||||
EncBase* enc = EncBase::getEncoder(this,encoder);
|
||||
EncoderBase* enc = EncoderBase::getEncoder(this,encoder);
|
||||
if(enc != NULL) {
|
||||
if(enc->configOk())
|
||||
ui.labelEncProfile->setText(tr("Selected encoder: <b>%1</b>")
|
||||
.arg(EncBase::getEncoderName(encoder)));
|
||||
.arg(EncoderBase::getEncoderName(encoder)));
|
||||
else
|
||||
ui.labelEncProfile->setText(tr("Selected encoder: <b>%1</b>")
|
||||
.arg("Invalid encoder configuration!"));
|
||||
|
|
|
@ -33,7 +33,9 @@ SOURCES += \
|
|||
uninstallwindow.cpp \
|
||||
base/utils.cpp \
|
||||
preview.cpp \
|
||||
base/encoders.cpp \
|
||||
base/encoderbase.cpp \
|
||||
base/encoderrbspeex.cpp \
|
||||
base/encoderexe.cpp \
|
||||
encttscfggui.cpp \
|
||||
base/encttssettings.cpp \
|
||||
base/ttsbase.cpp \
|
||||
|
@ -95,7 +97,9 @@ HEADERS += \
|
|||
uninstallwindow.h \
|
||||
base/utils.h \
|
||||
preview.h \
|
||||
base/encoders.h \
|
||||
base/encoderbase.h \
|
||||
base/encoderrbspeex.h \
|
||||
base/encoderexe.h \
|
||||
encttscfggui.h \
|
||||
base/encttssettings.h \
|
||||
base/ttsbase.h \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue