KTextAddons

translatorengineclient.h
1/*
2 SPDX-FileCopyrightText: 2022-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include <QObject>
10
11#include "texttranslator_export.h"
12#include <QMap>
13#include <TextTranslator/TranslatorUtil>
14namespace TextTranslator
15{
16class TranslatorEnginePlugin;
17class TEXTTRANSLATOR_EXPORT TranslatorEngineClient : public QObject
18{
19 Q_OBJECT
20public:
21 enum EngineType {
22 Locale,
23 Network,
24 };
25 explicit TranslatorEngineClient(QObject *parent = nullptr);
26 ~TranslatorEngineClient() override;
27
28 /**
29 * @returns the name of the implementing class.
30 */
31 virtual QString name() const = 0;
32
33 virtual QString translatedName() const = 0;
34
35 virtual TranslatorEnginePlugin *createTranslator() = 0;
36
37 [[nodiscard]] virtual QMap<TranslatorUtil::Language, QString> supportedFromLanguages() = 0;
38 [[nodiscard]] virtual QMap<TranslatorUtil::Language, QString> supportedToLanguages() = 0;
39 virtual void updateListLanguages();
40
41 [[nodiscard]] virtual bool hasConfigurationDialog() const;
42
43 virtual bool showConfigureDialog(QWidget *parentWidget);
44 virtual void generateToListFromCurrentToLanguage(const QString &languageCode);
45
46 [[nodiscard]] virtual bool hasInvertSupport() const;
47
48 [[nodiscard]] virtual TextTranslator::TranslatorEngineClient::EngineType engineType() const = 0;
49
50 [[nodiscard]] static QString convertEngineType(TextTranslator::TranslatorEngineClient::EngineType type);
51
52Q_SIGNALS:
53 void configureChanged();
54
55protected:
57 [[nodiscard]] virtual bool isSupported(TextTranslator::TranslatorUtil::Language lang) const = 0;
59};
60}
61Q_DECLARE_INTERFACE(TextTranslator::TranslatorEngineClient, "org.kde.translator.Client")
QString name(StandardAction id)
QCA_EXPORT bool isSupported(const char *features, const QString &provider=QString())
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:49:44 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.