// static
void LLPanelLandMedia::onClickRemoveURLFilter(void *data)
{
	LLPanelLandMedia* panelp = (LLPanelLandMedia*)data;
	if (panelp && panelp->mURLFilterList)
	{
		LLParcel* parcel = panelp->mParcel->getParcel();
		if (parcel)
		{
			LLSD list = parcel->getMediaURLFilterList();
			
			std::vector<LLScrollListItem*> domains = panelp->mURLFilterList->getAllSelected();
			for (std::vector<LLScrollListItem*>::iterator iter = domains.begin(); iter != domains.end(); iter++)
			{
				LLScrollListItem* item = *iter;
				const std::string domain = item->getValue().asString();

				for(S32 i = 0; i < list.size(); i++)
				{
					if (list[i].asString() == domain)
					{
						list.erase(i);
						break;
					}
				}
			}
			
			parcel->setMediaURLFilterList(list);
			LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel );

			panelp->refresh();
		}
	}
	
}
// static
void LLPanelLandMedia::onResetBtn(void *userdata)
{
	LLPanelLandMedia *self = (LLPanelLandMedia *)userdata;
	LLParcel* parcel = self->mParcel->getParcel();
	// LLViewerMedia::navigateHome();
	self->refresh();
	self->childSetText("current_url", parcel->getMediaURL());
	// LLViewerParcelMedia::sendMediaNavigateMessage(parcel->getMediaURL());

}
// static
void LLPanelLandMedia::onSetBtn(void *userdata)
{
	LLPanelLandMedia *self = (LLPanelLandMedia *)userdata;
	self->mURLEntryFloater = LLFloaterURLEntry::show( self->getHandle(), self->getMediaURL() );
	LLFloater* parent_floater = gFloaterView->getParentFloater(self);
	if (parent_floater)
	{
		parent_floater->addDependentFloater(self->mURLEntryFloater.get());
	}
}
// static
void LLPanelLandMedia::onCommitType(LLUICtrl *ctrl, void *userdata)
{
	LLPanelLandMedia *self = (LLPanelLandMedia *)userdata;
	std::string current_type = LLMIMETypes::widgetType(self->childGetText("mime_type"));
	std::string new_type = self->mMediaTypeCombo->getValue();
	if(current_type != new_type)
	{
		self->childSetText("mime_type", LLMIMETypes::findDefaultMimeType(new_type));
	}
	onCommitAny(ctrl, userdata);

}
// static
void LLPanelLandMedia::onCommitAny(LLUICtrl*, void *userdata)
{
	LLPanelLandMedia *self = (LLPanelLandMedia *)userdata;

	LLParcel* parcel = self->mParcel->getParcel();
	if (!parcel)
	{
		return;
	}

	// Extract data from UI
	std::string media_url	= self->mMediaURLEdit->getText();
	std::string media_desc	= self->mMediaDescEdit->getText();
	std::string mime_type	= self->childGetText("mime_type");
	U8 media_auto_scale		= self->mMediaAutoScaleCheck->get();
	U8 media_loop           = self->mMediaLoopCheck->get();
	F32 media_reset_time	= (F32)self->mMediaResetCtrl->get();
	S32 media_width			= (S32)self->mMediaWidthCtrl->get();
	S32 media_height		= (S32)self->mMediaHeightCtrl->get();
	LLUUID media_id			= self->mMediaTextureCtrl->getImageAssetID();
	U8 navigate_allow       = ! self->mRadioNavigateControl->getSelectedIndex();
	U8 navigate_filter      = self->mMediaURLFilterCheck->get();


	self->childSetText("mime_type", mime_type);

	// Remove leading/trailing whitespace (common when copying/pasting)
	LLStringUtil::trim(media_url);

	// Push data into current parcel
	parcel->setMediaURL(media_url);
	parcel->setMediaType(mime_type);
	parcel->setMediaDesc(media_desc);
	parcel->setMediaWidth(media_width);
	parcel->setMediaHeight(media_height);
	parcel->setMediaID(media_id);
	parcel->setMediaAutoScale ( media_auto_scale );
	parcel->setMediaLoop ( media_loop );
	parcel->setMediaURLFilterEnable(navigate_filter);
	parcel->setMediaAllowNavigate(navigate_allow);
	parcel->setMediaURLTimeout(media_reset_time);


	// Send current parcel data upstream to server
	LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel );

	// Might have changed properties, so let's redraw!
	self->refresh();
}
Ejemplo n.º 6
0
// static
void LLPanelLandMedia::onCommitAny(LLUICtrl*, void *userdata)
{
	LLPanelLandMedia *self = (LLPanelLandMedia *)userdata;

	LLParcel* parcel = self->mParcel->getParcel();
	if (!parcel)
	{
		return;
	}

	// Extract data from UI
	std::string media_url	= self->mMediaURLEdit->getText();
	std::string media_desc	= self->mMediaDescEdit->getText();
	std::string mime_type	= self->getChild<LLUICtrl>("mime_type")->getValue().asString();
	U8 media_auto_scale		= self->mMediaAutoScaleCheck->get();
	U8 media_loop           = self->mMediaLoopCheck->get();
	U8 obscure_media		= self->mMediaUrlCheck->get();
	S32 media_width			= (S32)self->mMediaWidthCtrl->get();
	S32 media_height		= (S32)self->mMediaHeightCtrl->get();
	LLUUID media_id			= self->mMediaTextureCtrl->getImageAssetID();


	self->getChild<LLUICtrl>("mime_type")->setValue(mime_type);

	// Remove leading/trailing whitespace (common when copying/pasting)
	LLStringUtil::trim(media_url);

	// Push data into current parcel
	parcel->setMediaURL(media_url);
	parcel->setMediaType(mime_type);
	parcel->setMediaDesc(media_desc);
	parcel->setMediaWidth(media_width);
	parcel->setMediaHeight(media_height);
	parcel->setMediaID(media_id);
	parcel->setMediaAutoScale ( media_auto_scale );
	parcel->setMediaLoop ( media_loop );
	parcel->setObscureMedia( obscure_media );

	// Send current parcel data upstream to server
	LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel );

	// Might have changed properties, so let's redraw!
	self->refresh();
}
// static
void LLPanelLandMedia::onClickAddURLFilter(void *userdata)
{
	LLPanelLandMedia *panelp = (LLPanelLandMedia *)userdata;
	LLParcel* parcel = panelp->mParcel->getParcel();
	
	LLSD list = parcel->getMediaURLFilterList();

	std::string domain = panelp->mMediaURLFilterDomainEdit->getText();
	LLStringUtil::trim(domain);

	BOOL add = TRUE;
	if (domain == "")
	{
		add = FALSE;
	}

	// check for dupes
	for(S32 i = 0; i < list.size(); i++)
	{
		if (list[i].asString() == domain)
		{
			add = FALSE;
			break;
		}
	}

	if (add)
	{
		list.append(domain);
		parcel->setMediaURLFilterList(list);

		LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel );

		panelp->mMediaURLFilterDomainEdit->setText(std::string(""));

		panelp->refresh();
	}

}