From e3ec854f275cc6f79129bbdd3129be277100908f Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sat, 15 Feb 2014 22:45:17 +0300 Subject: Move some listeners classes into listeners directory. --- src/CMakeLists.txt | 6 ++--- src/Makefile.am | 6 ++--- src/being/localplayer.h | 2 +- src/client.h | 2 +- src/configlistener.h | 50 ------------------------------------ src/configuration.cpp | 3 ++- src/depricatedevent.cpp | 3 ++- src/depricatedlistener.cpp | 39 ---------------------------- src/depricatedlistener.h | 40 ----------------------------- src/eventsmanager.h | 2 +- src/gui/theme.h | 2 +- src/gui/viewport.h | 3 ++- src/gui/widgets/avatarlistbox.h | 2 +- src/gui/windowmenu.h | 2 +- src/gui/windows/botcheckerwindow.h | 2 +- src/gui/windows/chatwindow.h | 4 +-- src/gui/windows/inventorywindow.h | 3 ++- src/gui/windows/killstats.h | 2 +- src/gui/windows/ministatuswindow.h | 3 ++- src/gui/windows/npcdialog.h | 2 +- src/gui/windows/statuswindow.h | 2 +- src/gui/windows/whoisonline.h | 2 +- src/listeners/configlistener.h | 50 ++++++++++++++++++++++++++++++++++++ src/listeners/depricatedlistener.cpp | 39 ++++++++++++++++++++++++++++ src/listeners/depricatedlistener.h | 40 +++++++++++++++++++++++++++++ src/map.h | 3 ++- src/maplayer.h | 3 ++- src/soundmanager.h | 2 +- src/touchmanager.h | 2 +- 29 files changed, 164 insertions(+), 157 deletions(-) delete mode 100644 src/configlistener.h delete mode 100644 src/depricatedlistener.cpp delete mode 100644 src/depricatedlistener.h create mode 100644 src/listeners/configlistener.h create mode 100644 src/listeners/depricatedlistener.cpp create mode 100644 src/listeners/depricatedlistener.h diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 65570ee7b..042ed6af6 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -607,7 +607,7 @@ SET(SRCS commands.h being/compoundsprite.cpp being/compoundsprite.h - configlistener.h + listeners/configlistener.h configuration.cpp configuration.h debug.h @@ -615,8 +615,8 @@ SET(SRCS defaults.h depricatedevent.cpp depricatedevent.h - depricatedlistener.cpp - depricatedlistener.h + listeners/depricatedlistener.cpp + listeners/depricatedlistener.h dragdrop.h effectmanager.cpp effectmanager.h diff --git a/src/Makefile.am b/src/Makefile.am index 7fe7a5e2e..4aa93893f 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -732,7 +732,7 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ commands.h \ being/compoundsprite.cpp \ being/compoundsprite.h \ - configlistener.h \ + listeners/configlistener.h \ configuration.cpp \ configuration.h \ debug.h \ @@ -740,8 +740,8 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ defaults.h \ depricatedevent.cpp \ depricatedevent.h \ - depricatedlistener.cpp \ - depricatedlistener.h \ + listeners/depricatedlistener.cpp \ + listeners/depricatedlistener.h \ dragdrop.h \ dropshortcut.cpp \ dropshortcut.h \ diff --git a/src/being/localplayer.h b/src/being/localplayer.h index 1bbf7dcc8..16c317bab 100644 --- a/src/being/localplayer.h +++ b/src/being/localplayer.h @@ -23,7 +23,7 @@ #ifndef BEING_LOCALPLAYER_H #define BEING_LOCALPLAYER_H -#include "depricatedlistener.h" +#include "listeners/depricatedlistener.h" #include "being/actorspritelistener.h" #include "being/being.h" diff --git a/src/client.h b/src/client.h index c26e91eae..f020087ea 100644 --- a/src/client.h +++ b/src/client.h @@ -23,7 +23,7 @@ #ifndef CLIENT_H #define CLIENT_H -#include "configlistener.h" +#include "listeners/configlistener.h" #include "net/serverinfo.h" diff --git a/src/configlistener.h b/src/configlistener.h deleted file mode 100644 index 3de898692..000000000 --- a/src/configlistener.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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 . - */ - -#ifndef CONFIGLISTENER_H -#define CONFIGLISTENER_H - -#include - -/** - * The listener interface for receiving notifications about changes to - * configuration options. - * - * \ingroup CORE - */ -class ConfigListener -{ - public: - /** - * Destructor. - */ - virtual ~ConfigListener() - { } - - /** - * Called when an option changed. The config listener will have to be - * registered to the option name first. - */ - virtual void optionChanged(const std::string &name) = 0; -}; - -#endif // CONFIGLISTENER_H diff --git a/src/configuration.cpp b/src/configuration.cpp index d4b9f122b..7d6fc43fd 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -22,9 +22,10 @@ #include "configuration.h" -#include "configlistener.h" #include "logger.h" +#include "listeners/configlistener.h" + #include "utils/paths.h" #include "debug.h" diff --git a/src/depricatedevent.cpp b/src/depricatedevent.cpp index 8d021e2f3..fc499c47b 100644 --- a/src/depricatedevent.cpp +++ b/src/depricatedevent.cpp @@ -21,9 +21,10 @@ #include "depricatedevent.h" -#include "depricatedlistener.h" #include "variabledata.h" +#include "listeners/depricatedlistener.h" + #include "debug.h" DepricatedListenMap DepricatedEvent::mBindings; diff --git a/src/depricatedlistener.cpp b/src/depricatedlistener.cpp deleted file mode 100644 index 0cd473852..000000000 --- a/src/depricatedlistener.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 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 . - */ - -#include "depricatedlistener.h" - -#include "debug.h" - -DepricatedListener::~DepricatedListener() -{ - DepricatedEvent::remove(this); -} - -void DepricatedListener::listen(Channels channel) -{ - DepricatedEvent::bind(this, channel); -} - -void DepricatedListener::ignore(Channels channel) -{ - DepricatedEvent::unbind(this, channel); -} diff --git a/src/depricatedlistener.h b/src/depricatedlistener.h deleted file mode 100644 index 52596b70f..000000000 --- a/src/depricatedlistener.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 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 . - */ - -#ifndef DEPRICATEDLISTENER_H -#define DEPRICATEDLISTENER_H - -#include "depricatedevent.h" - -class DepricatedListener -{ - public: - virtual ~DepricatedListener(); - - void listen(Channels channel); - - void ignore(Channels channel); - - virtual void processEvent(const Channels channel, - const DepricatedEvent &event) = 0; -}; - -#endif // DEPRICATEDLISTENER_H diff --git a/src/eventsmanager.h b/src/eventsmanager.h index 5433a83fb..e54c4dee4 100644 --- a/src/eventsmanager.h +++ b/src/eventsmanager.h @@ -21,7 +21,7 @@ #ifndef EVENTSMANAGER_H #define EVENTSMANAGER_H -#include "configlistener.h" +#include "listeners/configlistener.h" #include diff --git a/src/gui/theme.h b/src/gui/theme.h index b40be2881..826902004 100644 --- a/src/gui/theme.h +++ b/src/gui/theme.h @@ -25,7 +25,7 @@ #ifndef GUI_THEME_H #define GUI_THEME_H -#include "configlistener.h" +#include "listeners/configlistener.h" #include "render/graphics.h" diff --git a/src/gui/viewport.h b/src/gui/viewport.h index 7e18d8395..9adaa6c18 100644 --- a/src/gui/viewport.h +++ b/src/gui/viewport.h @@ -23,9 +23,10 @@ #ifndef GUI_VIEWPORT_H #define GUI_VIEWPORT_H -#include "configlistener.h" #include "position.h" +#include "listeners/configlistener.h" + #include "gui/widgets/windowcontainer.h" #include "gui/base/mouselistener.hpp" diff --git a/src/gui/widgets/avatarlistbox.h b/src/gui/widgets/avatarlistbox.h index 46e5c8dea..ec384368c 100644 --- a/src/gui/widgets/avatarlistbox.h +++ b/src/gui/widgets/avatarlistbox.h @@ -24,7 +24,7 @@ #include "avatar.h" -#include "configlistener.h" +#include "listeners/configlistener.h" #include "gui/widgets/listbox.h" diff --git a/src/gui/windowmenu.h b/src/gui/windowmenu.h index bf8298b75..f6838115c 100644 --- a/src/gui/windowmenu.h +++ b/src/gui/windowmenu.h @@ -23,7 +23,7 @@ #ifndef GUI_WINDOWMENU_H #define GUI_WINDOWMENU_H -#include "configlistener.h" +#include "listeners/configlistener.h" #include "gui/widgets/container.h" #include "gui/widgets/button.h" diff --git a/src/gui/windows/botcheckerwindow.h b/src/gui/windows/botcheckerwindow.h index e7c9ecbb0..1346862d2 100644 --- a/src/gui/windows/botcheckerwindow.h +++ b/src/gui/windows/botcheckerwindow.h @@ -23,7 +23,7 @@ #ifndef GUI_BOTCHECKERWINDOW_H #define GUI_BOTCHECKERWINDOW_H -#include "configlistener.h" +#include "listeners/configlistener.h" #include "gui/widgets/window.h" diff --git a/src/gui/windows/chatwindow.h b/src/gui/windows/chatwindow.h index d20f68ecc..6678eac28 100644 --- a/src/gui/windows/chatwindow.h +++ b/src/gui/windows/chatwindow.h @@ -23,9 +23,9 @@ #ifndef GUI_WINDOWS_CHATWINDOW_H #define GUI_WINDOWS_CHATWINDOW_H -#include "depricatedlistener.h" +#include "listeners/depricatedlistener.h" -#include "configlistener.h" +#include "listeners/configlistener.h" #include "gui/widgets/window.h" diff --git a/src/gui/windows/inventorywindow.h b/src/gui/windows/inventorywindow.h index da6e56a77..c0289e70d 100644 --- a/src/gui/windows/inventorywindow.h +++ b/src/gui/windows/inventorywindow.h @@ -24,7 +24,8 @@ #define GUI_WINDOWS_INVENTORYWINDOW_H #include "inventory.h" -#include "depricatedlistener.h" + +#include "listeners/depricatedlistener.h" #include "gui/widgets/window.h" diff --git a/src/gui/windows/killstats.h b/src/gui/windows/killstats.h index 181e43a51..46dbf842b 100644 --- a/src/gui/windows/killstats.h +++ b/src/gui/windows/killstats.h @@ -25,7 +25,7 @@ #include "gui/base/actionlistener.hpp" -#include "depricatedlistener.h" +#include "listeners/depricatedlistener.h" #include "gui/widgets/window.h" diff --git a/src/gui/windows/ministatuswindow.h b/src/gui/windows/ministatuswindow.h index 7748f51d1..5fccae02e 100644 --- a/src/gui/windows/ministatuswindow.h +++ b/src/gui/windows/ministatuswindow.h @@ -24,7 +24,8 @@ #define GUI_WINDOWS_MINISTATUSWINDOW_H #include "inventory.h" -#include "depricatedlistener.h" + +#include "listeners/depricatedlistener.h" #include "gui/widgets/popup.h" diff --git a/src/gui/windows/npcdialog.h b/src/gui/windows/npcdialog.h index 21c3f93e5..8646e5365 100644 --- a/src/gui/windows/npcdialog.h +++ b/src/gui/windows/npcdialog.h @@ -23,7 +23,7 @@ #ifndef GUI_WINDOWS_NPCDIALOG_H #define GUI_WINDOWS_NPCDIALOG_H -#include "configlistener.h" +#include "listeners/configlistener.h" #include "gui/widgets/extendedlistmodel.h" #include "gui/widgets/window.h" diff --git a/src/gui/windows/statuswindow.h b/src/gui/windows/statuswindow.h index 5e100b64e..c9efe6edd 100644 --- a/src/gui/windows/statuswindow.h +++ b/src/gui/windows/statuswindow.h @@ -23,7 +23,7 @@ #ifndef GUI_WINDOWS_STATUSWINDOW_H #define GUI_WINDOWS_STATUSWINDOW_H -#include "depricatedlistener.h" +#include "listeners/depricatedlistener.h" #include "gui/widgets/window.h" diff --git a/src/gui/windows/whoisonline.h b/src/gui/windows/whoisonline.h index da5ab010d..d60805983 100644 --- a/src/gui/windows/whoisonline.h +++ b/src/gui/windows/whoisonline.h @@ -23,7 +23,7 @@ #ifndef GUI_WINDOWS_WHOISONLINE_H #define GUI_WINDOWS_WHOISONLINE_H -#include "configlistener.h" +#include "listeners/configlistener.h" #include "gui/widgets/linkhandler.h" #include "gui/widgets/window.h" diff --git a/src/listeners/configlistener.h b/src/listeners/configlistener.h new file mode 100644 index 000000000..757d24bfc --- /dev/null +++ b/src/listeners/configlistener.h @@ -0,0 +1,50 @@ +/* + * 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 . + */ + +#ifndef LISTENERS_CONFIGLISTENER_H +#define LISTENERS_CONFIGLISTENER_H + +#include + +/** + * The listener interface for receiving notifications about changes to + * configuration options. + * + * \ingroup CORE + */ +class ConfigListener +{ + public: + /** + * Destructor. + */ + virtual ~ConfigListener() + { } + + /** + * Called when an option changed. The config listener will have to be + * registered to the option name first. + */ + virtual void optionChanged(const std::string &name) = 0; +}; + +#endif // LISTENERS_CONFIGLISTENER_H diff --git a/src/listeners/depricatedlistener.cpp b/src/listeners/depricatedlistener.cpp new file mode 100644 index 000000000..c853c028d --- /dev/null +++ b/src/listeners/depricatedlistener.cpp @@ -0,0 +1,39 @@ +/* + * The ManaPlus Client + * Copyright (C) 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 . + */ + +#include "listeners/depricatedlistener.h" + +#include "debug.h" + +DepricatedListener::~DepricatedListener() +{ + DepricatedEvent::remove(this); +} + +void DepricatedListener::listen(Channels channel) +{ + DepricatedEvent::bind(this, channel); +} + +void DepricatedListener::ignore(Channels channel) +{ + DepricatedEvent::unbind(this, channel); +} diff --git a/src/listeners/depricatedlistener.h b/src/listeners/depricatedlistener.h new file mode 100644 index 000000000..175eec74a --- /dev/null +++ b/src/listeners/depricatedlistener.h @@ -0,0 +1,40 @@ +/* + * The ManaPlus Client + * Copyright (C) 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 . + */ + +#ifndef LISTENERS_DEPRICATEDLISTENER_H +#define LISTENERS_DEPRICATEDLISTENER_H + +#include "depricatedevent.h" + +class DepricatedListener +{ + public: + virtual ~DepricatedListener(); + + void listen(Channels channel); + + void ignore(Channels channel); + + virtual void processEvent(const Channels channel, + const DepricatedEvent &event) = 0; +}; + +#endif // LISTENERS_DEPRICATEDLISTENER_H diff --git a/src/map.h b/src/map.h index 26303da7a..d33857415 100644 --- a/src/map.h +++ b/src/map.h @@ -23,12 +23,13 @@ #ifndef MAP_H #define MAP_H -#include "configlistener.h" #include "position.h" #include "properties.h" #include "being/actor.h" +#include "listeners/configlistener.h" + #include "render/renderers.h" #include diff --git a/src/maplayer.h b/src/maplayer.h index dcfdb991e..88db82214 100644 --- a/src/maplayer.h +++ b/src/maplayer.h @@ -23,10 +23,11 @@ #ifndef MAPLAYER_H #define MAPLAYER_H -#include "configlistener.h" #include "position.h" #include "main.h" +#include "listeners/configlistener.h" + #include "being/actor.h" #include diff --git a/src/soundmanager.h b/src/soundmanager.h index 9eb1ea8a2..9a09f383d 100644 --- a/src/soundmanager.h +++ b/src/soundmanager.h @@ -25,7 +25,7 @@ #include -#include "configlistener.h" +#include "listeners/configlistener.h" #include diff --git a/src/touchmanager.h b/src/touchmanager.h index e203da69f..6419c4b17 100644 --- a/src/touchmanager.h +++ b/src/touchmanager.h @@ -23,7 +23,7 @@ #include "resources/image.h" -#include "configlistener.h" +#include "listeners/configlistener.h" #include "input/keydata.h" -- cgit v1.2.3-70-g09d2