/indra/newview/llfilteredwearablelist.cpp
C++ | 96 lines | 53 code | 14 blank | 29 comment | 8 complexity | d7b07f2847f2ada4ba590c28b0d3bb5a MD5 | raw file
Possible License(s): LGPL-2.1
1/** 2 * @file llfilteredwearablelist.cpp 3 * @brief Functionality for showing filtered wearable flat list 4 * 5 * $LicenseInfo:firstyear=2010&license=viewerlgpl$ 6 * Second Life Viewer Source Code 7 * Copyright (C) 2010, Linden Research, Inc. 8 * 9 * This library is free software; you can redistribute it and/or 10 * modify it under the terms of the GNU Lesser General Public 11 * License as published by the Free Software Foundation; 12 * version 2.1 of the License only. 13 * 14 * This library is distributed in the hope that it will be useful, 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 17 * Lesser General Public License for more details. 18 * 19 * You should have received a copy of the GNU Lesser General Public 20 * License along with this library; if not, write to the Free Software 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 22 * 23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA 24 * $/LicenseInfo$ 25 */ 26 27#include "llviewerprecompiledheaders.h" 28#include "llfilteredwearablelist.h" 29 30// newview 31#include "llinventoryfunctions.h" 32#include "llinventoryitemslist.h" 33#include "llinventorymodel.h" 34#include "llviewerinventory.h" 35 36 37LLFilteredWearableListManager::LLFilteredWearableListManager(LLInventoryItemsList* list, LLInventoryCollectFunctor* collector) 38: mWearableList(list) 39, mCollector(collector) 40{ 41 llassert(mWearableList); 42 gInventory.addObserver(this); 43 gInventory.fetchDescendentsOf(gInventory.getRootFolderID()); 44} 45 46LLFilteredWearableListManager::~LLFilteredWearableListManager() 47{ 48 gInventory.removeObserver(this); 49} 50 51void LLFilteredWearableListManager::changed(U32 mask) 52{ 53 if (LLInventoryObserver::CALLING_CARD == mask 54 || LLInventoryObserver::GESTURE == mask 55 || LLInventoryObserver::SORT == mask 56 ) 57 { 58 // skip non-related changes 59 return; 60 } 61 62 if(!gInventory.isInventoryUsable()) 63 { 64 return; 65 } 66 67 populateList(); 68} 69 70void LLFilteredWearableListManager::setFilterCollector(LLInventoryCollectFunctor* collector) 71{ 72 mCollector = collector; 73 populateList(); 74} 75 76void LLFilteredWearableListManager::populateList() 77{ 78 LLInventoryModel::cat_array_t cat_array; 79 LLInventoryModel::item_array_t item_array; 80 81 if(mCollector) 82 { 83 gInventory.collectDescendentsIf( 84 gInventory.getRootFolderID(), 85 cat_array, 86 item_array, 87 LLInventoryModel::EXCLUDE_TRASH, 88 *mCollector); 89 } 90 91 // Probably will also need to get items from Library (waiting for reply in EXT-6724). 92 93 mWearableList->refreshList(item_array); 94} 95 96// EOF