summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2015-04-05 16:42:33 +0300
committerAndrei Karas <akaras@inbox.ru>2015-04-05 16:42:33 +0300
commit84b6217136c8d59347ab9f28ec5e9e4d718d5058 (patch)
tree276a9727d86b516296d3e86c7150f707dc8e9340
parent08d5f2d6f3eeded6d7a2e1adcf94e850098aa85f (diff)
downloadmanaverse-84b6217136c8d59347ab9f28ec5e9e4d718d5058.tar.gz
manaverse-84b6217136c8d59347ab9f28ec5e9e4d718d5058.tar.bz2
manaverse-84b6217136c8d59347ab9f28ec5e9e4d718d5058.tar.xz
manaverse-84b6217136c8d59347ab9f28ec5e9e4d718d5058.zip
Show chat room name in player popup.
-rw-r--r--src/gui/popups/beingpopup.cpp45
-rw-r--r--src/gui/popups/beingpopup.h1
2 files changed, 41 insertions, 5 deletions
diff --git a/src/gui/popups/beingpopup.cpp b/src/gui/popups/beingpopup.cpp
index 5fc0fc6c5..f0a8868f4 100644
--- a/src/gui/popups/beingpopup.cpp
+++ b/src/gui/popups/beingpopup.cpp
@@ -33,6 +33,8 @@
#include "gui/widgets/label.h"
+#include "resources/chatobject.h"
+
#include "utils/gettext.h"
#include "utils/stringutils.h"
@@ -48,7 +50,8 @@ BeingPopup::BeingPopup() :
mBeingRank(new Label(this, "A")),
mBeingComment(new Label(this, "A")),
mBeingBuyBoard(new Label(this, "A")),
- mBeingSellBoard(new Label(this, "A"))
+ mBeingSellBoard(new Label(this, "A")),
+ mBeingRoom(new Label(this, "A"))
{
// Being Name
mBeingName->setFont(boldFont);
@@ -65,6 +68,7 @@ BeingPopup::BeingPopup() :
mBeingBuyBoard->setPosition(0, 4 * fontHeight);
mBeingSellBoard->setPosition(0, 4 * fontHeight);
mBeingComment->setPosition(0, 5 * fontHeight);
+ mBeingRoom->setPosition(0, 6 * fontHeight);
mBeingParty->setForegroundColorAll(getThemeColor(Theme::POPUP),
getThemeColor(Theme::POPUP_OUTLINE));
@@ -78,6 +82,8 @@ BeingPopup::BeingPopup() :
getThemeColor(Theme::POPUP_OUTLINE));
mBeingComment->setForegroundColorAll(getThemeColor(Theme::POPUP),
getThemeColor(Theme::POPUP_OUTLINE));
+ mBeingRoom->setForegroundColorAll(getThemeColor(Theme::POPUP),
+ getThemeColor(Theme::POPUP_OUTLINE));
}
BeingPopup::~BeingPopup()
@@ -93,6 +99,7 @@ void BeingPopup::postInit()
add(mBeingComment);
add(mBeingBuyBoard);
add(mBeingSellBoard);
+ add(mBeingRoom);
}
void BeingPopup::show(const int x, const int y, Being *const b)
@@ -109,6 +116,7 @@ void BeingPopup::show(const int x, const int y, Being *const b)
Label *label4 = mBeingBuyBoard;
Label *label5 = mBeingSellBoard;
Label *label6 = mBeingComment;
+ Label *label7 = mBeingRoom;
b->updateComment();
@@ -145,6 +153,7 @@ void BeingPopup::show(const int x, const int y, Being *const b)
label4->setCaption("");
label5->setCaption("");
label6->setCaption("");
+ label7->setCaption("");
#ifdef EATHENA_SUPPORT
const ActorType::Type type = b->getType();
@@ -165,6 +174,7 @@ void BeingPopup::show(const int x, const int y, Being *const b)
label4 = nullptr;
label5 = nullptr;
label6 = nullptr;
+ label7 = nullptr;
}
}
else if (type == ActorType::Homunculus)
@@ -184,6 +194,7 @@ void BeingPopup::show(const int x, const int y, Being *const b)
label4 = nullptr;
label5 = nullptr;
label6 = nullptr;
+ label7 = nullptr;
}
}
else
@@ -198,7 +209,8 @@ void BeingPopup::show(const int x, const int y, Being *const b)
}
else
{
- label6 = label4;
+ label7 = label6;
+ label6 = label5;
label5 = label4;
label4 = label3;
label3 = label2;
@@ -215,7 +227,8 @@ void BeingPopup::show(const int x, const int y, Being *const b)
}
else
{
- label6 = label4;
+ label7 = label6;
+ label6 = label5;
label5 = label4;
label4 = label3;
label3 = label2;
@@ -231,7 +244,8 @@ void BeingPopup::show(const int x, const int y, Being *const b)
}
else
{
- label6 = label4;
+ label7 = label6;
+ label6 = label5;
label5 = label4;
label4 = label3;
label3 = nullptr;
@@ -246,7 +260,8 @@ void BeingPopup::show(const int x, const int y, Being *const b)
}
else
{
- label6 = label4;
+ label7 = label6;
+ label6 = label5;
label5 = label4;
label4 = nullptr;
}
@@ -260,6 +275,7 @@ void BeingPopup::show(const int x, const int y, Being *const b)
}
else
{
+ label7 = label6;
label6 = label5;
label5 = nullptr;
}
@@ -273,8 +289,23 @@ void BeingPopup::show(const int x, const int y, Being *const b)
}
else
{
+ label7 = label6;
label6 = nullptr;
}
+#ifdef EATHENA_SUPPORT
+ const ChatObject *const chat = b->getChat();
+ if (chat)
+ {
+ // TRANSLATORS: being popup label
+ label7->setCaption(strprintf(_("Chat room: %s"),
+ chat->title.c_str()));
+ label7->adjustSize();
+ }
+ else
+ {
+ label7 = nullptr;
+ }
+#endif
}
int minWidth = mBeingName->getWidth();
@@ -290,6 +321,8 @@ void BeingPopup::show(const int x, const int y, Being *const b)
minWidth = label5->getWidth();
if (label6 && label6->getWidth() > minWidth)
minWidth = label6->getWidth();
+ if (label7 && label7->getWidth() > minWidth)
+ minWidth = label7->getWidth();
const int height1 = getFont()->getHeight();
int height = height1;
@@ -305,6 +338,8 @@ void BeingPopup::show(const int x, const int y, Being *const b)
height += height1;
if (label6)
height += height1;
+ if (label7)
+ height += height1;
setContentSize(minWidth, height);
position(x, y);
diff --git a/src/gui/popups/beingpopup.h b/src/gui/popups/beingpopup.h
index 6203b5ef7..eba961063 100644
--- a/src/gui/popups/beingpopup.h
+++ b/src/gui/popups/beingpopup.h
@@ -64,6 +64,7 @@ class BeingPopup final : public Popup
Label *mBeingComment;
Label *mBeingBuyBoard;
Label *mBeingSellBoard;
+ Label *mBeingRoom;
};
extern BeingPopup *beingPopup;