1// Copyright (C) 2015 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only
3
4
5
6#ifndef QTEXTTOSPEECH_P_H
7#define QTEXTTOSPEECH_P_H
8
9//
10// W A R N I N G
11// -------------
12//
13// This file is not part of the Qt API. It exists for the convenience
14// of other Qt classes. This header file may change from version to
15// version without notice, or even be removed.
16//
17// We mean it.
18//
19
20#include <qtexttospeech.h>
21#include <qtexttospeechplugin.h>
22#include <QMutex>
23#include <QCborMap>
24#include <QtCore/qhash.h>
25#include <QtCore/qqueue.h>
26#include <QtCore/qnumeric.h>
27#include <QtCore/private/qobject_p.h>
28
29QT_BEGIN_NAMESPACE
30
31class QTextToSpeech;
32class QTextToSpeechPrivate : public QObjectPrivate
33{
34 Q_DECLARE_PUBLIC(QTextToSpeech)
35public:
36 QTextToSpeechPrivate(QTextToSpeech *speech);
37 ~QTextToSpeechPrivate();
38
39 void setEngineProvider(const QString &engine, const QVariantMap &params);
40 static QMultiHash<QString, QCborMap> plugins(bool reload = false);
41
42private:
43 bool loadMeta();
44 void loadPlugin();
45 void updateState(QTextToSpeech::State newState);
46 void disconnectSynthesizeFunctor();
47 static void loadPluginMetadata(QMultiHash<QString, QCborMap> &list);
48 QTextToSpeech *q_ptr;
49 QTextToSpeechPlugin *m_plugin = nullptr;
50 std::unique_ptr<QTextToSpeechEngine> m_engine = nullptr;
51 QString m_providerName;
52 QCborMap m_metaData;
53 static QMutex m_mutex;
54 QQueue<QString> m_pendingUtterances;
55 QTextToSpeech::State m_state = QTextToSpeech::Error;
56 QMetaObject::Connection m_synthesizeConnection;
57 QtPrivate::QSlotObjectBase *m_slotObject = nullptr;
58
59 qsizetype m_utteranceCounter = 0;
60 qsizetype m_currentUtterance = 0;
61 double m_storedPitch = qQNaN();
62 double m_storedVolume = qQNaN();
63 double m_storedRate = qQNaN();
64};
65
66QT_END_NAMESPACE
67
68#endif
69

source code of qtspeech/src/tts/qtexttospeech_p.h