summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2009-10-06 23:40:55 +0200
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2009-10-06 23:43:40 +0200
commit64a37da4cb8d74a29f369e96e8c3669275516394 (patch)
treecaa0eb0d05ab5674b6b6ac822d151aa2585721e8 /src/gui
parent610dc30ceecdfe538f71826689630e0f28c278cc (diff)
downloadmana-64a37da4cb8d74a29f369e96e8c3669275516394.tar.gz
mana-64a37da4cb8d74a29f369e96e8c3669275516394.tar.bz2
mana-64a37da4cb8d74a29f369e96e8c3669275516394.tar.xz
mana-64a37da4cb8d74a29f369e96e8c3669275516394.zip
Some cleanup regarding keeping track of gender for eAthena
LoginHandler now owns the world list and the token, instead of having them as global variables with pointers to the 'sex' member of the token from the GUI.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/register.cpp21
-rw-r--r--src/gui/register.h16
2 files changed, 8 insertions, 29 deletions
diff --git a/src/gui/register.cpp b/src/gui/register.cpp
index 78c79eeb..5d9469ca 100644
--- a/src/gui/register.cpp
+++ b/src/gui/register.cpp
@@ -54,11 +54,11 @@ void WrongDataNoticeListener::action(const gcn::ActionEvent &event)
mTarget->requestFocus();
}
-Gender *RegisterDialog::useGender = NULL;
-
RegisterDialog::RegisterDialog(LoginData *loginData):
Window(_("Register")),
mEmailField(0),
+ mMaleButton(0),
+ mFemaleButton(0),
mWrongDataNoticeListener(new WrongDataNoticeListener),
mLoginData(loginData)
{
@@ -70,8 +70,6 @@ RegisterDialog::RegisterDialog(LoginData *loginData):
mUserField = new TextField(loginData->username);
mPasswordField = new PasswordField(loginData->password);
mConfirmField = new PasswordField;
- mMaleButton = new RadioButton(_("Male"), "sex", true);
- mFemaleButton = new RadioButton(_("Female"), "sex", false);
mRegisterButton = new Button(_("Register"), "register", this);
mCancelButton = new Button(_("Cancel"), "cancel", this);
@@ -81,8 +79,10 @@ RegisterDialog::RegisterDialog(LoginData *loginData):
place(0, 1, passwordLabel);
place(0, 2, confirmLabel);
- if (useGender)
+ if (optionalActions & Net::LoginHandler::SetGenderOnRegister)
{
+ mMaleButton = new RadioButton(_("Male"), "sex", true);
+ mFemaleButton = new RadioButton(_("Female"), "sex", false);
place(1, 3, mMaleButton);
place(2, 3, mFemaleButton);
}
@@ -213,9 +213,9 @@ void RegisterDialog::action(const gcn::ActionEvent &event)
mLoginData->username = mUserField->getText();
mLoginData->password = mPasswordField->getText();
- if (useGender)
- *useGender = mFemaleButton->isSelected() ? GENDER_FEMALE :
- GENDER_MALE;
+ if (mFemaleButton)
+ mLoginData->gender = mFemaleButton->isSelected() ?
+ GENDER_FEMALE : GENDER_MALE;
if (mEmailField)
mLoginData->email = mEmailField->getText();
mLoginData->registerLogin = true;
@@ -230,11 +230,6 @@ void RegisterDialog::keyPressed(gcn::KeyEvent &keyEvent)
mRegisterButton->setEnabled(canSubmit());
}
-void RegisterDialog::setGender(Gender *gender)
-{
- useGender = gender;
-}
-
bool RegisterDialog::canSubmit() const
{
return !mUserField->getText().empty() &&
diff --git a/src/gui/register.h b/src/gui/register.h
index 9f22a5bb..418d6dcd 100644
--- a/src/gui/register.h
+++ b/src/gui/register.h
@@ -80,20 +80,6 @@ class RegisterDialog : public Window, public gcn::ActionListener,
*/
void keyPressed(gcn::KeyEvent &keyEvent);
- /**
- * Tell the dialog to show an email field. Value stored in the passed
- * string pointer. Default email from pointer. Passing NULL disables
- * the feature.
- */
- static void setEmail(std::string *email);
-
- /**
- * Tell the dialog to show a gender selection. Value stored in the
- * passed Gender pointer. Default Gender from pointer. Passing NULL
- * disables the feature.
- */
- static void setGender(Gender *gender);
-
private:
/**
* Returns whether submit can be enabled. This is true in the register
@@ -114,8 +100,6 @@ class RegisterDialog : public Window, public gcn::ActionListener,
WrongDataNoticeListener *mWrongDataNoticeListener;
LoginData *mLoginData;
-
- static Gender *useGender;
};
#endif