File indexing completed on 2024-05-26 16:09:09

0001 /*
0002    SPDX-FileCopyrightText: 2022-2024 Laurent Montel <montel@kde.org>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "libruqolacore_export.h"
0010 #include <QObject>
0011 #include <texttranslator_version.h>
0012 namespace TextTranslator
0013 {
0014 class TranslatorEnginePlugin;
0015 }
0016 class LIBRUQOLACORE_EXPORT TranslatorEngineManager : public QObject
0017 {
0018     Q_OBJECT
0019 public:
0020     explicit TranslatorEngineManager(QObject *parent = nullptr);
0021     ~TranslatorEngineManager() override;
0022     static TranslatorEngineManager *self();
0023 
0024     void translatorConfigChanged();
0025 
0026     [[nodiscard]] TextTranslator::TranslatorEnginePlugin *translatorEngineBase() const;
0027 
0028 Q_SIGNALS:
0029     void updateTranslateEngine();
0030     void translateDone(const QString &translatedText);
0031     void translateFailed(const QString &errorMessage = QString());
0032 
0033 private:
0034     LIBRUQOLACORE_NO_EXPORT void initializeTranslateEngine();
0035     LIBRUQOLACORE_NO_EXPORT void slotTranslateDone();
0036     TextTranslator::TranslatorEnginePlugin *mTranslatorEnginePlugin = nullptr;
0037 };