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

0001 /*
0002   SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org>
0003 
0004   SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 #include "voskspeechtotextclient.h"
0007 #include "voskenginedialog.h"
0008 #include "voskspeechtotextplugin.h"
0009 #include <KLocalizedString>
0010 #include <QPointer>
0011 
0012 VoskSpeechToTextClient::VoskSpeechToTextClient(QObject *parent)
0013     : TextSpeechToText::SpeechToTextClient{parent}
0014 {
0015 }
0016 
0017 VoskSpeechToTextClient::~VoskSpeechToTextClient() = default;
0018 
0019 QString VoskSpeechToTextClient::name() const
0020 {
0021     return QStringLiteral("vosk");
0022 }
0023 
0024 QString VoskSpeechToTextClient::translatedName() const
0025 {
0026     return i18n("Vosk");
0027 }
0028 
0029 TextSpeechToText::SpeechToTextClient::EngineType VoskSpeechToTextClient::engineType() const
0030 {
0031     return TextSpeechToText::SpeechToTextClient::Locale;
0032 }
0033 
0034 TextSpeechToText::SpeechToTextPlugin *VoskSpeechToTextClient::createTextToSpeech()
0035 {
0036     return new VoskSpeechToTextPlugin;
0037 }
0038 
0039 bool VoskSpeechToTextClient::hasConfigurationDialog() const
0040 {
0041     return true;
0042 }
0043 
0044 bool VoskSpeechToTextClient::showConfigureDialog(QWidget *parentWidget)
0045 {
0046     bool settingsChanged = false;
0047     QPointer<VoskEngineDialog> dlg = new VoskEngineDialog(parentWidget);
0048     if (dlg->exec()) {
0049         Q_EMIT configureChanged();
0050         settingsChanged = true;
0051     }
0052     delete dlg;
0053     return settingsChanged;
0054 }
0055 
0056 #include "moc_voskspeechtotextclient.cpp"