diff options
author | Dennis Friis <peavey@inspircd.org> | 2009-05-24 21:49:09 +0200 |
---|---|---|
committer | Dennis Friis <peavey@inspircd.org> | 2009-05-25 05:26:55 +0200 |
commit | 050103b8d2e3eb23e7aea188a1a269feb7c181ab (patch) | |
tree | 9bfb7d2ac95cdd93399ab22fc27b9bd059a7af26 | |
parent | 18b6856aa416473019bc36ead2c0e9cda3719a44 (diff) | |
download | mana-050103b8d2e3eb23e7aea188a1a269feb7c181ab.tar.gz mana-050103b8d2e3eb23e7aea188a1a269feb7c181ab.tar.bz2 mana-050103b8d2e3eb23e7aea188a1a269feb7c181ab.tar.xz mana-050103b8d2e3eb23e7aea188a1a269feb7c181ab.zip |
Add change password dialog to athena client
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/gui/charselectdialog.cpp | 43 | ||||
-rw-r--r-- | src/gui/charselectdialog.h | 12 | ||||
-rw-r--r-- | src/main.cpp | 2 | ||||
-rw-r--r-- | src/main.h | 4 |
5 files changed, 28 insertions, 37 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index a474c963..7ed6da63 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -69,6 +69,8 @@ tmw_SOURCES = gui/widgets/avatar.cpp \ gui/buy.h \ gui/buysell.cpp \ gui/buysell.h \ + gui/changepassworddialog.cpp \ + gui/changepassworddialog.h \ gui/charselectdialog.cpp \ gui/charselectdialog.h \ gui/charcreatedialog.cpp \ @@ -368,8 +370,6 @@ tmw_SOURCES += \ gui/buddywindow.h \ gui/changeemaildialog.cpp \ gui/changeemaildialog.h \ - gui/changepassworddialog.cpp \ - gui/changepassworddialog.h \ gui/connection.cpp \ gui/connection.h \ gui/guildlistbox.cpp \ diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp index 4df0243b..dd91af5c 100644 --- a/src/gui/charselectdialog.cpp +++ b/src/gui/charselectdialog.cpp @@ -25,17 +25,16 @@ #include "gui/confirmdialog.h" #include "gui/okdialog.h" #include "gui/playerbox.h" +#include "gui/changepassworddialog.h" +#include "net/logindata.h" #ifdef TMWSERV_SUPPORT #include "gui/widgets/radiobutton.h" #include "gui/widgets/slider.h" #include "gui/unregisterdialog.h" -#include "gui/changepassworddialog.h" #include "gui/changeemaildialog.h" -#include "net/logindata.h" - #include "net/tmwserv/accountserver/account.h" #endif @@ -91,36 +90,30 @@ void CharDeleteConfirm::action(const gcn::ActionEvent &event) ConfirmDialog::action(event); } -#ifdef TMWSERV_SUPPORT CharSelectDialog::CharSelectDialog(LockedArray<LocalPlayer*> *charInfo, LoginData *loginData): Window(_("Account and Character Management")), mCharInfo(charInfo), mCharSelected(false), - mLoginData(loginData) -#else -CharSelectDialog::CharSelectDialog(LockedArray<LocalPlayer*> *charInfo, - Gender gender): - Window(_("Select Character")), - mCharInfo(charInfo), - mCharSelected(false), - mGender(gender) +#ifdef EATHENA_SUPPORT + mGender(loginData->sex), #endif + mLoginData(loginData) { mSelectButton = new Button(_("OK"), "ok", this); mCancelButton = new Button(_("Cancel"), "cancel", this); mPreviousButton = new Button(_("Previous"), "previous", this); mNextButton = new Button(_("Next"), "next", this); + mAccountNameLabel = new Label(strprintf(_("Account: %s"), mLoginData->username.c_str())); mNameLabel = new Label(strprintf(_("Name: %s"), "")); mLevelLabel = new Label(strprintf(_("Level: %d"), 0)); + mChangePasswordButton = new Button(_("Change Password"), "change_password", this); #ifdef TMWSERV_SUPPORT mNewCharButton = new Button(_("New"), "new", this); mDelCharButton = new Button(_("Delete"), "delete", this); mUnRegisterButton = new Button(_("Unregister"), "unregister", this); - mChangePasswordButton = new Button(_("Change Password"), "change_password", this); mChangeEmailButton = new Button(_("Change Email Address"), "change_email", this); - mAccountNameLabel = new Label(strprintf(_("Account: %s"), mLoginData->username.c_str())); mNameLabel = new Label(strprintf(_("Name: %s"), "")); mLevelLabel = new Label(strprintf(_("Level: %d"), 0)); mMoneyLabel = new Label(strprintf(_("Money: %d"), 0)); @@ -169,13 +162,15 @@ CharSelectDialog::CharSelectDialog(LockedArray<LocalPlayer*> *charInfo, ContainerPlacer place; place = getPlacer(0, 0); - + place(0, 0, mAccountNameLabel); + place(0, 1, mChangePasswordButton); + place = getPlacer(0, 1); place(0, 0, mPlayerBox, 1, 6).setPadding(3); - place(1, 0, mNewDelCharButton); - place(1, 1, mNameLabel, 5); - place(1, 2, mLevelLabel, 5); - place(1, 3, mJobLevelLabel, 5); - place(1, 4, mMoneyLabel, 5); + place(1, 0, mNameLabel, 5); + place(1, 1, mLevelLabel, 5); + place(1, 2, mJobLevelLabel, 5); + place(1, 3, mMoneyLabel, 5); + place(1, 4, mNewDelCharButton); place.getCell().matchColWidth(1, 4); place = getPlacer(0, 2); place(0, 0, mPreviousButton); @@ -276,15 +271,15 @@ void CharSelectDialog::action(const gcn::ActionEvent &event) if (pi) mMoney = Units::formatCurrency(pi->getMoney()); } + else if (event.getId() == "change_password") + { + new ChangePasswordDialog(this, mLoginData); + } #ifdef TMWSERV_SUPPORT else if (event.getId() == "unregister") { new UnRegisterDialog(this, mLoginData); } - else if (event.getId() == "change_password") - { - new ChangePasswordDialog(this, mLoginData); - } else if (event.getId() == "change_email") { new ChangeEmailDialog(this, mLoginData); diff --git a/src/gui/charselectdialog.h b/src/gui/charselectdialog.h index adbf3de1..06ce4b55 100644 --- a/src/gui/charselectdialog.h +++ b/src/gui/charselectdialog.h @@ -47,13 +47,8 @@ class CharSelectDialog : public Window, public gcn::ActionListener /** * Constructor. */ -#ifdef TMWSERV_SUPPORT CharSelectDialog(LockedArray<LocalPlayer*> *charInfo, LoginData *loginData); -#else - CharSelectDialog(LockedArray<LocalPlayer*> *charInfo, - Gender gender); -#endif void action(const gcn::ActionEvent &event); @@ -70,12 +65,16 @@ class CharSelectDialog : public Window, public gcn::ActionListener gcn::Button *mCancelButton; gcn::Button *mPreviousButton; gcn::Button *mNextButton; + gcn::Button *mChangePasswordButton; gcn::Label *mNameLabel; gcn::Label *mLevelLabel; gcn::Label *mMoneyLabel; + gcn::Label *mAccountNameLabel; std::string mMoney; + LoginData *mLoginData; + PlayerBox *mPlayerBox; bool mCharSelected; @@ -84,11 +83,8 @@ class CharSelectDialog : public Window, public gcn::ActionListener gcn::Button *mNewCharButton; gcn::Button *mDelCharButton; gcn::Button *mUnRegisterButton; - gcn::Button *mChangePasswordButton; gcn::Button *mChangeEmailButton; - gcn::Label *mAccountNameLabel; - LoginData *mLoginData; #else gcn::Button *mNewDelCharButton; gcn::Label *mJobLevelLabel; diff --git a/src/main.cpp b/src/main.cpp index 61e5a408..92fdf2f2 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1446,7 +1446,7 @@ int main(int argc, char *argv[]) case STATE_CHAR_SELECT: logger->log("State: CHAR_SELECT"); currentDialog = new CharSelectDialog(&charInfo, - loginData.sex); + &loginData); positionDialog(currentDialog, screenWidth, screenHeight); if (((CharSelectDialog*) currentDialog)-> @@ -87,6 +87,8 @@ enum State { STATE_GAME, STATE_ERROR, STATE_UPDATE, + STATE_CHANGEPASSWORD_ATTEMPT, + STATE_CHANGEPASSWORD, #ifdef TMWSERV_SUPPORT STATE_CHOOSE_SERVER, STATE_CONNECT_ACCOUNT, @@ -96,8 +98,6 @@ enum State { STATE_ACCOUNTCHANGE_ERROR, STATE_CHANGEEMAIL_ATTEMPT, STATE_CHANGEEMAIL, - STATE_CHANGEPASSWORD_ATTEMPT, - STATE_CHANGEPASSWORD, STATE_UNREGISTER_ATTEMPT, STATE_UNREGISTER, STATE_SWITCH_CHARACTER, |