summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-02-07 01:10:59 +0300
committerAndrei Karas <akaras@inbox.ru>2013-02-07 01:10:59 +0300
commit00ed76a265c1ee4ea4989f5de32ab80b6adb6623 (patch)
tree1e450140ce1b4dfa8811f8435a91ce1636224296 /src
parent7c51bd3c7f488de09a56fdd3a7d14af3763b45e2 (diff)
downloadmanaplus-00ed76a265c1ee4ea4989f5de32ab80b6adb6623.tar.gz
manaplus-00ed76a265c1ee4ea4989f5de32ab80b6adb6623.tar.bz2
manaplus-00ed76a265c1ee4ea4989f5de32ab80b6adb6623.tar.xz
manaplus-00ed76a265c1ee4ea4989f5de32ab80b6adb6623.zip
Add missing close button to some windows.
Diffstat (limited to 'src')
-rw-r--r--src/gui/charselectdialog.cpp10
-rw-r--r--src/gui/charselectdialog.h2
-rw-r--r--src/gui/logindialog.cpp10
-rw-r--r--src/gui/logindialog.h2
-rw-r--r--src/gui/registerdialog.cpp10
-rw-r--r--src/gui/registerdialog.h2
-rw-r--r--src/gui/serverdialog.cpp1
7 files changed, 33 insertions, 4 deletions
diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp
index fd9eb1e88..f87bb6b93 100644
--- a/src/gui/charselectdialog.cpp
+++ b/src/gui/charselectdialog.cpp
@@ -153,7 +153,7 @@ CharSelectDialog::CharSelectDialog(LoginData *const data):
mDeleteDialog(nullptr),
mDeleteIndex(-1)
{
- setCloseButton(false);
+ setCloseButton(true);
const int optionalActions = Net::getLoginHandler()
->supportedOptionalActions();
@@ -250,7 +250,7 @@ void CharSelectDialog::action(const gcn::ActionEvent &event)
}
else if (eventId == "switch")
{
- Client::setState(STATE_SWITCH_LOGIN);
+ close();
}
else if (eventId == "change_password")
{
@@ -557,6 +557,12 @@ bool CharSelectDialog::selectByName(const std::string &name,
return false;
}
+void CharSelectDialog::close()
+{
+ Client::setState(STATE_SWITCH_LOGIN);
+ Window::close();
+}
+
CharacterDisplay::CharacterDisplay(const Widget2 *const widget,
CharSelectDialog *const charSelectDialog) :
diff --git a/src/gui/charselectdialog.h b/src/gui/charselectdialog.h
index 87716f78e..c43bcca09 100644
--- a/src/gui/charselectdialog.h
+++ b/src/gui/charselectdialog.h
@@ -91,6 +91,8 @@ class CharSelectDialog final : public Window,
void askPasswordForDeletion(const int index);
+ void close() override;
+
private:
void attemptCharacterDelete(const int index);
diff --git a/src/gui/logindialog.cpp b/src/gui/logindialog.cpp
index c8304a61e..6d349243e 100644
--- a/src/gui/logindialog.cpp
+++ b/src/gui/logindialog.cpp
@@ -152,6 +152,8 @@ LoginDialog::LoginDialog(LoginData *const data, std::string serverName,
mUpdateHost(updateHost),
mServerName(serverName)
{
+ setCloseButton(true);
+
Label *const serverLabel1 = new Label(this, _("Server:"));
Label *const serverLabel2 = new Label(this, serverName);
serverLabel2->adjustSize();
@@ -255,7 +257,7 @@ void LoginDialog::action(const gcn::ActionEvent &event)
}
else if (event.getId() == "server")
{
- Client::setState(STATE_SWITCH_SERVER);
+ close();
}
else if (event.getId() == "register")
{
@@ -370,3 +372,9 @@ void LoginDialog::prepareUpdate()
else
LoginDialog::savedPasswordKey = "-";
}
+
+void LoginDialog::close()
+{
+ Client::setState(STATE_SWITCH_SERVER);
+ Window::close();
+}
diff --git a/src/gui/logindialog.h b/src/gui/logindialog.h
index bf22e01e6..dbe2fa167 100644
--- a/src/gui/logindialog.h
+++ b/src/gui/logindialog.h
@@ -72,6 +72,8 @@ class LoginDialog final : public Window, public gcn::ActionListener,
*/
void keyPressed(gcn::KeyEvent &keyEvent) override;
+ void close() override;
+
static std::string savedPasswordKey;
static std::string savedPassword;
diff --git a/src/gui/registerdialog.cpp b/src/gui/registerdialog.cpp
index d803bd89e..53ce9b3d3 100644
--- a/src/gui/registerdialog.cpp
+++ b/src/gui/registerdialog.cpp
@@ -78,6 +78,8 @@ RegisterDialog::RegisterDialog(LoginData *const data):
mOtherButton(nullptr),
mWrongDataNoticeListener(new WrongDataNoticeListener)
{
+ setCloseButton(true);
+
const int optionalActions = Net::getLoginHandler()->
supportedOptionalActions();
@@ -168,7 +170,7 @@ void RegisterDialog::action(const gcn::ActionEvent &event)
{
if (event.getId() == "cancel")
{
- Client::setState(STATE_LOGIN);
+ close();
}
else if (event.getId() == "register" && canSubmit())
{
@@ -301,3 +303,9 @@ bool RegisterDialog::canSubmit() const
!mConfirmField->getText().empty() &&
Client::getState() == STATE_REGISTER;
}
+
+void RegisterDialog::close()
+{
+ Client::setState(STATE_LOGIN);
+ Window::close();
+}
diff --git a/src/gui/registerdialog.h b/src/gui/registerdialog.h
index 83d76d772..02995de85 100644
--- a/src/gui/registerdialog.h
+++ b/src/gui/registerdialog.h
@@ -89,6 +89,8 @@ class RegisterDialog final : public Window, public gcn::ActionListener,
*/
void keyPressed(gcn::KeyEvent &keyEvent) override;
+ void close() override;
+
private:
/**
* Returns whether submit can be enabled. This is true in the register
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp
index e07a222e2..9e3372dca 100644
--- a/src/gui/serverdialog.cpp
+++ b/src/gui/serverdialog.cpp
@@ -830,4 +830,5 @@ void ServerDialog::close()
if (mDownload)
mDownload->cancel();
Client::setState(STATE_FORCE_QUIT);
+ Window::close();
}