summaryrefslogtreecommitdiff
path: root/indra/newview/llcofwearables.cpp
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2010-07-15 14:26:11 -0400
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2010-07-15 14:26:11 -0400
commitd4845c1d263c07aaa0b8c2c638cd2a214e166bdd (patch)
treefc056a7c16d03fc53a5efe0da0d055f6c606177a /indra/newview/llcofwearables.cpp
parentd5655c9bbfc2b498334e055da882055a8d99fff0 (diff)
parent08647d14c256cd6959a9853dc194614771a19501 (diff)
merge
Diffstat (limited to 'indra/newview/llcofwearables.cpp')
-rw-r--r--indra/newview/llcofwearables.cpp74
1 files changed, 31 insertions, 43 deletions
diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp
index 8fdbdd08bf..86d9121213 100644
--- a/indra/newview/llcofwearables.cpp
+++ b/indra/newview/llcofwearables.cpp
@@ -79,9 +79,7 @@ protected:
}
// Set proper label for the "Create new <WEARABLE_TYPE>" menu item.
- LLStringUtil::format_map_t args;
- args["[WEARABLE_TYPE]"] = LLTrans::getString(LLWearableType::getTypeDefaultNewName(w_type));
- std::string new_label = LLTrans::getString("CreateNewWearable", args);
+ std::string new_label = LLTrans::getString("create_new_" + LLWearableType::getTypeName(w_type));
menu_item->setLabel(new_label);
}
@@ -285,7 +283,8 @@ LLCOFWearables::LLCOFWearables() : LLPanel(),
mClothingTab(NULL),
mAttachmentsTab(NULL),
mBodyPartsTab(NULL),
- mLastSelectedTab(NULL)
+ mLastSelectedTab(NULL),
+ mCOFVersion(-1)
{
mClothingMenu = new CofClothingContextMenu(this);
mAttachmentMenu = new CofAttachmentContextMenu(this);
@@ -333,6 +332,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();
}
@@ -376,6 +379,23 @@ void LLCOFWearables::onAccordionTabStateChanged(LLUICtrl* ctrl, const LLSD& expa
void LLCOFWearables::refresh()
{
+ const LLUUID cof_id = LLAppearanceMgr::instance().getCOF();
+ if (cof_id.isNull())
+ {
+ llwarns << "COF ID cannot be NULL" << llendl;
+ return;
+ }
+
+ LLViewerInventoryCategory* catp = gInventory.getCategory(cof_id);
+ if (!catp)
+ {
+ llwarns << "COF category cannot be NULL" << llendl;
+ return;
+ }
+
+ if (mCOFVersion == catp->getVersion()) return;
+ mCOFVersion = catp->getVersion();
+
typedef std::vector<LLSD> values_vector_t;
typedef std::map<LLFlatListView*, values_vector_t> selection_map_t;
@@ -391,7 +411,7 @@ void LLCOFWearables::refresh()
LLInventoryModel::cat_array_t cats;
LLInventoryModel::item_array_t cof_items;
- gInventory.collectDescendents(LLAppearanceMgr::getInstance()->getCOF(), cats, cof_items, LLInventoryModel::EXCLUDE_TRASH);
+ gInventory.collectDescendents(cof_id, cats, cof_items, LLInventoryModel::EXCLUDE_TRASH);
populateAttachmentsAndBodypartsLists(cof_items);
@@ -499,7 +519,7 @@ LLPanelClothingListItem* LLCOFWearables::buildClothingListItem(LLViewerInventory
item_panel->childSetAction("btn_edit", mCOFCallbacks.mEditWearable);
//turning on gray separator line for the last item in the items group of the same wearable type
- item_panel->childSetVisible("wearable_type_separator_icon", last);
+ item_panel->setSeparatorVisible(last);
return item_panel;
}
@@ -632,49 +652,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 get_if_there(mTab2AssetType, expanded_tab, LLAssetType::AT_NONE);
}
- return result;
-}
-
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)