diff options
author | Chuck Miller <shadowmil@gmail.com> | 2010-08-01 18:00:41 -0400 |
---|---|---|
committer | Chuck Miller <shadowmil@gmail.com> | 2010-08-01 18:29:00 -0400 |
commit | 0e189bbe81c88283438aabb4fec3ba30920d3a36 (patch) | |
tree | c3f4b454564c6335c972fadd64fbc82cf23db55e /src/gui | |
parent | 1937ef53c8dd42d986c0a6b061a482a6d8e3c0f7 (diff) | |
download | mana-0e189bbe81c88283438aabb4fec3ba30920d3a36.tar.gz mana-0e189bbe81c88283438aabb4fec3ba30920d3a36.tar.bz2 mana-0e189bbe81c88283438aabb4fec3ba30920d3a36.tar.xz mana-0e189bbe81c88283438aabb4fec3ba30920d3a36.zip |
Reduce localChatTab presence replacing it with the event system
Reviewed-By: Jared Adams
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/chat.cpp | 2 | ||||
-rw-r--r-- | src/gui/npcpostdialog.cpp | 6 | ||||
-rw-r--r-- | src/gui/outfitwindow.cpp | 1 | ||||
-rw-r--r-- | src/gui/recorder.cpp | 12 | ||||
-rw-r--r-- | src/gui/socialwindow.cpp | 54 | ||||
-rw-r--r-- | src/gui/trade.cpp | 10 |
6 files changed, 39 insertions, 46 deletions
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp index 86dc9d4d..00787182 100644 --- a/src/gui/chat.cpp +++ b/src/gui/chat.cpp @@ -415,9 +415,7 @@ void ChatWindow::event(const std::string &channel, const Mana::Event &event) if (channel == "Notices") { if (event.getName() == "ServerNotice") - { localChatTab->chatLog(event.getString("message"), BY_SERVER); - } } } diff --git a/src/gui/npcpostdialog.cpp b/src/gui/npcpostdialog.cpp index 68a91f36..74173ae9 100644 --- a/src/gui/npcpostdialog.cpp +++ b/src/gui/npcpostdialog.cpp @@ -21,8 +21,9 @@ #include "gui/npcpostdialog.h" +#include "eventmanager.h" + #include "gui/widgets/button.h" -#include "gui/widgets/chattab.h" #include "gui/widgets/label.h" #include "gui/widgets/textbox.h" #include "gui/widgets/textfield.h" @@ -91,8 +92,7 @@ void NpcPostDialog::action(const gcn::ActionEvent &event) { if (mSender->getText().empty() || mText->getText().empty()) { - localChatTab->chatLog(_("Failed to send as sender or letter " - "invalid.")); + SERVER_NOTICE(_("Failed to send as sender or letter invalid.")) } else { diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp index 51b4b5c5..ad3342ee 100644 --- a/src/gui/outfitwindow.cpp +++ b/src/gui/outfitwindow.cpp @@ -33,7 +33,6 @@ #include "gui/widgets/button.h" #include "gui/widgets/checkbox.h" -#include "gui/widgets/chattab.h" #include "gui/widgets/label.h" #include "gui/widgets/layout.h" diff --git a/src/gui/recorder.cpp b/src/gui/recorder.cpp index 257afd7f..53024e7c 100644 --- a/src/gui/recorder.cpp +++ b/src/gui/recorder.cpp @@ -21,11 +21,11 @@ #include "gui/recorder.h" #include "client.h" +#include "eventmanager.h" #include "gui/chat.h" #include "gui/widgets/button.h" -#include "gui/widgets/chattab.h" #include "gui/widgets/layout.h" #include "gui/widgets/windowcontainer.h" @@ -84,16 +84,16 @@ void Recorder::setRecordingFile(const std::string &msg) * Message should go after mStream is closed so that it isn't * recorded. */ - localChatTab->chatLog(_("Finishing recording."), BY_SERVER); + SERVER_NOTICE(_("Finishing recording.")) } else { - localChatTab->chatLog(_("Not currently recording."), BY_SERVER); + SERVER_NOTICE(_("Not currently recording.")) } } else if (mStream.is_open()) { - localChatTab->chatLog(_("Already recording."), BY_SERVER); + SERVER_NOTICE(_("Already recording.")) } else { @@ -101,7 +101,7 @@ void Recorder::setRecordingFile(const std::string &msg) * Message should go before mStream is opened so that it isn't * recorded. */ - localChatTab->chatLog(_("Starting to record..."), BY_SERVER); + SERVER_NOTICE(_("Starting to record...")) const std::string file = Client::getLocalDataDirectory() + "/" + msgCopy; mStream.open(file.c_str(), std::ios_base::trunc); @@ -109,7 +109,7 @@ void Recorder::setRecordingFile(const std::string &msg) if (mStream.is_open()) setVisible(true); else - localChatTab->chatLog(_("Failed to start recording."), BY_SERVER); + SERVER_NOTICE(_("Failed to start recording.")) } } diff --git a/src/gui/socialwindow.cpp b/src/gui/socialwindow.cpp index 25447f30..cd9471aa 100644 --- a/src/gui/socialwindow.cpp +++ b/src/gui/socialwindow.cpp @@ -20,6 +20,7 @@ #include "gui/socialwindow.h" +#include "eventmanager.h" #include "guild.h" #include "localplayer.h" #include "party.h" @@ -33,7 +34,6 @@ #include "gui/widgets/avatarlistbox.h" #include "gui/widgets/browserbox.h" #include "gui/widgets/button.h" -#include "gui/widgets/chattab.h" #include "gui/widgets/container.h" #include "gui/widgets/label.h" #include "gui/widgets/layouthelper.h" @@ -121,10 +121,9 @@ public: std::string name = mInviteDialog->getText(); Net::getGuildHandler()->invite(mGuild->getId(), name); - localChatTab->chatLog(strprintf(_("Invited user %s to guild %s."), + SERVER_NOTICE(strprintf(_("Invited user %s to guild %s."), name.c_str(), - mGuild->getName().c_str()), - BY_SERVER); + mGuild->getName().c_str())) mInviteDialog = NULL; } else if (event.getId() == "~do invite") @@ -134,8 +133,8 @@ public: else if (event.getId() == "yes") { Net::getGuildHandler()->leave(mGuild->getId()); - localChatTab->chatLog(strprintf(_("Guild %s quit requested."), - mGuild->getName().c_str()), BY_SERVER); + SERVER_NOTICE(strprintf(_("Guild %s quit requested."), + mGuild->getName().c_str())) mConfirmDialog = NULL; } else if (event.getId() == "~yes") @@ -202,8 +201,8 @@ public: std::string name = mInviteDialog->getText(); Net::getPartyHandler()->invite(name); - localChatTab->chatLog(strprintf(_("Invited user %s to party."), - name.c_str()), BY_SERVER); + SERVER_NOTICE(strprintf(_("Invited user %s to party."), + name.c_str())) mInviteDialog = NULL; } else if (event.getId() == "~do invite") @@ -213,8 +212,8 @@ public: else if (event.getId() == "yes") { Net::getPartyHandler()->leave(); - localChatTab->chatLog(strprintf(_("Party %s quit requested."), - mParty->getName().c_str()), BY_SERVER); + SERVER_NOTICE(strprintf(_("Party %s quit requested."), + mParty->getName().c_str())) mConfirmDialog = NULL; } else if (event.getId() == "~yes") @@ -438,14 +437,14 @@ void SocialWindow::action(const gcn::ActionEvent &event) // check if they accepted the invite if (eventId == "yes") { - localChatTab->chatLog(strprintf(_("Accepted party invite from %s."), - mPartyInviter.c_str())); + SERVER_NOTICE(strprintf(_("Accepted party invite from %s."), + mPartyInviter.c_str())) Net::getPartyHandler()->inviteResponse(mPartyInviter, true); } else if (eventId == "no") { - localChatTab->chatLog(strprintf(_("Rejected party invite from %s."), - mPartyInviter.c_str())); + SERVER_NOTICE(strprintf(_("Rejected party invite from %s."), + mPartyInviter.c_str())) Net::getPartyHandler()->inviteResponse(mPartyInviter, false); } @@ -457,14 +456,14 @@ void SocialWindow::action(const gcn::ActionEvent &event) // check if they accepted the invite if (eventId == "yes") { - localChatTab->chatLog(strprintf(_("Accepted guild invite from %s."), - mPartyInviter.c_str())); + SERVER_NOTICE(strprintf(_("Accepted guild invite from %s."), + mPartyInviter.c_str())) Net::getGuildHandler()->inviteResponse(mGuildInvited, true); } else if (eventId == "no") { - localChatTab->chatLog(strprintf(_("Rejected guild invite from %s."), - mPartyInviter.c_str())); + SERVER_NOTICE(strprintf(_("Rejected guild invite from %s."), + mPartyInviter.c_str())) Net::getGuildHandler()->inviteResponse(mGuildInvited, false); } @@ -497,8 +496,8 @@ void SocialWindow::action(const gcn::ActionEvent &event) } Net::getGuildHandler()->create(name); - localChatTab->chatLog(strprintf(_("Creating guild called %s."), - name.c_str()), BY_SERVER); + SERVER_NOTICE(strprintf(_("Creating guild called %s."), + name.c_str())) mGuildCreateDialog = NULL; } @@ -517,8 +516,8 @@ void SocialWindow::action(const gcn::ActionEvent &event) } Net::getPartyHandler()->create(name); - localChatTab->chatLog(strprintf(_("Creating party called %s."), - name.c_str()), BY_SERVER); + SERVER_NOTICE(strprintf(_("Creating party called %s."), + name.c_str())); mPartyCreateDialog = NULL; } @@ -543,14 +542,14 @@ void SocialWindow::showGuildInvite(const std::string &guildName, // check there isnt already an invite showing if (mGuildInvited != 0) { - localChatTab->chatLog(_("Received guild request, but one already " - "exists."), BY_SERVER); + SERVER_NOTICE(_("Received guild request, but one already " + "exists.")) return; } std::string msg = strprintf(_("%s has invited you to join the guild %s."), inviterName.c_str(), guildName.c_str()); - localChatTab->chatLog(msg, BY_SERVER); + SERVER_NOTICE(msg) // show invite mGuildAcceptDialog = new ConfirmDialog(_("Accept Guild Invite"), msg, this); @@ -565,8 +564,7 @@ void SocialWindow::showPartyInvite(const std::string &partyName, // check there isnt already an invite showing if (mPartyInviter != "") { - localChatTab->chatLog(_("Received party request, but one already " - "exists."), BY_SERVER); + SERVER_NOTICE(_("Received party request, but one already exists.")) return; } @@ -597,7 +595,7 @@ void SocialWindow::showPartyInvite(const std::string &partyName, } } - localChatTab->chatLog(msg, BY_SERVER); + SERVER_NOTICE(msg) // show invite mPartyAcceptDialog = new ConfirmDialog(_("Accept Party Invite"), msg, this); diff --git a/src/gui/trade.cpp b/src/gui/trade.cpp index 4a86c235..6d3c7b21 100644 --- a/src/gui/trade.cpp +++ b/src/gui/trade.cpp @@ -21,6 +21,7 @@ #include "gui/trade.h" +#include "eventmanager.h" #include "inventory.h" #include "item.h" #include "localplayer.h" @@ -32,7 +33,6 @@ #include "gui/setup.h" #include "gui/widgets/button.h" -#include "gui/widgets/chattab.h" #include "gui/widgets/itemcontainer.h" #include "gui/widgets/label.h" #include "gui/widgets/scrollarea.h" @@ -271,9 +271,8 @@ void TradeWindow::action(const gcn::ActionEvent &event) if (mMyInventory->contains(item)) { - localChatTab->chatLog(_("Failed adding item. You can not " - "overlap one kind of item on the window."), - BY_SERVER); + SERVER_NOTICE(_("Failed adding item. You can not " + "overlap one kind of item on the window.")) return; } @@ -314,8 +313,7 @@ void TradeWindow::action(const gcn::ActionEvent &event) int curMoney = PlayerInfo::getAttribute(MONEY); if (v > curMoney) { - localChatTab->chatLog(_("You don't have enough money."), - BY_SERVER); + SERVER_NOTICE(_("You don't have enough money.")) v = curMoney; } Net::getTradeHandler()->setMoney(v); |