diff options
author | Tofu Linden <tofu.linden@lindenlab.com> | 2010-09-29 14:41:42 +0100 |
---|---|---|
committer | Tofu Linden <tofu.linden@lindenlab.com> | 2010-09-29 14:41:42 +0100 |
commit | 81051206e0c8ede5b2748e4aaedbaf6fdb7811c4 (patch) | |
tree | 504a47d6c0bc6b6967717e551f7d5eb958b2d817 /indra | |
parent | 704cdf2bc3cd8ce6c567117c0466f92f7279fd85 (diff) | |
parent | 16a973feea87016bd6dc0154d610e4eedeb1b1cf (diff) |
merge storm-249
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llsidepanelinventory.cpp | 46 | ||||
-rw-r--r-- | indra/newview/llsidepanelinventory.h | 2 |
2 files changed, 45 insertions, 3 deletions
diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp index 23e96c22fa..5b4c530f06 100644 --- a/indra/newview/llsidepanelinventory.cpp +++ b/indra/newview/llsidepanelinventory.cpp @@ -182,8 +182,26 @@ void LLSidepanelInventory::performActionOnSelection(const std::string &action) void LLSidepanelInventory::onWearButtonClicked() { - performActionOnSelection("wear"); - performActionOnSelection("attach"); + LLPanelMainInventory *panel_main_inventory = mInventoryPanel->findChild<LLPanelMainInventory>("panel_main_inventory"); + if (!panel_main_inventory) + { + llassert(panel_main_inventory != NULL); + return; + } + + // Get selected items set. + const std::set<LLUUID> selected_uuids_set = panel_main_inventory->getActivePanel()->getRootFolder()->getSelectionList(); + if (selected_uuids_set.empty()) return; // nothing selected + + // Convert the set to a vector. + uuid_vec_t selected_uuids_vec; + for (std::set<LLUUID>::const_iterator it = selected_uuids_set.begin(); it != selected_uuids_set.end(); ++it) + { + selected_uuids_vec.push_back(*it); + } + + // Wear all selected items. + wear_multiple(selected_uuids_vec, true); } void LLSidepanelInventory::onPlayButtonClicked() @@ -286,7 +304,7 @@ void LLSidepanelInventory::updateVerbs() case LLInventoryType::IT_OBJECT: case LLInventoryType::IT_ATTACHMENT: mWearBtn->setVisible(TRUE); - mWearBtn->setEnabled(get_can_item_be_worn(item->getLinkedUUID())); + mWearBtn->setEnabled(canWearSelected()); mShopBtn->setVisible(FALSE); break; case LLInventoryType::IT_SOUND: @@ -325,6 +343,28 @@ bool LLSidepanelInventory::canShare() return bridge ? bridge->canShare() : false; } +bool LLSidepanelInventory::canWearSelected() +{ + LLPanelMainInventory* panel_main_inventory = + mInventoryPanel->findChild<LLPanelMainInventory>("panel_main_inventory"); + + if (!panel_main_inventory) + { + llassert(panel_main_inventory != NULL); + return false; + } + + std::set<LLUUID> selected_uuids = panel_main_inventory->getActivePanel()->getRootFolder()->getSelectionList(); + for (std::set<LLUUID>::const_iterator it = selected_uuids.begin(); + it != selected_uuids.end(); + ++it) + { + if (!get_can_item_be_worn(*it)) return false; + } + + return true; +} + LLInventoryItem *LLSidepanelInventory::getSelectedItem() { LLPanelMainInventory *panel_main_inventory = mInventoryPanel->findChild<LLPanelMainInventory>("panel_main_inventory"); diff --git a/indra/newview/llsidepanelinventory.h b/indra/newview/llsidepanelinventory.h index 4776dd7530..32c98bc034 100644 --- a/indra/newview/llsidepanelinventory.h +++ b/indra/newview/llsidepanelinventory.h @@ -65,6 +65,8 @@ protected: void performActionOnSelection(const std::string &action); void updateVerbs(); + bool canWearSelected(); // check whether selected items can be worn + // // UI Elements // |