QTfrontend/ui/dialog/input_password.cpp
author sheepluva
Mon, 05 Aug 2019 00:20:45 +0200
changeset 15295 f382ec6dba11
parent 11046 47a8c19ecb60
permissions -rw-r--r--
In hindsight my emscripten-ifdef (70d416a8f63f) is nonsense. As fpcrtl_glShaderSource() would not be defined and lead to compiling issues. So either it's 3 ifdefs (in pas2cRedo, pas2cSystem and misc.c), in order to toggle between fpcrtl_ and the native function, or alternatively have no ifdef for it at all. I'm going with none at all, which means emscripten will compile with the original (const) function prototype, being wrapped by the fpcrtl_ function, same as non-emscripten builds.
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
11046
47a8c19ecb60 more copyright fixes
sheepluva
parents: 10537
diff changeset
     3
 * Copyright (c) 2004-2015 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
10108
c68cf030eded update FSF address. note: two sdl include files (by Sam Lantinga) still have the old FSF address in their copyright - but I ain't gonna touch their copyright headers
sheepluva
parents: 10015
diff changeset
    16
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
6910
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
8181
70e980278080 GCI2012: User/Pass Single Prompt
Ondrej
parents: 7795
diff changeset
    28
HWPasswordDialog::HWPasswordDialog(QWidget* parent) : QDialog(parent)
6910
ea058558c68b add a checkbox for the password field prompt (issue 316)
Stepan777
parents:
diff changeset
    29
{
8181
70e980278080 GCI2012: User/Pass Single Prompt
Ondrej
parents: 7795
diff changeset
    30
    setWindowTitle(tr("Login"));
8434
4821897a0f10 big indentation/whitespaces cleanup
sheepluva
parents: 8364
diff changeset
    31
6910
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
8181
70e980278080 GCI2012: User/Pass Single Prompt
Ondrej
parents: 7795
diff changeset
    34
    QLabel * titleLabel = new QLabel(this);
8824
fe9eacd390f2 Unbreak lua localisation, fix untranslated login prompt, update translations.
nemo
parents: 8434
diff changeset
    35
    titleLabel->setText(tr("To connect to the server, please log in.\n\nIf you don't have an account on www.hedgewars.org,\njust enter your nickname."));
8181
70e980278080 GCI2012: User/Pass Single Prompt
Ondrej
parents: 7795
diff changeset
    36
    layout->addWidget(titleLabel, 0, 0);
8434
4821897a0f10 big indentation/whitespaces cleanup
sheepluva
parents: 8364
diff changeset
    37
8181
70e980278080 GCI2012: User/Pass Single Prompt
Ondrej
parents: 7795
diff changeset
    38
    QLabel * nickLabel = new QLabel(this);
8824
fe9eacd390f2 Unbreak lua localisation, fix untranslated login prompt, update translations.
nemo
parents: 8434
diff changeset
    39
    nickLabel->setText(tr("Nickname:"));
8181
70e980278080 GCI2012: User/Pass Single Prompt
Ondrej
parents: 7795
diff changeset
    40
    layout->addWidget(nickLabel, 1, 0);
8434
4821897a0f10 big indentation/whitespaces cleanup
sheepluva
parents: 8364
diff changeset
    41
8181
70e980278080 GCI2012: User/Pass Single Prompt
Ondrej
parents: 7795
diff changeset
    42
    leNickname = new QLineEdit(this);
70e980278080 GCI2012: User/Pass Single Prompt
Ondrej
parents: 7795
diff changeset
    43
    leNickname->setEchoMode(QLineEdit::Normal);
70e980278080 GCI2012: User/Pass Single Prompt
Ondrej
parents: 7795
diff changeset
    44
    layout->addWidget(leNickname, 2, 0);
8434
4821897a0f10 big indentation/whitespaces cleanup
sheepluva
parents: 8364
diff changeset
    45
8181
70e980278080 GCI2012: User/Pass Single Prompt
Ondrej
parents: 7795
diff changeset
    46
    QLabel * passLabel = new QLabel(this);
8824
fe9eacd390f2 Unbreak lua localisation, fix untranslated login prompt, update translations.
nemo
parents: 8434
diff changeset
    47
    passLabel->setText(tr("Password:"));
8181
70e980278080 GCI2012: User/Pass Single Prompt
Ondrej
parents: 7795
diff changeset
    48
    layout->addWidget(passLabel, 3, 0);
6910
ea058558c68b add a checkbox for the password field prompt (issue 316)
Stepan777
parents:
diff changeset
    49
ea058558c68b add a checkbox for the password field prompt (issue 316)
Stepan777
parents:
diff changeset
    50
    lePassword = new QLineEdit(this);
ea058558c68b add a checkbox for the password field prompt (issue 316)
Stepan777
parents:
diff changeset
    51
    lePassword->setEchoMode(QLineEdit::Password);
8181
70e980278080 GCI2012: User/Pass Single Prompt
Ondrej
parents: 7795
diff changeset
    52
    layout->addWidget(lePassword, 4, 0);
6910
ea058558c68b add a checkbox for the password field prompt (issue 316)
Stepan777
parents:
diff changeset
    53
ea058558c68b add a checkbox for the password field prompt (issue 316)
Stepan777
parents:
diff changeset
    54
    cbSave = new QCheckBox(this);
ea058558c68b add a checkbox for the password field prompt (issue 316)
Stepan777
parents:
diff changeset
    55
    cbSave->setText(QCheckBox::tr("Save password"));
8181
70e980278080 GCI2012: User/Pass Single Prompt
Ondrej
parents: 7795
diff changeset
    56
    layout->addWidget(cbSave, 5, 0);
6910
ea058558c68b add a checkbox for the password field prompt (issue 316)
Stepan777
parents:
diff changeset
    57
ea058558c68b add a checkbox for the password field prompt (issue 316)
Stepan777
parents:
diff changeset
    58
    QDialogButtonBox* dbbButtons = new QDialogButtonBox(this);
10537
7475f81a9b2e this string was untranslatable. thanks to siilimestari for pointing that out
sheepluva
parents: 10108
diff changeset
    59
    pbNewAccount = dbbButtons->addButton(tr("New Account"), QDialogButtonBox::ActionRole);
6910
ea058558c68b add a checkbox for the password field prompt (issue 316)
Stepan777
parents:
diff changeset
    60
    QPushButton * pbOK = dbbButtons->addButton(QDialogButtonBox::Ok);
ea058558c68b add a checkbox for the password field prompt (issue 316)
Stepan777
parents:
diff changeset
    61
    QPushButton * pbCancel = dbbButtons->addButton(QDialogButtonBox::Cancel);
8181
70e980278080 GCI2012: User/Pass Single Prompt
Ondrej
parents: 7795
diff changeset
    62
    layout->addWidget(dbbButtons, 6, 0);
6910
ea058558c68b add a checkbox for the password field prompt (issue 316)
Stepan777
parents:
diff changeset
    63
ea058558c68b add a checkbox for the password field prompt (issue 316)
Stepan777
parents:
diff changeset
    64
    connect(pbOK, SIGNAL(clicked()), this, SLOT(accept()));
ea058558c68b add a checkbox for the password field prompt (issue 316)
Stepan777
parents:
diff changeset
    65
    connect(pbCancel, SIGNAL(clicked()), this, SLOT(reject()));
7795
ba32d3f9e567 set window modality also for custom dialogs, small text changes
koda
parents: 6952
diff changeset
    66
ba32d3f9e567 set window modality also for custom dialogs, small text changes
koda
parents: 6952
diff changeset
    67
    this->setWindowModality(Qt::WindowModal);
6910
ea058558c68b add a checkbox for the password field prompt (issue 316)
Stepan777
parents:
diff changeset
    68
}