Use QLocale::toDateTime() for parsing the date instead of QDateTime::fromString(...
[kugel-rb.git] / rbutil / rbutilqt / base / ttsbase.cpp
blob1f4060fc72e49994bcf35523e77244ce94c2f40b
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
9 * Copyright (C) 2007 by Dominik Wenger
10 * $Id$
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
20 #include "ttsbase.h"
22 #include "ttsfestival.h"
23 #include "ttssapi.h"
24 #include "ttsexes.h"
26 // list of tts names and identifiers
27 QMap<QString,QString> TTSBase::ttsList;
29 TTSBase::TTSBase(QObject* parent): EncTtsSettingInterface(parent)
34 // static functions
35 void TTSBase::initTTSList()
37 ttsList["espeak"] = "Espeak TTS Engine";
38 ttsList["flite"] = "Flite TTS Engine";
39 ttsList["swift"] = "Swift TTS Engine";
40 #if defined(Q_OS_WIN)
41 ttsList["sapi"] = "Sapi TTS Engine";
42 #endif
43 #if defined(Q_OS_LINUX)
44 ttsList["festival"] = "Festival TTS Engine";
45 #endif
48 // function to get a specific encoder
49 TTSBase* TTSBase::getTTS(QObject* parent,QString ttsName)
52 TTSBase* tts;
53 #if defined(Q_OS_WIN)
54 if(ttsName == "sapi")
56 tts = new TTSSapi(parent);
57 return tts;
59 else
60 #endif
61 #if defined(Q_OS_LINUX)
62 if (ttsName == "festival")
64 tts = new TTSFestival(parent);
65 return tts;
67 else
68 #endif
69 if (true) // fix for OS other than WIN or LINUX
71 tts = new TTSExes(ttsName,parent);
72 return tts;
76 // get the list of encoders, nice names
77 QStringList TTSBase::getTTSList()
79 // init list if its empty
80 if(ttsList.count() == 0)
81 initTTSList();
83 return ttsList.keys();
86 // get nice name of a specific tts
87 QString TTSBase::getTTSName(QString tts)
89 if(ttsList.isEmpty())
90 initTTSList();
91 return ttsList.value(tts);