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