// virtual
void LLLandmarksPanel::onSearchEdit(const std::string& string)
{
	// give FolderView a chance to be refreshed. So, made all accordions visible
	for (accordion_tabs_t::const_iterator iter = mAccordionTabs.begin(); iter != mAccordionTabs.end(); ++iter)
	{
		LLAccordionCtrlTab* tab = *iter;
		tab->setVisible(TRUE);

		// expand accordion to see matched items in each one. See EXT-2014.
		if (string != "")
		{
			tab->changeOpenClose(false);
		}

		LLPlacesInventoryPanel* inventory_list = dynamic_cast<LLPlacesInventoryPanel*>(tab->getAccordionView());
		if (NULL == inventory_list) continue;

		filter_list(inventory_list, string);
	}

	if (sFilterSubString != string)
		sFilterSubString = string;

	// show all folders in Landmarks Accordion for empty filter
	// only if Landmarks inventory folder is not empty
	updateShowFolderState();
}
void LLOutfitsList::applyFilter(const std::string& new_filter_substring)
{
	mAccordion->setFilterSubString(new_filter_substring);

	for (outfits_map_t::iterator
			 iter = mOutfitsMap.begin(),
			 iter_end = mOutfitsMap.end();
		 iter != iter_end; ++iter)
	{
		LLAccordionCtrlTab* tab = iter->second;
		if (!tab) continue;

		bool more_restrictive = sFilterSubString.size() < new_filter_substring.size() && !new_filter_substring.substr(0, sFilterSubString.size()).compare(sFilterSubString);

		// Restore tab visibility in case of less restrictive filter
		// to compare it with updated string if it was previously hidden.
		if (!more_restrictive)
		{
			tab->setVisible(TRUE);
		}

		LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(tab->getAccordionView());
		if (list)
		{
			list->setFilterSubString(new_filter_substring);
		}

		if(sFilterSubString.empty() && !new_filter_substring.empty())
		{
			//store accordion tab state when filter is not empty
			tab->notifyChildren(LLSD().with("action","store_state"));
		}

		if (!new_filter_substring.empty())
		{
			applyFilterToTab(iter->first, tab, new_filter_substring);
		}
		else
		{
			// restore tab title when filter is empty
			tab->setTitle(tab->getTitle());

			//restore accordion state after all those accodrion tab manipulations
			tab->notifyChildren(LLSD().with("action","restore_state"));

			// Try restoring the tab selection.
			restoreOutfitSelection(tab, iter->first);
		}
	}

	mAccordion->arrange();
}
void LLOutfitsList::onCOFChanged()
{
	LLInventoryModel::cat_array_t cat_array;
	LLInventoryModel::item_array_t item_array;

	// Collect current COF items
	gInventory.collectDescendents(
		LLAppearanceMgr::instance().getCOF(),
		cat_array,
		item_array,
		LLInventoryModel::EXCLUDE_TRASH);

	uuid_vec_t vnew;
	uuid_vec_t vadded;
	uuid_vec_t vremoved;

	// From gInventory we get the UUIDs of links that are currently in COF.
	// These links UUIDs are not the same UUIDs that we have in each wearable items list.
	// So we collect base items' UUIDs to find them or links that point to them in wearable
	// items lists and update their worn state there.
	for (LLInventoryModel::item_array_t::const_iterator iter = item_array.begin();
		iter != item_array.end();
		++iter)
	{
		vnew.push_back((*iter)->getLinkedUUID());
	}

	// We need to update only items that were added or removed from COF.
	LLCommonUtils::computeDifference(vnew, mCOFLinkedItems, vadded, vremoved);

	// Store the ids of items currently linked from COF.
	mCOFLinkedItems = vnew;

	for (outfits_map_t::iterator iter = mOutfitsMap.begin();
			iter != mOutfitsMap.end();
			++iter)
	{
		LLAccordionCtrlTab* tab = iter->second;
		if (!tab) continue;

		LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(tab->getAccordionView());
		if (!list) continue;

		// Append removed ids to added ids because we should update all of them.
		vadded.reserve(vadded.size() + vremoved.size());
		vadded.insert(vadded.end(), vremoved.begin(), vremoved.end());

		// Every list updates the labels of changed items  or
		// the links that point to these items.
		list->updateChangedItems(vadded);
	}
}
Exemple #4
0
static LLPanel *childGetVisibleTabWithHelp(LLView *parent)
{
	LLView *child;

	// look through immediate children first for an active tab with help
	for (child = parent->getFirstChild(); child; child = parent->findNextSibling(child))
	{
		LLPanel *curTabPanel = NULL;

		// do we have a tab container?
		LLTabContainer *tab = dynamic_cast<LLTabContainer *>(child);
		if (tab && tab->getVisible())
		{
			curTabPanel = tab->getCurrentPanel();
		}

		// do we have an accordion tab?
		LLAccordionCtrlTab* accordion = dynamic_cast<LLAccordionCtrlTab *>(child);
		if (accordion && accordion->getDisplayChildren())
		{
			curTabPanel = dynamic_cast<LLPanel *>(accordion->getAccordionView());
		}

		// if we found a valid tab, does it have a help topic?
		if (curTabPanel && !curTabPanel->getHelpTopic().empty())
		{
			return curTabPanel;
		}
	}

	// then try a bit harder and recurse through all children
	for (child = parent->getFirstChild(); child; child = parent->findNextSibling(child))
	{
		if (child->getVisible())
		{
			LLPanel* tab = ::childGetVisibleTabWithHelp(child);
			if (tab)
			{
				return tab;
			}
		}
	}

	// couldn't find any active tabs with a help topic string
	return NULL;
}
void LLOutfitsList::onFilteredWearableItemsListRefresh(LLUICtrl* ctrl)
{
	if (!ctrl || sFilterSubString.empty())
		return;

	for (outfits_map_t::iterator
			 iter = mOutfitsMap.begin(),
			 iter_end = mOutfitsMap.end();
		 iter != iter_end; ++iter)
	{
		LLAccordionCtrlTab* tab = iter->second;
		if (!tab) continue;

		LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(tab->getAccordionView());
		if (list != ctrl) continue;

		applyFilterToTab(iter->first, tab, sFilterSubString);
	}
}
void LLOutfitsList::setSelectedOutfitByUUID(const LLUUID& outfit_uuid)
{
	for (outfits_map_t::iterator iter = mOutfitsMap.begin();
			iter != mOutfitsMap.end();
			++iter)
	{
		if (outfit_uuid == iter->first)
		{
			LLAccordionCtrlTab* tab = iter->second;
			if (!tab) continue;

			LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(tab->getAccordionView());
			if (!list) continue;

			tab->setFocus(TRUE);
			changeOutfitSelection(list, outfit_uuid);

			tab->setDisplayChildren(true);
		}
	}
}
Exemple #7
0
LLPanel* LLPanel::childGetVisibleTabWithHelp()
{
	LLView *child;

	bfs_tree_iterator_t it = beginTreeBFS();
	// skip ourselves
	++it;
	for (; it != endTreeBFS(); ++it)
	{
		child = *it;
		LLPanel *curTabPanel = NULL;

		// do we have a tab container?
		LLTabContainer *tab = dynamic_cast<LLTabContainer *>(child);
		if (tab && tab->getVisible())
		{
			curTabPanel = tab->getCurrentPanel();
		}

		// do we have an accordion tab?
		LLAccordionCtrlTab* accordion = dynamic_cast<LLAccordionCtrlTab *>(child);
		if (accordion && accordion->getDisplayChildren())
		{
			curTabPanel = dynamic_cast<LLPanel *>(accordion->getAccordionView());
		}

		// if we found a valid tab, does it have a help topic?
		if (curTabPanel && !curTabPanel->getHelpTopic().empty())
		{
			return curTabPanel;
		}
	}

	// couldn't find any active tabs with a help topic string
	return NULL;
}
void LLOutfitsList::onCOFChanged()
{
	LLInventoryModel::changed_items_t changed_linked_items;

	const LLInventoryModel::changed_items_t& changed_items = gInventory.getChangedIDs();
	for (LLInventoryModel::changed_items_t::const_iterator iter = changed_items.begin();
		 iter != changed_items.end();
		 ++iter)
	{
		LLViewerInventoryItem* item = gInventory.getItem(*iter);
		if (item)
		{
			// From gInventory we get the UUIDs of new links added to COF
			// or removed from COF. These links UUIDs are not the same UUIDs
			// that we have in each wearable items list. So we collect base items
			// UUIDs to find all items or links that point to same base items in wearable
			// items lists and update their worn state there.
			changed_linked_items.insert(item->getLinkedUUID());
		}
	}

	for (outfits_map_t::iterator iter = mOutfitsMap.begin();
			iter != mOutfitsMap.end();
			++iter)
	{
		LLAccordionCtrlTab* tab = iter->second;
		if (!tab) continue;

		LLWearableItemsList* list = dynamic_cast<LLWearableItemsList*>(tab->getAccordionView());
		if (!list) continue;

		// Every list updates the labels of changed items  or
		// the links that point to these items.
		list->updateChangedItems(changed_linked_items);
	}
}