Handle language change events in widgets.
[maemo-rb.git] / rbutil / rbutilqt / base / ttsbase.cpp
blob9cc12fb586e2fd0606852f304a2783ddd31d7b0b
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 "ttsbase.h"
21 #include "ttsfestival.h"
22 #include "ttssapi.h"
23 #include "ttsexes.h"
24 #if defined(Q_OS_MACX)
25 #include "ttscarbon.h"
26 #endif
28 // list of tts names and identifiers
29 QMap<QString,QString> TTSBase::ttsList;
31 TTSBase::TTSBase(QObject* parent): EncTtsSettingInterface(parent)
36 // static functions
37 void TTSBase::initTTSList()
39 #if !defined(Q_OS_WIN)
40 ttsList["espeak"] = tr("Espeak TTS Engine");
41 #endif
42 ttsList["flite"] = tr("Flite TTS Engine");
43 ttsList["swift"] = tr("Swift TTS Engine");
44 #if defined(Q_OS_WIN)
45 ttsList["sapi"] = tr("SAPI TTS Engine");
46 #endif
47 #if defined(Q_OS_LINUX)
48 ttsList["festival"] = tr("Festival TTS Engine");
49 #endif
50 #if defined(Q_OS_MACX)
51 ttsList["carbon"] = tr("OS X System Engine");
52 #endif
55 // function to get a specific encoder
56 TTSBase* TTSBase::getTTS(QObject* parent,QString ttsName)
59 TTSBase* tts;
60 #if defined(Q_OS_WIN)
61 if(ttsName == "sapi")
63 tts = new TTSSapi(parent);
64 return tts;
66 else
67 #endif
68 #if defined(Q_OS_LINUX)
69 if (ttsName == "festival")
71 tts = new TTSFestival(parent);
72 return tts;
74 else
75 #endif
76 #if defined(Q_OS_MACX)
77 if(ttsName == "carbon")
79 tts = new TTSCarbon(parent);
80 return tts;
82 else
83 #endif
84 if (true) // fix for OS other than WIN or LINUX
86 tts = new TTSExes(ttsName,parent);
87 return tts;
91 // get the list of encoders, nice names
92 QStringList TTSBase::getTTSList()
94 // init list if its empty
95 if(ttsList.count() == 0)
96 initTTSList();
98 return ttsList.keys();
101 // get nice name of a specific tts
102 QString TTSBase::getTTSName(QString tts)
104 if(ttsList.isEmpty())
105 initTTSList();
106 return ttsList.value(tts);