Ejemplo n.º 1
0
/*static*/ QString TalkerCode::defaultTalkerCode(const QString &fullLanguageCode, const QString &moduleName)
{
    TalkerCode tmpTalkerCode;
    //tmpTalkerCode.setFullLanguageCode(fullLanguageCode);
    tmpTalkerCode.setOutputModule(moduleName);
    //tmpTalkerCode.normalize();
    return tmpTalkerCode.getTalkerCode();
}
Ejemplo n.º 2
0
/**
 * Copy Constructor.
 */
TalkerCode::TalkerCode(const TalkerCode& other)
:d(new TalkerCodePrivate(this))
{
    d->name = other.name();
    d->language = other.language();
    d->voiceType = other.voiceType();
    d->volume = other.volume();
    d->rate = other.rate();
    d->pitch = other.pitch();
    d->voiceName = other.voiceName();
    d->outputModule = other.outputModule();
    d->punctuation = other.punctuation();
}
Ejemplo n.º 3
0
bool TalkerCode::operator!=(TalkerCode &other) const
{
    return d->language != other.language() ||
           d->voiceType != other.voiceType() ||
           d->rate != other.rate() ||
           d->volume != other.volume() ||
           d->pitch != other.pitch() ||
           d->voiceName != other.voiceName() ||
           d->outputModule != other.outputModule() ||
           d->punctuation != other.punctuation();
}
Ejemplo n.º 4
0
bool TalkerCode::operator==(TalkerCode &other) const
{
    return d->language == other.language() &&
           d->voiceType == other.voiceType() &&
           d->rate == other.rate() &&
           d->volume == other.volume() &&
           d->pitch == other.pitch() &&
           d->voiceName == other.voiceName() &&
           d->outputModule == other.outputModule() &&
           d->punctuation == other.punctuation();
}
Ejemplo n.º 5
0
Archivo: jovie.cpp Proyecto: KDE/jovie
void Jovie::setCurrentTalker(const TalkerCode &talker)
{
    Speaker::Instance()->setOutputModule(talker.outputModule());
    Speaker::Instance()->setLanguage(TalkerCode::languageCodeToLanguage(talker.language()));
    Speaker::Instance()->setVoiceType(talker.voiceType());
    Speaker::Instance()->setVolume(talker.volume());
    Speaker::Instance()->setSpeed(talker.rate());
    Speaker::Instance()->setPitch(talker.pitch());
}
Ejemplo n.º 6
0
/**
 * Loads notify events from a file.  Clearing data if clear is True.
 */
void SpeechData::loadNotifyEventsFromFile( const QString& filename, bool clear)
{
    // Open existing event list.
    QFile file( filename );
    if ( !file.open( IO_ReadOnly ) )
    {
        kdDebug() << "SpeechData::loadNotifyEventsFromFile: Unable to open file " << filename << endl;
    }
    // QDomDocument doc( "http://www.kde.org/share/apps/kttsd/stringreplacer/wordlist.dtd []" );
    QDomDocument doc( "" );
    if ( !doc.setContent( &file ) ) {
        file.close();
        kdDebug() << "SpeechData::loadNotifyEventsFromFile: File not in proper XML format. " << filename << endl;
    }
    // kdDebug() << "StringReplacerConf::load: document successfully parsed." << endl;
    file.close();

    if ( clear )
    {
        notifyDefaultPresent = NotifyPresent::Passive;
        notifyDefaultOptions.action = NotifyAction::SpeakMsg;
        notifyDefaultOptions.talker = QString::null;
        notifyDefaultOptions.customMsg = QString::null;
        notifyAppMap.clear();
    }

    // Event list.
    QDomNodeList eventList = doc.elementsByTagName("notifyEvent");
    const int eventListCount = eventList.count();
    for (int eventIndex = 0; eventIndex < eventListCount; ++eventIndex)
    {
        QDomNode eventNode = eventList.item(eventIndex);
        QDomNodeList propList = eventNode.childNodes();
        QString eventSrc;
        QString event;
        QString actionName;
        QString message;
        TalkerCode talkerCode;
        const int propListCount = propList.count();
        for (int propIndex = 0; propIndex < propListCount; ++propIndex)
        {
            QDomNode propNode = propList.item(propIndex);
            QDomElement prop = propNode.toElement();
            if (prop.tagName() == "eventSrc") eventSrc = prop.text();
            if (prop.tagName() == "event") event = prop.text();
            if (prop.tagName() == "action") actionName = prop.text();
            if (prop.tagName() == "message") message = prop.text();
            if (prop.tagName() == "talker") talkerCode = TalkerCode(prop.text(), false);
        }
        NotifyOptions notifyOptions;
        notifyOptions.action = NotifyAction::action( actionName );
        notifyOptions.talker = talkerCode.getTalkerCode();
        notifyOptions.customMsg = message;
        if ( eventSrc != "default" )
        {
            notifyOptions.eventName = NotifyEvent::getEventName( eventSrc, event );
            NotifyEventMap notifyEventMap = notifyAppMap[ eventSrc ];
            notifyEventMap[ event ] = notifyOptions;
            notifyAppMap[ eventSrc ] = notifyEventMap;
        } else {
            notifyOptions.eventName = QString::null;
            notifyDefaultPresent = NotifyPresent::present( event );
            notifyDefaultOptions = notifyOptions;
        }
    }
}