KTextAddons

voskspeechtotextinfo.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 "voskspeechtotextinfo.h"
8
9VoskSpeechToTextInfo::VoskSpeechToTextInfo() = default;
10
11VoskSpeechToTextInfo::~VoskSpeechToTextInfo() = default;
12
13bool VoskSpeechToTextInfo::isValid() const
14{
15 return !mIdentifier.isEmpty() && !mUrl.isEmpty() && !mObsolete;
16}
17
18QString VoskSpeechToTextInfo::identifier() const
19{
20 return mIdentifier;
21}
22
23void VoskSpeechToTextInfo::setIdentifier(const QString &newLang)
24{
25 mIdentifier = newLang;
26}
27
28QString VoskSpeechToTextInfo::langText() const
29{
30 return mLangText;
31}
32
33void VoskSpeechToTextInfo::setLangText(const QString &newLangText)
34{
35 mLangText = newLangText;
36}
37
38QString VoskSpeechToTextInfo::md5() const
39{
40 return mMd5;
41}
42
43void VoskSpeechToTextInfo::setMd5(const QString &newMd5)
44{
45 mMd5 = newMd5;
46}
47
48QString VoskSpeechToTextInfo::version() const
49{
50 return mVersion;
51}
52
53void VoskSpeechToTextInfo::setVersion(const QString &newVersion)
54{
55 mVersion = newVersion;
56}
57
58QString VoskSpeechToTextInfo::url() const
59{
60 return mUrl;
61}
62
63void VoskSpeechToTextInfo::setUrl(const QString &newUrl)
64{
65 mUrl = newUrl;
66}
67
68quint64 VoskSpeechToTextInfo::size() const
69{
70 return mSize;
71}
72
73void VoskSpeechToTextInfo::setSize(quint64 newSize)
74{
75 mSize = newSize;
76}
77
78bool VoskSpeechToTextInfo::obsolete() const
79{
80 return mObsolete;
81}
82
83void VoskSpeechToTextInfo::setObsolete(bool newObsolete)
84{
85 mObsolete = newObsolete;
86}
87
88bool VoskSpeechToTextInfo::operator==(const VoskSpeechToTextInfo &other) const
89{
90 return mIdentifier == other.identifier() && mLangText == other.langText() && mMd5 == other.md5() && mVersion == other.version() && mUrl == other.url()
91 && mSize == other.size() && mObsolete == other.obsolete() && mType == other.type() && mName == other.name();
92}
93
94void VoskSpeechToTextInfo::parse(const QJsonObject &obj)
95{
96 mLangText = obj[QLatin1String("lang_text")].toString();
97 mIdentifier = obj[QLatin1String("lang")].toString();
98 mMd5 = obj[QLatin1String("md5")].toString();
99 mObsolete = obj[QLatin1String("obsolete")].toBool();
100 mVersion = obj[QLatin1String("version")].toString();
101 mSize = obj[QLatin1String("size")].toInteger();
102 mUrl = obj[QLatin1String("url")].toString();
103 mType = obj[QLatin1String("type")].toString();
104 mName = obj[QLatin1String("name")].toString();
105}
106
107QString VoskSpeechToTextInfo::type() const
108{
109 return mType;
110}
111
112void VoskSpeechToTextInfo::setType(const QString &newType)
113{
114 mType = newType;
115}
116
117QString VoskSpeechToTextInfo::name() const
118{
119 return mName;
120}
121
122void VoskSpeechToTextInfo::setName(const QString &newName)
123{
124 mName = newName;
125}
126
127QDebug operator<<(QDebug d, const VoskSpeechToTextInfo &t)
128{
129 d << "mLang : " << t.identifier();
130 d << "mLangText : " << t.langText();
131 d << "mMd5 : " << t.md5();
132 d << "mVersion : " << t.version();
133 d << "mUrl : " << t.url();
134 d << "mSize : " << t.size();
135 d << "mObsolete : " << t.obsolete();
136 d << "mType : " << t.type();
137 d << "mName : " << t.name();
138 return d;
139}
KTEXTEDITOR_EXPORT QDebug operator<<(QDebug s, const MovingCursor &cursor)
bool isEmpty() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:49:44 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.