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

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/TranslatorEngineClient>
0010 namespace QKeychain
0011 {
0012 class Job;
0013 }
0014 class LibreTranslateEngineClient : public TextTranslator::TranslatorEngineClient
0015 {
0016     Q_OBJECT
0017     Q_PLUGIN_METADATA(IID "org.kde.Translator.libretranslate")
0018     Q_INTERFACES(TextTranslator::TranslatorEngineClient)
0019 public:
0020     explicit LibreTranslateEngineClient(QObject *parent = nullptr);
0021     ~LibreTranslateEngineClient() override;
0022 
0023     [[nodiscard]] QString name() const override;
0024     [[nodiscard]] QString translatedName() const override;
0025     [[nodiscard]] TextTranslator::TranslatorEnginePlugin *createTranslator() override;
0026     [[nodiscard]] QMap<TextTranslator::TranslatorUtil::Language, QString> supportedFromLanguages() override;
0027     [[nodiscard]] QMap<TextTranslator::TranslatorUtil::Language, QString> supportedToLanguages() override;
0028 
0029     [[nodiscard]] bool hasConfigurationDialog() const override;
0030     [[nodiscard]] bool showConfigureDialog(QWidget *parentWidget) override;
0031     [[nodiscard]] TextTranslator::TranslatorEngineClient::EngineType engineType() const override;
0032 
0033 protected:
0034     [[nodiscard]] bool isSupported(TextTranslator::TranslatorUtil::Language lang) const override;
0035 
0036 private:
0037     void slotPasswordWritten(QKeychain::Job *baseJob);
0038 };