summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2012-09-08 15:17:51 +0300
committerAndrei Karas <akaras@inbox.ru>2012-09-08 15:28:43 +0300
commitc5a64309d9d792fc4ee3218f4db902e8a846a18a (patch)
tree08618c439436faa4f5265f4967a426b44fa79889 /src/gui
parent58b4f0bc45f9b866899db035664378969e583b01 (diff)
downloadplus-c5a64309d9d792fc4ee3218f4db902e8a846a18a.tar.gz
plus-c5a64309d9d792fc4ee3218f4db902e8a846a18a.tar.bz2
plus-c5a64309d9d792fc4ee3218f4db902e8a846a18a.tar.xz
plus-c5a64309d9d792fc4ee3218f4db902e8a846a18a.zip
Add new colors for whisper tabs.
New colors: WHISPER_TAB_HIGHLIGHTED, WHISPER_TAB_OFFLINE_HIGHLIGHTED, WHISPER_TAB_SELECTED, WHISPER_TAB_OFFLINE_SELECTED
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/chatwindow.cpp26
-rw-r--r--src/gui/chatwindow.h8
-rw-r--r--src/gui/theme.cpp4
-rw-r--r--src/gui/theme.h4
-rw-r--r--src/gui/widgets/avatarlistbox.cpp2
-rw-r--r--src/gui/widgets/whispertab.cpp19
-rw-r--r--src/gui/widgets/whispertab.h6
7 files changed, 47 insertions, 22 deletions
diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp
index 2aaa0da2d..7a8c3d63b 100644
--- a/src/gui/chatwindow.cpp
+++ b/src/gui/chatwindow.cpp
@@ -1025,7 +1025,7 @@ void ChatWindow::addWhisper(const std::string &nick,
if (tempNick.compare(playerName) == 0)
return;
- ChatTab *tab = nullptr;
+ WhisperTab *tab = nullptr;
const TabMap::const_iterator i = mWhispers.find(tempNick);
if (i != mWhispers.end())
@@ -1099,8 +1099,8 @@ void ChatWindow::addWhisper(const std::string &nick,
}
}
-ChatTab *ChatWindow::addWhisperTab(const std::string &nick,
- const bool switchTo)
+WhisperTab *ChatWindow::addWhisperTab(const std::string &nick,
+ const bool switchTo)
{
if (!player_node)
return nullptr;
@@ -1112,7 +1112,7 @@ ChatTab *ChatWindow::addWhisperTab(const std::string &nick,
toLower(tempNick);
const TabMap::const_iterator i = mWhispers.find(tempNick);
- ChatTab *ret;
+ WhisperTab *ret;
if (tempNick.compare(playerName) == 0)
return nullptr;
@@ -1137,7 +1137,7 @@ ChatTab *ChatWindow::addWhisperTab(const std::string &nick,
return ret;
}
-ChatTab *ChatWindow::getWhisperTab(const std::string &nick) const
+WhisperTab *ChatWindow::getWhisperTab(const std::string &nick) const
{
if (!player_node)
return nullptr;
@@ -1149,7 +1149,7 @@ ChatTab *ChatWindow::getWhisperTab(const std::string &nick) const
toLower(tempNick);
const TabMap::const_iterator i = mWhispers.find(tempNick);
- ChatTab *ret = nullptr;
+ WhisperTab *ret = nullptr;
if (tempNick.compare(playerName) == 0)
return nullptr;
@@ -1479,7 +1479,7 @@ void ChatWindow::updateOnline(std::set<std::string> &onlinePlayers)
if (onlinePlayers.find(tab->getNick()) != onlinePlayers.end())
{
- tab->setTabColor(&Theme::getThemeColor(Theme::WHISPER_TAB));
+ tab->setWhisperTabColors();
}
else
{
@@ -1490,8 +1490,7 @@ void ChatWindow::updateOnline(std::set<std::string> &onlinePlayers)
nick, ActorSprite::PLAYER);
if (being)
{
- tab->setTabColor(&Theme::getThemeColor(
- Theme::WHISPER_TAB));
+ tab->setWhisperTabColors();
continue;
}
}
@@ -1500,8 +1499,7 @@ void ChatWindow::updateOnline(std::set<std::string> &onlinePlayers)
const PartyMember *const pm = party->getMember(nick);
if (pm && pm->getOnline())
{
- tab->setTabColor(&Theme::getThemeColor(
- Theme::WHISPER_TAB));
+ tab->setWhisperTabColors();
continue;
}
}
@@ -1510,13 +1508,11 @@ void ChatWindow::updateOnline(std::set<std::string> &onlinePlayers)
const GuildMember *const gm = guild->getMember(nick);
if (gm && gm->getOnline())
{
- tab->setTabColor(&Theme::getThemeColor(
- Theme::WHISPER_TAB));
+ tab->setWhisperTabColors();
continue;
}
}
- tab->setTabColor(&Theme::getThemeColor(
- Theme::WHISPER_TAB_OFFLINE));
+ tab->setWhisperTabOfflineColors();
}
}
}
diff --git a/src/gui/chatwindow.h b/src/gui/chatwindow.h
index 4f65ed44d..4d4b249e6 100644
--- a/src/gui/chatwindow.h
+++ b/src/gui/chatwindow.h
@@ -227,10 +227,10 @@ class ChatWindow : public Window,
void addWhisper(const std::string &nick, const std::string &mes,
const Own own = BY_OTHER);
- ChatTab *addWhisperTab(const std::string &nick,
- const bool switchTo = false);
+ WhisperTab *addWhisperTab(const std::string &nick,
+ const bool switchTo = false);
- ChatTab *getWhisperTab(const std::string &nick) const;
+ WhisperTab *getWhisperTab(const std::string &nick) const;
void removeAllWhispers();
@@ -332,7 +332,7 @@ class ChatWindow : public Window,
bool mTmpVisible;
- typedef std::map<const std::string, ChatTab*> TabMap;
+ typedef std::map<const std::string, WhisperTab*> TabMap;
/** Manage whisper tabs */
TabMap mWhispers;
diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp
index dd9e616b7..113f313c3 100644
--- a/src/gui/theme.cpp
+++ b/src/gui/theme.cpp
@@ -717,6 +717,10 @@ static int readColorType(const std::string &type)
"PLAYER",
"WHISPER_TAB",
"WHISPER_TAB_OFFLINE",
+ "WHISPER_TAB_HIGHLIGHTED",
+ "WHISPER_TAB_OFFLINEB_HIGHLIGHTED",
+ "WHISPER_TAB_SELECTED",
+ "WHISPER_TAB_OFFLINEB_SELECTED",
"IS",
"SERVER",
"LOGGER",
diff --git a/src/gui/theme.h b/src/gui/theme.h
index a079f720c..cfa9ab49d 100644
--- a/src/gui/theme.h
+++ b/src/gui/theme.h
@@ -209,6 +209,10 @@ class Theme : public Palette, public ConfigListener
PLAYER,
WHISPER_TAB,
WHISPER_TAB_OFFLINE,
+ WHISPER_TAB_HIGHLIGHTED,
+ WHISPER_TAB_OFFLINE_HIGHLIGHTED,
+ WHISPER_TAB_SELECTED,
+ WHISPER_TAB_OFFLINE_SELECTED,
IS,
SERVER,
LOGGER,
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp
index b54b3d945..805922b2b 100644
--- a/src/gui/widgets/avatarlistbox.cpp
+++ b/src/gui/widgets/avatarlistbox.cpp
@@ -397,7 +397,7 @@ void AvatarListBox::mousePressed(gcn::MouseEvent &event)
{
if (ava->getType() == AVATAR_PLAYER && chatWindow)
{
- const ChatTab *const tab = chatWindow->addWhisperTab(
+ const WhisperTab *const tab = chatWindow->addWhisperTab(
model->getAvatarAt(selected)->getName(), true);
if (chatWindow && tab)
chatWindow->saveState();
diff --git a/src/gui/widgets/whispertab.cpp b/src/gui/widgets/whispertab.cpp
index ae034d8d2..cc4db6a87 100644
--- a/src/gui/widgets/whispertab.cpp
+++ b/src/gui/widgets/whispertab.cpp
@@ -39,7 +39,7 @@ WhisperTab::WhisperTab(const std::string &nick) :
ChatTab(nick),
mNick(nick)
{
- setTabColor(&Theme::getThemeColor(Theme::WHISPER_TAB));
+ setWhisperTabColors();
}
WhisperTab::~WhisperTab()
@@ -168,3 +168,20 @@ void WhisperTab::getAutoCompleteList(StringVect &names) const
{
names.push_back(mNick);
}
+
+void WhisperTab::setWhisperTabColors()
+{
+ setTabColor(&Theme::getThemeColor(Theme::WHISPER_TAB));
+ setHighlightedTabColor(&Theme::getThemeColor(
+ Theme::WHISPER_TAB_HIGHLIGHTED));
+ setSelectedTabColor(&Theme::getThemeColor(Theme::WHISPER_TAB_SELECTED));
+}
+
+void WhisperTab::setWhisperTabOfflineColors()
+{
+ setTabColor(&Theme::getThemeColor(Theme::WHISPER_TAB_OFFLINE));
+ setHighlightedTabColor(&Theme::getThemeColor(
+ Theme::WHISPER_TAB_OFFLINE_HIGHLIGHTED));
+ setSelectedTabColor(&Theme::getThemeColor(
+ Theme::WHISPER_TAB_OFFLINE_SELECTED));
+}
diff --git a/src/gui/widgets/whispertab.h b/src/gui/widgets/whispertab.h
index 85c670db1..eec66768c 100644
--- a/src/gui/widgets/whispertab.h
+++ b/src/gui/widgets/whispertab.h
@@ -23,7 +23,7 @@
#ifndef WHISPERTAB_H
#define WHISPERTAB_H
-#include "chattab.h"
+#include "gui/widgets/chattab.h"
class Channel;
@@ -46,6 +46,10 @@ class WhisperTab : public ChatTab
void saveToLogFile(std::string &msg);
+ void setWhisperTabColors();
+
+ void setWhisperTabOfflineColors();
+
protected:
friend class ChatWindow;