7#include "libretranslateengineconfigurewidget.h"
8#include <KLineEditEventHandler>
9#include <KLocalizedString>
15LibreTranslateEngineConfigureWidget::LibreTranslateEngineConfigureWidget(
QWidget *parent)
19 , mRequiredApiKey(new
QCheckBox(
i18nc(
"@option:check",
"Server required Api Key"), this))
22 mainLayout->setContentsMargins({});
23 mainLayout->setObjectName(QStringLiteral(
"mainLayout"));
25 mServerUrl->setObjectName(QStringLiteral(
"mServerUrl"));
26 mServerUrl->setClearButtonEnabled(
true);
27 mainLayout->addRow(
i18n(
"Server Url:"), mServerUrl);
29 mRequiredApiKey->setObjectName(QStringLiteral(
"mRequiredApiKey"));
30 mainLayout->addWidget(mRequiredApiKey);
32 mApiKey->setObjectName(QStringLiteral(
"mApiKey"));
33 mApiKey->setClearButtonEnabled(
true);
34 mainLayout->addRow(
i18n(
"Api Key:"), mApiKey);
38 QStringLiteral(
"https://libretranslate.com"),
39 QStringLiteral(
"https://libretranslate.de"),
40 QStringLiteral(
"https://translate.argosopentech.com"),
41 QStringLiteral(
"https://translate.api.skitzen.com"),
42 QStringLiteral(
"https://translate.fortytwo-it.com"),
43 QStringLiteral(
"https://translate.terraprint.co"),
44 QStringLiteral(
"https://lt.vern.cc"),
50 auto completer =
new QCompleter(listServer,
this);
52 mServerUrl->setCompleter(completer);
55LibreTranslateEngineConfigureWidget::~LibreTranslateEngineConfigureWidget() =
default;
57void LibreTranslateEngineConfigureWidget::updateApiKeyState(
bool state)
62QString LibreTranslateEngineConfigureWidget::serverUrl()
const
64 return mServerUrl->
text();
67void LibreTranslateEngineConfigureWidget::setServerUrl(
const QString &serverUrl)
72QString LibreTranslateEngineConfigureWidget::apiKey()
const
74 return mApiKey->
text();
77void LibreTranslateEngineConfigureWidget::setApiKey(
const QString &key)
82bool LibreTranslateEngineConfigureWidget::serverRequiredApiKey()
const
87void LibreTranslateEngineConfigureWidget::setServerRequiredApiKey(
bool state)
90 updateApiKeyState(state);
93#include "moc_libretranslateengineconfigurewidget.cpp"
QString i18nc(const char *context, const char *text, const TYPE &arg...)
QString i18n(const char *text, const TYPE &arg...)
void catchReturnKey(QObject *lineEdit)
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)