51 if (event.getId() ==
"ok")
59 mFemaleButton(nullptr),
65 gcn::Label *userLabel =
new Label(
_(
"Name:"));
66 gcn::Label *passwordLabel =
new Label(
_(
"Password:"));
67 gcn::Label *confirmLabel =
new Label(
_(
"Confirm:"));
76 place(0, 0, userLabel);
77 place(0, 1, passwordLabel);
78 place(0, 2, confirmLabel);
98 gcn::Label *emailLabel =
new Label(
_(
"Email:"));
100 place(0, row, emailLabel);
143 if (event.getId() ==
"cancel")
147 else if (event.getId() ==
"register" &&
canSubmit())
149 const std::string user =
mUserField->getText();
150 Log::info(
"RegisterDialog::register Username is %s", user.c_str());
160 if (user.length() < minUser)
164 (
_(
"The username needs to be at least %d characters long."),
168 else if (user.length() > maxUser - 1)
172 (
_(
"The username needs to be less than %d characters long."),
180 (
_(
"The password needs to be at least %d characters long."),
188 (
_(
"The password needs to be less than %d characters long."),
static void setState(State state)
This class is a helper for adding widgets to nested tables in a window.
LayoutCell & setPadding(int p)
Sets the padding around the cell content.
bool registerLogin
Whether an account is being registered.
virtual unsigned int getMinUserNameLength() const
virtual unsigned int getMaxPasswordLength() const
virtual int supportedOptionalActions() const =0
virtual unsigned int getMaxUserNameLength() const
virtual unsigned int getMinPasswordLength() const
gcn::TextField * mEmailField
gcn::TextField * mConfirmField
bool canSubmit() const
Returns whether submit can be enabled.
WrongDataNoticeListener * mWrongDataNoticeListener
~RegisterDialog() override
gcn::Button * mCancelButton
gcn::RadioButton * mMaleButton
gcn::TextField * mUserField
void keyPressed(gcn::KeyEvent &keyEvent) override
Called when a key is pressed in one of the text fields.
void action(const gcn::ActionEvent &event) override
Called when receiving actions from the widgets.
gcn::Button * mRegisterButton
gcn::RadioButton * mFemaleButton
gcn::TextField * mPasswordField
RegisterDialog(LoginData *loginData)
Constructor.
void center()
Positions the window in the center of it's parent.
virtual void setVisible(bool visible)
Overloads window setVisible by Guichan to allow sticky window handling.
ContainerPlacer getPlacer(int x, int y)
Returns a proxy for adding widgets in an inner table of the layout.
void reflowLayout(int w=0, int h=0)
Computes the position of the widgets according to the current layout.
LayoutCell & place(int x, int y, gcn::Widget *, int w=1, int h=1)
Adds a widget to the window and sets it at given cell.
Listener used while dealing with wrong data.
void setTarget(gcn::TextField *textField)
void action(const gcn::ActionEvent &event) override
void info(const char *log_text,...) LOG_PRINTF_ATTR
LoginHandler * getLoginHandler()
std::string strprintf(char const *format,...)
A safe version of sprintf that returns a std::string of the result.