summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorVladimir Pchelko <pchelko@productengine.com>2010-06-24 14:35:34 +0300
committerVladimir Pchelko <pchelko@productengine.com>2010-06-24 14:35:34 +0300
commit3735352328dbc835588b4a7026d2289f6706b5e8 (patch)
tree84fa5f954834be6971e468f0b06db41a5d366e14 /indra
parenta0cb8a35dc1419ed18ae031dfb201c68a6b14f4b (diff)
EXT-8008 FIXED Disable (+) button when worn item is selected (including multi-selection).
Reviewed by Neal Orman and Mike Antipov at https://codereview.productengine.com/secondlife/r/640/ --HG-- branch : product-engine
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llpaneloutfitedit.cpp62
-rw-r--r--indra/newview/llpaneloutfitedit.h3
2 files changed, 43 insertions, 22 deletions
diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp
index ea7d233333..54776ca2f7 100644
--- a/indra/newview/llpaneloutfitedit.cpp
+++ b/indra/newview/llpaneloutfitedit.cpp
@@ -564,7 +564,8 @@ void LLPanelOutfitEdit::onSearchEdit(const std::string& string)
void LLPanelOutfitEdit::onPlusBtnClicked(void)
{
- LLUUID selected_id = getSelectedItemUUID();
+ LLUUID selected_id;
+ getCurrentItemUUID(selected_id);
if (selected_id.isNull()) return;
@@ -651,30 +652,31 @@ void LLPanelOutfitEdit::onEditWearableClicked(void)
void LLPanelOutfitEdit::onInventorySelectionChange()
{
- LLUUID item_uuid = getSelectedItemUUID();
- if (item_uuid.isNull())
+ uuid_vec_t selected_items;
+ getSelectedItemsUUID(selected_items);
+ if (selected_items.empty())
{
return;
}
+ uuid_vec_t::iterator worn_item = std::find_if(selected_items.begin(), selected_items.end(), boost::bind(&get_is_item_worn, _1));
+ bool can_add = ( worn_item == selected_items.end() );
- LLViewerInventoryItem* item(gInventory.getItem(item_uuid));
- if (!item)
- {
- return;
- }
+ mPlusBtn->setEnabled(can_add);
- switch (item->getType())
+ LLViewerInventoryItem* first_item(gInventory.getItem(selected_items.front()));
+
+ if (can_add &&
+ first_item &&
+ selected_items.size() == 1 &&
+ first_item->getType() == LLAssetType::AT_BODYPART)
{
- case LLAssetType::AT_BODYPART:
mPlusBtn->setToolTip(getString("replace_body_part"));
- break;
- case LLAssetType::AT_CLOTHING:
- case LLAssetType::AT_OBJECT:
+ }
+ else
+ {
mPlusBtn->setToolTip(LLStringUtil::null);
- default:
- break;
}
-
+
/* Removing add to look inline button (not part of mvp for viewer 2)
LLRect btn_rect(current_item->getLocalRect().mRight - 50,
current_item->getLocalRect().mTop,
@@ -931,16 +933,15 @@ void LLPanelOutfitEdit::onOutfitChanging(bool started)
indicator->setVisible(started);
}
-LLUUID LLPanelOutfitEdit::getSelectedItemUUID()
+void LLPanelOutfitEdit::getCurrentItemUUID(LLUUID& selected_id)
{
- LLUUID selected_id;
if (mInventoryItemsPanel->getVisible())
{
LLFolderViewItem* curr_item = mInventoryItemsPanel->getRootFolder()->getCurSelectedItem();
- if (!curr_item) return selected_id;
+ if (!curr_item) return;
LLFolderViewEventListener* listenerp = curr_item->getListener();
- if (!listenerp) return selected_id;
+ if (!listenerp) return;
selected_id = listenerp->getUUID();
}
@@ -948,8 +949,27 @@ LLUUID LLPanelOutfitEdit::getSelectedItemUUID()
{
selected_id = mWearableItemsList->getSelectedUUID();
}
+}
+
+
+void LLPanelOutfitEdit::getSelectedItemsUUID(uuid_vec_t& uuid_list)
+{
+ if (mInventoryItemsPanel->getVisible())
+ {
+ std::set<LLUUID> item_set = mInventoryItemsPanel->getRootFolder()->getSelectionList();
+
+ std::for_each(item_set.begin(), item_set.end(), boost::bind( &uuid_vec_t::push_back, &uuid_list, _1));
+ }
+ else if (mWearablesListViewPanel->getVisible())
+ {
+ std::vector<LLSD> item_set;
+ mWearableItemsList->getSelectedValues(item_set);
+
+ std::for_each(item_set.begin(), item_set.end(), boost::bind( &uuid_vec_t::push_back, &uuid_list, boost::bind(&LLSD::asUUID, _1 )));
+
+ }
- return selected_id;
+// return selected_id;
}
diff --git a/indra/newview/llpaneloutfitedit.h b/indra/newview/llpaneloutfitedit.h
index aa5d00903a..de1bf87fb3 100644
--- a/indra/newview/llpaneloutfitedit.h
+++ b/indra/newview/llpaneloutfitedit.h
@@ -192,7 +192,8 @@ private:
void onAddMoreButtonClicked();
void showFilteredWearablesListView(LLWearableType::EType type);
void onOutfitChanging(bool started);
- LLUUID getSelectedItemUUID();
+ void getSelectedItemsUUID(uuid_vec_t& uuid_list);
+ void getCurrentItemUUID(LLUUID& selected_id);
LLTextBox* mCurrentOutfitName;
LLTextBox* mStatus;