summaryrefslogtreecommitdiff
path: root/src/gui/itempopup.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/itempopup.cpp')
-rw-r--r--src/gui/itempopup.cpp21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp
index 88afcd5b..48aa7c8c 100644
--- a/src/gui/itempopup.cpp
+++ b/src/gui/itempopup.cpp
@@ -1,10 +1,9 @@
/*
- * Aethyra
+ * The Mana World
* Copyright (C) 2008 The Legend of Mazzeroth Development Team
* Copyright (C) 2008 The Mana World Development Team
*
- * This file is part of Aethyra based on original code
- * from The Legend of Mazzeroth.
+ * This file is part of The Mana World.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -33,6 +32,8 @@
#include "widgets/layout.h"
+#include "../units.h"
+
#include "../resources/iteminfo.h"
#include "../utils/gettext.h"
@@ -51,7 +52,7 @@ ItemPopup::ItemPopup():
mItemName->setPosition(2, 2);
// Item Description
- mItemDesc = new TextBox();
+ mItemDesc = new TextBox;
mItemDesc->setEditable(false);
mItemDescScroll = new ScrollArea(mItemDesc);
@@ -62,7 +63,7 @@ ItemPopup::ItemPopup():
mItemDescScroll->setPosition(2, getFont()->getHeight());
// Item Effect
- mItemEffect = new TextBox();
+ mItemEffect = new TextBox;
mItemEffect->setEditable(false);
mItemEffectScroll = new ScrollArea(mItemEffect);
@@ -73,7 +74,7 @@ ItemPopup::ItemPopup():
mItemEffectScroll->setPosition(2, (2 * getFont()->getHeight()) + 5);
// Item Weight
- mItemWeight = new TextBox();
+ mItemWeight = new TextBox;
mItemWeight->setEditable(false);
mItemWeightScroll = new ScrollArea(mItemWeight);
@@ -109,8 +110,8 @@ void ItemPopup::setItem(const ItemInfo &item)
mItemName->setWidth(boldFont->getWidth(item.getName()));
mItemDesc->setTextWrapped(item.getDescription(), 196);
mItemEffect->setTextWrapped(item.getEffect(), 196);
- mItemWeight->setTextWrapped(_("Weight: ") + toString(item.getWeight()) +
- _(" grams"), 196);
+ mItemWeight->setTextWrapped(_("Weight: ") +
+ Units::formatWeight(item.getWeight()), 196);
int minWidth = mItemName->getWidth();
@@ -206,9 +207,9 @@ unsigned int ItemPopup::getNumRows()
void ItemPopup::view(int x, int y)
{
if (windowContainer->getWidth() < (x + getWidth() + 5))
- x = windowContainer->getWidth() - getWidth();
+ x = windowContainer->getWidth() - getWidth();
if ((y - getHeight() - 10) < 0)
- y = 0;
+ y = 0;
else
y = y - getHeight() - 10;
setPosition(x, y);