1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QDECLARATIVETEXTTOSPEECH_H
5#define QDECLARATIVETEXTTOSPEECH_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtTextToSpeech/qtexttospeech.h>
19
20#include <QtQml/qqml.h>
21#include <QtQml/qqmlparserstatus.h>
22
23QT_BEGIN_NAMESPACE
24
25class QVoiceSelectorAttached;
26
27class QDeclarativeTextToSpeech : public QTextToSpeech, public QQmlParserStatus
28{
29 Q_OBJECT
30 Q_PROPERTY(QString engine READ engine WRITE setEngine NOTIFY engineChanged FINAL)
31 Q_PROPERTY(QVariantMap engineParameters READ engineParameters WRITE setEngineParameters NOTIFY engineParametersChanged REVISION(6, 6) FINAL)
32
33 Q_INTERFACES(QQmlParserStatus)
34 QML_NAMED_ELEMENT(TextToSpeech)
35
36public:
37 explicit QDeclarativeTextToSpeech(QObject *parent = nullptr);
38
39 Q_REVISION(6, 6) Q_INVOKABLE QList<QVoice> findVoices(const QVariantMap &criteria) const;
40
41 QVoiceSelectorAttached *m_voiceSelector = nullptr;
42
43 void selectVoice();
44
45 QString engine() const;
46 void setEngine(const QString &engine);
47
48 QVariantMap engineParameters() const;
49 void setEngineParameters(const QVariantMap &parameters);
50
51Q_SIGNALS:
52 void engineChanged(const QString &);
53 Q_REVISION(6, 6) void engineParametersChanged();
54
55protected:
56 void classBegin() override;
57 void componentComplete() override;
58
59private:
60 bool m_complete = false;
61 QString m_engine;
62 QVariantMap m_engineParameters;
63};
64
65QT_END_NAMESPACE
66
67#endif // QDECLARATIVETEXTTOSPEECH_H
68

source code of qtspeech/src/tts/qml/qdeclarativetexttospeech_p.h