本文整理汇总了C++中LLInventoryModel类的典型用法代码示例。如果您正苦于以下问题:C++ LLInventoryModel类的具体用法?C++ LLInventoryModel怎么用?C++ LLInventoryModel使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LLInventoryModel类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: climb
// static
void LLLocalInventory::climb(LLInventoryCategory* cat,
LLInventoryModel::cat_array_t& cats,
LLInventoryModel::item_array_t& items)
{
LLInventoryModel* model = &gInventory;
// Add this category
cats.push_back(LLPointer<LLViewerInventoryCategory>((LLViewerInventoryCategory*)cat));
LLInventoryModel::cat_array_t *direct_cats;
LLInventoryModel::item_array_t *direct_items;
model->getDirectDescendentsOf(cat->getUUID(), direct_cats, direct_items);
// Add items
LLInventoryModel::item_array_t::iterator item_iter = direct_items->begin();
LLInventoryModel::item_array_t::iterator item_end = direct_items->end();
for( ; item_iter != item_end; ++item_iter)
{
items.push_back(*item_iter);
}
// Do subcategories
LLInventoryModel::cat_array_t::iterator cat_iter = direct_cats->begin();
LLInventoryModel::cat_array_t::iterator cat_end = direct_cats->end();
for( ; cat_iter != cat_end; ++cat_iter)
{
climb(*cat_iter, cats, items);
}
}
示例2: handleEvent
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
LLInventoryModel* model = mPtr->getPanel()->getModel();
if(!model) return false;
model->empty();
model->startBackgroundFetch();
return true;
}
示例3: callback_empty_lost_and_found
bool callback_empty_lost_and_found(const LLSD& notification, const LLSD& response)
{
S32 option = LLNotification::getSelectedOption(notification, response);
if (option == 0) // YES
{
LLInventoryModel* model = mPtr->getModel();
LLUUID lost_and_found_id = model->findCategoryUUIDForType(LLAssetType::AT_LOST_AND_FOUND);
model->purgeDescendentsOf(lost_and_found_id);
model->notifyObservers();
}
return false;
}
示例4: callback_empty_trash
bool callback_empty_trash(const LLSD& notification, const LLSD& response)
{
S32 option = LLNotification::getSelectedOption(notification, response);
if (option == 0) // YES
{
LLInventoryModel* model = mPtr->getModel();
LLUUID trash_id = model->findCategoryUUIDForType(LLFolderType::FT_TRASH);
model->purgeDescendentsOf(trash_id);
model->notifyObservers();
}
return false;
}
示例5: climb
//static
void LLLocalInventory::saveInvCache(std::string filename, LLFolderView* folder)
{
LLInventoryModel* model = &gInventory;
std::set<LLUUID> selected_items;
folder->getSelectionList(selected_items);
if(selected_items.size() < 1)
{
// No items selected? Wtfboom
return;
}
LLInventoryModel::cat_array_t cats;
LLInventoryModel::item_array_t items;
// Make complete lists of child categories and items
std::set<LLUUID>::iterator sel_iter = selected_items.begin();
std::set<LLUUID>::iterator sel_end = selected_items.end();
for( ; sel_iter != sel_end; ++sel_iter)
{
LLInventoryCategory* cat = model->getCategory(*sel_iter);
if(cat)
{
climb(cat, cats, items);
}
}
// And what about items inside a folder that wasn't selected?
// I guess I will just add selected items, so long as they aren't already added
for(sel_iter = selected_items.begin(); sel_iter != sel_end; ++sel_iter)
{
LLInventoryItem* item = model->getItem(*sel_iter);
if(item)
{
if(std::find(items.begin(), items.end(), item) == items.end())
{
items.push_back(LLPointer<LLViewerInventoryItem>((LLViewerInventoryItem*)item));
LLInventoryCategory* parent = model->getCategory(item->getParentUUID());
if(std::find(cats.begin(), cats.end(), parent) == cats.end())
{
cats.push_back(LLPointer<LLViewerInventoryCategory>((LLViewerInventoryCategory*)parent));
}
}
}
}
LLInventoryModel::saveToFile(filename, cats, items);
}
示例6: t2
void LLInventoryPanel::modelChanged(U32 mask)
{
LLFastTimer t2(LLFastTimer::FTM_REFRESH);
bool handled = false;
if(mask & LLInventoryObserver::LABEL)
{
handled = true;
// label change - empty out the display name for each object
// in this change set.
const std::set<LLUUID>& changed_items = gInventory.getChangedIDs();
std::set<LLUUID>::const_iterator id_it = changed_items.begin();
std::set<LLUUID>::const_iterator id_end = changed_items.end();
LLFolderViewItem* view = NULL;
LLInvFVBridge* bridge = NULL;
for (;id_it != id_end; ++id_it)
{
view = mFolders->getItemByID(*id_it);
if(view)
{
// request refresh on this item (also flags for filtering)
bridge = (LLInvFVBridge*)view->getListener();
if(bridge)
{ // Clear the display name first, so it gets properly re-built during refresh()
bridge->clearDisplayName();
}
view->refresh();
}
}
}
if((mask & (LLInventoryObserver::STRUCTURE
| LLInventoryObserver::ADD
| LLInventoryObserver::REMOVE)) != 0)
{
handled = true;
// Record which folders are open by uuid.
LLInventoryModel* model = getModel();
if (model)
{
const std::set<LLUUID>& changed_items = gInventory.getChangedIDs();
std::set<LLUUID>::const_iterator id_it = changed_items.begin();
std::set<LLUUID>::const_iterator id_end = changed_items.end();
for (;id_it != id_end; ++id_it)
{
// sync view with model
LLInventoryObject* model_item = model->getObject(*id_it);
LLFolderViewItem* view_item = mFolders->getItemByID(*id_it);
if (model_item)
{
if (!view_item)
{
// this object was just created, need to build a view for it
if ((mask & LLInventoryObserver::ADD) != LLInventoryObserver::ADD)
{
llwarns << *id_it << " is in model but not in view, but ADD flag not set" << llendl;
}
buildNewViews(*id_it);
// select any newly created object
// that has the auto rename at top of folder
// root set
if(mFolders->getRoot()->needsAutoRename())
{
setSelection(*id_it, FALSE);
}
}
else
{
// this object was probably moved, check its parent
if ((mask & LLInventoryObserver::STRUCTURE) != LLInventoryObserver::STRUCTURE)
{
llwarns << *id_it << " is in model and in view, but STRUCTURE flag not set" << llendl;
}
LLFolderViewFolder* new_parent = (LLFolderViewFolder*)mFolders->getItemByID(model_item->getParentUUID());
if (view_item->getParentFolder() != new_parent)
{
view_item->getParentFolder()->extractItem(view_item);
view_item->addToFolder(new_parent, mFolders);
}
}
}
else
{
if (view_item)
{
if ((mask & LLInventoryObserver::REMOVE) != LLInventoryObserver::REMOVE)
{
llwarns << *id_it << " is not in model but in view, but REMOVE flag not set" << llendl;
}
// item in view but not model, need to delete view
view_item->destroyView();
}
else
{
llwarns << *id_it << "Item does not exist in either view or model, but notification triggered" << llendl;
}
}
//.........这里部分代码省略.........
示例7: handleEvent
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)
{
LLInventoryPanel *panel = mPtr;
LLInventoryModel* model = panel->getModel();
if(!model) return true;
std::set<LLUUID> selected_items = panel->getRootFolder()->getSelectionList();
std::string name;
static int session_num = 1;
std::vector<LLUUID> members;
EInstantMessage type = IM_SESSION_CONFERENCE_START;
// [RLVa:KB] - Checked: 2013-05-08 (RLVa-1.4.9)
bool fRlvCanStartIM = true;
// [/RLVa:KB]
for (std::set<LLUUID>::const_iterator iter = selected_items.begin(); iter != selected_items.end(); iter++)
{
LLUUID item = *iter;
LLFolderViewItem* folder_item = panel->getRootFolder()->getItemByID(item);
if(folder_item)
{
LLFolderViewEventListener* fve_listener = folder_item->getListener();
if (fve_listener && (fve_listener->getInventoryType() == LLInventoryType::IT_CATEGORY))
{
LLFolderBridge* bridge = (LLFolderBridge*)folder_item->getListener();
if(!bridge) return true;
LLViewerInventoryCategory* cat = bridge->getCategory();
if(!cat) return true;
name = cat->getName();
LLUniqueBuddyCollector is_buddy;
LLInventoryModel::cat_array_t cat_array;
LLInventoryModel::item_array_t item_array;
model->collectDescendentsIf(bridge->getUUID(),
cat_array,
item_array,
LLInventoryModel::EXCLUDE_TRASH,
is_buddy);
S32 count = item_array.size();
if(count > 0)
{
// create the session
gIMMgr->setFloaterOpen(TRUE);
LLAvatarTracker& at = LLAvatarTracker::instance();
LLUUID id;
for(S32 i = 0; i < count; ++i)
{
id = item_array.at(i)->getCreatorUUID();
if(at.isBuddyOnline(id))
{
// [RLVa:KB] - Checked: 2013-05-08 (RLVa-1.4.9)
fRlvCanStartIM &= RlvActions::canStartIM(id);
// [RLVa:KB]
members.push_back(id);
}
}
}
}
else
{
LLFolderViewItem* folder_item = panel->getRootFolder()->getItemByID(item);
if(!folder_item) return true;
LLInvFVBridge* listenerp = (LLInvFVBridge*)folder_item->getListener();
if (listenerp->getInventoryType() == LLInventoryType::IT_CALLINGCARD)
{
LLInventoryItem* inv_item = gInventory.getItem(listenerp->getUUID());
if (inv_item)
{
LLAvatarTracker& at = LLAvatarTracker::instance();
LLUUID id = inv_item->getCreatorUUID();
if(at.isBuddyOnline(id))
{
// [RLVa:KB] - Checked: 2013-05-08 (RLVa-1.4.9)
fRlvCanStartIM &= RlvActions::canStartIM(id);
// [RLVa:KB]
members.push_back(id);
}
}
} //if IT_CALLINGCARD
} //if !IT_CATEGORY
}
} //for selected_items
// the session_id is randomly generated UUID which will be replaced later
// with a server side generated number
// [RLVa:KB] - Checked: 2013-05-08 (RLVa-1.4.9)
if (!fRlvCanStartIM)
{
make_ui_sound("UISndIvalidOp");
RlvUtil::notifyBlocked(RLV_STRING_BLOCKED_STARTCONF);
return true;
//.........这里部分代码省略.........
示例8:
inline LLCOFDragAndDropObserver::~LLCOFDragAndDropObserver()
{
if (mModel != NULL && mModel->containsObserver(this))
{
mModel->removeObserver(this);
}
}