QTfrontend/ui/dialog/input_password.cpp
changeset 6910 ea058558c68b
child 6952 7f70f37bbf08
equal deleted inserted replaced
6909:2b9c1228d516 6910:ea058558c68b
       
     1 /*
       
     2  * Hedgewars, a free turn based strategy game
       
     3  * Copyright (c) 2007-2012 Andrey Korotaev <unC0Rr@gmail.com>
       
     4  *
       
     5  * This program is free software; you can redistribute it and/or modify
       
     6  * it under the terms of the GNU General Public License as published by
       
     7  * the Free Software Foundation; version 2 of the License
       
     8  *
       
     9  * This program is distributed in the hope that it will be useful,
       
    10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
       
    11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       
    12  * GNU General Public License for more details.
       
    13  *
       
    14  * You should have received a copy of the GNU General Public License
       
    15  * along with this program; if not, write to the Free Software
       
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
       
    17  */
       
    18 
       
    19 #include <QLineEdit>
       
    20 #include <QDialogButtonBox>
       
    21 #include <QPushButton>
       
    22 #include <QGridLayout>
       
    23 #include <QCheckBox>
       
    24 #include <QLabel>
       
    25 
       
    26 #include "input_password.h"
       
    27 
       
    28 HWPasswordDialog::HWPasswordDialog(QWidget* parent, const QString & label) : QDialog(parent)
       
    29 {
       
    30     setWindowTitle(tr("Password"));
       
    31 
       
    32     QGridLayout * layout = new QGridLayout(this);
       
    33 
       
    34     QLabel * lbLabel = new QLabel(this);
       
    35     lbLabel->setText(label);
       
    36     layout->addWidget(lbLabel, 0, 0);
       
    37 
       
    38     lePassword = new QLineEdit(this);
       
    39     lePassword->setEchoMode(QLineEdit::Password);
       
    40     layout->addWidget(lePassword, 1, 0);
       
    41 
       
    42     cbSave = new QCheckBox(this);
       
    43     cbSave->setText(QCheckBox::tr("Save password"));
       
    44     layout->addWidget(cbSave, 2, 0);
       
    45 
       
    46     QDialogButtonBox* dbbButtons = new QDialogButtonBox(this);
       
    47     QPushButton * pbOK = dbbButtons->addButton(QDialogButtonBox::Ok);
       
    48     QPushButton * pbCancel = dbbButtons->addButton(QDialogButtonBox::Cancel);
       
    49     layout->addWidget(dbbButtons, 3, 0);
       
    50 
       
    51     connect(pbOK, SIGNAL(clicked()), this, SLOT(accept()));
       
    52     connect(pbCancel, SIGNAL(clicked()), this, SLOT(reject()));
       
    53 }