From c17acf93cb4ebe698b0af8a38a1fd6d49a6be3cc Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Tue, 8 Mar 2011 04:40:39 +0200 Subject: Add possible colors to item popups. --- src/gui/itempopup.cpp | 12 ++++++++---- src/gui/itempopup.h | 3 ++- src/gui/widgets/itemlinkhandler.cpp | 3 ++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/gui/itempopup.cpp b/src/gui/itempopup.cpp index 109e2edf8..d7f67ff0c 100644 --- a/src/gui/itempopup.cpp +++ b/src/gui/itempopup.cpp @@ -97,7 +97,7 @@ void ItemPopup::setItem(const Item *item, bool showImage) return; const ItemInfo &ii = item->getInfo(); - setItem(ii, showImage); + setItem(ii, item->getColor(), showImage); if (item->getRefine() > 0) { mItemName->setCaption(strprintf("%s (+%d), %d", ii.getName().c_str(), @@ -109,7 +109,8 @@ void ItemPopup::setItem(const Item *item, bool showImage) } } -void ItemPopup::setItem(const ItemInfo &item, bool showImage) +void ItemPopup::setItem(const ItemInfo &item, unsigned char color, + bool showImage) { if (!mIcon || item.getName() == mItemName->getCaption()) return; @@ -123,9 +124,12 @@ void ItemPopup::setItem(const ItemInfo &item, bool showImage) if (showImage) { ResourceManager *resman = ResourceManager::getInstance(); - Image *image = resman->getImage( + logger->log("img: " + combineDye2( paths.getStringValue("itemIcons") - + item.getDisplay().image); + + item.getDisplay().image, item.getDyeColorsString(color))); + Image *image = resman->getImage(combineDye2( + paths.getStringValue("itemIcons") + + item.getDisplay().image, item.getDyeColorsString(color))); mIcon->setImage(image); if (image) diff --git a/src/gui/itempopup.h b/src/gui/itempopup.h index 4cefae6c6..aeda26a0d 100644 --- a/src/gui/itempopup.h +++ b/src/gui/itempopup.h @@ -52,7 +52,8 @@ class ItemPopup : public Popup /** * Sets the info to be displayed given a particular item. */ - void setItem(const ItemInfo &item, bool showImage = false); + void setItem(const ItemInfo &item, unsigned char color, + bool showImage = false); void setItem(const Item *item, bool showImage = false); diff --git a/src/gui/widgets/itemlinkhandler.cpp b/src/gui/widgets/itemlinkhandler.cpp index e09307a8e..87d708cd0 100644 --- a/src/gui/widgets/itemlinkhandler.cpp +++ b/src/gui/widgets/itemlinkhandler.cpp @@ -57,7 +57,8 @@ void ItemLinkHandler::handleLink(const std::string &link, if (id > 0) { const ItemInfo &itemInfo = ItemDB::get(id); - mItemPopup->setItem(itemInfo, true); + //+++ need add color to links? + mItemPopup->setItem(itemInfo, 1, true); if (mItemPopup->isVisible()) mItemPopup->setVisible(false); -- cgit v1.2.3-60-g2f50