diff options
Diffstat (limited to 'src/plugins/mercurial/authenticationdialog.cpp')
-rw-r--r-- | src/plugins/mercurial/authenticationdialog.cpp | 52 |
1 files changed, 34 insertions, 18 deletions
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 <utils/layoutbuilder.h> -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 <QDialogButtonBox> +#include <QLineEdit> + +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 |