| 1 | /**************************************************************************** |
| 2 | ** |
| 3 | ** Copyright (C) 2015 The Qt Company Ltd. |
| 4 | ** Contact: http://www.qt.io/licensing/ |
| 5 | ** |
| 6 | ** This file is part of the Qt Speech module of the Qt Toolkit. |
| 7 | ** |
| 8 | ** $QT_BEGIN_LICENSE:LGPL3$ |
| 9 | ** Commercial License Usage |
| 10 | ** Licensees holding valid commercial Qt licenses may use this file in |
| 11 | ** accordance with the commercial license agreement provided with the |
| 12 | ** Software or, alternatively, in accordance with the terms contained in |
| 13 | ** a written agreement between you and The Qt Company. For licensing terms |
| 14 | ** and conditions see http://www.qt.io/terms-conditions. For further |
| 15 | ** information use the contact form at http://www.qt.io/contact-us. |
| 16 | ** |
| 17 | ** GNU Lesser General Public License Usage |
| 18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
| 19 | ** General Public License version 3 as published by the Free Software |
| 20 | ** Foundation and appearing in the file LICENSE.LGPLv3 included in the |
| 21 | ** packaging of this file. Please review the following information to |
| 22 | ** ensure the GNU Lesser General Public License version 3 requirements |
| 23 | ** will be met: https://www.gnu.org/licenses/lgpl.html. |
| 24 | ** |
| 25 | ** GNU General Public License Usage |
| 26 | ** Alternatively, this file may be used under the terms of the GNU |
| 27 | ** General Public License version 2.0 or later as published by the Free |
| 28 | ** Software Foundation and appearing in the file LICENSE.GPL included in |
| 29 | ** the packaging of this file. Please review the following information to |
| 30 | ** ensure the GNU General Public License version 2.0 requirements will be |
| 31 | ** met: http://www.gnu.org/licenses/gpl-2.0.html. |
| 32 | ** |
| 33 | ** $QT_END_LICENSE$ |
| 34 | ** |
| 35 | ****************************************************************************/ |
| 36 | |
| 37 | #include "qtexttospeechengine.h" |
| 38 | |
| 39 | #include <QLoggingCategory> |
| 40 | |
| 41 | QT_BEGIN_NAMESPACE |
| 42 | |
| 43 | |
| 44 | /*! |
| 45 | \class QTextToSpeechEngine |
| 46 | \inmodule QtSpeech |
| 47 | \brief The QTextToSpeechEngine class is the base for text-to-speech engine integrations. |
| 48 | |
| 49 | An engine implementation must derive from QTextToSpeechEngine and implement all |
| 50 | its pure virtual methods. |
| 51 | */ |
| 52 | |
| 53 | /*! \fn QVector<QLocale> QTextToSpeechEngine::availableLocales() const |
| 54 | |
| 55 | Implementation of \l QTextToSpeech::availableLocales(). |
| 56 | */ |
| 57 | |
| 58 | /*! \fn QVector<QVoice> QTextToSpeechEngine::availableVoices() const |
| 59 | |
| 60 | Implementation of \l QTextToSpeech::availableVoices(). |
| 61 | */ |
| 62 | |
| 63 | /*! \fn void QTextToSpeechEngine::say(const QString &text) |
| 64 | |
| 65 | Implementation of \l {QTextToSpeech::say()}{QTextToSpeech::say}(\a text). |
| 66 | */ |
| 67 | |
| 68 | /*! \fn void QTextToSpeechEngine::stop() |
| 69 | |
| 70 | Implementation of \l QTextToSpeech::stop(). |
| 71 | */ |
| 72 | |
| 73 | /*! \fn void QTextToSpeechEngine::pause() |
| 74 | |
| 75 | Implementation of \l QTextToSpeech::pause(). |
| 76 | */ |
| 77 | |
| 78 | /*! \fn void QTextToSpeechEngine::resume() |
| 79 | |
| 80 | Implementation of \l QTextToSpeech::resume(). |
| 81 | */ |
| 82 | |
| 83 | /*! \fn void QTextToSpeechEngine::rate() const |
| 84 | |
| 85 | Implementation of \l QTextToSpeech::rate(). |
| 86 | */ |
| 87 | |
| 88 | /*! \fn bool QTextToSpeechEngine::setRate(double rate) |
| 89 | |
| 90 | Implementation of \l {QTextToSpeech::setRate()}{QTextToSpeech::setRate}(\a rate). |
| 91 | |
| 92 | Return \c true if the operation was successful. |
| 93 | */ |
| 94 | |
| 95 | /*! \fn void QTextToSpeechEngine::pitch() const |
| 96 | |
| 97 | Implementation of \l QTextToSpeech::pitch(). |
| 98 | */ |
| 99 | |
| 100 | /*! \fn bool QTextToSpeechEngine::setPitch(double pitch) |
| 101 | |
| 102 | Implementation of \l {QTextToSpeech::setPitch()}{QTextToSpeech::setPitch}(\a pitch). |
| 103 | |
| 104 | Return \c true if the operation was successful. |
| 105 | */ |
| 106 | |
| 107 | /*! \fn QLocale QTextToSpeechEngine::locale() const |
| 108 | |
| 109 | Implementation of QTextToSpeech::locale(). |
| 110 | */ |
| 111 | |
| 112 | /*! \fn bool QTextToSpeechEngine::setLocale(const QLocale &locale) |
| 113 | |
| 114 | Implementation \l {QTextToSpeech::setLocale()}{QTextToSpeech::setLocale}(\a locale). |
| 115 | |
| 116 | Return \c true if the operation was successful. In this case, the |
| 117 | current voice (as returned by voice()) should also be updated to a |
| 118 | new, valid value. |
| 119 | */ |
| 120 | |
| 121 | /*! \fn double QTextToSpeechEngine::volume() const |
| 122 | |
| 123 | Implementation of QTextToSpeech::volume(). |
| 124 | */ |
| 125 | |
| 126 | /*! \fn bool QTextToSpeechEngine::setVolume(double volume) |
| 127 | |
| 128 | Implementation of \l {QTextToSpeech::setVolume()}{QTextToSpeech::setVolume}(\a volume). |
| 129 | |
| 130 | Return \c true if the operation was successful. |
| 131 | */ |
| 132 | |
| 133 | /*! \fn QVoice QTextToSpeechEngine::voice() const |
| 134 | |
| 135 | Implementation of \l QTextToSpeech::voice(). |
| 136 | */ |
| 137 | |
| 138 | /*! \fn bool QTextToSpeechEngine::setVoice(const QVoice &voice) |
| 139 | |
| 140 | Implementation of \l {QTextToSpeech::setVoice()}{QTextToSpeech::setVoice}(\a voice). |
| 141 | |
| 142 | Return \c true if the operation was successful. |
| 143 | */ |
| 144 | |
| 145 | /*! \fn QTextToSpeech::State QTextToSpeechEngine::state() const |
| 146 | |
| 147 | Implementation of QTextToSpeech::state(). |
| 148 | */ |
| 149 | |
| 150 | /*! \fn void QTextToSpeechEngine::stateChanged(QTextToSpeech::State state) |
| 151 | |
| 152 | Emitted when the text-to-speech engine \a state has changed. |
| 153 | |
| 154 | This signal is connected to QTextToSpeech::stateChanged() signal. |
| 155 | */ |
| 156 | |
| 157 | /*! |
| 158 | Constructs the text-to-speech engine base class with \a parent. |
| 159 | */ |
| 160 | QTextToSpeechEngine::QTextToSpeechEngine(QObject *parent): |
| 161 | QObject(parent) |
| 162 | { |
| 163 | } |
| 164 | |
| 165 | QTextToSpeechEngine::~QTextToSpeechEngine() |
| 166 | { |
| 167 | } |
| 168 | |
| 169 | /*! |
| 170 | Creates a voice for a text-to-speech engine. |
| 171 | |
| 172 | Parameters \a name, \a gender, \a age and \a data are directly stored in the QVoice instance. |
| 173 | */ |
| 174 | QVoice QTextToSpeechEngine::createVoice(const QString &name, QVoice::Gender gender, QVoice::Age age, const QVariant &data) |
| 175 | { |
| 176 | return QVoice(name, gender, age, data); |
| 177 | } |
| 178 | |
| 179 | /*! |
| 180 | Returns the engine-specific private data for the given \a voice. |
| 181 | |
| 182 | */ |
| 183 | QVariant QTextToSpeechEngine::voiceData(const QVoice &voice) |
| 184 | { |
| 185 | return voice.data(); |
| 186 | } |
| 187 | |
| 188 | QT_END_NAMESPACE |
| 189 | |