summaryrefslogtreecommitdiff
path: root/src/gui/windows
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-11-16 22:35:17 +0300
committerAndrei Karas <akaras@inbox.ru>2015-11-16 22:35:17 +0300
commitb3d17866a3c5700b52c2b0b954fce132a52c1dbf (patch)
tree7ba07c98a1842eb766de35e172f559dcf5ac6fb4 /src/gui/windows
parent5e8e53f6e795a84ab5ca6cfe0d08672878044707 (diff)
downloadmanaverse-b3d17866a3c5700b52c2b0b954fce132a52c1dbf.tar.gz
manaverse-b3d17866a3c5700b52c2b0b954fce132a52c1dbf.tar.bz2
manaverse-b3d17866a3c5700b52c2b0b954fce132a52c1dbf.tar.xz
manaverse-b3d17866a3c5700b52c2b0b954fce132a52c1dbf.zip
Convert State enum into strong typed.
Diffstat (limited to 'src/gui/windows')
-rw-r--r--src/gui/windows/changeemaildialog.cpp4
-rw-r--r--src/gui/windows/changepassworddialog.cpp4
-rw-r--r--src/gui/windows/charselectdialog.cpp8
-rw-r--r--src/gui/windows/logindialog.cpp8
-rw-r--r--src/gui/windows/quitdialog.cpp22
-rw-r--r--src/gui/windows/registerdialog.cpp6
-rw-r--r--src/gui/windows/serverdialog.cpp8
-rw-r--r--src/gui/windows/unregisterdialog.cpp4
-rw-r--r--src/gui/windows/updaterwindow.cpp16
-rw-r--r--src/gui/windows/worldselectdialog.cpp6
10 files changed, 43 insertions, 43 deletions
diff --git a/src/gui/windows/changeemaildialog.cpp b/src/gui/windows/changeemaildialog.cpp
index 1e069e6eb..c4ae533e2 100644
--- a/src/gui/windows/changeemaildialog.cpp
+++ b/src/gui/windows/changeemaildialog.cpp
@@ -114,7 +114,7 @@ void ChangeEmailDialog::action(const ActionEvent &event)
const std::string &eventId = event.getId();
if (eventId == "cancel")
{
- client->setState(STATE_CHAR_SELECT);
+ client->setState(State::CHAR_SELECT);
}
else if (eventId == "change_email")
{
@@ -180,7 +180,7 @@ void ChangeEmailDialog::action(const ActionEvent &event)
mChangeEmailButton->setEnabled(false);
// Set the new email address
mLoginData->email = newFirstEmail;
- client->setState(STATE_CHANGEEMAIL_ATTEMPT);
+ client->setState(State::CHANGEEMAIL_ATTEMPT);
}
}
}
diff --git a/src/gui/windows/changepassworddialog.cpp b/src/gui/windows/changepassworddialog.cpp
index 051448e6f..e0750b8bf 100644
--- a/src/gui/windows/changepassworddialog.cpp
+++ b/src/gui/windows/changepassworddialog.cpp
@@ -93,7 +93,7 @@ void ChangePasswordDialog::action(const ActionEvent &event)
const std::string &eventId = event.getId();
if (eventId == "cancel")
{
- client->setState(STATE_CHAR_SELECT);
+ client->setState(State::CHAR_SELECT);
}
else if (eventId == "change_password")
{
@@ -171,7 +171,7 @@ void ChangePasswordDialog::action(const ActionEvent &event)
// Set the new password
mLoginData->password = oldPassword;
mLoginData->newPassword = newFirstPass;
- client->setState(STATE_CHANGEPASSWORD_ATTEMPT);
+ client->setState(State::CHANGEPASSWORD_ATTEMPT);
}
}
}
diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp
index ca15caf97..8f7c44d66 100644
--- a/src/gui/windows/charselectdialog.cpp
+++ b/src/gui/windows/charselectdialog.cpp
@@ -268,16 +268,16 @@ void CharSelectDialog::action(const ActionEvent &event)
}
else if (eventId == "change_password")
{
- client->setState(STATE_CHANGEPASSWORD);
+ client->setState(State::CHANGEPASSWORD);
}
else if (eventId == "change_email")
{
- client->setState(STATE_CHANGEEMAIL);
+ client->setState(State::CHANGEEMAIL);
}
else if (eventId == "unregister")
{
charServerHandler->clear();
- client->setState(STATE_UNREGISTER);
+ client->setState(State::UNREGISTER);
}
else if (eventId == "try delete character")
{
@@ -572,7 +572,7 @@ bool CharSelectDialog::selectByName(const std::string &name,
void CharSelectDialog::close()
{
- client->setState(STATE_SWITCH_LOGIN);
+ client->setState(State::SWITCH_LOGIN);
Window::close();
}
diff --git a/src/gui/windows/logindialog.cpp b/src/gui/windows/logindialog.cpp
index 93bf10bc3..aebe962cb 100644
--- a/src/gui/windows/logindialog.cpp
+++ b/src/gui/windows/logindialog.cpp
@@ -216,7 +216,7 @@ void LoginDialog::action(const ActionEvent &event)
{
prepareUpdate();
mLoginData->registerLogin = false;
- client->setState(STATE_LOGIN_ATTEMPT);
+ client->setState(State::LOGIN_ATTEMPT);
}
else if (eventId == "server")
{
@@ -227,7 +227,7 @@ void LoginDialog::action(const ActionEvent &event)
if (loginHandler->isRegistrationEnabled())
{
prepareUpdate();
- client->setState(STATE_REGISTER_PREP);
+ client->setState(State::REGISTER_PREP);
}
else if (!mLoginData->registerUrl.empty())
{
@@ -283,7 +283,7 @@ bool LoginDialog::canSubmit() const
{
return !mUserField->getText().empty() &&
!mPassField->getText().empty() &&
- client->getState() == STATE_LOGIN;
+ client->getState() == State::LOGIN;
}
void LoginDialog::prepareUpdate()
@@ -354,6 +354,6 @@ void LoginDialog::prepareUpdate()
void LoginDialog::close()
{
- client->setState(STATE_SWITCH_SERVER);
+ client->setState(State::SWITCH_SERVER);
Window::close();
}
diff --git a/src/gui/windows/quitdialog.cpp b/src/gui/windows/quitdialog.cpp
index 9c5a2dee1..1f876e731 100644
--- a/src/gui/windows/quitdialog.cpp
+++ b/src/gui/windows/quitdialog.cpp
@@ -73,10 +73,10 @@ QuitDialog::QuitDialog(QuitDialog **const pointerToMe) :
ContainerPlacer placer = getPlacer(0, 0);
const State state = client->getState();
- mNeedForceQuit = (state == STATE_CHOOSE_SERVER
- || state == STATE_CONNECT_SERVER || state == STATE_LOGIN
- || state == STATE_PRE_LOGIN || state == STATE_LOGIN_ATTEMPT
- || state == STATE_UPDATE || state == STATE_LOAD_DATA);
+ mNeedForceQuit = (state == State::CHOOSE_SERVER
+ || state == State::CONNECT_SERVER || state == State::LOGIN
+ || state == State::PRE_LOGIN || state == State::LOGIN_ATTEMPT
+ || state == State::UPDATE || state == State::LOAD_DATA);
// All states, when we're not logged in to someone.
if (mNeedForceQuit)
@@ -90,7 +90,7 @@ QuitDialog::QuitDialog(QuitDialog **const pointerToMe) :
placeOption(placer, mSwitchAccountServer);
// Only added if we are connected to a gameserver
- if (state == STATE_GAME)
+ if (state == State::GAME)
placeOption(placer, mSwitchCharacter);
}
@@ -157,12 +157,12 @@ void QuitDialog::action(const ActionEvent &event)
if (mForceQuit->isSelected())
{
- client->setState(STATE_FORCE_QUIT);
+ client->setState(State::FORCE_QUIT);
}
else if (mLogoutQuit->isSelected())
{
DialogsManager::closeDialogs();
- client->setState(STATE_EXIT);
+ client->setState(State::EXIT);
}
else if (mRate && mRate->isSelected())
{
@@ -171,23 +171,23 @@ void QuitDialog::action(const ActionEvent &event)
config.setValue("rated", true);
if (mNeedForceQuit)
{
- client->setState(STATE_FORCE_QUIT);
+ client->setState(State::FORCE_QUIT);
}
else
{
DialogsManager::closeDialogs();
- client->setState(STATE_EXIT);
+ client->setState(State::EXIT);
}
}
else if (gameHandler->isConnected()
&& mSwitchAccountServer->isSelected())
{
DialogsManager::closeDialogs();
- client->setState(STATE_SWITCH_SERVER);
+ client->setState(State::SWITCH_SERVER);
}
else if (mSwitchCharacter->isSelected())
{
- if (client->getState() == STATE_GAME)
+ if (client->getState() == State::GAME)
{
charServerHandler->switchCharacter();
DialogsManager::closeDialogs();
diff --git a/src/gui/windows/registerdialog.cpp b/src/gui/windows/registerdialog.cpp
index 373a0f118..4c19ce01d 100644
--- a/src/gui/windows/registerdialog.cpp
+++ b/src/gui/windows/registerdialog.cpp
@@ -286,7 +286,7 @@ void RegisterDialog::action(const ActionEvent &event)
mLoginData->email = mEmailField->getText();
mLoginData->registerLogin = true;
- client->setState(STATE_REGISTER_ATTEMPT);
+ client->setState(State::REGISTER_ATTEMPT);
}
}
}
@@ -319,12 +319,12 @@ bool RegisterDialog::canSubmit() const
return !mUserField->getText().empty() &&
!mPasswordField->getText().empty() &&
!mConfirmField->getText().empty() &&
- client->getState() == STATE_REGISTER &&
+ client->getState() == State::REGISTER &&
(!mEmailField || !mEmailField->getText().empty());
}
void RegisterDialog::close()
{
- client->setState(STATE_LOGIN);
+ client->setState(State::LOGIN);
Window::close();
}
diff --git a/src/gui/windows/serverdialog.cpp b/src/gui/windows/serverdialog.cpp
index 135172f35..e35c3c8de 100644
--- a/src/gui/windows/serverdialog.cpp
+++ b/src/gui/windows/serverdialog.cpp
@@ -214,7 +214,7 @@ ServerDialog::~ServerDialog()
void ServerDialog::connectToSelectedServer()
{
- if (client->getState() == STATE_CONNECT_SERVER)
+ if (client->getState() == State::CONNECT_SERVER)
return;
const int index = mServersList->getSelected();
@@ -263,7 +263,7 @@ void ServerDialog::connectToSelectedServer()
config.setValue("usePersistentIP",
mPersistentIPCheckBox->isSelected());
- client->setState(STATE_CONNECT_SERVER);
+ client->setState(State::CONNECT_SERVER);
}
void ServerDialog::action(const ActionEvent &event)
@@ -314,7 +314,7 @@ void ServerDialog::keyPressed(KeyEvent &event)
{
case InputAction::GUI_CANCEL:
event.consume();
- client->setState(STATE_EXIT);
+ client->setState(State::EXIT);
return;
case InputAction::GUI_SELECT:
@@ -770,6 +770,6 @@ void ServerDialog::close()
{
if (mDownload)
mDownload->cancel();
- client->setState(STATE_FORCE_QUIT);
+ client->setState(State::FORCE_QUIT);
Window::close();
}
diff --git a/src/gui/windows/unregisterdialog.cpp b/src/gui/windows/unregisterdialog.cpp
index 80a02a952..69a3d2310 100644
--- a/src/gui/windows/unregisterdialog.cpp
+++ b/src/gui/windows/unregisterdialog.cpp
@@ -107,7 +107,7 @@ void UnRegisterDialog::action(const ActionEvent &event)
const std::string &eventId = event.getId();
if (eventId == "cancel")
{
- client->setState(STATE_CHAR_SELECT);
+ client->setState(State::CHAR_SELECT);
}
else if (eventId == "unregister")
{
@@ -159,7 +159,7 @@ void UnRegisterDialog::action(const ActionEvent &event)
// No errors detected, unregister the new user.
mUnRegisterButton->setEnabled(false);
mLoginData->password = password;
- client->setState(STATE_UNREGISTER_ATTEMPT);
+ client->setState(State::UNREGISTER_ATTEMPT);
}
}
}
diff --git a/src/gui/windows/updaterwindow.cpp b/src/gui/windows/updaterwindow.cpp
index 79dfe29aa..784fd2ad5 100644
--- a/src/gui/windows/updaterwindow.cpp
+++ b/src/gui/windows/updaterwindow.cpp
@@ -291,10 +291,10 @@ void UpdaterWindow::enable()
mPlayButton->setEnabled(true);
mPlayButton->requestFocus();
- if (client->getState() != STATE_GAME)
+ if (client->getState() != State::GAME)
{
if (mUpdateType & UpdateType::Close)
- client->setState(STATE_LOAD_DATA);
+ client->setState(State::LOAD_DATA);
}
else
{
@@ -318,8 +318,8 @@ void UpdaterWindow::action(const ActionEvent &event)
}
else if (eventId == "play")
{
- if (client->getState() != STATE_GAME)
- client->setState(STATE_LOAD_DATA);
+ if (client->getState() != State::GAME)
+ client->setState(State::LOAD_DATA);
else
deleteSelf();
}
@@ -331,8 +331,8 @@ void UpdaterWindow::keyPressed(KeyEvent &event)
if (actionId == InputAction::GUI_CANCEL)
{
action(ActionEvent(nullptr, mCancelButton->getActionEventId()));
- if (client->getState() != STATE_GAME)
- client->setState(STATE_LOGIN);
+ if (client->getState() != State::GAME)
+ client->setState(State::LOGIN);
else
deleteSelf();
}
@@ -534,8 +534,8 @@ int UpdaterWindow::updateProgress(void *ptr,
uw->setProgress(progress);
- if ((client->getState() != STATE_UPDATE
- && client->getState() != STATE_GAME)
+ if ((client->getState() != State::UPDATE
+ && client->getState() != State::GAME)
|| uw->mDownloadStatus == UPDATE_ERROR)
{
// If the action was canceled return an error code to stop the mThread
diff --git a/src/gui/windows/worldselectdialog.cpp b/src/gui/windows/worldselectdialog.cpp
index 58078dfbc..2a20c9a02 100644
--- a/src/gui/windows/worldselectdialog.cpp
+++ b/src/gui/windows/worldselectdialog.cpp
@@ -107,12 +107,12 @@ void WorldSelectDialog::action(const ActionEvent &event)
settings.persistentIp);
// Check in case netcode moves us forward
- if (client->getState() == STATE_WORLD_SELECT)
- client->setState(STATE_WORLD_SELECT_ATTEMPT);
+ if (client->getState() == State::WORLD_SELECT)
+ client->setState(State::WORLD_SELECT_ATTEMPT);
}
else if (eventId == "login")
{
- client->setState(STATE_PRE_LOGIN);
+ client->setState(State::PRE_LOGIN);
}
}