File indexing completed on 2024-11-24 04:16:55

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 BingEnginePlugin : public TextTranslator::TranslatorEnginePlugin
0012 {
0013     Q_OBJECT
0014 public:
0015     explicit BingEnginePlugin(QObject *parent = nullptr);
0016     ~BingEnginePlugin() 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 QByteArray sBingKey;
0027     static QByteArray sBingToken;
0028     static QString sBingIg;
0029     static QString sBingIid;
0030 };