File indexing completed on 2024-05-12 12:43:09

0001 /*
0002    SPDX-FileCopyrightText: 2014-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 #include "textedittexttospeech_export.h"
0009 #include <QObject>
0010 #include <QVoice>
0011 
0012 class QTextToSpeech;
0013 namespace TextEditTextToSpeech
0014 {
0015 /**
0016  * @brief The TextToSpeechConfigInterface class
0017  * @author Laurent Montel <montel@kde.org>
0018  */
0019 class TEXTEDITTEXTTOSPEECH_EXPORT TextToSpeechConfigInterface : public QObject
0020 {
0021     Q_OBJECT
0022 public:
0023     struct EngineSettings {
0024         int rate = 0;
0025         int pitch = 0;
0026         int volume = 0;
0027         QVoice voice;
0028         QString localeName;
0029     };
0030     explicit TextToSpeechConfigInterface(QObject *parent = nullptr);
0031     ~TextToSpeechConfigInterface() override;
0032 
0033     [[nodiscard]] QVector<QLocale> availableLocales() const;
0034     [[nodiscard]] QLocale locale() const;
0035 
0036     [[nodiscard]] QStringList availableEngines() const;
0037     [[nodiscard]] QVector<QVoice> availableVoices() const;
0038     void setEngine(const QString &engineName);
0039     void testEngine(const EngineSettings &engineSettings);
0040     QTextToSpeech *mTextToSpeech = nullptr;
0041 };
0042 }
0043 TEXTEDITTEXTTOSPEECH_EXPORT QDebug operator<<(QDebug d, const TextEditTextToSpeech::TextToSpeechConfigInterface::EngineSettings &t);