summaryrefslogtreecommitdiff
path: root/indra/newview/llpaneloutfitedit.cpp
diff options
context:
space:
mode:
authorDessie Linden <dessie@lindenlab.com>2010-07-15 12:31:08 -0700
committerDessie Linden <dessie@lindenlab.com>2010-07-15 12:31:08 -0700
commit5d85dad85f07ea23b3a2892276d8ac591a966864 (patch)
tree97aa94cc757e24239f8b13c0cedb3e4a543fff06 /indra/newview/llpaneloutfitedit.cpp
parent4339600d43601f07d01c676cce5da17c2758c4cb (diff)
Reverted changeset 2bb10eae42bf
Diffstat (limited to 'indra/newview/llpaneloutfitedit.cpp')
-rw-r--r--indra/newview/llpaneloutfitedit.cpp127
1 files changed, 24 insertions, 103 deletions
diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp
index 937b794686..f8350a56ef 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));
@@ -298,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)));
@@ -332,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));
@@ -348,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());
@@ -389,7 +388,7 @@ BOOL LLPanelOutfitEdit::postBuild()
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));
mSaveComboBtn.reset(new LLSaveOutfitComboBtn(this));
@@ -443,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
@@ -587,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)
@@ -623,52 +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)
- 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;
- 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
@@ -680,45 +634,20 @@ LLWearableType::EType LLPanelOutfitEdit::getCOFWearablesSelectionType() const
{
type = real_item->getWearableType();
}
- }
-
- return type;
-}
-
-LLWearableType::EType LLPanelOutfitEdit::getAddMorePanelSelectionType() const
-{
- LLWearableType::EType type = LLWearableType::WT_NONE;
-
- if (mAddWearablesPanel != NULL && mAddWearablesPanel->getVisible())
- {
- if (mInventoryItemsPanel != NULL && mInventoryItemsPanel->getVisible())
- {
- std::set<LLUUID> selected_uuids = mInventoryItemsPanel->getRootFolder()->getSelectionList();
- if (selected_uuids.size() == 1)
- {
- type = getWearableTypeByItemUUID(*(selected_uuids.begin()));
- }
- }
- else if (mWearableItemsList != NULL && mWearableItemsList->getVisible())
+ // WT_INVALID comes for attachments
+ if (type != LLWearableType::WT_INVALID)
{
- std::vector<LLUUID> selected_uuids;
- mWearableItemsList->getSelectedUUIDs(selected_uuids);
-
- if (selected_uuids.size() == 1)
- {
- type = getWearableTypeByItemUUID(selected_uuids.front());
- }
+ url = url_resolver.resolveURL(type, sex);
}
}
- return type;
-}
+ 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)
@@ -738,7 +667,7 @@ void LLPanelOutfitEdit::onEditWearableClicked(void)
}
}
-void LLPanelOutfitEdit::updatePlusButton()
+void LLPanelOutfitEdit::onInventorySelectionChange()
{
uuid_vec_t selected_items;
getSelectedItemsUUID(selected_items);
@@ -981,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)
@@ -1019,6 +945,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));
}
@@ -1085,13 +1014,5 @@ 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