mirror of
https://github.com/Cockatrice/Cockatrice.git
synced 2026-04-27 07:48:01 -07:00
merged with master
This commit is contained in:
commit
5cfb034452
416 changed files with 65983 additions and 19400 deletions
|
|
@ -4,9 +4,11 @@
|
|||
#include <QGridLayout>
|
||||
#include <QHBoxLayout>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QMessageBox>
|
||||
#include <QDebug>
|
||||
|
||||
#include "dlg_register.h"
|
||||
#include "settingscache.h"
|
||||
#include "pb/serverinfo_user.pb.h"
|
||||
|
||||
DlgRegister::DlgRegister(QWidget *parent)
|
||||
|
|
@ -32,16 +34,25 @@ DlgRegister::DlgRegister(QWidget *parent)
|
|||
passwordLabel->setBuddy(passwordEdit);
|
||||
passwordEdit->setEchoMode(QLineEdit::Password);
|
||||
|
||||
passwordConfirmationLabel = new QLabel(tr("Password (again):"));
|
||||
passwordConfirmationEdit = new QLineEdit();
|
||||
passwordConfirmationLabel->setBuddy(passwordConfirmationEdit);
|
||||
passwordConfirmationEdit->setEchoMode(QLineEdit::Password);
|
||||
|
||||
emailLabel = new QLabel(tr("Email:"));
|
||||
emailEdit = new QLineEdit();
|
||||
emailLabel->setBuddy(emailEdit);
|
||||
|
||||
genderLabel = new QLabel(tr("Gender:"));
|
||||
emailConfirmationLabel = new QLabel(tr("Email (again):"));
|
||||
emailConfirmationEdit = new QLineEdit();
|
||||
emailConfirmationLabel->setBuddy(emailConfirmationEdit);
|
||||
|
||||
genderLabel = new QLabel(tr("Pronouns:"));
|
||||
genderEdit = new QComboBox();
|
||||
genderLabel->setBuddy(genderEdit);
|
||||
genderEdit->insertItem(0, QIcon("theme:genders/unknown.svg"), tr("Undefined"));
|
||||
genderEdit->insertItem(1, QIcon("theme:genders/male.svg"), tr("Male"));
|
||||
genderEdit->insertItem(2, QIcon("theme:genders/female.svg"), tr("Female"));
|
||||
genderEdit->insertItem(0, QIcon("theme:genders/unknown.svg"), tr("Neutral"));
|
||||
genderEdit->insertItem(1, QIcon("theme:genders/male.svg"), tr("Masculine"));
|
||||
genderEdit->insertItem(2, QIcon("theme:genders/female.svg"), tr("Feminine"));
|
||||
genderEdit->setCurrentIndex(0);
|
||||
|
||||
countryLabel = new QLabel(tr("Country:"));
|
||||
|
|
@ -298,6 +309,9 @@ DlgRegister::DlgRegister(QWidget *parent)
|
|||
countryEdit->addItem(QIcon("theme:countries/zm.svg"), "zm");
|
||||
countryEdit->addItem(QIcon("theme:countries/zw.svg"), "zw");
|
||||
countryEdit->setCurrentIndex(0);
|
||||
QStringList countries = settingsCache->getCountries();
|
||||
foreach(QString c, countries)
|
||||
countryEdit->addItem(QPixmap(":/resources/countries/" + c + ".svg"), c);
|
||||
|
||||
realnameLabel = new QLabel(tr("Real name:"));
|
||||
realnameEdit = new QLineEdit();
|
||||
|
|
@ -312,14 +326,18 @@ DlgRegister::DlgRegister(QWidget *parent)
|
|||
grid->addWidget(playernameEdit, 2, 1);
|
||||
grid->addWidget(passwordLabel, 3, 0);
|
||||
grid->addWidget(passwordEdit, 3, 1);
|
||||
grid->addWidget(emailLabel, 4, 0);
|
||||
grid->addWidget(emailEdit, 4, 1);
|
||||
grid->addWidget(genderLabel, 5, 0);
|
||||
grid->addWidget(genderEdit, 5, 1);
|
||||
grid->addWidget(countryLabel, 6, 0);
|
||||
grid->addWidget(countryEdit, 6, 1);
|
||||
grid->addWidget(realnameLabel, 7, 0);
|
||||
grid->addWidget(realnameEdit, 7, 1);
|
||||
grid->addWidget(passwordConfirmationLabel, 4, 0);
|
||||
grid->addWidget(passwordConfirmationEdit, 4, 1);
|
||||
grid->addWidget(emailLabel, 5, 0);
|
||||
grid->addWidget(emailEdit, 5, 1);
|
||||
grid->addWidget(emailConfirmationLabel, 6, 0);
|
||||
grid->addWidget(emailConfirmationEdit, 6, 1);
|
||||
grid->addWidget(genderLabel, 7, 0);
|
||||
grid->addWidget(genderEdit, 7, 1);
|
||||
grid->addWidget(countryLabel, 8, 0);
|
||||
grid->addWidget(countryEdit, 8, 1);
|
||||
grid->addWidget(realnameLabel, 9, 0);
|
||||
grid->addWidget(realnameEdit, 9, 1);
|
||||
|
||||
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
connect(buttonBox, SIGNAL(accepted()), this, SLOT(actOk()));
|
||||
|
|
@ -337,6 +355,17 @@ DlgRegister::DlgRegister(QWidget *parent)
|
|||
|
||||
void DlgRegister::actOk()
|
||||
{
|
||||
if (passwordEdit->text() != passwordConfirmationEdit->text())
|
||||
{
|
||||
QMessageBox::critical(this, tr("Registration Warning"), tr("Your passwords do not match, please try again."));
|
||||
return;
|
||||
}
|
||||
else if (emailConfirmationEdit->text() != emailEdit->text())
|
||||
{
|
||||
QMessageBox::critical(this, tr("Registration Warning"), tr("Your email addresses do not match, please try again."));
|
||||
return;
|
||||
}
|
||||
|
||||
QSettings settings;
|
||||
settings.beginGroup("server");
|
||||
settings.setValue("hostname", hostEdit->text());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue