summaryrefslogtreecommitdiff
path: root/src/gui/widgets
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2009-04-16 19:20:30 +0200
committerBjørn Lindeijer <bjorn@lindeijer.nl>2009-04-16 19:20:30 +0200
commit69258182848b2781b0081d82453d33f42dd81679 (patch)
tree38d64cf8b1884727b941aecb95562f4390ad482b /src/gui/widgets
parent736795a624ae5f04b11fa284cb8a4b14579c1766 (diff)
downloadmana-client-69258182848b2781b0081d82453d33f42dd81679.tar.gz
mana-client-69258182848b2781b0081d82453d33f42dd81679.tar.bz2
mana-client-69258182848b2781b0081d82453d33f42dd81679.tar.xz
mana-client-69258182848b2781b0081d82453d33f42dd81679.zip
Some cleanups
* std::string arguments to 'const std::string &' * findMember2 renamed to findOrCreateMember * Made some functions const
Diffstat (limited to 'src/gui/widgets')
-rw-r--r--src/gui/widgets/channeltab.cpp11
-rw-r--r--src/gui/widgets/channeltab.h5
-rw-r--r--src/gui/widgets/chattab.cpp2
-rw-r--r--src/gui/widgets/chattab.h5
-rw-r--r--src/gui/widgets/whispertab.cpp8
-rw-r--r--src/gui/widgets/whispertab.h5
6 files changed, 22 insertions, 14 deletions
diff --git a/src/gui/widgets/channeltab.cpp b/src/gui/widgets/channeltab.cpp
index 0bafc10f..e3edbba0 100644
--- a/src/gui/widgets/channeltab.cpp
+++ b/src/gui/widgets/channeltab.cpp
@@ -28,8 +28,9 @@
#include "utils/gettext.h"
-ChannelTab::ChannelTab(Channel *channel) : ChatTab(channel->getName()),
- mChannel(channel)
+ChannelTab::ChannelTab(Channel *channel) :
+ ChatTab(channel->getName()),
+ mChannel(channel)
{
channel->setTab(this);
}
@@ -38,7 +39,8 @@ ChannelTab::~ChannelTab()
{
}
-void ChannelTab::handleInput(const std::string &msg) {
+void ChannelTab::handleInput(const std::string &msg)
+{
Net::getChatHandler()->sendToChannel(getChannel()->getId(), msg);
}
@@ -51,7 +53,8 @@ void ChannelTab::showHelp()
chatLog(_("/kick > Kick a user from the channel"));
}
-bool ChannelTab::handleCommand(std::string type, std::string args)
+bool ChannelTab::handleCommand(const std::string &type,
+ const std::string &args)
{
if (type == "help")
{
diff --git a/src/gui/widgets/channeltab.h b/src/gui/widgets/channeltab.h
index 886ae28e..2f668b89 100644
--- a/src/gui/widgets/channeltab.h
+++ b/src/gui/widgets/channeltab.h
@@ -33,11 +33,12 @@ class ChannelTab : public ChatTab
{
public:
- Channel *getChannel() { return mChannel; }
+ Channel *getChannel() const { return mChannel; }
void showHelp();
- bool handleCommand(std::string type, std::string args);
+ bool handleCommand(const std::string &type,
+ const std::string &args);
protected:
friend class Channel;
diff --git a/src/gui/widgets/chattab.cpp b/src/gui/widgets/chattab.cpp
index 0e3ae423..44840423 100644
--- a/src/gui/widgets/chattab.cpp
+++ b/src/gui/widgets/chattab.cpp
@@ -274,7 +274,7 @@ void ChatTab::handleInput(const std::string &msg) {
Net::getChatHandler()->talk(msg);
}
-void ChatTab::handleCommand(std::string msg)
+void ChatTab::handleCommand(const std::string &msg)
{
commandHandler->handleCommand(msg, this);
}
diff --git a/src/gui/widgets/chattab.h b/src/gui/widgets/chattab.h
index ccb85d2a..27c27480 100644
--- a/src/gui/widgets/chattab.h
+++ b/src/gui/widgets/chattab.h
@@ -113,7 +113,8 @@ class ChatTab : public Tab
* @returns true if the command was handled
* false if the command was not handled
*/
- virtual bool handleCommand(std::string type, std::string args)
+ virtual bool handleCommand(const std::string &type,
+ const std::string &args)
{ return false; }
protected:
@@ -124,7 +125,7 @@ class ChatTab : public Tab
virtual void handleInput(const std::string &msg);
- virtual void handleCommand(std::string msg);
+ virtual void handleCommand(const std::string &msg);
ScrollArea *mScrollArea;
BrowserBox *mTextOutput;
diff --git a/src/gui/widgets/whispertab.cpp b/src/gui/widgets/whispertab.cpp
index 975cac94..87a88222 100644
--- a/src/gui/widgets/whispertab.cpp
+++ b/src/gui/widgets/whispertab.cpp
@@ -43,7 +43,8 @@ WhisperTab::~WhisperTab()
chatWindow->removeWhisper(mNick);
}
-void WhisperTab::handleInput(const std::string &msg) {
+void WhisperTab::handleInput(const std::string &msg)
+{
if (msg.length() == 0) {
chatLog(_("Cannot send empty chat!"), BY_SERVER, false);
return;
@@ -55,7 +56,7 @@ void WhisperTab::handleInput(const std::string &msg) {
msg.c_str()), BY_PLAYER, false);
}
-void WhisperTab::handleCommand(std::string msg)
+void WhisperTab::handleCommand(const std::string &msg)
{
if (msg == "close")
delete this;
@@ -68,7 +69,8 @@ void WhisperTab::showHelp()
chatLog(_("/close > Close the whisper tab"));
}
-bool WhisperTab::handleCommand(std::string type, std::string args)
+bool WhisperTab::handleCommand(const std::string &type,
+ const std::string &args)
{
if (type == "help")
{
diff --git a/src/gui/widgets/whispertab.h b/src/gui/widgets/whispertab.h
index 0d39b6ec..af71025b 100644
--- a/src/gui/widgets/whispertab.h
+++ b/src/gui/widgets/whispertab.h
@@ -36,7 +36,8 @@ class WhisperTab : public ChatTab
void showHelp();
- bool handleCommand(std::string type, std::string args);
+ bool handleCommand(const std::string &type,
+ const std::string &args);
protected:
friend class ChatWindow;
@@ -52,7 +53,7 @@ class WhisperTab : public ChatTab
void handleInput(const std::string &msg);
- void handleCommand(std::string msg);
+ void handleCommand(const std::string &msg);
private:
std::string mNick;