diff options
-rw-r--r-- | src/gui/popups/itempopup.cpp | 16 | ||||
-rw-r--r-- | src/gui/popups/itempopup.h | 2 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/gui/popups/itempopup.cpp b/src/gui/popups/itempopup.cpp index 3cb80b7ac..f7898d91a 100644 --- a/src/gui/popups/itempopup.cpp +++ b/src/gui/popups/itempopup.cpp @@ -270,8 +270,8 @@ void ItemPopup::setItem(const ItemInfo &item, mItemName->adjustSize(); setLabelColor(mItemName, mItemType); mItemName->setPosition(space, 0); - - mItemEffect->setTextWrapped(item.getEffect(), 196); + const std::string readableEffect = replaceChar((char*)item.getEffect().c_str(), '/', '\n'); + mItemEffect->setTextWrapped(readableEffect, 196); // TRANSLATORS: popup label mItemWeight->setTextWrapped(strprintf(_("Weight: %s"), UnitsDb::formatWeight(item.getWeight()).c_str()), 196); @@ -466,3 +466,15 @@ void ItemPopup::resetPopup() mLastColor = ItemColor_one; mLastId = 0; } + +char* ItemPopup::replaceChar(char* str, char find, char replace) +{ + char *currentPos = str; + while ((currentPos = strchr(currentPos, find)) != NULL) + { + *currentPos = ' '; + *currentPos++; + *currentPos = replace; + } + return str; +} diff --git a/src/gui/popups/itempopup.h b/src/gui/popups/itempopup.h index d42bee103..b6cfd2e37 100644 --- a/src/gui/popups/itempopup.h +++ b/src/gui/popups/itempopup.h @@ -97,6 +97,8 @@ class ItemPopup final : public Popup void setLabelColor(Label *label, const ItemDbTypeT type) const A_NONNULL(2); + + char* replaceChar(char* str ,char find,char replace); }; extern ItemPopup *itemPopup; |