KTextAddons

deeplengineconfigurewidget.cpp
1/*
2 SPDX-FileCopyrightText: 2022-2024 Laurent Montel <montel@kde.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "deeplengineconfigurewidget.h"
8
9#include <KLineEditEventHandler>
10
11#include <KLocalizedString>
12#include <QCheckBox>
13#include <QFormLayout>
14#include <QLineEdit>
15
16DeeplEngineConfigureWidget::DeeplEngineConfigureWidget(QWidget *parent)
17 : QWidget{parent}
18 , mUseFreeLicense(new QCheckBox(i18nc("@option:check", "Use Free License Key"), this))
19 , mApiKey(new QLineEdit(this))
20{
21 auto mainLayout = new QFormLayout(this);
22 mainLayout->setObjectName(QStringLiteral("mainLayout"));
23 mainLayout->setContentsMargins({});
25 mUseFreeLicense->setObjectName(QStringLiteral("mUseFreeLicense"));
26 mainLayout->addWidget(mUseFreeLicense);
27
28 mApiKey->setObjectName(QStringLiteral("mApiKey"));
29 mApiKey->setClearButtonEnabled(true);
30 mainLayout->addRow(i18n("Api Key:"), mApiKey);
31}
32
33DeeplEngineConfigureWidget::~DeeplEngineConfigureWidget() = default;
34
35void DeeplEngineConfigureWidget::setUseFreeLicenceKey(bool b)
36{
37 mUseFreeLicense->setChecked(b);
38}
39
40bool DeeplEngineConfigureWidget::useFreeLicenceKey() const
41{
42 return mUseFreeLicense->isChecked();
43}
44
45QString DeeplEngineConfigureWidget::apiKey() const
46{
47 return mApiKey->text();
48}
49
50void DeeplEngineConfigureWidget::setApiKey(const QString &key)
51{
52 mApiKey->setText(key);
53}
54
55#include "moc_deeplengineconfigurewidget.cpp"
QString i18nc(const char *context, const char *text, const TYPE &arg...)
QString i18n(const char *text, const TYPE &arg...)
void catchReturnKey(QObject *lineEdit)
void setChecked(bool)
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.