File indexing completed on 2024-06-23 04:40:32
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 "lingvaenginewidget.h" 0008 #include <KLocalizedString> 0009 #include <QFormLayout> 0010 #include <QLineEdit> 0011 #if QT_VERSION < QT_VERSION_CHECK(6, 4, 0) 0012 #include <TextAddonsWidgets/LineEditCatchReturnKey> 0013 #else 0014 #include <KLineEditEventHandler> 0015 #endif 0016 0017 LingvaEngineWidget::LingvaEngineWidget(QWidget *parent) 0018 : QWidget{parent} 0019 , mServerUrl(new QLineEdit(this)) 0020 { 0021 auto mainLayout = new QFormLayout(this); 0022 mainLayout->setObjectName(QStringLiteral("mainLayout")); 0023 mainLayout->setContentsMargins({}); 0024 0025 mServerUrl->setObjectName(QStringLiteral("mServerUrl")); 0026 mServerUrl->setClearButtonEnabled(true); 0027 mainLayout->addRow(i18n("Server Url:"), mServerUrl); 0028 #if QT_VERSION < QT_VERSION_CHECK(6, 4, 0) 0029 new TextAddonsWidgets::LineEditCatchReturnKey(mServerUrl, this); 0030 #else 0031 KLineEditEventHandler::catchReturnKey(mServerUrl); 0032 #endif 0033 } 0034 0035 LingvaEngineWidget::~LingvaEngineWidget() = default; 0036 0037 QString LingvaEngineWidget::serverUrl() const 0038 { 0039 return mServerUrl->text(); 0040 } 0041 0042 void LingvaEngineWidget::setServerUrl(const QString &serverUrl) 0043 { 0044 mServerUrl->setText(serverUrl); 0045 } 0046 0047 #include "moc_lingvaenginewidget.cpp"