File indexing completed on 2024-11-24 04:16:57
0001 /* 0002 SPDX-FileCopyrightText: 2022-2024 Laurent Montel <montel@kde.org> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #pragma once 0008 0009 #include <TextTranslator/TranslatorEnginePlugin> 0010 0011 class YandexEnginePlugin : public TextTranslator::TranslatorEnginePlugin 0012 { 0013 Q_OBJECT 0014 public: 0015 explicit YandexEnginePlugin(QObject *parent = nullptr); 0016 ~YandexEnginePlugin() override; 0017 0018 void translate() override; 0019 0020 [[nodiscard]] QString languageCode(const QString &langStr) override; 0021 0022 private: 0023 void parseCredentials(QNetworkReply *reply); 0024 void translateText(); 0025 void parseTranslation(QNetworkReply *reply); 0026 static QString sYandexKey; 0027 QString mResult; 0028 };