Mercurial: Inline authenticationdialog.ui

Change-Id: I235c8aaf7d2dd8e49e8a22b81523a322b5f596bc
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
hjk
2022-10-04 10:10:58 +02:00
parent 8d80623a0f
commit 1f5eb9e62f
5 changed files with 43 additions and 118 deletions

View File

@@ -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)
#include <QDialogButtonBox>
#include <QLineEdit>
namespace Mercurial::Internal {
AuthenticationDialog::AuthenticationDialog(const QString &username, const QString &password, QWidget *parent)
: QDialog(parent)
{
ui->setupUi(this);
ui->username->setText(username);
ui->password->setText(password);
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()
{
delete ui;
}
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