From 29a93440367af32463f285ae5f0bd2aa23aadc92 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 19 May 2014 00:51:19 +0300 Subject: Move itemtype into separate file. --- src/gui/popups/itempopup.cpp | 36 ++++++++++++++++++------------------ src/gui/popups/itempopup.h | 4 ++-- src/gui/widgets/itemcontainer.cpp | 4 ++-- src/gui/windows/buydialog.cpp | 4 ++-- 4 files changed, 24 insertions(+), 24 deletions(-) (limited to 'src/gui') diff --git a/src/gui/popups/itempopup.cpp b/src/gui/popups/itempopup.cpp index 9b0870261..c07f99367 100644 --- a/src/gui/popups/itempopup.cpp +++ b/src/gui/popups/itempopup.cpp @@ -50,7 +50,7 @@ ItemPopup::ItemPopup() : mItemDesc(new TextBox(this)), mItemEffect(new TextBox(this)), mItemWeight(new TextBox(this)), - mItemType(ITEM_UNUSABLE), + mItemType(ItemType::UNUSABLE), mIcon(new Icon(this, nullptr)), mLastName(), mLastId(0), @@ -235,26 +235,26 @@ void ItemPopup::setItem(const ItemInfo &item, const unsigned char color, return label->setForegroundColorAll(getThemeColor(name2), \ getThemeColor(name2##_OUTLINE)); \ } -void ItemPopup::setLabelColor(Label *label, const ItemType type) const +void ItemPopup::setLabelColor(Label *label, const ItemType::Type type) const { switch (type) { - caseSetColor(ITEM_UNUSABLE, Theme::GENERIC) - caseSetColor(ITEM_USABLE, Theme::USABLE) - caseSetColor(ITEM_EQUIPMENT_ONE_HAND_WEAPON, Theme::ONEHAND) - caseSetColor(ITEM_EQUIPMENT_TWO_HANDS_WEAPON, Theme::TWOHAND) - caseSetColor(ITEM_EQUIPMENT_TORSO, Theme::TORSO) - caseSetColor(ITEM_EQUIPMENT_ARMS, Theme::ARMS) - caseSetColor(ITEM_EQUIPMENT_HEAD, Theme::HEAD) - caseSetColor(ITEM_EQUIPMENT_LEGS, Theme::LEGS) - caseSetColor(ITEM_EQUIPMENT_SHIELD, Theme::SHIELD) - caseSetColor(ITEM_EQUIPMENT_RING, Theme::RING) - caseSetColor(ITEM_EQUIPMENT_NECKLACE, Theme::NECKLACE) - caseSetColor(ITEM_EQUIPMENT_FEET, Theme::FEET) - caseSetColor(ITEM_EQUIPMENT_AMMO, Theme::AMMO) - caseSetColor(ITEM_EQUIPMENT_CHARM, Theme::CHARM) - caseSetColor(ITEM_SPRITE_RACE, Theme::UNKNOWN_ITEM) - caseSetColor(ITEM_SPRITE_HAIR, Theme::UNKNOWN_ITEM) + caseSetColor(ItemType::UNUSABLE, Theme::GENERIC) + caseSetColor(ItemType::USABLE, Theme::USABLE) + caseSetColor(ItemType::EQUIPMENT_ONE_HAND_WEAPON, Theme::ONEHAND) + caseSetColor(ItemType::EQUIPMENT_TWO_HANDS_WEAPON, Theme::TWOHAND) + caseSetColor(ItemType::EQUIPMENT_TORSO, Theme::TORSO) + caseSetColor(ItemType::EQUIPMENT_ARMS, Theme::ARMS) + caseSetColor(ItemType::EQUIPMENT_HEAD, Theme::HEAD) + caseSetColor(ItemType::EQUIPMENT_LEGS, Theme::LEGS) + caseSetColor(ItemType::EQUIPMENT_SHIELD, Theme::SHIELD) + caseSetColor(ItemType::EQUIPMENT_RING, Theme::RING) + caseSetColor(ItemType::EQUIPMENT_NECKLACE, Theme::NECKLACE) + caseSetColor(ItemType::EQUIPMENT_FEET, Theme::FEET) + caseSetColor(ItemType::EQUIPMENT_AMMO, Theme::AMMO) + caseSetColor(ItemType::EQUIPMENT_CHARM, Theme::CHARM) + caseSetColor(ItemType::SPRITE_RACE, Theme::UNKNOWN_ITEM) + caseSetColor(ItemType::SPRITE_HAIR, Theme::UNKNOWN_ITEM) default: { return label->setForegroundColorAll(getThemeColor( diff --git a/src/gui/popups/itempopup.h b/src/gui/popups/itempopup.h index 73129eaea..7f65f23da 100644 --- a/src/gui/popups/itempopup.h +++ b/src/gui/popups/itempopup.h @@ -68,13 +68,13 @@ class ItemPopup final : public Popup TextBox *mItemDesc; TextBox *mItemEffect; TextBox *mItemWeight; - ItemType mItemType; + ItemType::Type mItemType; Icon *mIcon; std::string mLastName; int mLastId; unsigned char mLastColor; - void setLabelColor(Label *label, const ItemType type) const; + void setLabelColor(Label *label, const ItemType::Type type) const; }; #endif // GUI_POPUPS_ITEMPOPUP_H diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp index fccc21b2f..1be268d56 100644 --- a/src/gui/widgets/itemcontainer.cpp +++ b/src/gui/widgets/itemcontainer.cpp @@ -149,8 +149,8 @@ namespace const ItemInfo &info1 = pair1->mItem->getInfo(); const ItemInfo &info2 = pair2->mItem->getInfo(); - const ItemType t1 = info1.getType(); - const ItemType t2 = info2.getType(); + const ItemType::Type t1 = info1.getType(); + const ItemType::Type t2 = info2.getType(); if (t1 == t2) { return (info1.getName() < info2.getName()); diff --git a/src/gui/windows/buydialog.cpp b/src/gui/windows/buydialog.cpp index 6799bcaf8..5d6774a51 100644 --- a/src/gui/windows/buydialog.cpp +++ b/src/gui/windows/buydialog.cpp @@ -152,8 +152,8 @@ namespace if (!item1 || !item2) return false; - const ItemType type1 = item1->getInfo().getType(); - const ItemType type2 = item2->getInfo().getType(); + const ItemType::Type type1 = item1->getInfo().getType(); + const ItemType::Type type2 = item2->getInfo().getType(); if (type1 == type2) return item1->getPrice() < item2->getPrice(); return type1 < type2; -- cgit v1.2.3-70-g09d2