diff options
author | Andrei Karas <akaras@inbox.ru> | 2014-05-16 17:21:24 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2014-05-16 17:21:24 +0300 |
commit | 396b3e298b21677ebe3c6f5c2f5b837ac25625f2 (patch) | |
tree | 01cfca3609db046afebe5c9e11ba0a5a803e378f /src/gui | |
parent | e50013d92b22faeffb8711d07a8f344ab71e9e57 (diff) | |
download | manaverse-396b3e298b21677ebe3c6f5c2f5b837ac25625f2.tar.gz manaverse-396b3e298b21677ebe3c6f5c2f5b837ac25625f2.tar.bz2 manaverse-396b3e298b21677ebe3c6f5c2f5b837ac25625f2.tar.xz manaverse-396b3e298b21677ebe3c6f5c2f5b837ac25625f2.zip |
Move dialog type into separate file.
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/dialogtype.h | 36 | ||||
-rw-r--r-- | src/gui/widgets/tabs/setup_input.cpp | 2 | ||||
-rw-r--r-- | src/gui/widgets/tabs/setup_theme.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/changeemaildialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/changepassworddialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/charcreatedialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/charselectdialog.cpp | 5 | ||||
-rw-r--r-- | src/gui/windows/editserverdialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/okdialog.cpp | 4 | ||||
-rw-r--r-- | src/gui/windows/okdialog.h | 17 | ||||
-rw-r--r-- | src/gui/windows/registerdialog.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/socialwindow.cpp | 2 | ||||
-rw-r--r-- | src/gui/windows/unregisterdialog.cpp | 2 |
13 files changed, 57 insertions, 23 deletions
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 |