From 1f5eb9e62fb79f0fd79480461074b34091ac867d Mon Sep 17 00:00:00 2001 From: hjk Date: Tue, 4 Oct 2022 10:10:58 +0200 Subject: Mercurial: Inline authenticationdialog.ui Change-Id: I235c8aaf7d2dd8e49e8a22b81523a322b5f596bc Reviewed-by: Alessandro Portale --- src/plugins/mercurial/authenticationdialog.cpp | 52 +++++++++++++++++--------- 1 file changed, 34 insertions(+), 18 deletions(-) (limited to 'src/plugins/mercurial/authenticationdialog.cpp') diff --git a/src/plugins/mercurial/authenticationdialog.cpp b/src/plugins/mercurial/authenticationdialog.cpp index e79e3d1a84..c04fb34d65 100644 --- a/src/plugins/mercurial/authenticationdialog.cpp +++ b/src/plugins/mercurial/authenticationdialog.cpp @@ -2,39 +2,55 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0 #include "authenticationdialog.h" -#include "ui_authenticationdialog.h" -namespace Mercurial { -namespace Internal { +#include -AuthenticationDialog::AuthenticationDialog(const QString &username, const QString &password, QWidget *parent) : - QDialog(parent), - ui(new Ui::AuthenticationDialog) -{ - ui->setupUi(this); - ui->username->setText(username); - ui->password->setText(password); -} +#include +#include + +namespace Mercurial::Internal { -AuthenticationDialog::~AuthenticationDialog() +AuthenticationDialog::AuthenticationDialog(const QString &username, const QString &password, QWidget *parent) + : QDialog(parent) { - delete ui; + resize(312, 116); + + m_username = new QLineEdit(username); + + m_password = new QLineEdit(password); + m_password->setEchoMode(QLineEdit::Password); + + auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel|QDialogButtonBox::Ok); + + using namespace Utils::Layouting; + + Column { + Form { + tr("Username:"), m_username, br, + tr("Password:"), m_password + }, + buttonBox + }.attachTo(this); + + connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept); + connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject); } +AuthenticationDialog::~AuthenticationDialog() = default; + void AuthenticationDialog::setPasswordEnabled(bool enabled) { - ui->password->setEnabled(enabled); + m_password->setEnabled(enabled); } QString AuthenticationDialog::getUserName() { - return ui->username->text(); + return m_username->text(); } QString AuthenticationDialog::getPassword() { - return ui->password->text(); + return m_password->text(); } -} // namespace Internal -} // namespace Mercurial +} // Mercurial::Internal -- cgit v1.2.1