summaryrefslogtreecommitdiff
path: root/src/gui/charselectdialog.cpp
diff options
context:
space:
mode:
authorStefan Dombrowski <stefan@uni-bonn.de>2009-11-07 17:34:26 +0100
committerJared Adams <jaxad0127@gmail.com>2009-11-07 11:49:29 -0700
commit819f8f85898c1a34dd1de439350f8732a9d840a7 (patch)
tree97b60aa2096cd84c7ba1c8f4b62060e38dc7ab8d /src/gui/charselectdialog.cpp
parent99be9859a30e84e758ee3bfe7dcc3de33dfa2391 (diff)
downloadmana-819f8f85898c1a34dd1de439350f8732a9d840a7.tar.gz
mana-819f8f85898c1a34dd1de439350f8732a9d840a7.tar.bz2
mana-819f8f85898c1a34dd1de439350f8732a9d840a7.tar.xz
mana-819f8f85898c1a34dd1de439350f8732a9d840a7.zip
Improve the look of the CharSelectDialog
Diffstat (limited to 'src/gui/charselectdialog.cpp')
-rw-r--r--src/gui/charselectdialog.cpp30
1 files changed, 21 insertions, 9 deletions
diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp
index 9421f77a..43537ca3 100644
--- a/src/gui/charselectdialog.cpp
+++ b/src/gui/charselectdialog.cpp
@@ -107,6 +107,7 @@ class CharEntry : public Container
PlayerBox *mPlayerBox;
Label *mName;
+ Label *mLevel;
Label *mMoney;
Button *mButton;
Button *mDelete;
@@ -289,7 +290,8 @@ CharEntry::CharEntry(CharSelectDialog *m, char slot, LocalPlayer *chr):
mPlayerBox(new PlayerBox(chr))
{
mButton = new Button("wwwwwwwww", "go", m);
- mName = new Label("wwwwwwwwwwwwwwwwwwwwwwww (888)");
+ mName = new Label("wwwwwwwwwwwwwwwwwwwwwwww");
+ mLevel = new Label("(888)");
mMoney = new Label("wwwwwwwww");
mDelete = new Button(_("Delete"), "delete", m);
@@ -299,14 +301,23 @@ CharEntry::CharEntry(CharSelectDialog *m, char slot, LocalPlayer *chr):
place(0, 0, mPlayerBox, 3, 5);
place(0, 5, mName, 3);
- place(0, 6, mMoney, 3);
- place(0, 7, mButton, 3);
- place(0, 8, mDelete, 3);
-
- h.reflowLayout(74, 123 + mName->getHeight() + mMoney->getHeight() +
- mButton->getHeight() + mDelete->getHeight());
+ place(0, 6, mLevel, 3);
+ place(0, 7, mMoney, 3);
+ place(0, 8, mButton, 3);
+ place(0, 9, mDelete, 3);
update();
+
+ // Setting the width so that the largest label fits.
+ mName->adjustSize();
+ mMoney->adjustSize();
+ int width = 74;
+ if (width < 20 + mName->getWidth())
+ width = 20 + mName->getWidth();
+ if (width < 20 + mMoney->getWidth())
+ width = 20 + mMoney->getWidth();
+ h.reflowLayout(width, 112 + mName->getHeight() + mLevel->getHeight() +
+ mMoney->getHeight() + mButton->getHeight() + mDelete->getHeight());
}
void CharEntry::setChar(LocalPlayer *chr)
@@ -329,8 +340,8 @@ void CharEntry::update()
{
mButton->setCaption(_("Choose"));
mButton->setActionEventId("use");
- mName->setCaption(strprintf("%s (%d)", mCharacter->getName().c_str(),
- mCharacter->getLevel()));
+ mName->setCaption(strprintf("%s", mCharacter->getName().c_str()));
+ mLevel->setCaption(strprintf("Level %d", mCharacter->getLevel()));
mMoney->setCaption(Units::formatCurrency(mCharacter->getMoney()));
mDelete->setVisible(true);
@@ -340,6 +351,7 @@ void CharEntry::update()
mButton->setCaption(_("Create"));
mButton->setActionEventId("new");
mName->setCaption(_("(empty)"));
+ mLevel->setCaption(_("(empty)"));
mMoney->setCaption(Units::formatCurrency(0));
mDelete->setVisible(false);