From 5781d238e97689be482c5ac691143ce35e3e278e Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Wed, 14 May 2014 15:36:21 +0300 Subject: Move playerlistener into separate file. --- src/gui/popups/popupmenu.cpp | 22 ---------------------- src/gui/popups/popupmenu.h | 25 +------------------------ 2 files changed, 1 insertion(+), 46 deletions(-) (limited to 'src/gui/popups') diff --git a/src/gui/popups/popupmenu.cpp b/src/gui/popups/popupmenu.cpp index c284b92a0..7629bf9ed 100644 --- a/src/gui/popups/popupmenu.cpp +++ b/src/gui/popups/popupmenu.cpp @@ -2900,25 +2900,3 @@ void PopupMenu::showGMPopup() showPopup(getX(), getY()); } - -PlayerListener::PlayerListener() : - ActionListener(), - mNick(), - mDialog(nullptr), - mType(static_cast(ActorType::UNKNOWN)) -{ -} - -void PlayerListener::action(const ActionEvent &event) -{ - if (event.getId() == "ok" && !mNick.empty() && mDialog) - { - std::string comment = mDialog->getText(); - Being *const being = actorManager->findBeingByName( - mNick, static_cast(mType)); - if (being) - being->setComment(comment); - Being::saveComment(mNick, comment, mType); - } - mDialog = nullptr; -} diff --git a/src/gui/popups/popupmenu.h b/src/gui/popups/popupmenu.h index fbbb69cd0..1fc124b16 100644 --- a/src/gui/popups/popupmenu.h +++ b/src/gui/popups/popupmenu.h @@ -27,6 +27,7 @@ #include "gui/widgets/popup.h" #include "listeners/actionlistener.h" +#include "listeners/playerlistener.h" #include "listeners/renamelistener.h" #include "localconsts.h" @@ -47,30 +48,6 @@ class TextField; class ProgressBar; class Window; -class PlayerListener : public ActionListener -{ - public: - PlayerListener(); - - A_DELETE_COPY(PlayerListener) - - void action(const ActionEvent &event) override final; - - void setNick(const std::string &name) - { mNick = name; } - - void setDialog(TextDialog *const dialog) - { mDialog = dialog; } - - void setType(const int type) - { mType = type; } - - private: - std::string mNick; - TextDialog *mDialog; - int mType; -}; - /** * Window showing popup menu. */ -- cgit v1.2.3-70-g09d2