summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-05-16 17:21:24 +0300
committerAndrei Karas <akaras@inbox.ru>2014-05-16 17:21:24 +0300
commit396b3e298b21677ebe3c6f5c2f5b837ac25625f2 (patch)
tree01cfca3609db046afebe5c9e11ba0a5a803e378f /src
parente50013d92b22faeffb8711d07a8f344ab71e9e57 (diff)
downloadmanaplus-396b3e298b21677ebe3c6f5c2f5b837ac25625f2.tar.gz
manaplus-396b3e298b21677ebe3c6f5c2f5b837ac25625f2.tar.bz2
manaplus-396b3e298b21677ebe3c6f5c2f5b837ac25625f2.tar.xz
manaplus-396b3e298b21677ebe3c6f5c2f5b837ac25625f2.zip
Move dialog type into separate file.
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt1
-rw-r--r--src/Makefile.am1
-rw-r--r--src/being/localplayer.cpp2
-rw-r--r--src/client.cpp10
-rw-r--r--src/gui/dialogtype.h36
-rw-r--r--src/gui/widgets/tabs/setup_input.cpp2
-rw-r--r--src/gui/widgets/tabs/setup_theme.cpp2
-rw-r--r--src/gui/windows/changeemaildialog.cpp2
-rw-r--r--src/gui/windows/changepassworddialog.cpp2
-rw-r--r--src/gui/windows/charcreatedialog.cpp2
-rw-r--r--src/gui/windows/charselectdialog.cpp5
-rw-r--r--src/gui/windows/editserverdialog.cpp2
-rw-r--r--src/gui/windows/okdialog.cpp4
-rw-r--r--src/gui/windows/okdialog.h17
-rw-r--r--src/gui/windows/registerdialog.cpp2
-rw-r--r--src/gui/windows/socialwindow.cpp2
-rw-r--r--src/gui/windows/unregisterdialog.cpp2
-rw-r--r--src/net/ea/charserverhandler.cpp5
-rw-r--r--src/net/ea/gamehandler.cpp5
-rw-r--r--src/net/ea/playerhandler.cpp6
20 files changed, 75 insertions, 35 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index e4307f1d8..a04bd8845 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -865,6 +865,7 @@ SET(SRCS
gui/chatlog.h
gui/cliprect.h
gui/color.h
+ gui/dialogtype.h
listeners/deathlistener.h
listeners/errorlistener.cpp
listeners/errorlistener.h
diff --git a/src/Makefile.am b/src/Makefile.am
index 1bf27a9fe..c963a244a 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -158,6 +158,7 @@ manaplus_SOURCES += events/actionevent.h \
gui/chatlog.h \
gui/cliprect.h \
gui/color.h \
+ gui/dialogtype.h \
listeners/deathlistener.h \
listeners/errorlistener.cpp \
listeners/errorlistener.h \
diff --git a/src/being/localplayer.cpp b/src/being/localplayer.cpp
index 08a74ad8b..29e8eaf03 100644
--- a/src/being/localplayer.cpp
+++ b/src/being/localplayer.cpp
@@ -1642,7 +1642,7 @@ void LocalPlayer::changeAwayMode()
// TRANSLATORS: away message box header
mAwayDialog = new OkDialog(_("Away"),
config.getStringValue("afkMessage"),
- DIALOG_SILENCE, true, false);
+ DialogType::SILENCE, true, false);
mAwayDialog->addActionListener(mAwayListener);
soundManager.volumeOff();
addAfkEffect();
diff --git a/src/client.cpp b/src/client.cpp
index 4469c1efc..d2b8fb474 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -1579,7 +1579,7 @@ int Client::gameExec()
logger->log1("State: LOGIN ERROR");
// TRANSLATORS: error dialog header
mCurrentDialog = new OkDialog(_("Error"),
- errorMessage, DIALOG_ERROR);
+ errorMessage, DialogType::ERROR);
mCurrentDialog->addActionListener(&loginListener);
mCurrentDialog = nullptr; // OkDialog deletes itself
BLOCK_END("Client::gameExec STATE_LOGIN_ERROR")
@@ -1590,7 +1590,7 @@ int Client::gameExec()
logger->log1("State: ACCOUNT CHANGE ERROR");
// TRANSLATORS: error dialog header
mCurrentDialog = new OkDialog(_("Error"),
- errorMessage, DIALOG_ERROR);
+ errorMessage, DialogType::ERROR);
mCurrentDialog->addActionListener(&accountListener);
mCurrentDialog = nullptr; // OkDialog deletes itself
BLOCK_END("Client::gameExec STATE_ACCOUNTCHANGE_ERROR")
@@ -1644,7 +1644,7 @@ int Client::gameExec()
// TRANSLATORS: password change message header
mCurrentDialog = new OkDialog(_("Password Change"),
// TRANSLATORS: password change message text
- _("Password changed successfully!"), DIALOG_ERROR);
+ _("Password changed successfully!"), DialogType::ERROR);
mCurrentDialog->addActionListener(&accountListener);
mCurrentDialog = nullptr; // OkDialog deletes itself
loginData.password = loginData.newPassword;
@@ -1668,7 +1668,7 @@ int Client::gameExec()
// TRANSLATORS: email change message header
mCurrentDialog = new OkDialog(_("Email Change"),
// TRANSLATORS: email change message text
- _("Email changed successfully!"), DIALOG_ERROR);
+ _("Email changed successfully!"), DialogType::ERROR);
mCurrentDialog->addActionListener(&accountListener);
mCurrentDialog = nullptr; // OkDialog deletes itself
break;
@@ -2959,7 +2959,7 @@ Window *Client::openErrorDialog(const std::string &header,
{
if (getSupportUrl().empty() || config.getBoolValue("hidesupport"))
{
- return new OkDialog(header, message, DIALOG_ERROR, modal);
+ return new OkDialog(header, message, DialogType::ERROR, modal);
}
else
{
diff --git a/src/gui/dialogtype.h b/src/gui/dialogtype.h
new file mode 100644
index 000000000..8da9f37fb
--- /dev/null
+++ b/src/gui/dialogtype.h
@@ -0,0 +1,36 @@
+/*
+ * The ManaPlus Client
+ * Copyright (C) 2004-2009 The Mana World Development Team
+ * Copyright (C) 2009-2010 The Mana Developers
+ * Copyright (C) 2011-2014 The ManaPlus Developers
+ *
+ * This file is part of The ManaPlus Client.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef GUI_DIALOG_TYPE_H
+#define GUI_DIALOG_TYPE_H
+
+namespace DialogType
+{
+ enum Type
+ {
+ OK = 0,
+ ERROR,
+ SILENCE
+ };
+}
+
+#endif // GUI_DIALOG_TYPE_H
diff --git a/src/gui/widgets/tabs/setup_input.cpp b/src/gui/widgets/tabs/setup_input.cpp
index f2651e086..4fae66b47 100644
--- a/src/gui/widgets/tabs/setup_input.cpp
+++ b/src/gui/widgets/tabs/setup_input.cpp
@@ -150,7 +150,7 @@ void Setup_Input::apply()
// TRANSLATORS: input settings error
strprintf(_("Conflict \"%s\" and \"%s\" keys. "
"Resolve them, or gameplay may result in strange behaviour."),
- gettext(str1.c_str()), gettext(str2.c_str())), DIALOG_ERROR);
+ gettext(str1.c_str()), gettext(str2.c_str())), DialogType::ERROR);
}
keyboard.setEnabled(true);
inputManager.store();
diff --git a/src/gui/widgets/tabs/setup_theme.cpp b/src/gui/widgets/tabs/setup_theme.cpp
index 5cf4e905b..5ef931249 100644
--- a/src/gui/widgets/tabs/setup_theme.cpp
+++ b/src/gui/widgets/tabs/setup_theme.cpp
@@ -306,7 +306,7 @@ void Setup_Theme::action(const ActionEvent &event)
else if (eventId == ACTION_INFO)
{
// TRANSLATORS: theme info dialog header
- new OkDialog(_("Theme info"), mThemeInfo, DIALOG_OK,
+ new OkDialog(_("Theme info"), mThemeInfo, DialogType::OK,
false, true, nullptr, 600);
}
}
diff --git a/src/gui/windows/changeemaildialog.cpp b/src/gui/windows/changeemaildialog.cpp
index 420dc3b76..1e5b526d7 100644
--- a/src/gui/windows/changeemaildialog.cpp
+++ b/src/gui/windows/changeemaildialog.cpp
@@ -165,7 +165,7 @@ void ChangeEmailDialog::action(const ActionEvent &event)
// TRANSLATORS: change email error header
OkDialog *const dlg = new OkDialog(_("Error"),
- errorMsg.str(), DIALOG_ERROR);
+ errorMsg.str(), DialogType::ERROR);
dlg->addActionListener(mWrongDataNoticeListener);
}
else
diff --git a/src/gui/windows/changepassworddialog.cpp b/src/gui/windows/changepassworddialog.cpp
index ea9084c5c..e8f6a5c0b 100644
--- a/src/gui/windows/changepassworddialog.cpp
+++ b/src/gui/windows/changepassworddialog.cpp
@@ -155,7 +155,7 @@ void ChangePasswordDialog::action(const ActionEvent &event)
// TRANSLATORS: change password error header
OkDialog *const dlg = new OkDialog(_("Error"),
- errorMsg.str(), DIALOG_ERROR);
+ errorMsg.str(), DialogType::ERROR);
dlg->addActionListener(mWrongDataNoticeListener);
}
else
diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp
index 34b4b5b5a..203ab01d2 100644
--- a/src/gui/windows/charcreatedialog.cpp
+++ b/src/gui/windows/charcreatedialog.cpp
@@ -356,7 +356,7 @@ void CharCreateDialog::action(const ActionEvent &event)
new OkDialog(_("Error"),
// TRANSLATORS: char creation error
_("Your name needs to be at least 4 characters."),
- DIALOG_ERROR, true, this);
+ DialogType::ERROR, true, this);
}
}
else if (id == "cancel")
diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp
index 559b1f349..5c12c5441 100644
--- a/src/gui/windows/charselectdialog.cpp
+++ b/src/gui/windows/charselectdialog.cpp
@@ -242,7 +242,7 @@ void CharSelectDialog::action(const ActionEvent &event)
character->data.mAttributes[Attributes::EXP]),
Units::formatCurrency(
character->data.mAttributes[Attributes::MONEY]).c_str());
- new OkDialog(data->getName(), msg, DIALOG_SILENCE);
+ new OkDialog(data->getName(), msg, DialogType::SILENCE);
}
}
if (eventId == "switch")
@@ -274,7 +274,8 @@ void CharSelectDialog::action(const ActionEvent &event)
else
{
// TRANSLATORS: error message
- new OkDialog(_("Error"), _("Incorrect password"), DIALOG_ERROR);
+ new OkDialog(_("Error"), _("Incorrect password"),
+ DialogType::ERROR);
}
mDeleteIndex = -1;
}
diff --git a/src/gui/windows/editserverdialog.cpp b/src/gui/windows/editserverdialog.cpp
index a3b687113..516efea4d 100644
--- a/src/gui/windows/editserverdialog.cpp
+++ b/src/gui/windows/editserverdialog.cpp
@@ -192,7 +192,7 @@ void EditServerDialog::action(const ActionEvent &event)
OkDialog *const dlg = new OkDialog(_("Error"),
// TRANSLATORS: edit server dialog error message
_("Please at least type both the address and the port "
- "of the server."), DIALOG_ERROR);
+ "of the server."), DialogType::ERROR);
dlg->addActionListener(this);
}
else
diff --git a/src/gui/windows/okdialog.cpp b/src/gui/windows/okdialog.cpp
index 3d734b7ad..5ab5356ca 100644
--- a/src/gui/windows/okdialog.cpp
+++ b/src/gui/windows/okdialog.cpp
@@ -78,9 +78,9 @@ OkDialog::OkDialog(const std::string &restrict title,
setVisible(true);
okButton->requestFocus();
- if (soundEvent == DIALOG_OK)
+ if (soundEvent == DialogType::OK)
soundManager.playGuiSound(SOUND_INFO);
- else if (soundEvent == DIALOG_ERROR)
+ else if (soundEvent == DialogType::ERROR)
soundManager.playGuiSound(SOUND_ERROR);
}
diff --git a/src/gui/windows/okdialog.h b/src/gui/windows/okdialog.h
index b8236dfbc..5017207cd 100644
--- a/src/gui/windows/okdialog.h
+++ b/src/gui/windows/okdialog.h
@@ -23,20 +23,15 @@
#ifndef GUI_WINDOWS_OKDIALOG_H
#define GUI_WINDOWS_OKDIALOG_H
-#include "localconsts.h"
+#include "gui/dialogtype.h"
#include "gui/widgets/window.h"
#include "listeners/actionlistener.h"
-class TextBox;
+#include "localconsts.h"
-enum
-{
- DIALOG_OK = 0,
- DIALOG_ERROR,
- DIALOG_SILENCE
-};
+class TextBox;
/**
* An 'Ok' button dialog.
@@ -54,8 +49,10 @@ class OkDialog final : public Window,
*/
OkDialog(const std::string &restrict title,
const std::string &restrict msg,
- const int soundEvent = DIALOG_OK, const bool modal = true,
- const bool showCenter = true, Window *const parent = nullptr,
+ const int soundEvent = DialogType::OK,
+ const bool modal = true,
+ const bool showCenter = true,
+ Window *const parent = nullptr,
const int minWidth = 260);
A_DELETE_COPY(OkDialog)
diff --git a/src/gui/windows/registerdialog.cpp b/src/gui/windows/registerdialog.cpp
index 375a34137..0f0d85c9c 100644
--- a/src/gui/windows/registerdialog.cpp
+++ b/src/gui/windows/registerdialog.cpp
@@ -258,7 +258,7 @@ void RegisterDialog::action(const ActionEvent &event)
OkDialog *const dlg = new OkDialog(
// TRANSLATORS: error message
- _("Error"), errorMsg, DIALOG_ERROR);
+ _("Error"), errorMsg, DialogType::ERROR);
dlg->addActionListener(mWrongDataNoticeListener);
}
else
diff --git a/src/gui/windows/socialwindow.cpp b/src/gui/windows/socialwindow.cpp
index 28d27e82b..711f5b8bc 100644
--- a/src/gui/windows/socialwindow.cpp
+++ b/src/gui/windows/socialwindow.cpp
@@ -1683,7 +1683,7 @@ void SocialWindow::showPartyCreate()
// TRANSLATORS: party creation message
new OkDialog(_("Create Party"),
_("Cannot create party. You are already in a party"),
- DIALOG_ERROR, true, true, this);
+ DialogType::ERROR, true, true, this);
return;
}
diff --git a/src/gui/windows/unregisterdialog.cpp b/src/gui/windows/unregisterdialog.cpp
index e35c27aa2..8b9721f40 100644
--- a/src/gui/windows/unregisterdialog.cpp
+++ b/src/gui/windows/unregisterdialog.cpp
@@ -144,7 +144,7 @@ void UnRegisterDialog::action(const ActionEvent &event)
// TRANSLATORS: unregister dialog. error message.
OkDialog *const dlg = new OkDialog(_("Error"),
- errorMsg.str(), DIALOG_ERROR);
+ errorMsg.str(), DialogType::ERROR);
dlg->addActionListener(mWrongDataNoticeListener);
}
else
diff --git a/src/net/ea/charserverhandler.cpp b/src/net/ea/charserverhandler.cpp
index 849fe15e1..067d9119f 100644
--- a/src/net/ea/charserverhandler.cpp
+++ b/src/net/ea/charserverhandler.cpp
@@ -199,7 +199,7 @@ void CharServerHandler::processCharCreateFailed(Net::MessageIn &msg)
break;
}
// TRANSLATORS: error message header
- new OkDialog(_("Error"), errorMessage, DIALOG_ERROR);
+ new OkDialog(_("Error"), errorMessage, DialogType::ERROR);
if (mCharCreateDialog)
mCharCreateDialog->unlock();
BLOCK_END("CharServerHandler::processCharCreateFailed")
@@ -223,7 +223,8 @@ void CharServerHandler::processCharDeleteFailed(Net::MessageIn &msg A_UNUSED)
BLOCK_START("CharServerHandler::processCharDeleteFailed")
unlockCharSelectDialog();
// TRANSLATORS: error message
- new OkDialog(_("Error"), _("Failed to delete character."), DIALOG_ERROR);
+ new OkDialog(_("Error"), _("Failed to delete character."),
+ DialogType::ERROR);
BLOCK_END("CharServerHandler::processCharDeleteFailed")
}
diff --git a/src/net/ea/gamehandler.cpp b/src/net/ea/gamehandler.cpp
index b0be76ac6..3d7da6247 100644
--- a/src/net/ea/gamehandler.cpp
+++ b/src/net/ea/gamehandler.cpp
@@ -85,7 +85,10 @@ void GameHandler::processCharSwitchResponse(Net::MessageIn &msg) const
void GameHandler::processMapQuitResponse(Net::MessageIn &msg) const
{
if (msg.readInt8())
- new OkDialog(_("Game"), _("Request to quit denied!"), DIALOG_ERROR);
+ {
+ new OkDialog(_("Game"), _("Request to quit denied!"),
+ DialogType::ERROR);
+ }
}
void GameHandler::clear()
diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp
index efaee8857..065ac6365 100644
--- a/src/net/ea/playerhandler.cpp
+++ b/src/net/ea/playerhandler.cpp
@@ -305,7 +305,7 @@ void PlayerHandler::processPlayerStatUpdate1(Net::MessageIn &msg)
// TRANSLATORS: weight message
_("You are carrying more than "
"half your weight. You are "
- "unable to regain health."), DIALOG_OK, false);
+ "unable to regain health."), DialogType::OK, false);
weightNotice->addActionListener(
&weightListener);
}
@@ -317,7 +317,7 @@ void PlayerHandler::processPlayerStatUpdate1(Net::MessageIn &msg)
// TRANSLATORS: weight message
_("You are carrying less than "
"half your weight. You "
- "can regain health."), DIALOG_OK, false);
+ "can regain health."), DialogType::OK, false);
weightNotice->addActionListener(
&weightListener);
}
@@ -398,7 +398,7 @@ void PlayerHandler::processPlayerStatUpdate1(Net::MessageIn &msg)
{
// TRANSLATORS: message header
deathNotice = new OkDialog(_("Message"),
- DeadDB::getRandomString(), DIALOG_OK, false);
+ DeadDB::getRandomString(), DialogType::OK, false);
deathNotice->addActionListener(&deathListener);
if (player_node->getCurrentAction() != BeingAction::DEAD)
{