summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIgor Borovkov <iborovkov@productengine.com>2010-07-08 18:57:16 +0300
committerIgor Borovkov <iborovkov@productengine.com>2010-07-08 18:57:16 +0300
commit737e8e59386f29c7693282ef22251263a51decc1 (patch)
tree534449ac6fcb9f65d0d44ed652050a10791782a8
parent414c845ddc0f624bca2eb7847d31afd8df6c5a6a (diff)
parent5fef1c902a3c028e6dd7158955a82b42145c1680 (diff)
merge
--HG-- branch : product-engine
-rw-r--r--indra/newview/llcofwearables.cpp44
-rw-r--r--indra/newview/llcofwearables.h2
2 files changed, 10 insertions, 36 deletions
diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp
index 8fdbdd08bf..0adbfd6ee2 100644
--- a/indra/newview/llcofwearables.cpp
+++ b/indra/newview/llcofwearables.cpp
@@ -333,6 +333,10 @@ BOOL LLCOFWearables::postBuild()
mBodyPartsTab = getChild<LLAccordionCtrlTab>("tab_body_parts");
mBodyPartsTab->setDropDownStateChangedCallback(boost::bind(&LLCOFWearables::onAccordionTabStateChanged, this, _1, _2));
+ mTab2AssetType[mClothingTab] = LLAssetType::AT_CLOTHING;
+ mTab2AssetType[mAttachmentsTab] = LLAssetType::AT_OBJECT;
+ mTab2AssetType[mBodyPartsTab] = LLAssetType::AT_BODYPART;
+
return LLPanel::postBuild();
}
@@ -632,49 +636,17 @@ LLAssetType::EType LLCOFWearables::getExpandedAccordionAssetType()
static type_map_t type_map;
static LLAccordionCtrl* accordion_ctrl = getChild<LLAccordionCtrl>("cof_wearables_accordion");
+ const LLAccordionCtrlTab* expanded_tab = accordion_ctrl->getExpandedTab();
- if (type_map.empty())
- {
- type_map["tab_clothing"] = LLAssetType::AT_CLOTHING;
- type_map["tab_attachments"] = LLAssetType::AT_OBJECT;
- type_map["tab_body_parts"] = LLAssetType::AT_BODYPART;
- }
-
- const LLAccordionCtrlTab* tab = accordion_ctrl->getExpandedTab();
- LLAssetType::EType result = LLAssetType::AT_NONE;
-
- if (tab)
- {
- type_map_t::iterator i = type_map.find(tab->getName());
- llassert(i != type_map.end());
- result = i->second;
- }
-
- return result;
+ return get_if_there(mTab2AssetType, expanded_tab, LLAssetType::AT_NONE);
}
LLAssetType::EType LLCOFWearables::getSelectedAccordionAssetType()
{
- //*TODO share the code with ::getExpandedAccordionAssetType(...)
static LLAccordionCtrl* accordion_ctrl = getChild<LLAccordionCtrl>("cof_wearables_accordion");
const LLAccordionCtrlTab* selected_tab = accordion_ctrl->getSelectedTab();
-
- if (selected_tab == mClothingTab)
- {
- return LLAssetType::AT_CLOTHING;
- }
- else if (selected_tab == mAttachmentsTab)
- {
- return LLAssetType::AT_OBJECT;
- }
- else if (selected_tab == mBodyPartsTab)
- {
- return LLAssetType::AT_BODYPART;
- }
- else
- {
- return LLAssetType::AT_NONE;
- }
+
+ return get_if_there(mTab2AssetType, selected_tab, LLAssetType::AT_NONE);
}
void LLCOFWearables::onListRightClick(LLUICtrl* ctrl, S32 x, S32 y, LLListContextMenu* menu)
diff --git a/indra/newview/llcofwearables.h b/indra/newview/llcofwearables.h
index de148e0d46..0518d59df3 100644
--- a/indra/newview/llcofwearables.h
+++ b/indra/newview/llcofwearables.h
@@ -116,6 +116,8 @@ protected:
LLAccordionCtrlTab* mLastSelectedTab;
+ std::map<const LLAccordionCtrlTab*, LLAssetType::EType> mTab2AssetType;
+
LLCOFCallbacks mCOFCallbacks;
LLListContextMenu* mClothingMenu;