File indexing completed on 2024-11-24 04:16:56

0001 /*
0002   SPDX-FileCopyrightText: 2022-2024 Laurent Montel <montel@kde.org>
0003 
0004   SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #include "deeplengineconfiguredialog.h"
0008 #include "deeplengineconfigurewidget.h"
0009 #include <KLocalizedString>
0010 #include <QDialogButtonBox>
0011 #include <QVBoxLayout>
0012 
0013 DeeplEngineConfigureDialog::DeeplEngineConfigureDialog(QWidget *parent)
0014     : QDialog(parent)
0015     , mConfigureWidget(new DeeplEngineConfigureWidget(this))
0016 {
0017     setWindowTitle(i18nc("@title:window", "Configure Engine"));
0018     mConfigureWidget->setObjectName(QStringLiteral("mConfigureWidget"));
0019 
0020     auto mainLayout = new QVBoxLayout(this);
0021     mainLayout->setObjectName(QStringLiteral("mainLayout"));
0022     mainLayout->addWidget(mConfigureWidget);
0023 
0024     auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this);
0025     buttonBox->setObjectName(QStringLiteral("buttonBox"));
0026     mainLayout->addWidget(buttonBox);
0027     connect(buttonBox, &QDialogButtonBox::accepted, this, &DeeplEngineConfigureDialog::accept);
0028     connect(buttonBox, &QDialogButtonBox::rejected, this, &DeeplEngineConfigureDialog::reject);
0029 }
0030 
0031 DeeplEngineConfigureDialog::~DeeplEngineConfigureDialog() = default;
0032 
0033 void DeeplEngineConfigureDialog::setUseFreeLicenceKey(bool b)
0034 {
0035     mConfigureWidget->setUseFreeLicenceKey(b);
0036 }
0037 
0038 bool DeeplEngineConfigureDialog::useFreeLicenceKey() const
0039 {
0040     return mConfigureWidget->useFreeLicenceKey();
0041 }
0042 
0043 QString DeeplEngineConfigureDialog::apiKey() const
0044 {
0045     return mConfigureWidget->apiKey();
0046 }
0047 
0048 void DeeplEngineConfigureDialog::setApiKey(const QString &key)
0049 {
0050     mConfigureWidget->setApiKey(key);
0051 }
0052 
0053 #include "moc_deeplengineconfiguredialog.cpp"