summaryrefslogtreecommitdiff
path: root/src/gui/beingpopup.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-06-14 23:23:30 +0300
committerAndrei Karas <akaras@inbox.ru>2011-06-14 23:36:38 +0300
commitbf9bccc30a186e338f96c230a4f63cc924c77bd8 (patch)
treee46dbc2f022842982d89164ee598e1bcf827aa39 /src/gui/beingpopup.cpp
parentfb0f86589ae9e2d582383cea43e0a391e8d4739d (diff)
downloadmanaverse-bf9bccc30a186e338f96c230a4f63cc924c77bd8.tar.gz
manaverse-bf9bccc30a186e338f96c230a4f63cc924c77bd8.tar.bz2
manaverse-bf9bccc30a186e338f96c230a4f63cc924c77bd8.tar.xz
manaverse-bf9bccc30a186e338f96c230a4f63cc924c77bd8.zip
Add ability to add comments to any players.
Diffstat (limited to 'src/gui/beingpopup.cpp')
-rw-r--r--src/gui/beingpopup.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/gui/beingpopup.cpp b/src/gui/beingpopup.cpp
index 1b32d2b7b..2ba79d1a1 100644
--- a/src/gui/beingpopup.cpp
+++ b/src/gui/beingpopup.cpp
@@ -59,10 +59,14 @@ BeingPopup::BeingPopup():
mBeingRank = new Label("A");
mBeingRank->setPosition(getPadding(), 3 * fontHeight);
+ mBeingComment = new Label("A");
+ mBeingComment->setPosition(getPadding(), 4 * fontHeight);
+
add(mBeingName);
add(mBeingParty);
add(mBeingGuild);
add(mBeingRank);
+ add(mBeingComment);
}
BeingPopup::~BeingPopup()
@@ -80,6 +84,9 @@ void BeingPopup::show(int x, int y, Being *b)
Label *label1 = mBeingParty;
Label *label2 = mBeingGuild;
Label *label3 = mBeingRank;
+ Label *label4 = mBeingComment;
+
+ b->updateComment();
mBeingName->setCaption(b->getName() + b->getGenderSignWithSpace());
if (gui)
@@ -94,6 +101,7 @@ void BeingPopup::show(int x, int y, Being *b)
label1->setCaption("");
label2->setCaption("");
label3->setCaption("");
+ label4->setCaption("");
if (!(b->getPartyName().empty()))
{
@@ -103,6 +111,7 @@ void BeingPopup::show(int x, int y, Being *b)
}
else
{
+ label4 = label3;
label3 = label2;
label2 = label1;
label1 = 0;
@@ -116,6 +125,7 @@ void BeingPopup::show(int x, int y, Being *b)
}
else
{
+ label4 = label3;
label3 = label2;
label2 = 0;
}
@@ -127,9 +137,21 @@ void BeingPopup::show(int x, int y, Being *b)
}
else
{
+ label4 = label3;
label3 = 0;
}
+ if (!b->getComment().empty())
+ {
+ label4->setCaption(strprintf(_("Comment: %s"),
+ b->getComment().c_str()));
+ label4->adjustSize();
+ }
+ else
+ {
+ label4 = 0;
+ }
+
int minWidth = mBeingName->getWidth();
if (label1 && label1->getWidth() > minWidth)
minWidth = label1->getWidth();
@@ -137,6 +159,8 @@ void BeingPopup::show(int x, int y, Being *b)
minWidth = label2->getWidth();
if (label3 && label3->getWidth() > minWidth)
minWidth = label3->getWidth();
+ if (label4 && label4->getWidth() > minWidth)
+ minWidth = label4->getWidth();
int height = getFont()->getHeight();
if (label1)
@@ -145,6 +169,8 @@ void BeingPopup::show(int x, int y, Being *b)
height += getFont()->getHeight();
if (label3)
height += getFont()->getHeight();
+ if (label4)
+ height += getFont()->getHeight();
setContentSize(minWidth + 10, height + 10);