KTextAddons

generateinstalledlanguageinfojob.cpp
1/*
2 SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "generateinstalledlanguageinfojob.h"
8#include "libvoskspeechtotext_debug.h"
9#include <KLocalizedString>
10
11GenerateInstalledLanguageInfoJob::GenerateInstalledLanguageInfoJob(QObject *parent)
12 : QObject{parent}
13{
14}
15
16GenerateInstalledLanguageInfoJob::~GenerateInstalledLanguageInfoJob() = default;
17
18void GenerateInstalledLanguageInfoJob::start()
19{
20 if (canStart()) {
21 if (!VoskEngineUtils::createInstalledLanguageInfo(mInfo.pathToStore, mInfo.info)) {
22 qCWarning(LIBVOSKSPEECHTOTEXT_LOG) << " Impossible to store installed language info " << mInfo;
23 Q_EMIT errorText(i18n("Impossible to store language info."));
24 }
25 }
26 Q_EMIT generatedDone();
28}
29
30bool GenerateInstalledLanguageInfoJob::canStart() const
31{
32 return mInfo.isValid();
33}
34
35GenerateInstalledLanguageInfoJob::LanguageInfo GenerateInstalledLanguageInfoJob::info() const
36{
37 return mInfo;
38}
39
40void GenerateInstalledLanguageInfoJob::setInfo(const GenerateInstalledLanguageInfoJob::LanguageInfo &newInfo)
41{
42 mInfo = newInfo;
43}
44
45bool GenerateInstalledLanguageInfoJob::LanguageInfo::isValid() const
46{
47 return !pathToStore.isEmpty() && info.isValid();
48}
49
50QDebug operator<<(QDebug d, const GenerateInstalledLanguageInfoJob::LanguageInfo &t)
51{
52 d << "info " << t.info;
53 d << "pathToStore " << t.pathToStore;
54 return d;
55}
56
57#include "moc_generateinstalledlanguageinfojob.cpp"
QString i18n(const char *text, const TYPE &arg...)
KCALENDARCORE_EXPORT QDataStream & operator<<(QDataStream &out, const KCalendarCore::Alarm::Ptr &)
Q_EMITQ_EMIT
void deleteLater()
bool isEmpty() const const
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.