From 2dc730f9aba84fc9fe684fd2af9864df97580502 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 28 Aug 2011 02:48:00 +0300 Subject: Fix possible conflicts between class names GuildTab, PartyTab and other. --- src/CMakeLists.txt | 4 +- src/Makefile.am | 4 +- src/gui/socialwindow.cpp | 56 ++++++++--------- src/gui/widgets/guildchattab.cpp | 127 +++++++++++++++++++++++++++++++++++++++ src/gui/widgets/guildchattab.h | 52 ++++++++++++++++ src/gui/widgets/guildtab.cpp | 127 --------------------------------------- src/gui/widgets/guildtab.h | 52 ---------------- src/guildmanager.cpp | 4 +- src/guildmanager.h | 4 +- 9 files changed, 215 insertions(+), 215 deletions(-) create mode 100644 src/gui/widgets/guildchattab.cpp create mode 100644 src/gui/widgets/guildchattab.h delete mode 100644 src/gui/widgets/guildtab.cpp delete mode 100644 src/gui/widgets/guildtab.h (limited to 'src') diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7f59135b8..49b41f906 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -137,8 +137,8 @@ SET(SRCS gui/widgets/emoteshortcutcontainer.h gui/widgets/flowcontainer.cpp gui/widgets/flowcontainer.h - gui/widgets/guildtab.cpp - gui/widgets/guildtab.h + gui/widgets/guildchattab.cpp + gui/widgets/guildchattab.h gui/widgets/horizontcontainer.cpp gui/widgets/horizontcontainer.h gui/widgets/icon.cpp diff --git a/src/Makefile.am b/src/Makefile.am index 7d0c1634b..ca6dd6bc2 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -140,8 +140,8 @@ manaplus_SOURCES += gui/widgets/avatarlistbox.cpp \ gui/widgets/emoteshortcutcontainer.h \ gui/widgets/flowcontainer.cpp \ gui/widgets/flowcontainer.h \ - gui/widgets/guildtab.cpp \ - gui/widgets/guildtab.h \ + gui/widgets/guildchattab.cpp \ + gui/widgets/guildchattab.h \ gui/widgets/horizontcontainer.cpp \ gui/widgets/horizontcontainer.h \ gui/widgets/icon.cpp \ diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp index aa26fa051..b517911ba 100644 --- a/src/gui/socialwindow.cpp +++ b/src/gui/socialwindow.cpp @@ -108,10 +108,10 @@ protected: AvatarListBox *mList; }; -class GuildTab : public SocialTab, public gcn::ActionListener +class SocialGuildTab : public SocialTab, public gcn::ActionListener { public: - GuildTab(Guild *guild): + SocialGuildTab(Guild *guild): mGuild(guild) { setCaption(_("Guild")); @@ -125,7 +125,7 @@ public: mScroll->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_ALWAYS); } - ~GuildTab() + ~SocialGuildTab() { delete mList; mList = 0; @@ -206,10 +206,10 @@ private: Guild *mGuild; }; -class GuildTab2 : public SocialTab, public gcn::ActionListener +class SocialGuildTab2 : public SocialTab, public gcn::ActionListener { public: - GuildTab2(Guild *guild): + SocialGuildTab2(Guild *guild): mGuild(guild) { setCaption(_("Guild")); @@ -223,7 +223,7 @@ public: mScroll->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_ALWAYS); } - ~GuildTab2() + ~SocialGuildTab2() { delete mList; mList = 0; @@ -309,10 +309,10 @@ private: Guild *mGuild; }; -class PartyTab : public SocialTab, public gcn::ActionListener +class SocialPartyTab : public SocialTab, public gcn::ActionListener { public: - PartyTab(Party *party): + SocialPartyTab(Party *party): mParty(party) { setCaption(_("Party")); @@ -326,7 +326,7 @@ public: mScroll->setVerticalScrollPolicy(gcn::ScrollArea::SHOW_ALWAYS); } - ~PartyTab() + ~SocialPartyTab() { delete mList; mList = 0; @@ -443,10 +443,10 @@ public: std::vector mMembers; }; -class PlayersTab : public SocialTab +class SocialPlayersTab : public SocialTab { public: - PlayersTab(std::string name) + SocialPlayersTab(std::string name) { mBeings = new BeingsListModal(); @@ -461,7 +461,7 @@ public: setCaption(name); } - ~PlayersTab() + ~SocialPlayersTab() { delete mList; mList = 0; @@ -608,10 +608,10 @@ private: }; -class NavigationTab : public SocialTab +class SocialNavigationTab : public SocialTab { public: - NavigationTab() + SocialNavigationTab() { mBeings = new BeingsListModal(); @@ -625,7 +625,7 @@ public: } - ~NavigationTab() + ~SocialNavigationTab() { delete mList; mList = 0; @@ -886,10 +886,10 @@ protected: }; -class AttackTab : public SocialTab +class SocialAttackTab : public SocialTab { public: - AttackTab() + SocialAttackTab() { mBeings = new BeingsListModal(); @@ -902,7 +902,7 @@ public: setCaption(_("Atk")); } - ~AttackTab() + ~SocialAttackTab() { delete mList; mList = 0; @@ -1149,15 +1149,15 @@ SocialWindow::SocialWindow() : loadWindowState(); - mPlayers = new PlayersTab("P"); + mPlayers = new SocialPlayersTab("P"); mTabs->addTab(mPlayers, mPlayers->mScroll); - mNavigation = new NavigationTab(); + mNavigation = new SocialNavigationTab(); mTabs->addTab(mNavigation, mNavigation->mScroll); if (config.getBoolValue("enableAttackFilter")) { - mAttackFilter = new AttackTab(); + mAttackFilter = new SocialAttackTab(); mTabs->addTab(mAttackFilter, mAttackFilter->mScroll); } else @@ -1211,9 +1211,9 @@ bool SocialWindow::addTab(Guild *guild) SocialTab *tab = 0; if (guild->getServerGuild()) - tab = new GuildTab(guild); + tab = new SocialGuildTab(guild); else - tab = new GuildTab2(guild); + tab = new SocialGuildTab2(guild); mGuilds[guild] = tab; mTabs->addTab(tab, tab->mScroll); @@ -1243,7 +1243,7 @@ bool SocialWindow::addTab(Party *party) if (mParties.find(party) != mParties.end()) return false; - PartyTab *tab = new PartyTab(party); + SocialPartyTab *tab = new SocialPartyTab(party); mParties[party] = tab; mTabs->addTab(tab, tab->mScroll); @@ -1556,7 +1556,7 @@ void SocialWindow::updatePortals() void SocialWindow::updatePortalNames() { if (mNavigation) - static_cast(mNavigation)->updateNames(); + static_cast(mNavigation)->updateNames(); } void SocialWindow::selectPortal(unsigned num) @@ -1568,7 +1568,7 @@ void SocialWindow::selectPortal(unsigned num) int SocialWindow::getPortalIndex(int x, int y) { if (mNavigation) - return static_cast(mNavigation)->getPortalIndex(x, y); + return static_cast(mNavigation)->getPortalIndex(x, y); else return -1; } @@ -1576,13 +1576,13 @@ int SocialWindow::getPortalIndex(int x, int y) void SocialWindow::addPortal(int x, int y) { if (mNavigation) - static_cast(mNavigation)->addPortal(x, y); + static_cast(mNavigation)->addPortal(x, y); } void SocialWindow::removePortal(int x, int y) { if (mNavigation) - static_cast(mNavigation)->removePortal(x, y); + static_cast(mNavigation)->removePortal(x, y); } void SocialWindow::nextTab() diff --git a/src/gui/widgets/guildchattab.cpp b/src/gui/widgets/guildchattab.cpp new file mode 100644 index 000000000..0d40506dd --- /dev/null +++ b/src/gui/widgets/guildchattab.cpp @@ -0,0 +1,127 @@ +/* + * The ManaPlus Client + * Copyright (C) 2008-2009 The Mana World Development Team + * Copyright (C) 2009-2010 The Mana Developers + * Copyright (C) 2011 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 "gui/widgets/guildchattab.h" + +#include "chatlogger.h" +#include "commandhandler.h" +#include "guild.h" +#include "guildmanager.h" +#include "localplayer.h" + +#include "gui/theme.h" + +#include "resources/iteminfo.h" +#include "resources/itemdb.h" + +#include "utils/dtor.h" +#include "utils/gettext.h" +#include "utils/stringutils.h" + +#include "debug.h" + +GuildChatTab::GuildChatTab() : + ChatTab(_("Guild")) +{ + setTabColor(&Theme::getThemeColor(Theme::GUILD_CHAT_TAB)); +} + +GuildChatTab::~GuildChatTab() +{ +} + +bool GuildChatTab::handleCommand(const std::string &type, const std::string &args) +{ + if (type == "help") + { + if (args == "invite") + { + chatLog(_("Command: /invite ")); + chatLog(_("This command invites to the guild you're in.")); + chatLog(_("If the has spaces in it, enclose it in " + "double quotes (\").")); + } + else if (args == "leave") + { + chatLog(_("Command: /leave")); + chatLog(_("This command causes the player to leave the guild.")); + } + else + return false; + } + else if (type == "invite" && guildManager) + { + guildManager->invite(args); + } + else if (type == "leave" && guildManager) + { + guildManager->leave(); + } + else if (type == "kick" && guildManager) + { + guildManager->kick(args); + } + else if (type == "notice" && guildManager) + { + guildManager->notice(args); + } + else + { + return false; + } + + return true; +} + +void GuildChatTab::handleInput(const std::string &msg) +{ + if (!guildManager) + return; + + if (chatWindow) + guildManager->chat(chatWindow->doReplace(msg)); + else + guildManager->chat(msg); +} + +void GuildChatTab::showHelp() +{ + chatLog(_("/help > Display this help.")); + chatLog(_("/invite > Invite a player to your guild")); + chatLog(_("/leave > Leave the guild you are in")); + chatLog(_("/kick > Kick some one from the guild you are in")); +} + +void GuildChatTab::getAutoCompleteList(std::vector &names) const +{ + if (!guildManager) + return; + + guildManager->getNames(names); + names.push_back("/notice "); +} + +void GuildChatTab::saveToLogFile(std::string &msg) +{ + if (chatLogger) + chatLogger->log("#Guild", msg); +} diff --git a/src/gui/widgets/guildchattab.h b/src/gui/widgets/guildchattab.h new file mode 100644 index 000000000..4f5ee3a8e --- /dev/null +++ b/src/gui/widgets/guildchattab.h @@ -0,0 +1,52 @@ +/* + * The ManaPlus Client + * Copyright (C) 2009 The Mana World Development Team + * Copyright (C) 2009-2010 The Mana Developers + * Copyright (C) 2011 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 GUI_GUILDTAB_H +#define GUI_GUILDTAB_H + +#include "gui/widgets/chattab.h" + +/** + * A tab for a guild chat channel. + */ +class GuildChatTab : public ChatTab +{ + public: + GuildChatTab(); + + ~GuildChatTab(); + + bool handleCommand(const std::string &type, const std::string &args); + + void showHelp(); + + void saveToLogFile(std::string &msg); + + int getType() const { return ChatTab::TAB_GUILD; } + + protected: + void handleInput(const std::string &msg); + + void getAutoCompleteList(std::vector &names) const; +}; + +#endif diff --git a/src/gui/widgets/guildtab.cpp b/src/gui/widgets/guildtab.cpp deleted file mode 100644 index f4288e228..000000000 --- a/src/gui/widgets/guildtab.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2008-2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011 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 "gui/widgets/guildtab.h" - -#include "chatlogger.h" -#include "commandhandler.h" -#include "guild.h" -#include "guildmanager.h" -#include "localplayer.h" - -#include "gui/theme.h" - -#include "resources/iteminfo.h" -#include "resources/itemdb.h" - -#include "utils/dtor.h" -#include "utils/gettext.h" -#include "utils/stringutils.h" - -#include "debug.h" - -GuildTab::GuildTab() : - ChatTab(_("Guild")) -{ - setTabColor(&Theme::getThemeColor(Theme::GUILD_CHAT_TAB)); -} - -GuildTab::~GuildTab() -{ -} - -bool GuildTab::handleCommand(const std::string &type, const std::string &args) -{ - if (type == "help") - { - if (args == "invite") - { - chatLog(_("Command: /invite ")); - chatLog(_("This command invites to the guild you're in.")); - chatLog(_("If the has spaces in it, enclose it in " - "double quotes (\").")); - } - else if (args == "leave") - { - chatLog(_("Command: /leave")); - chatLog(_("This command causes the player to leave the guild.")); - } - else - return false; - } - else if (type == "invite" && guildManager) - { - guildManager->invite(args); - } - else if (type == "leave" && guildManager) - { - guildManager->leave(); - } - else if (type == "kick" && guildManager) - { - guildManager->kick(args); - } - else if (type == "notice" && guildManager) - { - guildManager->notice(args); - } - else - { - return false; - } - - return true; -} - -void GuildTab::handleInput(const std::string &msg) -{ - if (!guildManager) - return; - - if (chatWindow) - guildManager->chat(chatWindow->doReplace(msg)); - else - guildManager->chat(msg); -} - -void GuildTab::showHelp() -{ - chatLog(_("/help > Display this help.")); - chatLog(_("/invite > Invite a player to your guild")); - chatLog(_("/leave > Leave the guild you are in")); - chatLog(_("/kick > Kick some one from the guild you are in")); -} - -void GuildTab::getAutoCompleteList(std::vector &names) const -{ - if (!guildManager) - return; - - guildManager->getNames(names); - names.push_back("/notice "); -} - -void GuildTab::saveToLogFile(std::string &msg) -{ - if (chatLogger) - chatLogger->log("#Guild", msg); -} diff --git a/src/gui/widgets/guildtab.h b/src/gui/widgets/guildtab.h deleted file mode 100644 index a7f0aa766..000000000 --- a/src/gui/widgets/guildtab.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * The ManaPlus Client - * Copyright (C) 2009 The Mana World Development Team - * Copyright (C) 2009-2010 The Mana Developers - * Copyright (C) 2011 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 GUI_GUILDTAB_H -#define GUI_GUILDTAB_H - -#include "gui/widgets/chattab.h" - -/** - * A tab for a guild chat channel. - */ -class GuildTab : public ChatTab -{ - public: - GuildTab(); - - ~GuildTab(); - - bool handleCommand(const std::string &type, const std::string &args); - - void showHelp(); - - void saveToLogFile(std::string &msg); - - int getType() const { return ChatTab::TAB_GUILD; } - - protected: - void handleInput(const std::string &msg); - - void getAutoCompleteList(std::vector &names) const; -}; - -#endif diff --git a/src/guildmanager.cpp b/src/guildmanager.cpp index 22b9de5a1..624193698 100644 --- a/src/guildmanager.cpp +++ b/src/guildmanager.cpp @@ -28,7 +28,7 @@ #include "gui/socialwindow.h" -#include "gui/widgets/guildtab.h" +#include "gui/widgets/guildchattab.h" #include "net/chathandler.h" #include "net/net.h" @@ -172,7 +172,7 @@ void GuildManager::createTab(Guild *guild) { if (!mTab) { - mTab = new GuildTab(); + mTab = new GuildChatTab(); mTab->loadFromLogFile("#Guild"); if (player_node) player_node->addGuild(guild); diff --git a/src/guildmanager.h b/src/guildmanager.h index 177cec12a..c89cba0a6 100644 --- a/src/guildmanager.h +++ b/src/guildmanager.h @@ -28,7 +28,7 @@ #include class Guild; -class GuildTab; +class GuildChatTab; class GuildManager { @@ -81,7 +81,7 @@ class GuildManager bool mGotName; bool mHavePower; std::vector mTempList; - GuildTab *mTab; + GuildChatTab *mTab; bool mRequest; }; -- cgit v1.2.3-70-g09d2