KTextAddons

translatorwidget.h
1/*
2
3 SPDX-FileCopyrightText: 2012-2024 Laurent Montel <montel@kde.org>
4
5 SPDX-License-Identifier: GPL-2.0-or-later
6*/
7
8#pragma once
9
10#include "texttranslator_export.h"
11#include <QPlainTextEdit>
12namespace TextTranslator
13{
14/**
15 * @brief The TranslatorTextEdit class
16 * @author Laurent Montel <montel@kde.org>
17 */
18class TEXTTRANSLATOR_EXPORT TranslatorTextEdit : public QPlainTextEdit
19{
20 Q_OBJECT
21public:
22 explicit TranslatorTextEdit(QWidget *parent = nullptr);
23
24Q_SIGNALS:
25 void translateText();
26
27protected:
28 void dropEvent(QDropEvent *) override;
29};
30
31/**
32 * @brief The TranslatorWidget class
33 * @author Laurent Montel <montel@kde.org>
34 */
35class TEXTTRANSLATOR_EXPORT TranslatorWidget : public QWidget
36{
37 Q_OBJECT
38public:
39 explicit TranslatorWidget(QWidget *parent = nullptr);
40 explicit TranslatorWidget(const QString &text, QWidget *parent = nullptr);
41 ~TranslatorWidget() override;
42
43 void setTextToTranslate(const QString &);
44 void writeConfig();
45 void readConfig();
46 void setStandalone(bool b);
47
48public Q_SLOTS:
49 void slotTranslate();
50 void slotCloseWidget();
51
52private:
53 TEXTTRANSLATOR_NO_EXPORT void slotFromLanguageChanged(int, bool initialize = false);
54 TEXTTRANSLATOR_NO_EXPORT void slotTextChanged();
55 TEXTTRANSLATOR_NO_EXPORT void slotInvertLanguage();
56 TEXTTRANSLATOR_NO_EXPORT void slotClear();
57 TEXTTRANSLATOR_NO_EXPORT void slotTranslateDone();
58 TEXTTRANSLATOR_NO_EXPORT void slotTranslateFailed(const QString &message);
59 TEXTTRANSLATOR_NO_EXPORT void slotDebug();
60 TEXTTRANSLATOR_NO_EXPORT void slotConfigChanged();
61
62protected:
63 bool event(QEvent *e) override;
64
65Q_SIGNALS:
66 void toolsWasClosed();
67
68private:
69 TEXTTRANSLATOR_NO_EXPORT void init();
70 TEXTTRANSLATOR_NO_EXPORT void initLanguage();
71 TEXTTRANSLATOR_NO_EXPORT void switchEngine();
72 TEXTTRANSLATOR_NO_EXPORT void loadEngineSettings();
73 TEXTTRANSLATOR_NO_EXPORT void updatePlaceHolder();
74 class TranslatorWidgetPrivate;
75 std::unique_ptr<TranslatorWidgetPrivate> const d;
76};
77}
The TranslatorTextEdit class.
The TranslatorWidget class.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:29:59 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.