KTextAddons

managermodelvoskspeechtotext.h
1/*
2 SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6#pragma once
7#include "libvoskspeechtotext_export.h"
8#include "voskdownloadlanguagejob.h"
9#include "voskspeechtotextinfo.h"
10#include <QObject>
11
12class LIBVOSKSPEECHTOTEXT_EXPORT ManagerModelVoskSpeechToText : public QObject
13{
14 Q_OBJECT
15public:
16 struct ProgressInfo {
17 QString languageName;
18 qint64 bytesReceived = -1;
19 qint64 bytesTotal = -1;
20 };
21 explicit ManagerModelVoskSpeechToText(QObject *parent = nullptr);
22 ~ManagerModelVoskSpeechToText() override;
23
24 static ManagerModelVoskSpeechToText *self();
25
26 void downloadListModels();
27
28 [[nodiscard]] QVector<VoskSpeechToTextInfo> speechToTextInfos() const;
29 void setSpeechToTextInfos(const QVector<VoskSpeechToTextInfo> &newTranslators);
30
31 void loadModelList(const QString &fileName);
32
33 void downloadLanguage(const VoskDownloadLanguageJob::DownloadLanguageInfo &info);
34 [[nodiscard]] bool needDownloadModelList() const;
36 void errorText(const QString &str);
37 void progress(const ManagerModelVoskSpeechToText::ProgressInfo &info);
38 void extractDone();
39 void downLoadModelListDone();
40
41private:
42 LIBVOSKSPEECHTOTEXT_NO_EXPORT void parseListModel(const QJsonArray &arrays);
43 QVector<VoskSpeechToTextInfo> mSpeechToTextInfos;
44};
45Q_DECLARE_TYPEINFO(ManagerModelVoskSpeechToText::ProgressInfo, Q_MOVABLE_TYPE);
Q_SIGNALSQ_SIGNALS
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:29:59 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.