KTextAddons

voskdownloadlanguagejob.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 "libvoskspeechtotext_private_export.h"
9#include <QCryptographicHash>
10#include <QObject>
11#include <QUrl>
12class QTemporaryFile;
13class LIBVOSKSPEECHTOTEXT_TESTS_EXPORT VoskDownloadLanguageJob : public QObject
14{
15 Q_OBJECT
16public:
17 struct LIBVOSKSPEECHTOTEXT_TESTS_EXPORT DownloadLanguageInfo {
18 QUrl url;
19 QString checksum;
22 [[nodiscard]] bool isValid() const;
23 };
24 explicit VoskDownloadLanguageJob(QObject *parent = nullptr);
25 ~VoskDownloadLanguageJob() override;
26 void start();
27
28 [[nodiscard]] bool canStart() const;
29
30 [[nodiscard]] DownloadLanguageInfo info() const;
31 void setInfo(const DownloadLanguageInfo &newInfo);
32
34 void errorText(const QString &str);
35 void downloadProgress(qint64 bytesReceived, qint64 bytesTotal);
36 void extractDone();
37
38private:
39 void generateInstalledLanguageInfo();
40 void extractLanguage();
41 void slotGenerateInstalledLanguageInfoDone();
42 DownloadLanguageInfo mInfo;
43 QCryptographicHash *mHash = nullptr;
44 QTemporaryFile *mDestination = nullptr;
45};
46Q_DECLARE_TYPEINFO(VoskDownloadLanguageJob::DownloadLanguageInfo, Q_MOVABLE_TYPE);
47LIBVOSKSPEECHTOTEXT_EXPORT QDebug operator<<(QDebug d, const VoskDownloadLanguageJob::DownloadLanguageInfo &t);
Q_SCRIPTABLE Q_NOREPLY void start()
KDB_EXPORT KDbVersionInfo version()
bool isValid(QStringView ifopt)
QString name(StandardAction id)
QDebug operator<<(QDebug dbg, const PerceptualColor::MultiSpinBoxSection &value)
Q_SIGNALSQ_SIGNALS
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:19:49 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.