summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Athay <ko2fan@gmail.com>2009-01-28 11:47:05 +0000
committerDavid Athay <ko2fan@gmail.com>2009-01-28 11:47:05 +0000
commit1a769276ce68285040bffd63bd1c01495ce411a7 (patch)
treeb0b7007ead5276801df1f95455abb31f1c130617 /src
parent3ca85b152531b9dd9cffa18d9b64d7c7ae615adf (diff)
downloadmana-client-1a769276ce68285040bffd63bd1c01495ce411a7.tar.gz
mana-client-1a769276ce68285040bffd63bd1c01495ce411a7.tar.bz2
mana-client-1a769276ce68285040bffd63bd1c01495ce411a7.tar.xz
mana-client-1a769276ce68285040bffd63bd1c01495ce411a7.zip
Added channel highlighting upon activity. Added /kick command to get rid of users from a channel
Diffstat (limited to 'src')
-rw-r--r--src/being.h4
-rw-r--r--src/commandhandler.cpp6
-rw-r--r--src/gui/chat.cpp1
-rw-r--r--src/gui/widgets/tab.cpp31
-rw-r--r--src/gui/widgets/tab.h7
5 files changed, 39 insertions, 10 deletions
diff --git a/src/being.h b/src/being.h
index 0591777e..cd317859 100644
--- a/src/being.h
+++ b/src/being.h
@@ -412,8 +412,8 @@ class Being : public Sprite
private:
- static const int Being::DEFAULT_WIDTH = 32;
- static const int Being::DEFAULT_HEIGHT = 32;
+ static const int DEFAULT_WIDTH = 32;
+ static const int DEFAULT_HEIGHT = 32;
// Speech Bubble components
SpeechBubble *mSpeechBubble;
diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp
index 4b1a0225..0f4d0f2f 100644
--- a/src/commandhandler.cpp
+++ b/src/commandhandler.cpp
@@ -87,6 +87,10 @@ void CommandHandler::handleCommand(const std::string &command)
{
handleOp(args);
}
+ else if (type == "kick")
+ {
+ handleKick(args);
+ }
else
{
chatWindow->chatLog("Unknown command");
@@ -115,6 +119,8 @@ void CommandHandler::handleHelp(const std::string &args)
chatWindow->chatLog("/quit > Leave a channel");
chatWindow->chatLog("/clear > Clears this window");
chatWindow->chatLog("/party > Invite a user to party");
+ chatWindow->chatLog("/op > Make a user a channel operator");
+ chatWindow->chatLog("/kick > Kick a user from the channel");
chatWindow->chatLog("For more information, type /help <command>");
}
else if (args == "announce")
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 1cf64c74..3d1b5643 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -411,6 +411,7 @@ void ChatWindow::sendToChannel(short channelId,
{
std::string channelName = channel->getName();
chatLog(user + ": " + msg, user == player_node->getName() ? BY_PLAYER : BY_OTHER, channelName);
+ mChatTabs->getTab(channelName)->setHighlighted(true);
}
}
diff --git a/src/gui/widgets/tab.cpp b/src/gui/widgets/tab.cpp
index c53ac85c..b09bc5b3 100644
--- a/src/gui/widgets/tab.cpp
+++ b/src/gui/widgets/tab.cpp
@@ -21,8 +21,9 @@
#include <algorithm>
-#include "tab.h"
+#include <guichan/widgets/label.hpp>
+#include "tab.h"
#include "tabbedarea.h"
#include "../../graphics.h"
@@ -79,6 +80,7 @@ Tab::~Tab()
void Tab::init()
{
setFrameSize(0);
+ mHighlighted = false;
if (mInstances == 0)
{
@@ -109,18 +111,26 @@ void Tab::init()
void Tab::draw(gcn::Graphics *graphics)
{
- int mode;
+ int mode = TAB_STANDARD;
// check which type of tab to draw
- if (mTabbedArea && mTabbedArea->isTabSelected(this))
- {
- mode = TAB_SELECTED;
- }
- else
+ if (mTabbedArea)
{
- mode = TAB_STANDARD;
+ if(mTabbedArea->isTabSelected(this))
+ {
+ mode = TAB_SELECTED;
+ // if tab is selected, it doesnt need to highlight activity
+ mLabel->setForegroundColor(gcn::Color(0, 0, 0));
+ mHighlighted = false;
+ }
+ else if (mHighlighted)
+ {
+ mode = TAB_HIGHLIGHTED;
+ mLabel->setForegroundColor(gcn::Color(255, 0, 0));
+ }
}
+
// draw tab
static_cast<Graphics*>(graphics)->
drawImageRect(0, 0, getWidth(), getHeight(), tabImg[mode]);
@@ -128,3 +138,8 @@ void Tab::draw(gcn::Graphics *graphics)
// draw label
drawChildren(graphics);
}
+
+void Tab::setHighlighted(bool high)
+{
+ mHighlighted = high;
+}
diff --git a/src/gui/widgets/tab.h b/src/gui/widgets/tab.h
index 42964b0f..65cc3fa0 100644
--- a/src/gui/widgets/tab.h
+++ b/src/gui/widgets/tab.h
@@ -47,12 +47,19 @@ class Tab : public gcn::Tab
*/
void draw(gcn::Graphics *graphics);
+ /**
+ * Set tab highlighted
+ */
+ void setHighlighted(bool high);
+
private:
/** Load images if no other instances exist yet */
void init();
static ImageRect tabImg[4]; /**< Tab state graphics */
static int mInstances; /**< Number of tab instances */
+
+ bool mHighlighted;
};
#endif