summaryrefslogtreecommitdiff
path: root/indra/newview/llinventoryfunctions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llinventoryfunctions.cpp')
-rw-r--r--indra/newview/llinventoryfunctions.cpp183
1 files changed, 100 insertions, 83 deletions
diff --git a/indra/newview/llinventoryfunctions.cpp b/indra/newview/llinventoryfunctions.cpp
index c8aa235506..5533c0328e 100644
--- a/indra/newview/llinventoryfunctions.cpp
+++ b/indra/newview/llinventoryfunctions.cpp
@@ -91,7 +91,7 @@
#include "llvoavatarself.h"
#include "llwearablelist.h"
-BOOL LLInventoryState::sWearNewClothing = FALSE;
+bool LLInventoryState::sWearNewClothing = false;
LLUUID LLInventoryState::sWearNewClothingTransactionID;
std::list<LLUUID> LLInventoryAction::sMarketplaceFolders;
bool LLInventoryAction::sDeleteConfirmationDisplayed = false;
@@ -553,12 +553,12 @@ public:
}
};
-BOOL get_is_parent_to_worn_item(const LLUUID& id)
+bool get_is_parent_to_worn_item(const LLUUID& id)
{
const LLViewerInventoryCategory* cat = gInventory.getCategory(id);
if (!cat)
{
- return FALSE;
+ return false;
}
LLInventoryModel::cat_array_t cats;
@@ -585,7 +585,7 @@ BOOL get_is_parent_to_worn_item(const LLUUID& id)
if (cat == parent_cat)
{
- return TRUE;
+ return true;
}
parent_id = parent_cat->getParentUUID();
@@ -593,23 +593,23 @@ BOOL get_is_parent_to_worn_item(const LLUUID& id)
}
}
- return FALSE;
+ return false;
}
-BOOL get_is_item_worn(const LLUUID& id, const LLViewerInventoryItem* item)
+bool get_is_item_worn(const LLUUID& id, const LLViewerInventoryItem* item)
{
if (!item)
- return FALSE;
+ return false;
if (item->getIsLinkType() && !gInventory.getItem(item->getLinkedUUID()))
{
- return FALSE;
+ return false;
}
// Consider the item as worn if it has links in COF.
if (LLAppearanceMgr::instance().isLinkedInCOF(id))
{
- return TRUE;
+ return true;
}
switch(item->getType())
@@ -617,55 +617,55 @@ BOOL get_is_item_worn(const LLUUID& id, const LLViewerInventoryItem* item)
case LLAssetType::AT_OBJECT:
{
if (isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item->getLinkedUUID()))
- return TRUE;
+ return true;
break;
}
case LLAssetType::AT_BODYPART:
case LLAssetType::AT_CLOTHING:
if(gAgentWearables.isWearingItem(item->getLinkedUUID()))
- return TRUE;
+ return true;
break;
case LLAssetType::AT_GESTURE:
if (LLGestureMgr::instance().isGestureActive(item->getLinkedUUID()))
- return TRUE;
+ return true;
break;
default:
break;
}
- return FALSE;
+ return false;
}
-BOOL get_is_item_worn(const LLUUID& id)
+bool get_is_item_worn(const LLUUID& id)
{
const LLViewerInventoryItem* item = gInventory.getItem(id);
return get_is_item_worn(id, item);
}
-BOOL get_is_item_worn(const LLViewerInventoryItem* item)
+bool get_is_item_worn(const LLViewerInventoryItem* item)
{
if (!item)
{
- return FALSE;
+ return false;
}
return get_is_item_worn(item->getUUID(), item);
}
-BOOL get_can_item_be_worn(const LLUUID& id)
+bool get_can_item_be_worn(const LLUUID& id)
{
const LLViewerInventoryItem* item = gInventory.getItem(id);
if (!item)
- return FALSE;
+ return false;
if (LLAppearanceMgr::instance().isLinkedInCOF(item->getLinkedUUID()))
{
// an item having links in COF (i.e. a worn item)
- return FALSE;
+ return false;
}
if (gInventory.isObjectDescendentOf(id, LLAppearanceMgr::instance().getCOF()))
{
// a non-link object in COF (should not normally happen)
- return FALSE;
+ return false;
}
const LLUUID trash_id = gInventory.findCategoryUUIDForType(
@@ -685,12 +685,12 @@ BOOL get_can_item_be_worn(const LLUUID& id)
if (isAgentAvatarValid() && gAgentAvatarp->isWearingAttachment(item->getLinkedUUID()))
{
// Already being worn
- return FALSE;
+ return false;
}
else
{
// Not being worn yet.
- return TRUE;
+ return true;
}
break;
}
@@ -699,18 +699,18 @@ BOOL get_can_item_be_worn(const LLUUID& id)
if(gAgentWearables.isWearingItem(item->getLinkedUUID()))
{
// Already being worn
- return FALSE;
+ return false;
}
else
{
// Not being worn yet.
- return TRUE;
+ return true;
}
break;
default:
break;
}
- return FALSE;
+ return false;
}
bool get_is_item_removable(const LLInventoryModel* model, const LLUUID& id, bool check_worn)
@@ -792,7 +792,7 @@ void handle_item_edit(const LLUUID& inv_item_id)
}
}
-BOOL get_is_category_removable(const LLInventoryModel* model, const LLUUID& id)
+bool get_is_category_removable(const LLInventoryModel* model, const LLUUID& id)
{
// NOTE: This function doesn't check the folder's children.
// See LLFolderBridge::isItemRemovable for a function that does
@@ -800,27 +800,27 @@ BOOL get_is_category_removable(const LLInventoryModel* model, const LLUUID& id)
if (!model)
{
- return FALSE;
+ return false;
}
if (!model->isObjectDescendentOf(id, gInventory.getRootFolderID()))
{
- return FALSE;
+ return false;
}
- if (!isAgentAvatarValid()) return FALSE;
+ if (!isAgentAvatarValid()) return false;
const LLInventoryCategory* category = model->getCategory(id);
if (!category)
{
- return FALSE;
+ return false;
}
const LLFolderType::EType folder_type = category->getPreferredType();
if (LLFolderType::lookupIsProtectedType(folder_type))
{
- return FALSE;
+ return false;
}
// Can't delete the outfit that is currently being worn.
@@ -829,11 +829,11 @@ BOOL get_is_category_removable(const LLInventoryModel* model, const LLUUID& id)
const LLViewerInventoryItem *base_outfit_link = LLAppearanceMgr::instance().getBaseOutfitLink();
if (base_outfit_link && (category == base_outfit_link->getLinkedCategory()))
{
- return FALSE;
+ return false;
}
}
- return TRUE;
+ return true;
}
bool get_is_category_and_children_removable(LLInventoryModel* model, const LLUUID& folder_id, bool check_worn)
@@ -904,11 +904,11 @@ bool get_is_category_and_children_removable(LLInventoryModel* model, const LLUUI
return true;
}
-BOOL get_is_category_renameable(const LLInventoryModel* model, const LLUUID& id)
+bool get_is_category_renameable(const LLInventoryModel* model, const LLUUID& id)
{
if (!model)
{
- return FALSE;
+ return false;
}
LLViewerInventoryCategory* cat = model->getCategory(id);
@@ -916,9 +916,9 @@ BOOL get_is_category_renameable(const LLInventoryModel* model, const LLUUID& id)
if (cat && !LLFolderType::lookupIsProtectedType(cat->getPreferredType()) &&
cat->getOwnerID() == gAgent.getID())
{
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
void show_task_item_profile(const LLUUID& item_uuid, const LLUUID& object_id)
@@ -1354,7 +1354,7 @@ bool can_move_item_to_marketplace(const LLInventoryCategory* root_folder, LLInve
LLInventoryModel::cat_array_t existing_categories;
LLInventoryModel::item_array_t existing_items;
- gInventory.collectDescendents(version_folder->getUUID(), existing_categories, existing_items, FALSE);
+ gInventory.collectDescendents(version_folder->getUUID(), existing_categories, existing_items, false);
existing_item_count += count_copyable_items(existing_items) + count_stock_folders(existing_categories);
existing_stock_count += count_stock_items(existing_items);
@@ -1428,7 +1428,7 @@ bool can_move_folder_to_marketplace(const LLInventoryCategory* root_folder, LLIn
{
LLInventoryModel::cat_array_t descendent_categories;
LLInventoryModel::item_array_t descendent_items;
- gInventory.collectDescendents(inv_cat->getUUID(), descendent_categories, descendent_items, FALSE);
+ gInventory.collectDescendents(inv_cat->getUUID(), descendent_categories, descendent_items, false);
int dragged_folder_count = descendent_categories.size() + bundle_size; // Note: We assume that we're moving a bunch of folders in. That might be wrong...
int dragged_item_count = count_copyable_items(descendent_items) + count_stock_folders(descendent_categories);
@@ -1450,7 +1450,7 @@ bool can_move_folder_to_marketplace(const LLInventoryCategory* root_folder, LLIn
// Tally the total number of categories and items inside the root folder
LLInventoryModel::cat_array_t existing_categories;
LLInventoryModel::item_array_t existing_items;
- gInventory.collectDescendents(version_folder->getUUID(), existing_categories, existing_items, FALSE);
+ gInventory.collectDescendents(version_folder->getUUID(), existing_categories, existing_items, false);
existing_folder_count += existing_categories.size();
existing_item_count += count_copyable_items(existing_items) + count_stock_folders(existing_categories);
@@ -2165,7 +2165,7 @@ void change_item_parent(const LLUUID& item_id, const LLUUID& new_parent_id)
LLPointer<LLViewerInventoryItem> new_item = new LLViewerInventoryItem(inv_item);
new_item->setParent(new_parent_id);
- new_item->updateParentOnServer(FALSE);
+ new_item->updateParentOnServer(false);
gInventory.updateItem(new_item);
gInventory.notifyObservers();
}
@@ -2205,7 +2205,7 @@ void move_items_to_folder(const LLUUID& new_cat_uuid, const uuid_vec_t& selected
LLFolderViewItem* fv_folder = sidepanel_inventory->getActivePanel()->getItemByID(new_cat_uuid);
if (fv_folder)
{
- fv_folder->setOpen(TRUE);
+ fv_folder->setOpen(true);
}
}
}
@@ -2269,7 +2269,7 @@ std::string get_category_path(LLUUID cat_id)
}
}
// Returns true if the item can be moved to Current Outfit or any outfit folder.
-bool can_move_to_outfit(LLInventoryItem* inv_item, BOOL move_is_into_current_outfit)
+bool can_move_to_outfit(LLInventoryItem* inv_item, bool move_is_into_current_outfit)
{
LLInventoryType::EType inv_type = inv_item->getInventoryType();
if ((inv_type != LLInventoryType::IT_WEARABLE) &&
@@ -2301,7 +2301,7 @@ bool can_move_to_outfit(LLInventoryItem* inv_item, BOOL move_is_into_current_out
return true;
}
-// Returns TRUE if item is a landmark or a link to a landmark
+// Returns true if item is a landmark or a link to a landmark
// and can be moved to Favorites or Landmarks folder.
bool can_move_to_landmarks(LLInventoryItem* inv_item)
{
@@ -2635,40 +2635,40 @@ bool LLIsType::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
{
if(mType == LLAssetType::AT_CATEGORY)
{
- if(cat) return TRUE;
+ if(cat) return true;
}
if(item)
{
- if(item->getType() == mType) return TRUE;
+ if(item->getType() == mType) return true;
}
- return FALSE;
+ return false;
}
bool LLIsNotType::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
{
if(mType == LLAssetType::AT_CATEGORY)
{
- if(cat) return FALSE;
+ if(cat) return false;
}
if(item)
{
- if(item->getType() == mType) return FALSE;
- else return TRUE;
+ if(item->getType() == mType) return false;
+ else return true;
}
- return TRUE;
+ return true;
}
bool LLIsOfAssetType::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
{
if(mType == LLAssetType::AT_CATEGORY)
{
- if(cat) return TRUE;
+ if(cat) return true;
}
if(item)
{
- if(item->getActualType() == mType) return TRUE;
+ if(item->getActualType() == mType) return true;
}
- return FALSE;
+ return false;
}
bool LLAssetIDAndTypeMatches::operator()(LLInventoryCategory* cat, LLInventoryItem* item)
@@ -2690,7 +2690,7 @@ bool LLIsTypeWithPermissions::operator()(LLInventoryCategory* cat, LLInventoryIt
{
if(cat)
{
- return TRUE;
+ return true;
}
}
if(item)
@@ -2700,11 +2700,11 @@ bool LLIsTypeWithPermissions::operator()(LLInventoryCategory* cat, LLInventoryIt
LLPermissions perm = item->getPermissions();
if ((perm.getMaskBase() & mPerm) == mPerm)
{
- return TRUE;
+ return true;
}
}
}
- return FALSE;
+ return false;
}
bool LLBuddyCollector::operator()(LLInventoryCategory* cat,
@@ -2748,10 +2748,10 @@ bool LLParticularBuddyCollector::operator()(LLInventoryCategory* cat,
if((LLAssetType::AT_CALLINGCARD == item->getType())
&& (item->getCreatorUUID() == mBuddyID))
{
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
@@ -2803,9 +2803,9 @@ bool LLFindBrokenLinks::operator()(LLInventoryCategory* cat,
// it is linked too
if (item && LLAssetType::lookupIsLinkType(item->getType()))
{
- return TRUE;
+ return true;
}
- return FALSE;
+ return false;
}
bool LLFindWearables::operator()(LLInventoryCategory* cat,
@@ -2816,10 +2816,10 @@ bool LLFindWearables::operator()(LLInventoryCategory* cat,
if((item->getType() == LLAssetType::AT_CLOTHING)
|| (item->getType() == LLAssetType::AT_BODYPART))
{
- return TRUE;
+ return true;
}
}
- return FALSE;
+ return false;
}
LLFindWearablesEx::LLFindWearablesEx(bool is_worn, bool include_body_parts)
@@ -2911,7 +2911,7 @@ bool LLLinkedItemIDMatches::operator()(LLInventoryCategory* cat, LLInventoryItem
(item->getLinkedUUID() == mBaseItemID)); // A linked item's assetID will be the compared-to item's itemID.
}
-void LLSaveFolderState::setApply(BOOL apply)
+void LLSaveFolderState::setApply(bool apply)
{
mApply = apply;
// before generating new list of open folders, clear the old one
@@ -2934,7 +2934,7 @@ void LLSaveFolderState::doFolder(LLFolderViewFolder* folder)
{
if (!folder->isOpen())
{
- folder->setOpen(TRUE);
+ folder->setOpen(true);
}
}
else
@@ -2942,7 +2942,7 @@ void LLSaveFolderState::doFolder(LLFolderViewFolder* folder)
// keep selected filter in its current state, this is less jarring to user
if (!folder->isSelected() && folder->isOpen())
{
- folder->setOpen(FALSE);
+ folder->setOpen(false);
}
}
}
@@ -2960,7 +2960,7 @@ void LLOpenFilteredFolders::doItem(LLFolderViewItem *item)
{
if (item->passedFilter())
{
- item->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP);
+ item->getParentFolder()->setOpenArrangeRecursively(true, LLFolderViewFolder::RECURSE_UP);
}
}
@@ -2968,12 +2968,12 @@ void LLOpenFilteredFolders::doFolder(LLFolderViewFolder* folder)
{
if (folder->LLFolderViewItem::passedFilter() && folder->getParentFolder())
{
- folder->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP);
+ folder->getParentFolder()->setOpenArrangeRecursively(true, LLFolderViewFolder::RECURSE_UP);
}
// if this folder didn't pass the filter, and none of its descendants did
else if (!folder->getViewModelItem()->passedFilter() && !folder->getViewModelItem()->descendantsPassedFilter())
{
- folder->setOpenArrangeRecursively(FALSE, LLFolderViewFolder::RECURSE_NO);
+ folder->setOpenArrangeRecursively(false, LLFolderViewFolder::RECURSE_NO);
}
}
@@ -2981,12 +2981,12 @@ void LLSelectFirstFilteredItem::doItem(LLFolderViewItem *item)
{
if (item->passedFilter() && !mItemSelected)
{
- item->getRoot()->setSelection(item, FALSE, FALSE);
+ item->getRoot()->setSelection(item, false, false);
if (item->getParentFolder())
{
- item->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP);
+ item->getParentFolder()->setOpenArrangeRecursively(true, LLFolderViewFolder::RECURSE_UP);
}
- mItemSelected = TRUE;
+ mItemSelected = true;
}
}
@@ -2995,9 +2995,9 @@ void LLSelectFirstFilteredItem::doFolder(LLFolderViewFolder* folder)
// Skip if folder or item already found, if not filtered or if no parent (root folder is not selectable)
if (!mFolderSelected && !mItemSelected && folder->LLFolderViewItem::passedFilter() && folder->getParentFolder())
{
- folder->getRoot()->setSelection(folder, FALSE, FALSE);
- folder->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP);
- mFolderSelected = TRUE;
+ folder->getRoot()->setSelection(folder, false, false);
+ folder->getParentFolder()->setOpenArrangeRecursively(true, LLFolderViewFolder::RECURSE_UP);
+ mFolderSelected = true;
}
}
@@ -3005,7 +3005,7 @@ void LLOpenFoldersWithSelection::doItem(LLFolderViewItem *item)
{
if (item->getParentFolder() && item->isSelected())
{
- item->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP);
+ item->getParentFolder()->setOpenArrangeRecursively(true, LLFolderViewFolder::RECURSE_UP);
}
}
@@ -3013,7 +3013,7 @@ void LLOpenFoldersWithSelection::doFolder(LLFolderViewFolder* folder)
{
if (folder->getParentFolder() && folder->isSelected())
{
- folder->getParentFolder()->setOpenArrangeRecursively(TRUE, LLFolderViewFolder::RECURSE_UP);
+ folder->getParentFolder()->setOpenArrangeRecursively(true, LLFolderViewFolder::RECURSE_UP);
}
}
@@ -3023,7 +3023,7 @@ void LLInventoryAction::callback_doToSelected(const LLSD& notification, const LL
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
if (option == 0) // YES
{
- doToSelected(model, root, action, FALSE);
+ doToSelected(model, root, action, false);
}
}
@@ -3032,11 +3032,11 @@ void LLInventoryAction::callback_copySelected(const LLSD& notification, const LL
S32 option = LLNotificationsUtil::getSelectedOption(notification, response);
if (option == 0) // YES, Move no copy item(s)
{
- doToSelected(model, root, "copy_or_move_to_marketplace_listings", FALSE);
+ doToSelected(model, root, "copy_or_move_to_marketplace_listings", false);
}
else if (option == 1) // NO, Don't move no copy item(s) (leave them behind)
{
- doToSelected(model, root, "copy_to_marketplace_listings", FALSE);
+ doToSelected(model, root, "copy_to_marketplace_listings", false);
}
}
@@ -3069,7 +3069,7 @@ bool get_selection_object_uuids(LLFolderView *root, uuid_vec_t& ids)
}
-void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root, const std::string& action, BOOL user_confirm)
+void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root, const std::string& action, bool user_confirm)
{
std::set<LLFolderViewItem*> selected_items = root->getSelectionList();
if (selected_items.empty()
@@ -3187,7 +3187,7 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root
LLInventoryModel::cat_array_t categories;
LLInventoryModel::item_array_t items;
- gInventory.collectDescendents(obj_id, categories, items, FALSE);
+ gInventory.collectDescendents(obj_id, categories, items, false);
for (LLInventoryModel::item_array_t::value_type& item : items)
{
@@ -3461,6 +3461,23 @@ void LLInventoryAction::doToSelected(LLInventoryModel* model, LLFolderView* root
ungroup_folder_items(*ids.begin());
}
}
+ else if ("thumbnail" == action)
+ {
+ if (selected_items.size() > 0)
+ {
+ LLSD data;
+ std::set<LLFolderViewItem*>::iterator set_iter;
+ for (set_iter = selected_items.begin(); set_iter != selected_items.end(); ++set_iter)
+ {
+ LLFolderViewItem* folder_item = *set_iter;
+ if (!folder_item) continue;
+ LLInvFVBridge* bridge = (LLInvFVBridge*)folder_item->getViewModelItem();
+ if (!bridge) continue;
+ data.append(bridge->getUUID());
+ }
+ LLFloaterReg::showInstance("change_item_thumbnail", data);
+ }
+ }
else
{
std::set<LLFolderViewItem*>::iterator set_iter;
@@ -3588,7 +3605,7 @@ void LLInventoryAction::onItemsRemovalConfirmation(const LLSD& notification, con
LLInventoryModel::cat_array_t categories;
LLInventoryModel::item_array_t items;
- gInventory.collectDescendents(obj_id, categories, items, FALSE);
+ gInventory.collectDescendents(obj_id, categories, items, false);
for (LLInventoryModel::item_array_t::value_type& item : items)
{