KTextAddons

speechtotextplugin.h
1/*
2 SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8#include "textspeechtotext_export.h"
9#include <QObject>
10#include <memory>
11namespace TextSpeechToText
12{
13/**
14 * @brief The SpeechToTextPlugin class
15 * @author Laurent Montel <montel@kde.org>
16 */
17class SpeechToTextPluginPrivate;
18class TEXTSPEECHTOTEXT_EXPORT SpeechToTextPlugin : public QObject
19{
20 Q_OBJECT
21public:
22 enum PluginStatus {
23 Unknown = 0,
24 NoMicrophoneFound,
25 Waiting,
26 Running,
27 Paused,
28 PermissionMissing,
29 };
30 Q_ENUM(PluginStatus)
31
32 explicit SpeechToTextPlugin(QObject *parent = nullptr);
33 ~SpeechToTextPlugin() override;
34
35 [[nodiscard]] QString result() const;
36
37 virtual void speechToText() = 0;
38
39 [[nodiscard]] virtual int sampleRate() const = 0;
40
41 [[nodiscard]] QString defaultLanguage() const;
42 [[nodiscard]] virtual QIODevice *audioDevice() const = 0;
43
44 void setDefaultLanguage(const QString &language);
45
46 [[nodiscard]] virtual bool loadSettings() = 0;
47
48 virtual void clear() = 0;
49
50Q_SIGNALS:
51 void speechToTextDone(const QString &result);
52
53private:
54 std::unique_ptr<SpeechToTextPluginPrivate> const d;
55};
56}
KGuiItem clear()
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:02:03 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.