From e6d251345a48108495d39d82b0ec79deac63d86d Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 5 May 2015 18:40:31 +0300 Subject: Add strong typed bool type in OkDialog. --- src/actions/actions.cpp | 2 +- src/client.cpp | 8 ++++---- src/enums/simpletypes.h | 1 + src/gamemodifiers.cpp | 2 +- src/gui/dialogsmanager.cpp | 14 ++++++++++---- src/gui/widgets/tabs/setup_input.cpp | 2 +- src/gui/widgets/tabs/setup_theme.cpp | 9 +++++---- src/gui/widgets/tabs/setup_video.cpp | 8 ++++---- src/gui/windows/changeemaildialog.cpp | 2 +- src/gui/windows/changepassworddialog.cpp | 2 +- src/gui/windows/charcreatedialog.cpp | 2 +- src/gui/windows/charselectdialog.cpp | 4 ++-- src/gui/windows/editserverdialog.cpp | 2 +- src/gui/windows/okdialog.cpp | 4 ++-- src/gui/windows/okdialog.h | 2 +- src/gui/windows/registerdialog.cpp | 2 +- src/gui/windows/socialwindow.cpp | 2 +- src/gui/windows/unregisterdialog.cpp | 2 +- src/net/ea/charserverhandler.cpp | 4 ++-- src/net/ea/gamehandler.cpp | 2 +- src/net/eathena/charserverhandler.cpp | 8 ++++---- src/net/tmwa/charserverhandler.cpp | 2 +- 22 files changed, 47 insertions(+), 39 deletions(-) diff --git a/src/actions/actions.cpp b/src/actions/actions.cpp index 9c88debcb..f9b0c0550 100644 --- a/src/actions/actions.cpp +++ b/src/actions/actions.cpp @@ -148,7 +148,7 @@ static int uploadUpdate(void *ptr, _("OK"), DialogType::OK, Modal_true, - false, + ShowCenter_false, nullptr, 260); } diff --git a/src/client.cpp b/src/client.cpp index 1287e3789..a9354342c 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -1394,7 +1394,7 @@ int Client::gameExec() _("Close"), DialogType::ERROR, Modal_true, - true, + ShowCenter_true, nullptr, 260); mCurrentDialog->addActionListener(&loginListener); @@ -1412,7 +1412,7 @@ int Client::gameExec() _("Close"), DialogType::ERROR, Modal_true, - true, + ShowCenter_true, nullptr, 260); mCurrentDialog->addActionListener(&accountListener); @@ -1473,7 +1473,7 @@ int Client::gameExec() _("OK"), DialogType::ERROR, Modal_true, - true, + ShowCenter_true, nullptr, 260); mCurrentDialog->addActionListener(&accountListener); @@ -1504,7 +1504,7 @@ int Client::gameExec() _("OK"), DialogType::ERROR, Modal_true, - true, + ShowCenter_true, nullptr, 260); mCurrentDialog->addActionListener(&accountListener); diff --git a/src/enums/simpletypes.h b/src/enums/simpletypes.h index 6cb0abcbd..c32f22413 100644 --- a/src/enums/simpletypes.h +++ b/src/enums/simpletypes.h @@ -53,5 +53,6 @@ defBoolEnum(Favorite); defBoolEnum(Equipm); defBoolEnum(Equipped); defBoolEnum(Modal); +defBoolEnum(ShowCenter); #endif // ENUMS_SIMPLETYPES_H diff --git a/src/gamemodifiers.cpp b/src/gamemodifiers.cpp index 076cf2653..5cc79f7c6 100644 --- a/src/gamemodifiers.cpp +++ b/src/gamemodifiers.cpp @@ -439,7 +439,7 @@ void GameModifiers::changeAwayMode(const bool forward A_UNUSED) _("OK"), DialogType::SILENCE, Modal_true, - false, + ShowCenter_false, nullptr, 260); localPlayer->setAwayDialog(dialog); diff --git a/src/gui/dialogsmanager.cpp b/src/gui/dialogsmanager.cpp index b71a27664..9d2bcb057 100644 --- a/src/gui/dialogsmanager.cpp +++ b/src/gui/dialogsmanager.cpp @@ -105,7 +105,10 @@ Window *DialogsManager::openErrorDialog(const std::string &header, // TRANSLATORS: ok dialog button _("Close"), DialogType::ERROR, - modal, true, nullptr, 260); + modal, + ShowCenter_true, + nullptr, + 260); } else { @@ -129,7 +132,10 @@ void DialogsManager::playerDeath() // TRANSLATORS: ok dialog button _("Revive"), DialogType::OK, - Modal_false, true, nullptr, 260); + Modal_false, + ShowCenter_true, + nullptr, + 260); deathNotice->addActionListener(&postDeathListener); } } @@ -158,7 +164,7 @@ void DialogsManager::attributeChanged(const int id, _("OK"), DialogType::OK, Modal_false, - true, + ShowCenter_true, nullptr, 260); weightNotice->addActionListener( @@ -177,7 +183,7 @@ void DialogsManager::attributeChanged(const int id, _("OK"), DialogType::OK, Modal_false, - true, + ShowCenter_true, nullptr, 260); weightNotice->addActionListener( diff --git a/src/gui/widgets/tabs/setup_input.cpp b/src/gui/widgets/tabs/setup_input.cpp index 3328cdb28..4eb81bc4a 100644 --- a/src/gui/widgets/tabs/setup_input.cpp +++ b/src/gui/widgets/tabs/setup_input.cpp @@ -164,7 +164,7 @@ void Setup_Input::apply() _("OK"), DialogType::ERROR, Modal_true, - true, + ShowCenter_true, nullptr, 260); } diff --git a/src/gui/widgets/tabs/setup_theme.cpp b/src/gui/widgets/tabs/setup_theme.cpp index e795b0928..9efba0897 100644 --- a/src/gui/widgets/tabs/setup_theme.cpp +++ b/src/gui/widgets/tabs/setup_theme.cpp @@ -312,7 +312,7 @@ void Setup_Theme::action(const ActionEvent &event) _("OK"), DialogType::OK, Modal_false, - true, + ShowCenter_true, nullptr, 600); } @@ -340,13 +340,14 @@ void Setup_Theme::apply() if (config.getStringValue("theme") != mTheme) { // TRANSLATORS: theme message dialog - new OkDialog(_("Theme Changed"), _("Restart your client for " - "the change to take effect."), + new OkDialog(_("Theme Changed"), + // TRANSLATORS: ok dialog message + _("Restart your client for the change to take effect."), // TRANSLATORS: ok dialog button _("OK"), DialogType::OK, Modal_true, - true, + ShowCenter_true, nullptr, 260); } diff --git a/src/gui/widgets/tabs/setup_video.cpp b/src/gui/widgets/tabs/setup_video.cpp index 8c4be5f85..c2ee237e5 100644 --- a/src/gui/widgets/tabs/setup_video.cpp +++ b/src/gui/widgets/tabs/setup_video.cpp @@ -250,7 +250,7 @@ void Setup_Video::apply() _("OK"), DialogType::OK, Modal_true, - true, + ShowCenter_true, nullptr, 260); } @@ -277,7 +277,7 @@ void Setup_Video::apply() _("OK"), DialogType::OK, Modal_true, - true, + ShowCenter_true, nullptr, 260); } @@ -395,7 +395,7 @@ void Setup_Video::action(const ActionEvent &event) _("OK"), DialogType::OK, Modal_true, - true, + ShowCenter_true, nullptr, 260); } @@ -410,7 +410,7 @@ void Setup_Video::action(const ActionEvent &event) _("OK"), DialogType::OK, Modal_true, - true, + ShowCenter_true, nullptr, 260); } diff --git a/src/gui/windows/changeemaildialog.cpp b/src/gui/windows/changeemaildialog.cpp index 953f8e75c..fcfd0bfd3 100644 --- a/src/gui/windows/changeemaildialog.cpp +++ b/src/gui/windows/changeemaildialog.cpp @@ -167,7 +167,7 @@ void ChangeEmailDialog::action(const ActionEvent &event) _("OK"), DialogType::ERROR, Modal_true, - true, + ShowCenter_true, nullptr, 260); dlg->addActionListener(mWrongDataNoticeListener); diff --git a/src/gui/windows/changepassworddialog.cpp b/src/gui/windows/changepassworddialog.cpp index 24f8055f6..3fae963ed 100644 --- a/src/gui/windows/changepassworddialog.cpp +++ b/src/gui/windows/changepassworddialog.cpp @@ -157,7 +157,7 @@ void ChangePasswordDialog::action(const ActionEvent &event) _("OK"), DialogType::ERROR, Modal_true, - true, + ShowCenter_true, nullptr, 260); dlg->addActionListener(mWrongDataNoticeListener); diff --git a/src/gui/windows/charcreatedialog.cpp b/src/gui/windows/charcreatedialog.cpp index 065e6db15..4b10d5cf3 100644 --- a/src/gui/windows/charcreatedialog.cpp +++ b/src/gui/windows/charcreatedialog.cpp @@ -380,7 +380,7 @@ void CharCreateDialog::action(const ActionEvent &event) _("OK"), DialogType::ERROR, Modal_true, - this, + ShowCenter_true, nullptr, 260); } diff --git a/src/gui/windows/charselectdialog.cpp b/src/gui/windows/charselectdialog.cpp index 6d3c75e87..4dc0440aa 100644 --- a/src/gui/windows/charselectdialog.cpp +++ b/src/gui/windows/charselectdialog.cpp @@ -280,7 +280,7 @@ void CharSelectDialog::action(const ActionEvent &event) _("OK"), DialogType::SILENCE, Modal_true, - true, + ShowCenter_true, nullptr, 260); } @@ -325,7 +325,7 @@ void CharSelectDialog::action(const ActionEvent &event) _("OK"), DialogType::ERROR, Modal_true, - true, + ShowCenter_true, nullptr, 260); } diff --git a/src/gui/windows/editserverdialog.cpp b/src/gui/windows/editserverdialog.cpp index 5ad5c9c32..a9be34595 100644 --- a/src/gui/windows/editserverdialog.cpp +++ b/src/gui/windows/editserverdialog.cpp @@ -217,7 +217,7 @@ void EditServerDialog::action(const ActionEvent &event) _("OK"), DialogType::ERROR, Modal_true, - true, + ShowCenter_true, nullptr, 260); dlg->addActionListener(this); diff --git a/src/gui/windows/okdialog.cpp b/src/gui/windows/okdialog.cpp index 1f77af3f9..1a6c0c3c8 100644 --- a/src/gui/windows/okdialog.cpp +++ b/src/gui/windows/okdialog.cpp @@ -39,7 +39,7 @@ OkDialog::OkDialog(const std::string &restrict title, const std::string &restrict button, const int soundEvent, const Modal modal, - const bool showCenter, + const ShowCenter showCenter, Window *const parent, const int minWidth) : Window(title, modal, parent, "ok.xml"), @@ -73,7 +73,7 @@ OkDialog::OkDialog(const std::string &restrict title, add(mTextBox); add(okButton); - if (showCenter) + if (showCenter == ShowCenter_true) center(); else centerHorisontally(); diff --git a/src/gui/windows/okdialog.h b/src/gui/windows/okdialog.h index 3d7fd140b..1a6b022d9 100644 --- a/src/gui/windows/okdialog.h +++ b/src/gui/windows/okdialog.h @@ -50,7 +50,7 @@ class OkDialog final : public Window, const std::string &restrict button, const int soundEvent, const Modal modal, - const bool showCenter, + const ShowCenter showCenter, Window *const parent, const int minWidth); diff --git a/src/gui/windows/registerdialog.cpp b/src/gui/windows/registerdialog.cpp index dca38dad6..70537bd95 100644 --- a/src/gui/windows/registerdialog.cpp +++ b/src/gui/windows/registerdialog.cpp @@ -243,7 +243,7 @@ void RegisterDialog::action(const ActionEvent &event) _("Error"), errorMsg, _("OK"), DialogType::ERROR, Modal_true, - true, + ShowCenter_true, nullptr, 260); dlg->addActionListener(mWrongDataNoticeListener); diff --git a/src/gui/windows/socialwindow.cpp b/src/gui/windows/socialwindow.cpp index f1d5550dd..ffe9688c6 100644 --- a/src/gui/windows/socialwindow.cpp +++ b/src/gui/windows/socialwindow.cpp @@ -507,7 +507,7 @@ void SocialWindow::showPartyCreate() _("OK"), DialogType::ERROR, Modal_true, - true, + ShowCenter_true, this, 260); return; diff --git a/src/gui/windows/unregisterdialog.cpp b/src/gui/windows/unregisterdialog.cpp index 7dc18da4e..32b2e9555 100644 --- a/src/gui/windows/unregisterdialog.cpp +++ b/src/gui/windows/unregisterdialog.cpp @@ -146,7 +146,7 @@ void UnRegisterDialog::action(const ActionEvent &event) _("OK"), DialogType::ERROR, Modal_true, - true, + ShowCenter_true, nullptr, 260); dlg->addActionListener(mWrongDataNoticeListener); diff --git a/src/net/ea/charserverhandler.cpp b/src/net/ea/charserverhandler.cpp index e7e99af8b..6348b5dc5 100644 --- a/src/net/ea/charserverhandler.cpp +++ b/src/net/ea/charserverhandler.cpp @@ -143,7 +143,7 @@ void CharServerHandler::processCharCreateFailed(Net::MessageIn &msg) _("OK"), DialogType::ERROR, Modal_true, - true, + ShowCenter_true, nullptr, 260); if (mCharCreateDialog) @@ -165,7 +165,7 @@ void CharServerHandler::processCharDelete(Net::MessageIn &msg A_UNUSED) _("OK"), DialogType::OK, Modal_true, - true, + ShowCenter_true, nullptr, 260); BLOCK_END("CharServerHandler::processCharDelete") diff --git a/src/net/ea/gamehandler.cpp b/src/net/ea/gamehandler.cpp index 000d9e8ad..9c100de00 100644 --- a/src/net/ea/gamehandler.cpp +++ b/src/net/ea/gamehandler.cpp @@ -83,7 +83,7 @@ void GameHandler::processMapQuitResponse(Net::MessageIn &msg) _("OK"), DialogType::ERROR, Modal_true, - true, + ShowCenter_true, nullptr, 260); } diff --git a/src/net/eathena/charserverhandler.cpp b/src/net/eathena/charserverhandler.cpp index 8ff7d4b1a..f3ce778cf 100644 --- a/src/net/eathena/charserverhandler.cpp +++ b/src/net/eathena/charserverhandler.cpp @@ -579,7 +579,7 @@ void CharServerHandler::processCharCheckRename(Net::MessageIn &msg) _("Error"), DialogType::ERROR, Modal_true, - true, + ShowCenter_true, nullptr, 260); } @@ -597,7 +597,7 @@ void CharServerHandler::processCharRename(Net::MessageIn &msg) _("OK"), DialogType::OK, Modal_true, - true, + ShowCenter_true, nullptr, 260); } @@ -630,7 +630,7 @@ void CharServerHandler::processCharRename(Net::MessageIn &msg) _("OK"), DialogType::OK, Modal_true, - true, + ShowCenter_true, nullptr, 260); } @@ -663,7 +663,7 @@ void CharServerHandler::processCharDeleteFailed(Net::MessageIn &msg) _("OK"), DialogType::ERROR, Modal_true, - true, + ShowCenter_true, nullptr, 260); BLOCK_END("CharServerHandler::processCharDeleteFailed") diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp index 6a647fcac..b33e0e4e2 100644 --- a/src/net/tmwa/charserverhandler.cpp +++ b/src/net/tmwa/charserverhandler.cpp @@ -523,7 +523,7 @@ void CharServerHandler::processCharDeleteFailed(Net::MessageIn &msg) _("OK"), DialogType::ERROR, Modal_true, - true, + ShowCenter_true, nullptr, 260); BLOCK_END("CharServerHandler::processCharDeleteFailed") -- cgit v1.2.3-70-g09d2