Files
qt-creator/src/plugins/mercurial/authenticationdialog.cpp
hjk 8cf500c5bc Utils: Make Layouting a top level namespace
The whole machinery is now almost only layoutbuilder.{h,cpp},
mostly independent of the rest of Utils. Idea is to finish the
separation to make it stand-alone usable also outside creator.

Change-Id: I958aa667d17ae26b21209f22412309c5307a579c
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-04-25 13:31:25 +00:00

59 lines
1.4 KiB
C++

// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "authenticationdialog.h"
#include "mercurialtr.h"
#include <utils/layoutbuilder.h>
#include <QDialogButtonBox>
#include <QLineEdit>
namespace Mercurial::Internal {
AuthenticationDialog::AuthenticationDialog(const QString &username, const QString &password, QWidget *parent)
: QDialog(parent)
{
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 Layouting;
Column {
Form {
Tr::tr("Username:"), m_username, br,
Tr::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)
{
m_password->setEnabled(enabled);
}
QString AuthenticationDialog::getUserName()
{
return m_username->text();
}
QString AuthenticationDialog::getPassword()
{
return m_password->text();
}
} // Mercurial::Internal