Пример #1
0
void LLMediaRemoteCtrl::enableMediaButtons()
{
	// Media
	bool play_media_enabled = false;
	bool stop_media_enabled = false;
	bool play_music_enabled = false;
	bool stop_music_enabled = false;
	bool music_show_pause = false;
	bool media_show_pause = false;
	LLColor4 music_icon_color = LLUI::sColorsGroup->getColor( "IconDisabledColor" );
	LLColor4 media_icon_color = LLUI::sColorsGroup->getColor( "IconDisabledColor" );
	std::string media_type = "none/none";

	// Put this in xui file
	std::string media_url = mControls->getString("default_tooltip_label");
	LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();

	if (gSavedSettings.getBOOL("AudioStreamingVideo"))
	{
		if ( parcel && parcel->getMediaURL()[0])
		{
			// Set the tooltip
			// Put this text into xui file
			media_url = parcel->getObscureMedia() ? mControls->getString("media_hidden_label") : parcel->getMediaURL();
			media_type = parcel->getMediaType();

			play_media_enabled = true;
			media_icon_color = LLUI::sColorsGroup->getColor( "IconEnabledColor" );

			LLMediaBase::EStatus status = LLViewerParcelMedia::getStatus();
			switch(status)
			{
			case LLMediaBase::STATUS_STOPPED:
			case LLMediaBase::STATUS_UNKNOWN:
				media_show_pause = false;
				stop_media_enabled = false;
				break;
			case LLMediaBase::STATUS_STARTED:
			case LLMediaBase::STATUS_NAVIGATING:
			case LLMediaBase::STATUS_RESETTING:
				// HACK: only show the pause button for movie types
				media_show_pause = LLMIMETypes::widgetType(parcel->getMediaType()) == "movie" ? true : false;
				stop_media_enabled = true;
				play_media_enabled = false;
				break;
			case LLMediaBase::STATUS_PAUSED:
				media_show_pause = false;
				stop_media_enabled = true;
				break;
			default:
				// inherit defaults above
				break;
			}
		}
	}
	if (gSavedSettings.getBOOL("AudioStreamingMusic") && gAudiop)
	{
	
		if ( parcel && parcel->getMusicURL()[0])
		{
			play_music_enabled = true;
			music_icon_color = LLUI::sColorsGroup->getColor( "IconEnabledColor" );

			if (gOverlayBar->musicPlaying())
			{
				music_show_pause = true;
				stop_music_enabled = true;
			}
			else
			{
				music_show_pause = false;
				stop_music_enabled = false;
			}
		}
		// if no mime type has been set disable play
		if( LLViewerMedia::getMimeType().empty() 
			|| LLViewerMedia::getMimeType() == "none/none")
		{
			play_media_enabled = false;
			stop_media_enabled = false;
		}
	}
	const std::string media_icon_name = LLMIMETypes::findIcon(media_type);
	LLButton* music_play_btn = getChild<LLButton>("music_play");
	LLButton* music_stop_btn = getChild<LLButton>("music_stop");
	LLButton* music_pause_btn = getChild<LLButton>("music_pause");
	LLButton* media_play_btn = getChild<LLButton>("media_play");
	LLButton* media_stop_btn = getChild<LLButton>("media_stop");
	LLButton* media_pause_btn = getChild<LLButton>("media_pause");
	LLIconCtrl* media_icon = getChild<LLIconCtrl>("media_icon");

	music_play_btn->setEnabled(play_music_enabled);
	music_stop_btn->setEnabled(stop_music_enabled);
	music_pause_btn->setEnabled(music_show_pause);
	music_pause_btn->setVisible(music_show_pause);
	music_play_btn->setVisible(! music_show_pause);
	childSetColor("music_icon", music_icon_color);
	if(!media_icon_name.empty())
	{
		media_icon->setImage(media_icon_name);
	}

	media_play_btn->setEnabled(play_media_enabled);
	media_stop_btn->setEnabled(stop_media_enabled);
	media_pause_btn->setEnabled(media_show_pause);
	media_pause_btn->setVisible(media_show_pause);
	media_play_btn->setVisible(! media_show_pause);
	childSetColor("media_icon", media_icon_color);

	setToolTip(media_url);
}
Пример #2
0
// public
void LLPanelLandMedia::refresh()
{
	LLParcel *parcel = mParcel->getParcel();

	if (!parcel)
	{
		clearCtrls();
	}
	else
	{
		// something selected, hooray!

		// Display options
		BOOL can_change_media = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_CHANGE_MEDIA);

		mMediaURLEdit->setText(parcel->getMediaURL());
		mMediaURLEdit->setEnabled( FALSE );

		getChild<LLUICtrl>("current_url")->setValue(parcel->getMediaCurrentURL());

		mMediaDescEdit->setText(parcel->getMediaDesc());
		mMediaDescEdit->setEnabled( can_change_media );

		std::string mime_type = parcel->getMediaType();
		if (mime_type.empty() || mime_type == LLMIMETypes::getDefaultMimeType())
		{
			mime_type = LLMIMETypes::getDefaultMimeTypeTranslation();
		}
		setMediaType(mime_type);
		mMediaTypeCombo->setEnabled( can_change_media );
		getChild<LLUICtrl>("mime_type")->setValue(mime_type);

		mMediaUrlCheck->set( parcel->getObscureMedia() );
		mMediaUrlCheck->setEnabled( can_change_media );

		// don't display urls if you're not able to change it
		// much requested change in forums so people can't 'steal' urls
		// NOTE: bug#2009 means this is still vunerable - however, bug
		// should be closed since this bug opens up major security issues elsewhere.
		bool obscure_media = ! can_change_media && parcel->getObscureMedia();

		// Special code to disable asterixes for html type
		if(mime_type == "text/html")
		{
			obscure_media = false;
			mMediaUrlCheck->set( 0 );
			mMediaUrlCheck->setEnabled( false );
		}

		mMediaURLEdit->setDrawAsterixes( obscure_media );

		mMediaAutoScaleCheck->set( parcel->getMediaAutoScale () );
		mMediaAutoScaleCheck->setEnabled ( can_change_media );

		// Special code to disable looping checkbox for HTML MIME type
		// (DEV-10042 -- Parcel Media: "Loop Media" should be disabled for static media types)
		bool allow_looping = LLMIMETypes::findAllowLooping( mime_type );
		if ( allow_looping )
			mMediaLoopCheck->set( parcel->getMediaLoop () );
		else
			mMediaLoopCheck->set( false );
		mMediaLoopCheck->setEnabled ( can_change_media && allow_looping );
		
		// disallow media size change for mime types that don't allow it
		bool allow_resize = LLMIMETypes::findAllowResize( mime_type );
		if ( allow_resize )
			mMediaWidthCtrl->setValue( parcel->getMediaWidth() );
		else
			mMediaWidthCtrl->setValue( 0 );
		mMediaWidthCtrl->setEnabled ( can_change_media && allow_resize );

		if ( allow_resize )
			mMediaHeightCtrl->setValue( parcel->getMediaHeight() );
		else
			mMediaHeightCtrl->setValue( 0 );
		mMediaHeightCtrl->setEnabled ( can_change_media && allow_resize );

		// enable/disable for text label for completeness
		mMediaSizeCtrlLabel->setEnabled( can_change_media && allow_resize );

		LLUUID tmp = parcel->getMediaID();
		mMediaTextureCtrl->setImageAssetID ( parcel->getMediaID() );
		mMediaTextureCtrl->setEnabled( can_change_media );

		mSetURLButton->setEnabled( can_change_media );

	}
}