File indexing completed on 2024-11-24 04:16:55
0001 /* 0002 SPDX-FileCopyrightText: 2023-2024 Laurent Montel <montel.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 #pragma once 0007 #include "libbergamot_private_export.h" 0008 #include <QJsonObject> 0009 0010 class LIBBERGAMOT_TESTS_EXPORT Translator 0011 { 0012 public: 0013 Translator(); 0014 ~Translator(); 0015 0016 void parse(const QJsonObject &obj, bool remote = true); 0017 0018 [[nodiscard]] QString shortName() const; 0019 void setShortName(const QString &newShortName); 0020 0021 [[nodiscard]] QString modelName() const; 0022 void setModelName(const QString &newModelName); 0023 0024 [[nodiscard]] QString source() const; 0025 void setSource(const QString &newSource); 0026 0027 [[nodiscard]] QString checkSum() const; 0028 void setCheckSum(const QString &newCheckSum); 0029 0030 [[nodiscard]] QString target() const; 0031 void setTarget(const QString &newTarget); 0032 0033 [[nodiscard]] int version() const; 0034 void setVersion(int newVersion); 0035 0036 [[nodiscard]] int api() const; 0037 void setApi(int newApi); 0038 0039 [[nodiscard]] QString url() const; 0040 void setUrl(const QString &newUrl); 0041 0042 [[nodiscard]] QString repository() const; 0043 void setRepository(const QString &newRepository); 0044 0045 [[nodiscard]] QString type() const; 0046 void setType(const QString &newType); 0047 0048 [[nodiscard]] bool isValid() const; 0049 0050 [[nodiscard]] bool operator==(const Translator &other) const; 0051 0052 [[nodiscard]] bool remote() const; 0053 void setRemote(bool newRemote); 0054 0055 private: 0056 QString mShortName; 0057 QString mModelName; 0058 QString mSource; 0059 QString mTarget; 0060 QString mCheckSum; 0061 QString mRepository; 0062 QString mUrl; 0063 QString mType; 0064 int mVersion = -1; 0065 int mApi = -1; 0066 bool mRemote = true; 0067 }; 0068 LIBBERGAMOT_EXPORT QDebug operator<<(QDebug d, const Translator &t); 0069 Q_DECLARE_METATYPE(Translator) 0070 Q_DECLARE_TYPEINFO(Translator, Q_MOVABLE_TYPE);