File indexing completed on 2024-12-22 04:28:24

0001 /*
0002   SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org>
0003 
0004   SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "textspeechtotext_export.h"
0010 #include <QObject>
0011 #include <memory>
0012 namespace TextSpeechToText
0013 {
0014 class SpeechToTextEngineLoaderPrivate;
0015 class SpeechToTextClient;
0016 /**
0017  * @brief The SpeechToTextEngineLoader class
0018  * @author Laurent Montel <montel@kde.org>
0019  */
0020 class TEXTSPEECHTOTEXT_EXPORT SpeechToTextEngineLoader : public QObject
0021 {
0022     Q_OBJECT
0023 public:
0024     static SpeechToTextEngineLoader *self();
0025 
0026     explicit SpeechToTextEngineLoader(QObject *parent = nullptr);
0027     ~SpeechToTextEngineLoader() override;
0028 
0029     [[nodiscard]] TextSpeechToText::SpeechToTextClient *createSpeechToTextClient(const QString &clientName);
0030 
0031     [[nodiscard]] bool hasConfigurationDialog(const QString &clientName) const;
0032 
0033     [[nodiscard]] bool showConfigureDialog(const QString &clientName, QWidget *parentWidget);
0034 
0035     [[nodiscard]] QMap<QString, QString> speechToTextEngineInfos() const;
0036 
0037     [[nodiscard]] QString fallbackFirstEngine() const;
0038 
0039     [[nodiscard]] bool hasEngine() const;
0040 
0041 Q_SIGNALS:
0042     void loadingSpeechToTextFailed();
0043     void noPluginsFound();
0044 
0045 private:
0046     TEXTSPEECHTOTEXT_NO_EXPORT void loadPlugins();
0047     TEXTSPEECHTOTEXT_NO_EXPORT void loadPlugin(const QString &pluginPath);
0048     std::unique_ptr<SpeechToTextEngineLoaderPrivate> const d;
0049 };
0050 }