diff options
author | Nat Goodspeed <nat@lindenlab.com> | 2024-08-28 20:47:43 -0400 |
---|---|---|
committer | Nat Goodspeed <nat@lindenlab.com> | 2024-08-28 20:47:43 -0400 |
commit | cde1174345224d33d6b45b1e3243fa39043223e5 (patch) | |
tree | 6c8db6e0499622d8c7206a11c997eb173ebd478f /indra/newview/llinventorypanel.cpp | |
parent | 6f454ad8366ed33bbe199c3fc3ed69e6d3448cec (diff) | |
parent | 35efadf78315f9b351415930dca4fae251ef4dd0 (diff) |
Merge branch 'main' into release/luau-scripting.
Diffstat (limited to 'indra/newview/llinventorypanel.cpp')
-rw-r--r-- | indra/newview/llinventorypanel.cpp | 124 |
1 files changed, 66 insertions, 58 deletions
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 67efe01720..ac3756c82a 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -377,7 +377,7 @@ void LLInventoryPanel::initializeViewBuilding() } /*virtual*/ -void LLInventoryPanel::onVisibilityChange(BOOL new_visibility) +void LLInventoryPanel::onVisibilityChange(bool new_visibility) { if (new_visibility && mViewsInitialized == VIEWS_UNINITIALIZED) { @@ -476,7 +476,7 @@ U32 LLInventoryPanel::getSortOrder() const return getFolderViewModel()->getSorter().getSortOrder(); } -void LLInventoryPanel::setSinceLogoff(BOOL sl) +void LLInventoryPanel::setSinceLogoff(bool sl) { getFilter().setDateRangeLastLogoff(sl); } @@ -563,7 +563,7 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve view_item->refresh(); } LLFolderViewFolder* parent = view_item->getParentFolder(); - if(parent) + if(parent && parent->getViewModelItem()) { parent->getViewModelItem()->dirtyDescendantsFilter(); } @@ -614,7 +614,7 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve // Sort the folder. if (mask & LLInventoryObserver::SORT) { - if (view_folder) + if (view_folder && view_folder->getViewModelItem()) { view_folder->getViewModelItem()->requestSort(); } @@ -643,9 +643,9 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve } // Select any newly created object that has the auto rename at top of folder root set. - if(mFolderRoot.get()->getRoot()->needsAutoRename()) + if(mFolderRoot.get() && mFolderRoot.get()->getRoot()->needsAutoRename()) { - setSelection(item_id, FALSE); + setSelection(item_id, false); } updateFolderLabel(model_item->getParentUUID()); } @@ -659,7 +659,8 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve // Don't process the item if it is the root if (old_parent) { - LLFolderViewModelItemInventory* viewmodel_folder = static_cast<LLFolderViewModelItemInventory*>(old_parent->getViewModelItem()); + LLFolderViewModelItem* old_parent_vmi = old_parent->getViewModelItem(); + LLFolderViewModelItemInventory* viewmodel_folder = static_cast<LLFolderViewModelItemInventory*>(old_parent_vmi); LLFolderViewFolder* new_parent = (LLFolderViewFolder*)getItemByID(model_item->getParentUUID()); // Item has been moved. if (old_parent != new_parent) @@ -674,7 +675,7 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve const LLUUID trash_id = mInventory->findCategoryUUIDForType(LLFolderType::FT_TRASH); if (trash_id != model_item->getParentUUID() && (mask & LLInventoryObserver::INTERNAL) && new_parent->isOpen()) { - setSelection(item_id, FALSE); + setSelection(item_id, false); } } updateFolderLabel(model_item->getParentUUID()); @@ -693,7 +694,10 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve { updateFolderLabel(viewmodel_folder->getUUID()); } - old_parent->getViewModelItem()->dirtyDescendantsFilter(); + if (old_parent_vmi) + { + old_parent_vmi->dirtyDescendantsFilter(); + } } } } @@ -709,11 +713,15 @@ void LLInventoryPanel::itemChanged(const LLUUID& item_id, U32 mask, const LLInve view_item->destroyView(); if(parent) { - parent->getViewModelItem()->dirtyDescendantsFilter(); - LLFolderViewModelItemInventory* viewmodel_folder = static_cast<LLFolderViewModelItemInventory*>(parent->getViewModelItem()); - if(viewmodel_folder) + LLFolderViewModelItem* parent_wmi = parent->getViewModelItem(); + if (parent_wmi) { - updateFolderLabel(viewmodel_folder->getUUID()); + parent_wmi->dirtyDescendantsFilter(); + LLFolderViewModelItemInventory* viewmodel_folder = static_cast<LLFolderViewModelItemInventory*>(parent_wmi); + if (viewmodel_folder) + { + updateFolderLabel(viewmodel_folder->getUUID()); + } } } } @@ -883,16 +891,16 @@ void LLInventoryPanel::idle(void* user_data) EAcceptance last_accept = LLToolDragAndDrop::getInstance()->getLastAccept(); if (last_accept == ACCEPT_YES_SINGLE || last_accept == ACCEPT_YES_COPY_SINGLE) { - panel->mFolderRoot.get()->setShowSingleSelection(TRUE); + panel->mFolderRoot.get()->setShowSingleSelection(true); } else { - panel->mFolderRoot.get()->setShowSingleSelection(FALSE); + panel->mFolderRoot.get()->setShowSingleSelection(false); } } else { - panel->mFolderRoot.get()->setShowSingleSelection(FALSE); + panel->mFolderRoot.get()->setShowSingleSelection(false); } } else @@ -946,14 +954,14 @@ void LLInventoryPanel::initializeViews(F64 max_time) LLFolderViewFolder* lib_folder = getFolderByID(gInventory.getLibraryRootFolderID()); if (lib_folder) { - lib_folder->setOpen(TRUE); + lib_folder->setOpen(true); } // Auto close the user's my inventory folder LLFolderViewFolder* my_inv_folder = getFolderByID(gInventory.getRootFolderID()); if (my_inv_folder) { - my_inv_folder->setOpenArrangeRecursively(FALSE, LLFolderViewFolder::RECURSE_DOWN); + my_inv_folder->setOpenArrangeRecursively(false, LLFolderViewFolder::RECURSE_DOWN); } } } @@ -1142,7 +1150,7 @@ LLFolderViewItem* LLInventoryPanel::buildViewsTree(const LLUUID& id, // In the case of the root folder been shown, open that folder by default once the widget is created if (create_root) { - folder_view_item->setOpen(TRUE); + folder_view_item->setOpen(true); } } } @@ -1220,7 +1228,7 @@ LLFolderViewItem* LLInventoryPanel::buildViewsTree(const LLUUID& id, // Make sure panel won't lock in a loop over existing items if // folder is enormous and at least some work gets done const S32 MIN_ITEMS_PER_CALL = 500; - const S32 starting_item_count = mItemMap.size(); + const S32 starting_item_count = static_cast<S32>(mItemMap.size()); LLFolderViewFolder *parentp = dynamic_cast<LLFolderViewFolder*>(folder_view_item); bool done = true; @@ -1251,7 +1259,7 @@ LLFolderViewItem* LLInventoryPanel::buildViewsTree(const LLUUID& id, if (!mBuildChildrenViews && mode == BUILD_TIMELIMIT - && MIN_ITEMS_PER_CALL + starting_item_count < mItemMap.size()) + && MIN_ITEMS_PER_CALL + starting_item_count < static_cast<S32>(mItemMap.size())) { // Single folder view, check if we still have time // @@ -1326,7 +1334,7 @@ void LLInventoryPanel::openStartFolderOrMyInventory() && fchild->getViewModelItem() && fchild->getViewModelItem()->getName() == "My Inventory") { - fchild->setOpen(TRUE); + fchild->setOpen(true); break; } } @@ -1348,13 +1356,13 @@ void LLInventoryPanel::openSelected() void LLInventoryPanel::unSelectAll() { - mFolderRoot.get()->setSelection(NULL, FALSE, FALSE); + mFolderRoot.get()->setSelection(NULL, false, false); } -BOOL LLInventoryPanel::handleHover(S32 x, S32 y, MASK mask) +bool LLInventoryPanel::handleHover(S32 x, S32 y, MASK mask) { - BOOL handled = LLView::handleHover(x, y, mask); + bool handled = LLView::handleHover(x, y, mask); if(handled) { // getCursor gets current cursor, setCursor sets next cursor @@ -1370,10 +1378,10 @@ BOOL LLInventoryPanel::handleHover(S32 x, S32 y, MASK mask) { getWindow()->setCursor(UI_CURSOR_ARROW); } - return TRUE; + return true; } -BOOL LLInventoryPanel::handleToolTip(S32 x, S32 y, MASK mask) +bool LLInventoryPanel::handleToolTip(S32 x, S32 y, MASK mask) { if (const LLFolderViewItem* hover_item_p = (!mFolderRoot.isDead()) ? mFolderRoot.get()->getHoveredItem() : nullptr) { @@ -1398,19 +1406,19 @@ BOOL LLInventoryPanel::handleToolTip(S32 x, S32 y, MASK mask) .delay_time(LLView::getTooltipTimeout()) .create_callback(boost::bind(&LLInspectTextureUtil::createInventoryToolTip, _1)) .create_params(params)); - return TRUE; + return true; } } return LLPanel::handleToolTip(x, y, mask); } -BOOL LLInventoryPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, +bool LLInventoryPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg) { - BOOL handled = FALSE; + bool handled = false; if (mAcceptsDragAndDrop) { @@ -1478,11 +1486,11 @@ bool LLInventoryPanel::addBadge(LLBadge * badge) void LLInventoryPanel::openAllFolders() { - mFolderRoot.get()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_DOWN); + mFolderRoot.get()->setOpenArrangeRecursively(true, LLFolderViewFolder::RECURSE_DOWN); mFolderRoot.get()->arrangeAll(); } -void LLInventoryPanel::setSelection(const LLUUID& obj_id, BOOL take_keyboard_focus) +void LLInventoryPanel::setSelection(const LLUUID& obj_id, bool take_keyboard_focus) { // Don't select objects in COF (e.g. to prevent refocus when items are worn). const LLInventoryObject *obj = mInventory->getObject(obj_id); @@ -1493,7 +1501,7 @@ void LLInventoryPanel::setSelection(const LLUUID& obj_id, BOOL take_keyboard_foc setSelectionByID(obj_id, take_keyboard_focus); } -void LLInventoryPanel::setSelectCallback(const boost::function<void (const std::deque<LLFolderViewItem*>& items, BOOL user_action)>& cb) +void LLInventoryPanel::setSelectCallback(const boost::function<void (const std::deque<LLFolderViewItem*>& items, bool user_action)>& cb) { if (mFolderRoot.get()) { @@ -1513,7 +1521,7 @@ LLInventoryPanel::selected_items_t LLInventoryPanel::getSelectedItems() const return mFolderRoot.get()->getSelectionList(); } -void LLInventoryPanel::onSelectionChange(const std::deque<LLFolderViewItem*>& items, BOOL user_action) +void LLInventoryPanel::onSelectionChange(const std::deque<LLFolderViewItem*>& items, bool user_action) { // Schedule updating the folder view context menu when all selected items become complete (STORM-373). mCompletionObserver->reset(); @@ -1541,7 +1549,7 @@ void LLInventoryPanel::onSelectionChange(const std::deque<LLFolderViewItem*>& it LLFolderView* fv = mFolderRoot.get(); if (fv->needsAutoRename()) // auto-selecting a new user-created asset and preparing to rename { - fv->setNeedsAutoRename(FALSE); + fv->setNeedsAutoRename(false); if (items.size()) // new asset is visible and selected { fv->startRenamingSelectedItem(); @@ -1665,7 +1673,7 @@ bool LLInventoryPanel::beginIMSession() item_array, LLInventoryModel::EXCLUDE_TRASH, is_buddy); - S32 count = item_array.size(); + auto count = item_array.size(); if(count > 0) { //*TODO by what to replace that? @@ -1674,7 +1682,7 @@ bool LLInventoryPanel::beginIMSession() // create the session LLAvatarTracker& at = LLAvatarTracker::instance(); LLUUID id; - for(S32 i = 0; i < count; ++i) + for(size_t i = 0; i < count; ++i) { id = item_array.at(i)->getCreatorUUID(); if(at.isBuddyOnline(id)) @@ -1761,7 +1769,7 @@ void LLInventoryPanel::purgeSelectedItems() const std::set<LLFolderViewItem*> inventory_selected = mFolderRoot.get()->getSelectionList(); if (inventory_selected.empty()) return; LLSD args; - S32 count = inventory_selected.size(); + auto count = inventory_selected.size(); std::vector<LLUUID> selected_items; for (std::set<LLFolderViewItem*>::const_iterator it = inventory_selected.begin(), end_it = inventory_selected.end(); it != end_it; @@ -1774,7 +1782,7 @@ void LLInventoryPanel::purgeSelectedItems() count += items.size() + cats.size(); selected_items.push_back(item_id); } - args["COUNT"] = count; + args["COUNT"] = static_cast<S32>(count); LLNotificationsUtil::add("PurgeSelectedItems", args, LLSD(), boost::bind(callbackPurgeSelectedItems, _1, _2, selected_items)); } @@ -1813,7 +1821,7 @@ bool LLInventoryPanel::attachObject(const LLSD& userdata) return true; } -BOOL LLInventoryPanel::getSinceLogoff() +bool LLInventoryPanel::getSinceLogoff() { return getFilter().isSinceLogoff(); } @@ -1826,15 +1834,15 @@ void LLInventoryPanel::dumpSelectionInformation(void* user_data) iv->mFolderRoot.get()->dumpSelectionInformation(); } -BOOL is_inventorysp_active() +bool is_inventorysp_active() { LLSidepanelInventory *sidepanel_inventory = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory"); - if (!sidepanel_inventory || !sidepanel_inventory->isInVisibleChain()) return FALSE; + if (!sidepanel_inventory || !sidepanel_inventory->isInVisibleChain()) return false; return sidepanel_inventory->isMainInventoryPanelActive(); } // static -LLInventoryPanel* LLInventoryPanel::getActiveInventoryPanel(BOOL auto_open) +LLInventoryPanel* LLInventoryPanel::getActiveInventoryPanel(bool auto_open) { S32 z_min = S32_MAX; LLInventoryPanel* res = NULL; @@ -1844,7 +1852,7 @@ LLInventoryPanel* LLInventoryPanel::getActiveInventoryPanel(BOOL auto_open) if (!floater_inventory) { LL_WARNS() << "Could not find My Inventory floater" << LL_ENDL; - return FALSE; + return nullptr; } LLSidepanelInventory *inventory_panel = LLFloaterSidePanelContainer::getPanel<LLSidepanelInventory>("inventory"); @@ -1873,7 +1881,7 @@ LLInventoryPanel* LLInventoryPanel::getActiveInventoryPanel(BOOL auto_open) // Make sure the floater is not minimized (STORM-438). if (active_inv_floaterp && active_inv_floaterp->isMinimized()) { - active_inv_floaterp->setMinimized(FALSE); + active_inv_floaterp->setMinimized(false); } } else if (auto_open) @@ -1956,7 +1964,7 @@ void LLInventoryPanel::openInventoryPanelAndSetSelection(bool auto_open, const L LLFloater* floater_inventory = LLFloaterReg::getInstance("inventory"); if (floater_inventory) { - floater_inventory->setFocus(TRUE); + floater_inventory->setFocus(true); } active_panel->setSelection(obj_id, take_keyboard_focus); } @@ -1991,7 +1999,7 @@ void LLInventoryPanel::addHideFolderType(LLFolderType::EType folder_type) getFilter().setFilterCategoryTypes(getFilter().getFilterCategoryTypes() & ~(1ULL << folder_type)); } -BOOL LLInventoryPanel::getIsHiddenFolderType(LLFolderType::EType folder_type) const +bool LLInventoryPanel::getIsHiddenFolderType(LLFolderType::EType folder_type) const { return !(getFilter().getFilterCategoryTypes() & (1ULL << folder_type)); } @@ -2005,7 +2013,7 @@ void LLInventoryPanel::removeItemID(const LLUUID& id) { LLInventoryModel::cat_array_t categories; LLInventoryModel::item_array_t items; - gInventory.collectDescendents(id, categories, items, TRUE); + gInventory.collectDescendents(id, categories, items, true); mItemMap.erase(id); @@ -2045,7 +2053,7 @@ LLFolderViewFolder* LLInventoryPanel::getFolderByID(const LLUUID& id) } -void LLInventoryPanel::setSelectionByID( const LLUUID& obj_id, BOOL take_keyboard_focus ) +void LLInventoryPanel::setSelectionByID( const LLUUID& obj_id, bool take_keyboard_focus ) { LLFolderViewItem* itemp = getItemByID(obj_id); @@ -2060,7 +2068,7 @@ void LLInventoryPanel::setSelectionByID( const LLUUID& obj_id, BOOL take_keyb if(itemp && itemp->getViewModelItem()) { - itemp->arrangeAndSet(TRUE, take_keyboard_focus); + itemp->arrangeAndSet(true, take_keyboard_focus); mSelectThisID.setNull(); mFocusSelection = false; return; @@ -2093,9 +2101,9 @@ void LLInventoryPanel::doToSelected(const LLSD& userdata) return; } -BOOL LLInventoryPanel::handleKeyHere( KEY key, MASK mask ) +bool LLInventoryPanel::handleKeyHere( KEY key, MASK mask ) { - BOOL handled = FALSE; + bool handled = false; switch (key) { case KEY_RETURN: @@ -2115,7 +2123,7 @@ BOOL LLInventoryPanel::handleKeyHere( KEY key, MASK mask ) } } LLInventoryAction::doToSelected(mInventory, mFolderRoot.get(), "open"); - handled = TRUE; + handled = true; } break; case KEY_DELETE: @@ -2127,7 +2135,7 @@ BOOL LLInventoryPanel::handleKeyHere( KEY key, MASK mask ) if (isSelectionRemovable() && (mask == MASK_NONE)) { LLInventoryAction::doToSelected(mInventory, mFolderRoot.get(), "delete"); - handled = TRUE; + handled = true; } break; } @@ -2238,7 +2246,7 @@ void LLInventorySingleFolderPanel::onFocusReceived() if (folder_view->getVisible()) { const LLFolderViewModelItemInventory* modelp = static_cast<const LLFolderViewModelItemInventory*>(folder_view->getViewModelItem()); - setSelectionByID(modelp->getUUID(), TRUE); + setSelectionByID(modelp->getUUID(), true); // quick and dirty fix: don't scroll on switching focus // todo: better 'tab' support, one that would work for LLInventoryPanel mFolderRoot.get()->stopAutoScollining(); @@ -2259,7 +2267,7 @@ void LLInventorySingleFolderPanel::onFocusReceived() if (item_view->getVisible()) { const LLFolderViewModelItemInventory* modelp = static_cast<const LLFolderViewModelItemInventory*>(item_view->getViewModelItem()); - setSelectionByID(modelp->getUUID(), TRUE); + setSelectionByID(modelp->getUUID(), true); mFolderRoot.get()->stopAutoScollining(); break; } @@ -2485,13 +2493,13 @@ void LLAssetFilteredInventoryPanel::initFromParams(const Params& p) getFilter().setFilterNoMarketplaceFolder(); } -BOOL LLAssetFilteredInventoryPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, +bool LLAssetFilteredInventoryPanel::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop, EDragAndDropType cargo_type, void* cargo_data, EAcceptance* accept, std::string& tooltip_msg) { - BOOL result = FALSE; + bool result = false; if (mAcceptsDragAndDrop) { |