summaryrefslogtreecommitdiff
path: root/src/gui
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-12-08 18:01:40 +0300
committerAndrei Karas <akaras@inbox.ru>2014-12-08 18:01:40 +0300
commit6303e605ef23003aabace85cde3f04574f1fb05c (patch)
tree6c9477f7314e4d371081473d7b96503b47573dea /src/gui
parent568cd6279a753b1f04afb08a9193ab0873bf8e53 (diff)
downloadplus-6303e605ef23003aabace85cde3f04574f1fb05c.tar.gz
plus-6303e605ef23003aabace85cde3f04574f1fb05c.tar.bz2
plus-6303e605ef23003aabace85cde3f04574f1fb05c.tar.xz
plus-6303e605ef23003aabace85cde3f04574f1fb05c.zip
In whisper constructor allow separatly set nick and caption.
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/widgets/avatarlistbox.cpp3
-rw-r--r--src/gui/widgets/tabs/chat/whispertab.cpp3
-rw-r--r--src/gui/widgets/tabs/chat/whispertab.h1
-rw-r--r--src/gui/windows/chatwindow.cpp9
-rw-r--r--src/gui/windows/chatwindow.h3
5 files changed, 12 insertions, 7 deletions
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp
index a351c7199..53e4684d4 100644
--- a/src/gui/widgets/avatarlistbox.cpp
+++ b/src/gui/widgets/avatarlistbox.cpp
@@ -470,8 +470,9 @@ void AvatarListBox::mousePressed(MouseEvent &event)
{
if (type == MapItemType::EMPTY && chatWindow)
{
+ const std::string &name = model->getAvatarAt(selected)->getName();
const WhisperTab *const tab = chatWindow->addWhisperTab(
- model->getAvatarAt(selected)->getName(), true);
+ name, name, true);
if (tab)
chatWindow->saveState();
}
diff --git a/src/gui/widgets/tabs/chat/whispertab.cpp b/src/gui/widgets/tabs/chat/whispertab.cpp
index 53712c6b2..5ca65f580 100644
--- a/src/gui/widgets/tabs/chat/whispertab.cpp
+++ b/src/gui/widgets/tabs/chat/whispertab.cpp
@@ -35,8 +35,9 @@
#include "debug.h"
WhisperTab::WhisperTab(const Widget2 *const widget,
+ const std::string &caption,
const std::string &nick) :
- ChatTab(widget, nick, nick, nick, ChatTabType::WHISPER),
+ ChatTab(widget, caption, nick, nick, ChatTabType::WHISPER),
mNick(nick)
{
setWhisperTabColors();
diff --git a/src/gui/widgets/tabs/chat/whispertab.h b/src/gui/widgets/tabs/chat/whispertab.h
index 24fc2abe0..677e8b470 100644
--- a/src/gui/widgets/tabs/chat/whispertab.h
+++ b/src/gui/widgets/tabs/chat/whispertab.h
@@ -57,6 +57,7 @@ class WhisperTab final : public ChatTab
* @param nick the name of the player this tab is whispering to
*/
WhisperTab(const Widget2 *const widget,
+ const std::string &caption,
const std::string &nick);
~WhisperTab();
diff --git a/src/gui/windows/chatwindow.cpp b/src/gui/windows/chatwindow.cpp
index dae1c86b2..524256dd4 100644
--- a/src/gui/windows/chatwindow.cpp
+++ b/src/gui/windows/chatwindow.cpp
@@ -1047,7 +1047,7 @@ void ChatWindow::addWhisper(const std::string &restrict nick,
}
else if (config.getBoolValue("whispertab"))
{
- tab = addWhisperTab(nick);
+ tab = addWhisperTab(nick, nick);
if (tab)
saveState();
}
@@ -1113,7 +1113,8 @@ void ChatWindow::addWhisper(const std::string &restrict nick,
}
}
-WhisperTab *ChatWindow::addWhisperTab(const std::string &nick,
+WhisperTab *ChatWindow::addWhisperTab(const std::string &caption,
+ const std::string &nick,
const bool switchTo)
{
if (!localPlayer)
@@ -1137,7 +1138,7 @@ WhisperTab *ChatWindow::addWhisperTab(const std::string &nick,
}
else
{
- ret = new WhisperTab(this, nick);
+ ret = new WhisperTab(this, caption, nick);
if (gui && !player_relations.isGoodName(nick))
ret->setLabelFont(gui->getSecureFont());
mWhispers[tempNick] = ret;
@@ -1216,7 +1217,7 @@ ChatTab *ChatWindow::addChatTab(const std::string &name,
}
else
{
- return addWhisperTab(name, switchTo);
+ return addWhisperTab(name, name, switchTo);
}
}
diff --git a/src/gui/windows/chatwindow.h b/src/gui/windows/chatwindow.h
index a2b1781bf..a6bf15384 100644
--- a/src/gui/windows/chatwindow.h
+++ b/src/gui/windows/chatwindow.h
@@ -194,7 +194,8 @@ class ChatWindow final : public Window,
const std::string &restrict mes,
const ChatMsgType::Type own = ChatMsgType::BY_OTHER);
- WhisperTab *addWhisperTab(const std::string &nick,
+ WhisperTab *addWhisperTab(const std::string &caption,
+ const std::string &nick,
const bool switchTo = false) A_WARN_UNUSED;
WhisperTab *getWhisperTab(const std::string &nick) const A_WARN_UNUSED;