summaryrefslogtreecommitdiff
path: root/indra/newview/llpaneloutfitedit.cpp
diff options
context:
space:
mode:
authorVadim Savchuk <vsavchuk@productengine.com>2010-08-02 18:59:35 +0300
committerVadim Savchuk <vsavchuk@productengine.com>2010-08-02 18:59:35 +0300
commit3b7da511179fd2e2e734a4f3137ac8813a5eebee (patch)
tree6642492a8be25cf36de2712d019e31f1681ac9ea /indra/newview/llpaneloutfitedit.cpp
parent122209c4a61ce00bc6157c7ae0b9311930f4410b (diff)
parentd1094573117db0a951a7e6159a352b0f4c8a8a24 (diff)
Merge from default branch
--HG-- branch : product-engine
Diffstat (limited to 'indra/newview/llpaneloutfitedit.cpp')
-rw-r--r--indra/newview/llpaneloutfitedit.cpp185
1 files changed, 28 insertions, 157 deletions
diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp
index 2cd354277e..5195b719d4 100644
--- a/indra/newview/llpaneloutfitedit.cpp
+++ b/indra/newview/llpaneloutfitedit.cpp
@@ -71,7 +71,6 @@
#include "llsdutil.h"
#include "llsidepanelappearance.h"
#include "lltoggleablemenu.h"
-#include "llvoavatarself.h"
#include "llwearablelist.h"
#include "llwearableitemslist.h"
#include "llwearabletype.h"
@@ -264,7 +263,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::onCOFChanged, this));
+ observer.addCOFChangedCallback(boost::bind(&LLPanelOutfitEdit::update, this));
gAgentWearables.addLoadingStartedCallback(boost::bind(&LLPanelOutfitEdit::onOutfitChanging, this, true));
gAgentWearables.addLoadedCallback(boost::bind(&LLPanelOutfitEdit::onOutfitChanging, this, false));
@@ -283,8 +282,6 @@ LLPanelOutfitEdit::~LLPanelOutfitEdit()
delete mCOFDragAndDropObserver;
- delete mWearableListViewItemsComparator;
-
while (!mListViewItemTypes.empty()) {
delete mListViewItemTypes.back();
mListViewItemTypes.pop_back();
@@ -300,9 +297,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 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.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.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)));
@@ -334,7 +331,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, _2));
+ setVisibleCallback(boost::bind(&LLPanelOutfitEdit::onVisibilityChange, this));
mCOFWearables = getChild<LLCOFWearables>("cof_wearables_list");
mCOFWearables->setCommitCallback(boost::bind(&LLPanelOutfitEdit::filterWearablesBySelectedItem, this));
@@ -350,8 +347,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::updatePlusButton, this));
- mInventoryItemsPanel->getRootFolder()->setReshapeCallback(boost::bind(&LLPanelOutfitEdit::updatePlusButton, this));
+ mInventoryItemsPanel->setSelectCallback(boost::bind(&LLPanelOutfitEdit::onInventorySelectionChange, this));
+ mInventoryItemsPanel->getRootFolder()->setReshapeCallback(boost::bind(&LLPanelOutfitEdit::onInventorySelectionChange, this));
mCOFDragAndDropObserver = new LLCOFDragAndDropObserver(mInventoryItemsPanel->getModel());
@@ -388,24 +385,11 @@ BOOL LLPanelOutfitEdit::postBuild()
childSetAction(REVERT_BTN, boost::bind(&LLAppearanceMgr::wearBaseOutfit, LLAppearanceMgr::getInstance()));
- /*
- * By default AT_CLOTHING are sorted by (in in MY OUTFITS):
- * - by type (types order determined in LLWearableType::EType)
- * - each LLWearableType::EType by outer layer on top
- *
- * In Add More panel AT_CLOTHING should be sorted in a such way:
- * - by type (types order determined in LLWearableType::EType)
- * - each LLWearableType::EType by name (EXT-8205)
- */
- mWearableListViewItemsComparator = new LLWearableItemTypeNameComparator();
- mWearableListViewItemsComparator->setOrder(LLAssetType::AT_CLOTHING, LLWearableItemTypeNameComparator::ORDER_RANK_1, false, true);
-
mWearablesListViewPanel = getChild<LLPanel>("filtered_wearables_panel");
mWearableItemsList = getChild<LLInventoryItemsList>("list_view");
mWearableItemsList->setCommitOnSelectionChange(true);
- mWearableItemsList->setCommitCallback(boost::bind(&LLPanelOutfitEdit::updatePlusButton, this));
+ mWearableItemsList->setCommitCallback(boost::bind(&LLPanelOutfitEdit::onInventorySelectionChange, this));
mWearableItemsList->setDoubleClickCallback(boost::bind(&LLPanelOutfitEdit::onPlusBtnClicked, this));
- mWearableItemsList->setComparator(mWearableListViewItemsComparator);
mSaveComboBtn.reset(new LLSaveOutfitComboBtn(this));
return TRUE;
@@ -458,9 +442,6 @@ void LLPanelOutfitEdit::showAddWearablesPanel(bool show_add_wearables)
mListViewFilterCmbBox->setVisible(false);
showWearablesFilter();
-
- // Reset mWearableItemsList position to top. See EXT-8180.
- mWearableItemsList->goToTop();
}
//switching button bars
@@ -602,16 +583,11 @@ void LLPanelOutfitEdit::onPlusBtnClicked(void)
}
}
-void LLPanelOutfitEdit::onVisibilityChange(const LLSD &in_visible_chain)
+void LLPanelOutfitEdit::onVisibilityChange()
{
showAddWearablesPanel(false);
mWearableItemsList->resetSelection();
mInventoryItemsPanel->clearSelection();
-
- if (in_visible_chain.asBoolean())
- {
- update();
- }
}
void LLPanelOutfitEdit::onAddWearableClicked(void)
@@ -638,63 +614,15 @@ 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)
- selection_info_t selection_info = getAddMorePanelSelectionType();
-
- LLWearableType::EType type = selection_info.first;
-
- if (selection_info.second > 1)
- {
- // the second argument is not important in this case: generic market place will be opened
- url = url_resolver.resolveURL(LLWearableType::WT_NONE, SEX_FEMALE);
- }
- else
- {
- 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;
- LLWearableType::EType type = LLWearableType::WT_NONE;
-
mCOFWearables->getSelectedItems(selected_items);
+ ESex sex = gSavedSettings.getU32("AvatarSex") ? SEX_MALE : SEX_FEMALE;
+
if (selected_items.size() == 1)
{
+ LLWearableType::EType type = LLWearableType::WT_NONE;
LLPanel* item = selected_items.front();
// LLPanelDummyClothingListItem is lower then LLPanelInventoryListItemBase in hierarchy tree
@@ -706,49 +634,20 @@ LLWearableType::EType LLPanelOutfitEdit::getCOFWearablesSelectionType() const
{
type = real_item->getWearableType();
}
- }
-
- return type;
-}
-LLPanelOutfitEdit::selection_info_t LLPanelOutfitEdit::getAddMorePanelSelectionType() const
-{
- selection_info_t result = std::make_pair(LLWearableType::WT_NONE, 0);
-
- if (mAddWearablesPanel != NULL && mAddWearablesPanel->getVisible())
- {
- if (mInventoryItemsPanel != NULL && mInventoryItemsPanel->getVisible())
+ // WT_INVALID comes for attachments
+ if (type != LLWearableType::WT_INVALID)
{
- std::set<LLUUID> selected_uuids = mInventoryItemsPanel->getRootFolder()->getSelectionList();
-
- result.second = selected_uuids.size();
-
- if (result.second == 1)
- {
- result.first = getWearableTypeByItemUUID(*(selected_uuids.begin()));
- }
- }
- else if (mWearableItemsList != NULL && mWearableItemsList->getVisible())
- {
- std::vector<LLUUID> selected_uuids;
- mWearableItemsList->getSelectedUUIDs(selected_uuids);
-
- result.second = selected_uuids.size();
-
- if (result.second == 1)
- {
- result.first = getWearableTypeByItemUUID(selected_uuids.front());
- }
+ url = url_resolver.resolveURL(type, sex);
}
}
- return result;
-}
+ if (url.empty())
+ {
+ url = url_resolver.resolveURL(mCOFWearables->getExpandedAccordionAssetType(), sex);
+ }
-LLWearableType::EType LLPanelOutfitEdit::getWearableTypeByItemUUID(const LLUUID& item_uuid) const
-{
- LLViewerInventoryItem* item = gInventory.getLinkedItem(item_uuid);
- return (item != NULL) ? item->getWearableType() : LLWearableType::WT_NONE;
+ LLWeb::loadURLExternal(url);
}
void LLPanelOutfitEdit::onRemoveFromOutfitClicked(void)
@@ -768,7 +667,7 @@ void LLPanelOutfitEdit::onEditWearableClicked(void)
}
}
-void LLPanelOutfitEdit::updatePlusButton()
+void LLPanelOutfitEdit::onInventorySelectionChange()
{
uuid_vec_t selected_items;
getSelectedItemsUUID(selected_items);
@@ -779,7 +678,7 @@ void LLPanelOutfitEdit::updatePlusButton()
}
// If any of the selected items are not wearable (due to already being worn OR being of the wrong type), disable the add button.
- uuid_vec_t::iterator unwearable_item = std::find_if(selected_items.begin(), selected_items.end(), !boost::bind(&get_can_item_be_worn, _1));
+ uuid_vec_t::iterator unwearable_item = std::find_if(selected_items.begin(), selected_items.end(), !boost::bind(& get_can_item_be_worn, _1));
bool can_add = ( unwearable_item == selected_items.end() );
mPlusBtn->setEnabled(can_add);
@@ -839,38 +738,15 @@ void LLPanelOutfitEdit::filterWearablesBySelectedItem(void)
bool more_than_one_selected = ids.size() > 1;
bool is_dummy_item = (ids.size() && dynamic_cast<LLPanelDummyClothingListItem*>(mCOFWearables->getSelectedItem()));
- // selected, expanded accordion tabs and selection in flat list view determine filtering when no item is selected in COF
- // selection in flat list view participates in determining filtering because of EXT-7963
- // So the priority of criterions in is:
- // 1. Selected accordion tab | IF (any accordion selected)
- // | filter_type = selected_accordion_type
- // 2. Selected item in flat list view | ELSEIF (any item in flat list view selected)
- // | filter_type = selected_item_type
- // 3. Expanded accordion tab | ELSEIF (any accordion expanded)
- // | filter_type = expanded accordion_type
+ //selected and expanded accordion tabs determine filtering when no item is selected
if (nothing_selected)
{
showWearablesListView();
- //selected accordion tab is more priority than expanded tab
- //and selected item in flat list view of 'Add more' panel when
- //determining filtering
+ //selected accordion tab is more priority than expanded tab when determining filtering
LLAssetType::EType type = mCOFWearables->getSelectedAccordionAssetType();
if (type == LLAssetType::AT_NONE)
- { //no accordion selected
-
- // when no accordion selected then selected item from flat list view
- // has more priority than expanded when determining filtering
- LLUUID selected_item_id = mWearableItemsList->getSelectedUUID();
- LLViewerInventoryItem* item = gInventory.getLinkedItem(selected_item_id);
- if(item)
- {
- showFilteredWearablesListView(item->getWearableType());
- return;
- }
-
- // when no accordion selected and no selected items in flat list view
- // determine filtering according to expanded accordion
+ {
type = mCOFWearables->getExpandedAccordionAssetType();
}
@@ -1034,9 +910,6 @@ 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)
@@ -1084,6 +957,9 @@ 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));
}
@@ -1150,10 +1026,5 @@ void LLPanelOutfitEdit::getSelectedItemsUUID(uuid_vec_t& uuid_list)
// return selected_id;
}
-void LLPanelOutfitEdit::onCOFChanged()
-{
- update();
-}
-
// EOF