本文整理汇总了C++中LLInvFVBridge类的典型用法代码示例。如果您正苦于以下问题:C++ LLInvFVBridge类的具体用法?C++ LLInvFVBridge怎么用?C++ LLInvFVBridge使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LLInvFVBridge类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: openSelected
void LLInventoryPanel::openSelected()
{
LLFolderViewItem* folder_item = mFolderRoot.get()->getCurSelectedItem();
if(!folder_item) return;
LLInvFVBridge* bridge = (LLInvFVBridge*)folder_item->getListener();
if(!bridge) return;
bridge->openItem();
}
示例2: get_active_inventory_panel
// static
bool LLAvatarActions::canShareSelectedItems(LLInventoryPanel* inv_panel /* = NULL*/)
{
using namespace action_give_inventory;
if (!inv_panel)
{
LLInventoryPanel* active_panel = get_active_inventory_panel();
if (!active_panel) return false;
inv_panel = active_panel;
}
// check selection in the panel
LLFolderView* root_folder = inv_panel->getRootFolder();
if (!root_folder)
{
return false;
}
const std::set<LLFolderViewItem*> inventory_selected = root_folder->getSelectionList();
if (inventory_selected.empty()) return false; // nothing selected
bool can_share = true;
std::set<LLFolderViewItem*>::const_iterator it = inventory_selected.begin();
const std::set<LLFolderViewItem*>::const_iterator it_end = inventory_selected.end();
for (; it != it_end; ++it)
{
LLViewerInventoryCategory* inv_cat = gInventory.getCategory(static_cast<LLFolderViewModelItemInventory*>((*it)->getViewModelItem())->getUUID());
// any category can be offered.
if (inv_cat)
{
continue;
}
// check if inventory item can be given
LLFolderViewItem* item = *it;
if (!item) return false;
LLInvFVBridge* bridge = dynamic_cast<LLInvFVBridge*>(item->getViewModelItem());
if (bridge && bridge->canShare())
{
continue;
}
// there are neither item nor category in inventory
can_share = false;
break;
}
return can_share;
}
示例3: canShare
bool LLSidepanelInventory::canShare()
{
LLPanelMainInventory* panel_main_inventory =
mInventoryPanel->findChild<LLPanelMainInventory>("panel_main_inventory");
LLFolderView* root_folder =
panel_main_inventory->getActivePanel()->getRootFolder();
LLFolderViewItem* current_item = root_folder->hasVisibleChildren()
? root_folder->getCurSelectedItem()
: NULL;
LLInvFVBridge* bridge = current_item
? dynamic_cast <LLInvFVBridge*> (current_item->getListener())
: NULL;
return bridge ? bridge->canShare() : false;
}
示例4: FTM_REFRESH
void LLInventoryPanel::modelChanged(U32 mask)
{
static LLFastTimer::DeclareTimer FTM_REFRESH("Inventory Refresh");
LLFastTimer t2(FTM_REFRESH);
if (!mViewsInitialized) return;
const LLInventoryModel* model = getModel();
if (!model) return;
const LLInventoryModel::changed_items_t& changed_items = model->getChangedIDs();
if (changed_items.empty()) return;
for (LLInventoryModel::changed_items_t::const_iterator items_iter = changed_items.begin();
items_iter != changed_items.end();
++items_iter)
{
const LLUUID& item_id = (*items_iter);
const LLInventoryObject* model_item = model->getObject(item_id);
LLFolderViewItem* view_item = mFolderRoot.get()->getItemByID(item_id);
// LLFolderViewFolder is derived from LLFolderViewItem so dynamic_cast from item
// to folder is the fast way to get a folder without searching through folders tree.
LLFolderViewFolder* view_folder = dynamic_cast<LLFolderViewFolder*>(view_item);
//////////////////////////////
// LABEL Operation
// Empty out the display name for relabel.
if (mask & LLInventoryObserver::LABEL)
{
if (view_item)
{
// Request refresh on this item (also flags for filtering)
LLInvFVBridge* bridge = (LLInvFVBridge*)view_item->getListener();
if(bridge)
{ // Clear the display name first, so it gets properly re-built during refresh()
bridge->clearDisplayName();
view_item->refresh();
}
// Singu note: Needed to propagate name change to wearables.
view_item->nameOrDescriptionChanged();
}
}
//////////////////////////////
// DESCRIPTION Operation (singu only)
// Alert listener.
if ((mask & LLInventoryObserver::DESCRIPTION))
{
if (view_item)
{
view_item->nameOrDescriptionChanged();
}
}
//////////////////////////////
// REBUILD Operation
// Destroy and regenerate the UI.
if (mask & LLInventoryObserver::REBUILD)
{
if (model_item && view_item)
{
view_item->destroyView();
}
view_item = buildNewViews(item_id);
view_folder = dynamic_cast<LLFolderViewFolder *>(view_item);
}
//////////////////////////////
// INTERNAL Operation
// This could be anything. For now, just refresh the item.
if (mask & LLInventoryObserver::INTERNAL)
{
if (view_item)
{
view_item->refresh();
}
}
//////////////////////////////
// SORT Operation
// Sort the folder.
if (mask & LLInventoryObserver::SORT)
{
if (view_folder)
{
view_folder->requestSort();
}
}
// We don't typically care which of these masks the item is actually flagged with, since the masks
// may not be accurate (e.g. in the main inventory panel, I move an item from My Inventory into
// Landmarks; this is a STRUCTURE change for that panel but is an ADD change for the Landmarks
// panel). What's relevant is that the item and UI are probably out of sync and thus need to be
// resynchronized.
if (mask & (LLInventoryObserver::STRUCTURE |
LLInventoryObserver::ADD |
LLInventoryObserver::REMOVE))
{
//.........这里部分代码省略.........
示例5: 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;
}
}
//.........这里部分代码省略.........
示例6: if
bool LLInventoryAction::doToSelected(LLFolderView* folder, std::string action)
{
if (!folder)
return true;
LLInventoryModel* model = &gInventory;
if ("rename" == action)
{
folder->startRenamingSelectedItem();
return true;
}
else if ("delete" == action)
{
folder->removeSelectedItems();
return true;
}
else if ("copy" == action || "cut" == action)
{
LLInventoryClipboard::instance().reset();
}
else if ("save_as" == action)
{
LLInventoryBackup::save(folder);
return true;
}
else if ("save_invcache" == action)
{
//AIFilePicker* filepicker = AIFilePicker::create();
//filepicker->open(FFLOAD_INVGZ, "", "invgz");
LLLocalInventory::saveInvCache(folder);
}
std::set<LLUUID> selected_items = folder->getSelectionList();
LLMultiFloater* multi_floaterp = NULL;
if (("task_open" == action || "open" == action) && selected_items.size() > 1)
{
S32 left, top;
gFloaterView->getNewFloaterPosition(&left, &top);
multi_floaterp = new LLMultiPreview(LLRect(left, top, left + 300, top - 100));
gFloaterView->addChild(multi_floaterp);
LLFloater::setFloaterHost(multi_floaterp);
}
else if (("task_properties" == action || "properties" == action) && selected_items.size() > 1)
{
S32 left, top;
gFloaterView->getNewFloaterPosition(&left, &top);
multi_floaterp = new LLMultiProperties(LLRect(left, top, left + 100, top - 100));
gFloaterView->addChild(multi_floaterp);
LLFloater::setFloaterHost(multi_floaterp);
}
std::set<LLUUID>::iterator set_iter;
for (set_iter = selected_items.begin(); set_iter != selected_items.end(); ++set_iter)
{
LLFolderViewItem* folder_item = folder->getItemByID(*set_iter);
if(!folder_item) continue;
LLInvFVBridge* bridge = (LLInvFVBridge*)folder_item->getListener();
if(!bridge) continue;
bridge->performAction(model, action);
}
LLFloater::setFloaterHost(NULL);
if (multi_floaterp)
{
multi_floaterp->open();
}
return true;
}
示例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: doToSelected
bool doToSelected(LLFolderView* folder, std::string action)
{
LLInventoryModel* model = &gInventory;
if ("rename" == action)
{
folder->startRenamingSelectedItem();
return true;
}
if ("delete" == action)
{
folder->removeSelectedItems();
return true;
}
if ("copy" == action)
{
LLInventoryClipboard::instance().reset();
}
// <edit>
if("save_as" == action)
{
LLInventoryBackup::save(folder);
return true;
}
else if("save_invcache" == action)
{
LLFilePicker& file_picker = LLFilePicker::instance();
if(file_picker.getSaveFile( LLFilePicker::FFSAVE_INVGZ ))
{
std::string file_name = file_picker.getFirstFile();
LLLocalInventory::saveInvCache(file_name, folder);
}
return true;
}
/*
else if("acquire_asset_id" == action)
{
if(LLCheats::cheatCodes["AcquireAssetID"].entered)
{
std::set<LLUUID> selected_items_set;
folder->getSelectionList(selected_items_set);
if(selected_items_set.size() > 0)
{
LLAssetIDAcquirer::acquire(selected_items_set);
}
}
return true;
}
else if("magic_get" == action)
{
std::set<LLUUID> selected_items_set;
folder->getSelectionList(selected_items_set);
if(selected_items_set.size() > 0)
{
LLNotecardMagic::acquire(selected_items_set);
}
}
*/
// </edit>
std::set<LLUUID> selected_items;
folder->getSelectionList(selected_items);
LLMultiPreview* multi_previewp = NULL;
LLMultiProperties* multi_propertiesp = NULL;
if (("task_open" == action || "open" == action) && selected_items.size() > 1)
{
S32 left, top;
gFloaterView->getNewFloaterPosition(&left, &top);
multi_previewp = new LLMultiPreview(LLRect(left, top, left + 300, top - 100));
gFloaterView->addChild(multi_previewp);
LLFloater::setFloaterHost(multi_previewp);
}
else if (("task_properties" == action || "properties" == action) && selected_items.size() > 1)
{
S32 left, top;
gFloaterView->getNewFloaterPosition(&left, &top);
multi_propertiesp = new LLMultiProperties(LLRect(left, top, left + 100, top - 100));
gFloaterView->addChild(multi_propertiesp);
LLFloater::setFloaterHost(multi_propertiesp);
}
std::set<LLUUID>::iterator set_iter;
for (set_iter = selected_items.begin(); set_iter != selected_items.end(); ++set_iter)
{
LLFolderViewItem* folder_item = folder->getItemByID(*set_iter);
if(!folder_item) continue;
LLInvFVBridge* bridge = (LLInvFVBridge*)folder_item->getListener();
if(!bridge) continue;
bridge->performAction(folder, model, action);
//.........这里部分代码省略.........
示例9: if
//.........这里部分代码省略.........
LLNotificationsUtil::add("ConfirmListingCutOrDelete", LLSD(), LLSD(), boost::bind(&LLInventoryAction::callback_doToSelected, _1, _2, root, action));
return true;
}
}
}
// Copying to the marketplace needs confirmation if nocopy items are involved
if (("copy_to_marketplace_listings" == action))
{
std::set<LLUUID>::iterator set_iter = selected_items.begin();
if (contains_nocopy_items(*set_iter))
{
LLNotificationsUtil::add("ConfirmCopyToMarketplace", LLSD(), LLSD(), boost::bind(&LLInventoryAction::callback_copySelected, _1, _2, root, action));
return true;
}
}
// Keep track of the marketplace folders that will need update of their status/name after the operation is performed
buildMarketplaceFolders(root);
LLInventoryModel* model = &gInventory;
if ("rename" == action)
{
root->startRenamingSelectedItem();
// Update the marketplace listings that have been affected by the operation
updateMarketplaceFolders();
return true;
}
if ("delete" == action)
{
root->removeSelectedItems();
// Update the marketplace listings that have been affected by the operation
updateMarketplaceFolders();
return true;
}
if ("copy" == action || "cut" == action)
{
LLInventoryClipboard::instance().reset();
}
LLMultiFloater* multi_floaterp = NULL;
if (("task_open" == action || "open" == action) && selected_items.size() > 1)
{
S32 left, top;
gFloaterView->getNewFloaterPosition(&left, &top);
multi_floaterp = new LLMultiPreview(LLRect(left, top, left + 300, top - 100));
gFloaterView->addChild(multi_floaterp);
LLFloater::setFloaterHost(multi_floaterp);
}
else if (("task_properties" == action || "properties" == action) && selected_items.size() > 1)
{
S32 left, top;
gFloaterView->getNewFloaterPosition(&left, &top);
multi_floaterp = new LLMultiProperties(LLRect(left, top, left + 100, top - 100));
gFloaterView->addChild(multi_floaterp);
LLFloater::setFloaterHost(multi_floaterp);
}
std::set<LLUUID>::iterator set_iter;
// This rather warty piece of code is to allow items to be removed
// from the avatar in a batch, eliminating redundant
// updateAppearanceFromCOF() requests further down the line. (MAINT-4918)
//
// There are probably other cases where similar batching would be
// desirable, but the current item-by-item performAction()
// approach would need to be reworked.
uuid_vec_t object_uuids_to_remove;
if (isRemoveAction(action) && get_selection_object_uuids(root, object_uuids_to_remove))
{
LLAppearanceMgr::instance().removeItemsFromAvatar(object_uuids_to_remove);
}
else
{
for (set_iter = selected_items.begin(); set_iter != selected_items.end(); ++set_iter)
{
LLFolderViewItem* folder_item = root->getItemByID(*set_iter);
if(!folder_item) continue;
LLInvFVBridge* bridge = (LLInvFVBridge*)folder_item->getListener();
if(!bridge) continue;
bridge->performAction(model, action);
}
}
LLFloater::setFloaterHost(NULL);
if (multi_floaterp)
{
multi_floaterp->open();
}
return true;
}
示例10: beginIMSession
bool LLInventoryPanel::beginIMSession()
{
std::set<LLUUID> selected_items = mFolderRoot->getSelectionList();
std::string name;
static int session_num = 1;
// LLDynamicArray<LLUUID> members;
// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h
uuid_vec_t members;
// [/RLVa:KB]
// EInstantMessage type = IM_SESSION_CONFERENCE_START;
std::set<LLUUID>::const_iterator iter;
for (iter = selected_items.begin(); iter != selected_items.end(); iter++)
{
LLUUID item = *iter;
LLFolderViewItem* folder_item = mFolderRoot->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;
gInventory.collectDescendentsIf(bridge->getUUID(),
cat_array,
item_array,
LLInventoryModel::EXCLUDE_TRASH,
is_buddy);
S32 count = item_array.count();
if(count > 0)
{
//*TODO by what to replace that?
//LLFloaterReg::showInstance("communicate");
// create the session
LLAvatarTracker& at = LLAvatarTracker::instance();
LLUUID id;
for(S32 i = 0; i < count; ++i)
{
id = item_array.get(i)->getCreatorUUID();
if(at.isBuddyOnline(id))
{
// members.put(id);
// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h
members.push_back(id);
// [/RLVa:KB]
}
}
}
}
else
{
LLFolderViewItem* folder_item = mFolderRoot->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))
{
// members.put(id);
// [RLVa:KB] - Checked: 2011-04-11 (RLVa-1.3.0h) | Added: RLVa-1.3.0h
members.push_back(id);
// [/RLVa:KB]
}
}
} //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
if (name.empty())
{
name = llformat("Session %d", session_num++);
}
// LLUUID session_id = gIMMgr->addSession(name, type, members[0], members);
// if (session_id != LLUUID::null)
// {
//.........这里部分代码省略.........