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 0007 #include "voskspeechtotextinfo.h" 0008 0009 VoskSpeechToTextInfo::VoskSpeechToTextInfo() = default; 0010 0011 VoskSpeechToTextInfo::~VoskSpeechToTextInfo() = default; 0012 0013 bool VoskSpeechToTextInfo::isValid() const 0014 { 0015 return !mIdentifier.isEmpty() && !mUrl.isEmpty() && !mObsolete; 0016 } 0017 0018 QString VoskSpeechToTextInfo::identifier() const 0019 { 0020 return mIdentifier; 0021 } 0022 0023 void VoskSpeechToTextInfo::setIdentifier(const QString &newLang) 0024 { 0025 mIdentifier = newLang; 0026 } 0027 0028 QString VoskSpeechToTextInfo::langText() const 0029 { 0030 return mLangText; 0031 } 0032 0033 void VoskSpeechToTextInfo::setLangText(const QString &newLangText) 0034 { 0035 mLangText = newLangText; 0036 } 0037 0038 QString VoskSpeechToTextInfo::md5() const 0039 { 0040 return mMd5; 0041 } 0042 0043 void VoskSpeechToTextInfo::setMd5(const QString &newMd5) 0044 { 0045 mMd5 = newMd5; 0046 } 0047 0048 QString VoskSpeechToTextInfo::version() const 0049 { 0050 return mVersion; 0051 } 0052 0053 void VoskSpeechToTextInfo::setVersion(const QString &newVersion) 0054 { 0055 mVersion = newVersion; 0056 } 0057 0058 QString VoskSpeechToTextInfo::url() const 0059 { 0060 return mUrl; 0061 } 0062 0063 void VoskSpeechToTextInfo::setUrl(const QString &newUrl) 0064 { 0065 mUrl = newUrl; 0066 } 0067 0068 quint64 VoskSpeechToTextInfo::size() const 0069 { 0070 return mSize; 0071 } 0072 0073 void VoskSpeechToTextInfo::setSize(quint64 newSize) 0074 { 0075 mSize = newSize; 0076 } 0077 0078 bool VoskSpeechToTextInfo::obsolete() const 0079 { 0080 return mObsolete; 0081 } 0082 0083 void VoskSpeechToTextInfo::setObsolete(bool newObsolete) 0084 { 0085 mObsolete = newObsolete; 0086 } 0087 0088 bool VoskSpeechToTextInfo::operator==(const VoskSpeechToTextInfo &other) const 0089 { 0090 return mIdentifier == other.identifier() && mLangText == other.langText() && mMd5 == other.md5() && mVersion == other.version() && mUrl == other.url() 0091 && mSize == other.size() && mObsolete == other.obsolete() && mType == other.type() && mName == other.name(); 0092 } 0093 0094 void VoskSpeechToTextInfo::parse(const QJsonObject &obj) 0095 { 0096 mLangText = obj[QLatin1String("lang_text")].toString(); 0097 mIdentifier = obj[QLatin1String("lang")].toString(); 0098 mMd5 = obj[QLatin1String("md5")].toString(); 0099 mObsolete = obj[QLatin1String("obsolete")].toBool(); 0100 mVersion = obj[QLatin1String("version")].toString(); 0101 mSize = obj[QLatin1String("size")].toInteger(); 0102 mUrl = obj[QLatin1String("url")].toString(); 0103 mType = obj[QLatin1String("type")].toString(); 0104 mName = obj[QLatin1String("name")].toString(); 0105 } 0106 0107 QString VoskSpeechToTextInfo::type() const 0108 { 0109 return mType; 0110 } 0111 0112 void VoskSpeechToTextInfo::setType(const QString &newType) 0113 { 0114 mType = newType; 0115 } 0116 0117 QString VoskSpeechToTextInfo::name() const 0118 { 0119 return mName; 0120 } 0121 0122 void VoskSpeechToTextInfo::setName(const QString &newName) 0123 { 0124 mName = newName; 0125 } 0126 0127 QDebug operator<<(QDebug d, const VoskSpeechToTextInfo &t) 0128 { 0129 d << "mLang : " << t.identifier(); 0130 d << "mLangText : " << t.langText(); 0131 d << "mMd5 : " << t.md5(); 0132 d << "mVersion : " << t.version(); 0133 d << "mUrl : " << t.url(); 0134 d << "mSize : " << t.size(); 0135 d << "mObsolete : " << t.obsolete(); 0136 d << "mType : " << t.type(); 0137 d << "mName : " << t.name(); 0138 return d; 0139 }