diff options
author | Vadim Savchuk <vsavchuk@productengine.com> | 2010-08-03 16:28:58 +0300 |
---|---|---|
committer | Vadim Savchuk <vsavchuk@productengine.com> | 2010-08-03 16:28:58 +0300 |
commit | e2135bd6dd7668560f5b3af5e1a7549488caa2ab (patch) | |
tree | a033e2809d98ebea2fa74a5808c235276f5f5df2 /indra/newview/llpaneloutfitedit.cpp | |
parent | b12201bf01caeef0f5a13951980be187ac3936c8 (diff) | |
parent | d10b9a7f37bec670342136eeea2c8c2604fdfeef (diff) |
Merge from default branch
--HG--
branch : product-engine
Diffstat (limited to 'indra/newview/llpaneloutfitedit.cpp')
-rw-r--r-- | indra/newview/llpaneloutfitedit.cpp | 127 |
1 files changed, 103 insertions, 24 deletions
diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index 5195b719d4..8b9baef54a 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -71,6 +71,7 @@ #include "llsdutil.h" #include "llsidepanelappearance.h" #include "lltoggleablemenu.h" +#include "llvoavatarself.h" #include "llwearablelist.h" #include "llwearableitemslist.h" #include "llwearabletype.h" @@ -263,7 +264,7 @@ LLPanelOutfitEdit::LLPanelOutfitEdit() observer.addBOFReplacedCallback(boost::bind(&LLPanelOutfitEdit::updateCurrentOutfitName, this)); observer.addBOFChangedCallback(boost::bind(&LLPanelOutfitEdit::updateVerbs, this)); observer.addOutfitLockChangedCallback(boost::bind(&LLPanelOutfitEdit::updateVerbs, this)); - observer.addCOFChangedCallback(boost::bind(&LLPanelOutfitEdit::update, this)); + observer.addCOFChangedCallback(boost::bind(&LLPanelOutfitEdit::onCOFChanged, this)); gAgentWearables.addLoadingStartedCallback(boost::bind(&LLPanelOutfitEdit::onOutfitChanging, this, true)); gAgentWearables.addLoadedCallback(boost::bind(&LLPanelOutfitEdit::onOutfitChanging, this, false)); @@ -297,9 +298,9 @@ BOOL LLPanelOutfitEdit::postBuild() mFolderViewItemTypes[FVIT_ATTACHMENT] = LLLookItemType(getString("Filter.Objects"), ATTACHMENT_MASK); //order is important, see EListViewItemType for order information - mListViewItemTypes.push_back(new LLFilterItem(getString("Filter.All"), new LLFindByMask(ALL_ITEMS_MASK))); - mListViewItemTypes.push_back(new LLFilterItem(getString("Filter.Clothing"), new LLIsType(LLAssetType::AT_CLOTHING))); - mListViewItemTypes.push_back(new LLFilterItem(getString("Filter.Bodyparts"), new LLIsType(LLAssetType::AT_BODYPART))); + mListViewItemTypes.push_back(new LLFilterItem(getString("Filter.All"), new LLFindNonLinksByMask(ALL_ITEMS_MASK))); + mListViewItemTypes.push_back(new LLFilterItem(getString("Filter.Clothing"), new LLIsTypeActual(LLAssetType::AT_CLOTHING))); + mListViewItemTypes.push_back(new LLFilterItem(getString("Filter.Bodyparts"), new LLIsTypeActual(LLAssetType::AT_BODYPART))); mListViewItemTypes.push_back(new LLFilterItem(getString("Filter.Objects"), new LLFindByMask(ATTACHMENT_MASK)));; mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("shape"), new LLFindActualWearablesOfType(LLWearableType::WT_SHAPE))); mListViewItemTypes.push_back(new LLFilterItem(LLTrans::getString("skin"), new LLFindActualWearablesOfType(LLWearableType::WT_SKIN))); @@ -331,7 +332,7 @@ BOOL LLPanelOutfitEdit::postBuild() childSetCommitCallback("shop_btn_1", boost::bind(&LLPanelOutfitEdit::onShopButtonClicked, this), NULL); childSetCommitCallback("shop_btn_2", boost::bind(&LLPanelOutfitEdit::onShopButtonClicked, this), NULL); - setVisibleCallback(boost::bind(&LLPanelOutfitEdit::onVisibilityChange, this)); + setVisibleCallback(boost::bind(&LLPanelOutfitEdit::onVisibilityChange, this, _2)); mCOFWearables = getChild<LLCOFWearables>("cof_wearables_list"); mCOFWearables->setCommitCallback(boost::bind(&LLPanelOutfitEdit::filterWearablesBySelectedItem, this)); @@ -347,8 +348,8 @@ BOOL LLPanelOutfitEdit::postBuild() mInventoryItemsPanel = getChild<LLInventoryPanel>("folder_view"); mInventoryItemsPanel->setFilterTypes(ALL_ITEMS_MASK); mInventoryItemsPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS); - mInventoryItemsPanel->setSelectCallback(boost::bind(&LLPanelOutfitEdit::onInventorySelectionChange, this)); - mInventoryItemsPanel->getRootFolder()->setReshapeCallback(boost::bind(&LLPanelOutfitEdit::onInventorySelectionChange, this)); + mInventoryItemsPanel->setSelectCallback(boost::bind(&LLPanelOutfitEdit::updatePlusButton, this)); + mInventoryItemsPanel->getRootFolder()->setReshapeCallback(boost::bind(&LLPanelOutfitEdit::updatePlusButton, this)); mCOFDragAndDropObserver = new LLCOFDragAndDropObserver(mInventoryItemsPanel->getModel()); @@ -388,7 +389,7 @@ BOOL LLPanelOutfitEdit::postBuild() mWearablesListViewPanel = getChild<LLPanel>("filtered_wearables_panel"); mWearableItemsList = getChild<LLInventoryItemsList>("list_view"); mWearableItemsList->setCommitOnSelectionChange(true); - mWearableItemsList->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onInventorySelectionChange, this)); + mWearableItemsList->setCommitCallback(boost::bind(&LLPanelOutfitEdit::updatePlusButton, this)); mWearableItemsList->setDoubleClickCallback(boost::bind(&LLPanelOutfitEdit::onPlusBtnClicked, this)); mSaveComboBtn.reset(new LLSaveOutfitComboBtn(this)); @@ -442,6 +443,9 @@ void LLPanelOutfitEdit::showAddWearablesPanel(bool show_add_wearables) mListViewFilterCmbBox->setVisible(false); showWearablesFilter(); + + // Reset mWearableItemsList position to top. See EXT-8180. + mWearableItemsList->goToTop(); } //switching button bars @@ -583,11 +587,16 @@ void LLPanelOutfitEdit::onPlusBtnClicked(void) } } -void LLPanelOutfitEdit::onVisibilityChange() +void LLPanelOutfitEdit::onVisibilityChange(const LLSD &in_visible_chain) { showAddWearablesPanel(false); mWearableItemsList->resetSelection(); mInventoryItemsPanel->clearSelection(); + + if (in_visible_chain.asBoolean()) + { + update(); + } } void LLPanelOutfitEdit::onAddWearableClicked(void) @@ -614,15 +623,52 @@ void LLPanelOutfitEdit::onShopButtonClicked() { static LLShopURLDispatcher url_resolver; + // will contain the resultant URL std::string url; + + if (isAgentAvatarValid()) + { + // try to get wearable type from 'Add More' panel first (EXT-7639) + LLWearableType::EType type = getAddMorePanelSelectionType(); + + if (type == LLWearableType::WT_NONE) + { + type = getCOFWearablesSelectionType(); + } + + ESex sex = gAgentAvatarp->getSex(); + + // WT_INVALID comes for attachments + if (type != LLWearableType::WT_INVALID && type != LLWearableType::WT_NONE) + { + url = url_resolver.resolveURL(type, sex); + } + + if (url.empty()) + { + url = url_resolver.resolveURL(mCOFWearables->getExpandedAccordionAssetType(), sex); + } + } + else + { + llwarns << "Agent avatar is invalid" << llendl; + + // the second argument is not important in this case: generic market place will be opened + url = url_resolver.resolveURL(LLWearableType::WT_NONE, SEX_FEMALE); + } + + LLWeb::loadURLExternal(url); +} + +LLWearableType::EType LLPanelOutfitEdit::getCOFWearablesSelectionType() const +{ std::vector<LLPanel*> selected_items; - mCOFWearables->getSelectedItems(selected_items); + LLWearableType::EType type = LLWearableType::WT_NONE; - ESex sex = gSavedSettings.getU32("AvatarSex") ? SEX_MALE : SEX_FEMALE; + mCOFWearables->getSelectedItems(selected_items); if (selected_items.size() == 1) { - LLWearableType::EType type = LLWearableType::WT_NONE; LLPanel* item = selected_items.front(); // LLPanelDummyClothingListItem is lower then LLPanelInventoryListItemBase in hierarchy tree @@ -634,20 +680,45 @@ void LLPanelOutfitEdit::onShopButtonClicked() { type = real_item->getWearableType(); } + } - // WT_INVALID comes for attachments - if (type != LLWearableType::WT_INVALID) + return type; +} + +LLWearableType::EType LLPanelOutfitEdit::getAddMorePanelSelectionType() const +{ + LLWearableType::EType type = LLWearableType::WT_NONE; + + if (mAddWearablesPanel != NULL && mAddWearablesPanel->getVisible()) + { + if (mInventoryItemsPanel != NULL && mInventoryItemsPanel->getVisible()) { - url = url_resolver.resolveURL(type, sex); + std::set<LLUUID> selected_uuids = mInventoryItemsPanel->getRootFolder()->getSelectionList(); + + if (selected_uuids.size() == 1) + { + type = getWearableTypeByItemUUID(*(selected_uuids.begin())); + } } - } + else if (mWearableItemsList != NULL && mWearableItemsList->getVisible()) + { + std::vector<LLUUID> selected_uuids; + mWearableItemsList->getSelectedUUIDs(selected_uuids); - if (url.empty()) - { - url = url_resolver.resolveURL(mCOFWearables->getExpandedAccordionAssetType(), sex); + if (selected_uuids.size() == 1) + { + type = getWearableTypeByItemUUID(selected_uuids.front()); + } + } } - LLWeb::loadURLExternal(url); + return type; +} + +LLWearableType::EType LLPanelOutfitEdit::getWearableTypeByItemUUID(const LLUUID& item_uuid) const +{ + LLViewerInventoryItem* item = gInventory.getLinkedItem(item_uuid); + return (item != NULL) ? item->getWearableType() : LLWearableType::WT_NONE; } void LLPanelOutfitEdit::onRemoveFromOutfitClicked(void) @@ -667,7 +738,7 @@ void LLPanelOutfitEdit::onEditWearableClicked(void) } } -void LLPanelOutfitEdit::onInventorySelectionChange() +void LLPanelOutfitEdit::updatePlusButton() { uuid_vec_t selected_items; getSelectedItemsUUID(selected_items); @@ -910,6 +981,9 @@ void LLPanelOutfitEdit::updateVerbs() mStatus->setText(outfit_is_dirty ? getString("unsaved_changes") : getString("now_editing")); updateCurrentOutfitName(); + + //updating state of "Wear Item" button previously known as "Plus" button + updatePlusButton(); } bool LLPanelOutfitEdit::switchPanels(LLPanel* switch_from_panel, LLPanel* switch_to_panel) @@ -957,9 +1031,6 @@ void LLPanelOutfitEdit::showFilteredWearablesListView(LLWearableType::EType type showAddWearablesPanel(true); showWearablesListView(); - // Reset mWearableItemsList position to top. See EXT-8180. - mWearableItemsList->goToTop(); - //e_list_view_item_type implicitly contains LLWearableType::EType starting from LVIT_SHAPE applyListViewFilter((EListViewItemType) (LVIT_SHAPE + type)); } @@ -1026,5 +1097,13 @@ void LLPanelOutfitEdit::getSelectedItemsUUID(uuid_vec_t& uuid_list) // return selected_id; } +void LLPanelOutfitEdit::onCOFChanged() +{ + //the panel is only updated when is visible to a user + if (!isInVisibleChain()) return; + + update(); +} + // EOF |