summaryrefslogtreecommitdiff
path: root/src/gui/register.cpp
diff options
context:
space:
mode:
authorEugenio Favalli <elvenprogrammer@gmail.com>2006-08-02 09:43:57 +0000
committerEugenio Favalli <elvenprogrammer@gmail.com>2006-08-02 09:43:57 +0000
commit25fe73f89756cb4102f97bcccdb8635a6a56f35d (patch)
tree12f6737acba4927f49f7d7b676467fe301a2a430 /src/gui/register.cpp
parent2ae843719c2a7b2325309404a0e3cbb4aeb9c3df (diff)
downloadmana-25fe73f89756cb4102f97bcccdb8635a6a56f35d.tar.gz
mana-25fe73f89756cb4102f97bcccdb8635a6a56f35d.tar.bz2
mana-25fe73f89756cb4102f97bcccdb8635a6a56f35d.tar.xz
mana-25fe73f89756cb4102f97bcccdb8635a6a56f35d.zip
Ported account registration to tmwserv. There's still a disconnection/reconnection between registration and login.
Diffstat (limited to 'src/gui/register.cpp')
-rw-r--r--src/gui/register.cpp20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/gui/register.cpp b/src/gui/register.cpp
index 38136b87..82e5f716 100644
--- a/src/gui/register.cpp
+++ b/src/gui/register.cpp
@@ -50,10 +50,12 @@ RegisterDialog::RegisterDialog(LoginData *loginData):
gcn::Label *userLabel = new gcn::Label("Name:");
gcn::Label *passwordLabel = new gcn::Label("Password:");
gcn::Label *confirmLabel = new gcn::Label("Confirm:");
+ gcn::Label *emailLabel = new gcn::Label("Email:");
gcn::Label *serverLabel = new gcn::Label("Server:");
mUserField = new TextField("player");
mPasswordField = new PasswordField();
mConfirmField = new PasswordField();
+ mEmailField = new TextField();
mServerField = new TextField();
mMaleButton = new RadioButton("Male", "sex", true);
mFemaleButton = new RadioButton("Female", "sex", false);
@@ -61,7 +63,7 @@ RegisterDialog::RegisterDialog(LoginData *loginData):
mCancelButton = new Button("Cancel", "cancel", this);
int width = 200;
- int height = 150;
+ int height = 170;
setContentSize(width, height);
mUserField->setPosition(65, 5);
@@ -72,17 +74,21 @@ RegisterDialog::RegisterDialog(LoginData *loginData):
mConfirmField->setPosition(
65, mPasswordField->getY() + mPasswordField->getHeight() + 7);
mConfirmField->setWidth(130);
+ mEmailField->setPosition(
+ 65, mConfirmField->getY() + mConfirmField->getHeight() + 7);
+ mEmailField->setWidth(130);
mServerField->setPosition(
- 65, 23 + mConfirmField->getY() + mConfirmField->getHeight() + 7);
+ 65, 23 + mEmailField->getY() + mEmailField->getHeight() + 7);
mServerField->setWidth(130);
userLabel->setPosition(5, mUserField->getY() + 1);
passwordLabel->setPosition(5, mPasswordField->getY() + 1);
confirmLabel->setPosition(5, mConfirmField->getY() + 1);
+ emailLabel->setPosition(5, mEmailField->getY() + 1);
serverLabel->setPosition(5, mServerField->getY() + 1);
mFemaleButton->setPosition(width - mFemaleButton->getWidth() - 10,
- mConfirmField->getY() + mConfirmField->getHeight() + 7);
+ mEmailField->getY() + mEmailField->getHeight() + 7);
mMaleButton->setPosition(mFemaleButton->getX() - mMaleButton->getWidth() - 5,
mFemaleButton->getY());
@@ -92,11 +98,13 @@ RegisterDialog::RegisterDialog(LoginData *loginData):
add(userLabel);
add(passwordLabel);
+ add(emailLabel);
add(serverLabel);
add(confirmLabel);
add(mUserField);
add(mPasswordField);
add(mConfirmField);
+ add(mEmailField);
add(mServerField);
add(mMaleButton);
add(mFemaleButton);
@@ -176,6 +184,8 @@ RegisterDialog::action(const std::string &eventId, gcn::Widget *widget)
error = 2;
}
+ // TODO: Check if a valid email address was given
+
if (error > 0)
{
if (error == 1)
@@ -202,9 +212,9 @@ RegisterDialog::action(const std::string &eventId, gcn::Widget *widget)
mLoginData->port = (short)config.getValue("port", 0);
mLoginData->username = mUserField->getText();
mLoginData->password = mPasswordField->getText();
- mLoginData->username += mFemaleButton->isMarked() ? "_F" : "_M";
+ mLoginData->email = mEmailField->getText();
- state = ACCOUNT_STATE;
+ state = REGISTER_ACCOUNT_STATE;
}
}
}