void LLFloaterAvatarPicker::draw()
{
	LLFloater::draw();

// [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-1.0.0e
	// TODO-RLVa: this code needs revisiting
	if (rlv_handler_t::isEnabled())
	{
		LLPanel* pNearMePanel = getChild<LLPanel>("NearMePanel");
		if ( (pNearMePanel) && (childGetVisibleTab("ResidentChooserTabs") == pNearMePanel) )
		{
			if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))
			{
				if (mNearMeListComplete)
				{
					getChild<LLScrollListCtrl>("NearMe")->deleteAllItems();
					childSetEnabled("Select", false);
				}
				mNearMeListComplete = FALSE;
				pNearMePanel->setCtrlsEnabled(FALSE);
				return;
			}
			pNearMePanel->setCtrlsEnabled(TRUE);
		}
	}
// [/RLVa:KB]

	if (!mNearMeListComplete && childGetVisibleTab("ResidentChooserTabs") == getChild<LLPanel>("NearMePanel"))
	{
		populateNearMe();
	}
}
void LLPanelMainInventory::onFilterSelected()
{
	// Find my index
	mActivePanel = (LLInventoryPanel*)childGetVisibleTab("inventory filter tabs");

	if (!mActivePanel)
	{
		return;
	}

	BOOL recent_active = ("Recent Items" == mActivePanel->getName());
	childSetVisible("add_btn_panel", !recent_active);

	setFilterSubString(mFilterSubString);
	LLInventoryFilter* filter = mActivePanel->getFilter();
	LLFloaterInventoryFinder *finder = getFinder();
	if (finder)
	{
		finder->changeFilter(filter);
	}
	if (filter->isActive())
	{
		// If our filter is active we may be the first thing requiring a fetch so we better start it here.
		LLInventoryModelBackgroundFetch::instance().start();
	}
	setFilterTextFromFilter();
}
Exemple #3
0
void LLFloaterGodTools::showPanel(const LLString& panel_name)
{
	childShowTab("GodTools Tabs", panel_name);
	open();	/*Flawfinder: ignore*/
	LLPanel *panel = childGetVisibleTab("GodTools Tabs");
	if (panel) panel->setFocus(TRUE);
}
void LLInventoryView::onFilterSelected()
{
	// Find my index
	mActivePanel = (LLInventoryPanel*)childGetVisibleTab("inventory filter tabs");

	if (!mActivePanel)
	{
		return;
	}

	//>setFilterSubString(self->mFilterSubString);
	LLInventoryFilter* filter = mActivePanel->getFilter();
	LLFloaterInventoryFinder *finder = getFinder();
	if (finder)
	{
		finder->changeFilter(filter);
	}
	if (filter->isActive())
	{
		// If our filter is active we may be the first thing requiring a fetch so we better start it here.
		LLInventoryModelBackgroundFetch::instance().start();
	}
	setFilterTextFromFilter();
	updateSortControls();
}
void LLFloaterAvatarPicker::chkcards()
{
	if(init_cards == FALSE)
	{
		LLPanel* active_panel = childGetVisibleTab("ResidentChooserTabs");

		if(active_panel == getChild<LLPanel>("CallingCardsPanel"))
		{
			init_cards = TRUE;
			/*<inventory_panel allow_multi_select="false" border="true" bottom_delta="-117"
			     follows="left|top|right|bottom" height="110" left="10" mouse_opaque="true"
			     name="InventoryPanel" sort_order="AvatarPickerSortOrder" width="115" />*/
			LLRect rect = active_panel->getRect();
			rect.mLeft += 10;
			rect.setLeftTopAndSize(rect.mLeft,rect.mTop,rect.getWidth(),110);
			LLInventoryPanel* panel = new LLInventoryPanel("InventoryPanel", "AvatarPickerSortOrder",
								 rect, &gInventory,
								 FALSE, active_panel);
			panel->setFollowsAll();
			panel->reshape(rect.getWidth(), rect.getHeight());
			panel->postBuild();
			active_panel->addChild(panel);
			LLInventoryPanel* inventory_panel = getChild<LLInventoryPanel>("InventoryPanel");
			inventory_panel->setFilterTypes(0x1 << LLInventoryType::IT_CALLINGCARD);
			inventory_panel->setFollowsAll();
			inventory_panel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
			inventory_panel->openDefaultFolderForType(LLAssetType::AT_CALLINGCARD);
			inventory_panel->setSelectCallback(LLFloaterAvatarPicker::onCallingCardSelectionChange, this);
		}
	}
}
// Callback for inventory picker (select from calling cards)
void LLFloaterAvatarPicker::doCallingCardSelectionChange(const std::deque<LLFolderViewItem*> &items, BOOL user_action, void* data)
{
	bool panel_active = (childGetVisibleTab("ResidentChooserTabs") == getChild<LLPanel>("CallingCardsPanel"));
	
	mSelectedInventoryAvatarIDs.clear();
	mSelectedInventoryAvatarNames.clear();
	
	if (panel_active)
	{
		childSetEnabled("Select", FALSE);
	}

	std::deque<LLFolderViewItem*>::const_iterator item_it;
	for (item_it = items.begin(); item_it != items.end(); ++item_it)
	{
		LLFolderViewEventListener* listenerp = (*item_it)->getListener();
		if (listenerp->getInventoryType() == LLInventoryType::IT_CALLINGCARD)
		{
			LLInventoryItem* item = gInventory.getItem(listenerp->getUUID());
			if (item)
			{
				mSelectedInventoryAvatarIDs.push_back(item->getCreatorUUID());
				mSelectedInventoryAvatarNames.push_back(listenerp->getName());
			}
		}
	}

	if (panel_active)
	{
		childSetEnabled("Select", visibleItemsSelected());
	}
}
void LLFloaterAvatarPicker::draw()
{
	LLFloater::draw();
	if (!mNearMeListComplete && childGetVisibleTab("ResidentChooserTabs") == getChild<LLPanel>("NearMePanel"))
	{
		populateNearMe();
	}
}
void LLFloaterGodTools::showPanel(const std::string& panel_name)
{
	childShowTab("GodTools Tabs", panel_name);
	openFloater();
	LLPanel *panel = childGetVisibleTab("GodTools Tabs");
	if (panel)
		panel->setFocus(TRUE);
}
void LLPanelOutfitsInventory::onTabChange()
{
    mActivePanel = (LLInventoryPanel*)childGetVisibleTab("appearance_tabs");
    if (!mActivePanel)
    {
        return;
    }
    mActivePanel->setFilterSubString(mFilterSubString);
    updateVerbs();
}
void LLFloaterAvatarPicker::onBtnSelect()
{

	// If select btn not enabled then do not callback
	if (!isSelectBtnEnabled())
		return;

	if(mSelectionCallback)
	{
		std::string acvtive_panel_name;
		LLScrollListCtrl* list =  NULL;
		LLPanel* active_panel = childGetVisibleTab("ResidentChooserTabs");
		if(active_panel)
		{
			acvtive_panel_name = active_panel->getName();
		}
		if(acvtive_panel_name == "SearchPanel")
		{
			list = getChild<LLScrollListCtrl>("SearchResults");
		}
		else if(acvtive_panel_name == "NearMePanel")
		{
			list = getChild<LLScrollListCtrl>("NearMe");
		}
		else if (acvtive_panel_name == "FriendsPanel")
		{
			list = getChild<LLScrollListCtrl>("Friends");
		}

		if(list)
		{
			std::vector<std::string>	avatar_names;
			uuid_vec_t			avatar_ids;
			getSelectedAvatarData(list, avatar_names, avatar_ids);
			mSelectionCallback(avatar_names, avatar_ids);
		}
	}
	getChild<LLScrollListCtrl>("SearchResults")->deselectAllItems(TRUE);
	getChild<LLScrollListCtrl>("NearMe")->deselectAllItems(TRUE);
	getChild<LLScrollListCtrl>("Friends")->deselectAllItems(TRUE);
	if(mCloseOnSelect)
	{
		mCloseOnSelect = FALSE;
		closeFloater();		
	}
}
BOOL LLFloaterAvatarPicker::visibleItemsSelected() const
{
	LLPanel* active_panel = childGetVisibleTab("ResidentChooserTabs");

	if(active_panel == getChild<LLPanel>("SearchPanel"))
	{
		return getChild<LLScrollListCtrl>("SearchResults")->getFirstSelectedIndex() >= 0;
	}
	else if(active_panel == getChild<LLPanel>("CallingCardsPanel"))
	{
		return mSelectedInventoryAvatarIDs.size() > 0;
	}
	else if(active_panel == getChild<LLPanel>("NearMePanel"))
	{
		return getChild<LLScrollListCtrl>("NearMe")->getFirstSelectedIndex() >= 0;
	}
	return FALSE;
}
void LLFloaterAvatarPicker::draw()
{
	// sometimes it is hard to determine when Select/Ok button should be disabled (see LLAvatarActions::shareWithAvatars).
	// lets check this via mOkButtonValidateSignal callback periodically.
	static LLFrameTimer timer;
	if (timer.hasExpired())
	{
		timer.setTimerExpirySec(0.33f); // three times per second should be enough.

		// simulate list changes.
		onList();
		timer.start();
	}

	LLFloater::draw();

// [RLVa:KB] - Version: 1.23.4 | Checked: 2009-07-08 (RLVa-1.0.0e) | Added: RLVa-1.0.0e
	// TODO-RLVa: this code needs revisiting
	if (rlv_handler_t::isEnabled())
	{
		LLPanel* pNearMePanel = getChild<LLPanel>("NearMePanel");
		if ( (pNearMePanel) && (childGetVisibleTab("ResidentChooserTabs") == pNearMePanel) )
		{
			if (gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES))
			{
				if (mNearMeListComplete)
				{
					getChild<LLScrollListCtrl>("NearMe")->deleteAllItems();
					childSetEnabled("Select", false);
				}
				mNearMeListComplete = FALSE;
				pNearMePanel->setCtrlsEnabled(FALSE);
				return;
			}
			pNearMePanel->setCtrlsEnabled(TRUE);
		}
	}
