QTfrontend/ui/dialog/input_password.cpp
branchwebgl
changeset 8330 aaefa587e277
parent 8181 70e980278080
child 8444 75db7bb8dce8
equal deleted inserted replaced
8116:d24257910f8d 8330:aaefa587e277
    23 #include <QCheckBox>
    23 #include <QCheckBox>
    24 #include <QLabel>
    24 #include <QLabel>
    25 
    25 
    26 #include "input_password.h"
    26 #include "input_password.h"
    27 
    27 
    28 HWPasswordDialog::HWPasswordDialog(QWidget* parent, const QString & label) : QDialog(parent)
    28 HWPasswordDialog::HWPasswordDialog(QWidget* parent) : QDialog(parent)
    29 {
    29 {
    30     setWindowTitle(tr("Password"));
    30     setWindowTitle(tr("Login"));
       
    31 
       
    32     QString titleLabelText = "To connect to the server, please log in.\n\nIf you don't have an account on www.hedgewars.org,\njust enter your nickname.";
       
    33     QString nickLabelText = "Nickname:";
       
    34     QString passLabelText = "Password:";
    31 
    35 
    32     QGridLayout * layout = new QGridLayout(this);
    36     QGridLayout * layout = new QGridLayout(this);
    33 
    37 
    34     QLabel * lbLabel = new QLabel(this);
    38     QLabel * titleLabel = new QLabel(this);
    35     lbLabel->setText(label);
    39     titleLabel->setText(titleLabelText);
    36     layout->addWidget(lbLabel, 0, 0);
    40     layout->addWidget(titleLabel, 0, 0);
       
    41 
       
    42     QLabel * nickLabel = new QLabel(this);
       
    43     nickLabel->setText(nickLabelText);
       
    44     layout->addWidget(nickLabel, 1, 0);
       
    45 
       
    46     leNickname = new QLineEdit(this);
       
    47     leNickname->setEchoMode(QLineEdit::Normal);
       
    48     layout->addWidget(leNickname, 2, 0);
       
    49 
       
    50     QLabel * passLabel = new QLabel(this);
       
    51     passLabel->setText(passLabelText);
       
    52     layout->addWidget(passLabel, 3, 0);
    37 
    53 
    38     lePassword = new QLineEdit(this);
    54     lePassword = new QLineEdit(this);
    39     lePassword->setEchoMode(QLineEdit::Password);
    55     lePassword->setEchoMode(QLineEdit::Password);
    40     layout->addWidget(lePassword, 1, 0);
    56     layout->addWidget(lePassword, 4, 0);
    41 
    57 
    42     cbSave = new QCheckBox(this);
    58     cbSave = new QCheckBox(this);
    43     cbSave->setText(QCheckBox::tr("Save password"));
    59     cbSave->setText(QCheckBox::tr("Save password"));
    44     layout->addWidget(cbSave, 2, 0);
    60     layout->addWidget(cbSave, 5, 0);
    45 
    61 
    46     QDialogButtonBox* dbbButtons = new QDialogButtonBox(this);
    62     QDialogButtonBox* dbbButtons = new QDialogButtonBox(this);
    47     QPushButton * pbOK = dbbButtons->addButton(QDialogButtonBox::Ok);
    63     QPushButton * pbOK = dbbButtons->addButton(QDialogButtonBox::Ok);
    48     QPushButton * pbCancel = dbbButtons->addButton(QDialogButtonBox::Cancel);
    64     QPushButton * pbCancel = dbbButtons->addButton(QDialogButtonBox::Cancel);
    49     layout->addWidget(dbbButtons, 3, 0);
    65     layout->addWidget(dbbButtons, 6, 0);
    50 
    66 
    51     connect(pbOK, SIGNAL(clicked()), this, SLOT(accept()));
    67     connect(pbOK, SIGNAL(clicked()), this, SLOT(accept()));
    52     connect(pbCancel, SIGNAL(clicked()), this, SLOT(reject()));
    68     connect(pbCancel, SIGNAL(clicked()), this, SLOT(reject()));
    53 
    69 
    54     this->setWindowModality(Qt::WindowModal);
    70     this->setWindowModality(Qt::WindowModal);