Bump version numbers for 3.13
[maemo-rb.git] / rbutil / rbutilqt / base / ttsbase.cpp
blob3b8384f534349c51a6e9109641f00f81cbca1c55
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
9 * Copyright (C) 2007 by Dominik Wenger
11 * All files in this archive are subject to the GNU General Public License.
12 * See the file COPYING in the source tree root for full license agreement.
14 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
15 * KIND, either express or implied.
17 ****************************************************************************/
19 #include <QtCore>
20 #include "ttsbase.h"
22 #include "ttsfestival.h"
23 #include "ttssapi.h"
24 #include "ttssapi4.h"
25 #include "ttsmssp.h"
26 #include "ttsexes.h"
27 #include "ttsespeak.h"
28 #include "ttsflite.h"
29 #include "ttsswift.h"
30 #if defined(Q_OS_MACX)
31 #include "ttscarbon.h"
32 #endif
34 // list of tts names and identifiers
35 QMap<QString,QString> TTSBase::ttsList;
37 TTSBase::TTSBase(QObject* parent): EncTtsSettingInterface(parent)
41 // static functions
42 void TTSBase::initTTSList()
44 #if !defined(Q_OS_WIN)
45 ttsList["espeak"] = tr("Espeak TTS Engine");
46 #endif
47 ttsList["flite"] = tr("Flite TTS Engine");
48 ttsList["swift"] = tr("Swift TTS Engine");
49 #if defined(Q_OS_WIN)
50 #if 0 /* SAPI4 has been disabled since long. Keep support for now. */
51 ttsList["sapi4"] = tr("SAPI4 TTS Engine");
52 #endif
53 ttsList["sapi"] = tr("SAPI5 TTS Engine");
54 ttsList["mssp"] = tr("MS Speech Platform");
55 #endif
56 #if defined(Q_OS_LINUX)
57 ttsList["festival"] = tr("Festival TTS Engine");
58 #endif
59 #if defined(Q_OS_MACX)
60 ttsList["carbon"] = tr("OS X System Engine");
61 #endif
64 // function to get a specific encoder
65 TTSBase* TTSBase::getTTS(QObject* parent,QString ttsName)
68 TTSBase* tts = 0;
69 #if defined(Q_OS_WIN)
70 if(ttsName == "sapi")
71 tts = new TTSSapi(parent);
72 else if (ttsName == "sapi4")
73 tts = new TTSSapi4(parent);
74 else if (ttsName == "mssp")
75 tts = new TTSMssp(parent);
76 else
77 #elif defined(Q_OS_LINUX)
78 if (ttsName == "festival")
79 tts = new TTSFestival(parent);
80 else
81 #elif defined(Q_OS_MACX)
82 if(ttsName == "carbon")
83 tts = new TTSCarbon(parent);
84 else
85 #endif
86 if(ttsName == "espeak")
87 tts = new TTSEspeak(parent);
88 else if(ttsName == "flite")
89 tts = new TTSFlite(parent);
90 else if(ttsName == "swift")
91 tts = new TTSSwift(parent);
92 else if(ttsName == "user")
93 tts = new TTSExes(parent);
95 return tts;
98 // get the list of encoders, nice names
99 QStringList TTSBase::getTTSList()
101 // init list if its empty
102 if(ttsList.count() == 0)
103 initTTSList();
105 return ttsList.keys();
108 // get nice name of a specific tts
109 QString TTSBase::getTTSName(QString tts)
111 if(ttsList.isEmpty())
112 initTTSList();
113 return ttsList.value(tts);