// [/RLVa:KB]

	if (!mNearMeListComplete &&  getChild<LLTabContainer>("ResidentChooserTabs")->getCurrentPanel() == getChild<LLPanel>("NearMePanel"))
	{
		populateNearMe();
	}
}
void LLFloaterAvatarPicker::draw()
{
	// sometimes it is hard to determine when Select/Ok button should be disabled (see LLAvatarActions::shareWithAvatars).
	// lets check this via mOkButtonValidateSignal callback periodically.
	static LLFrameTimer timer;
	if (timer.hasExpired())
	{
		timer.setTimerExpirySec(0.33f); // three times per second should be enough.

		// simulate list changes.
		onList();
		timer.start();
	}

	LLFloater::draw();
	if (!mNearMeListComplete && childGetVisibleTab("ResidentChooserTabs") == getChild<LLPanel>("NearMePanel"))
	{
		populateNearMe();
	}
}
bool LLFloaterAvatarPicker::isSelectBtnEnabled()
{
	bool ret_val = visibleItemsSelected();

	if ( ret_val && mOkButtonValidateSignal.num_slots() )
	{
		std::string acvtive_panel_name;
		LLScrollListCtrl* list =  NULL;
		LLPanel* active_panel = childGetVisibleTab("ResidentChooserTabs");

		if(active_panel)
		{
			acvtive_panel_name = active_panel->getName();
		}

		if(acvtive_panel_name == "SearchPanel")
		{
			list = getChild<LLScrollListCtrl>("SearchResults");
		}
		else if(acvtive_panel_name == "NearMePanel")
		{
			list = getChild<LLScrollListCtrl>("NearMe");
		}
		else if (acvtive_panel_name == "FriendsPanel")
		{
			list = getChild<LLScrollListCtrl>("Friends");
		}

		if(list)
		{
			uuid_vec_t avatar_ids;
			std::vector<std::string> avatar_names;
			getSelectedAvatarData(list, avatar_names, avatar_ids);
			return mOkButtonValidateSignal(avatar_ids);
		}
	}

	return ret_val;
}
void LLPanelMainInventory::onFilterSelected()
{
	// Find my index
	mActivePanel = (LLInventoryPanel*)childGetVisibleTab("inventory filter tabs");

	if (!mActivePanel)
	{
		return;
	}
	setFilterSubString(mFilterSubString);
	LLInventoryFilter* filter = mActivePanel->getFilter();
	LLFloaterInventoryFinder *finder = getFinder();
	if (finder)
	{
		finder->changeFilter(filter);
	}
	if (filter->isActive())
	{
		// If our filter is active we may be the first thing requiring a fetch so we better start it here.
		gInventory.startBackgroundFetch();
	}
	setFilterTextFromFilter();
}
BOOL LLFloaterAvatarPicker::visibleItemsSelected() const
{
	LLPanel* active_panel = childGetVisibleTab("ResidentChooserTabs");

	if(active_panel == getChild<LLPanel>("SearchPanel"))
	{
		return getChild<LLScrollListCtrl>("SearchResults")->getFirstSelectedIndex() >= 0;
	}
	else if(active_panel == getChild<LLPanel>("CallingCardsPanel"))
	{
		return !mSelectedInventoryAvatarIDs.empty();
	}
	else if(active_panel == getChild<LLPanel>("NearMePanel"))
	{
		return getChild<LLScrollListCtrl>("NearMe")->getFirstSelectedIndex() >= 0;
	}
	else if(active_panel == getChild<LLPanel>("KeyPanel"))
	{
		LLUUID specified = getChild<LLLineEditor>("EditUUID")->getValue().asUUID();
		return !specified.isNull();
	}
	return FALSE;
}
LLScrollListCtrl* LLFloaterAvatarPicker::getActiveList()
{
	std::string acvtive_panel_name;
	LLScrollListCtrl* list = NULL;
	LLPanel* active_panel = childGetVisibleTab("ResidentChooserTabs");
	if(active_panel)
	{
		acvtive_panel_name = active_panel->getName();
	}
	if(acvtive_panel_name == "SearchPanel")
	{
		list = getChild<LLScrollListCtrl>("SearchResults");
	}
	else if(acvtive_panel_name == "NearMePanel")
	{
		list = getChild<LLScrollListCtrl>("NearMe");
	}
	else if (acvtive_panel_name == "FriendsPanel")
	{
		list = getChild<LLScrollListCtrl>("Friends");
	}
	return list;
}
void LLFloaterAvatarPicker::onBtnSelect()
{

	// If select btn not enabled then do not callback
	if (!visibleItemsSelected())
		return;

	if(mSelectionCallback)
	{
		std::vector<LLAvatarName>	avatar_names;
		std::vector<LLUUID>			avatar_ids;
		std::string active_panel_name;
		LLScrollListCtrl* list =  NULL;
		LLPanel* active_panel = childGetVisibleTab("ResidentChooserTabs");
		if(active_panel)
		{
			active_panel_name = active_panel->getName();
		}
		if(active_panel_name == "CallingCardsPanel")
		{
			avatar_ids = mSelectedInventoryAvatarIDs;
			for(std::vector<std::string>::size_type i = 0; i < avatar_ids.size(); ++i)
			{
				std::map<LLUUID, LLAvatarName>::iterator iter = sAvatarNameMap.find(avatar_ids[i]);
				LLAvatarName av_name;
				if (iter != sAvatarNameMap.end())
				{
					avatar_names.push_back(iter->second);
				}
				else if(LLAvatarNameCache::get(avatar_ids[i], &av_name))
				{
					avatar_names.push_back(av_name);
				}
				else
				{
					std::string name = gCacheName->buildLegacyName(mSelectedInventoryAvatarNames[i]);
					std::string::size_type pos = name.find(' ');
					av_name.mLegacyFirstName = name.substr(pos);
					av_name.mLegacyLastName = pos!=std::string::npos ? name.substr(pos+1) : "Resident";
					av_name.mDisplayName = name;
					av_name.mUsername = "";
					avatar_names.push_back(av_name);
				}
			}
		}
		else if(active_panel_name == "SearchPanel")
		{
			list = getChild<LLScrollListCtrl>("SearchResults");
		}
		else if(active_panel_name == "NearMePanel")
		{
			list = getChild<LLScrollListCtrl>("NearMe");
		}
		else if(active_panel_name == "KeyPanel")
		{
			LLUUID specified = getChild<LLLineEditor>("EditUUID")->getValue().asUUID();
			if(specified.isNull())
				return;
			avatar_ids.push_back(specified);

			std::map<LLUUID, LLAvatarName>::iterator iter = sAvatarNameMap.find(specified);
			if (iter != sAvatarNameMap.end())
			{
				avatar_names.push_back(iter->second);
			}
			else
			{
				LLAvatarName av_name;
				LLAvatarNameCache::get(specified, &av_name);
				avatar_names.push_back(av_name);
			}
		}

		if(list)
		{
			getSelectedAvatarData(list, avatar_ids, avatar_names);
		}
		if(!avatar_names.empty() && !avatar_ids.empty())
		{
			mSelectionCallback(avatar_ids, avatar_names);
		}
	}
	getChild<LLInventoryPanel>("InventoryPanel")->setSelection(LLUUID::null, FALSE);
	getChild<LLScrollListCtrl>("SearchResults")->deselectAllItems(TRUE);
	getChild<LLScrollListCtrl>("NearMe")->deselectAllItems(TRUE);
	if(mCloseOnSelect)
	{
		mCloseOnSelect = FALSE;
		close();		
	}
}