static void handle_click_action_open_media(LLPointer<LLViewerObject> objectp) { //FIXME: how do we handle object in different parcel than us? LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (!parcel) return; // did we hit an object? if (objectp.isNull()) return; // did we hit a valid face on the object? S32 face = LLToolPie::getInstance()->getPick().mObjectFace; if( face < 0 || face >= objectp->getNumTEs() ) return; // is media playing on this face? if (LLViewerMedia::getMediaImplFromTextureID(objectp->getTE(face)->getID()) != NULL) { handle_click_action_play(); return; } std::string media_url = std::string ( parcel->getMediaURL () ); std::string media_type = std::string ( parcel->getMediaType() ); LLStringUtil::trim(media_url); // Get the scheme, see if that is handled as well. LLURI uri(media_url); std::string media_scheme = uri.scheme() != "" ? uri.scheme() : "http"; // HACK: This is directly referencing an impl name. BAD! // This can be removed when we have a truly generic media browser that only // builds an impl based on the type of url it is passed. LLWeb::loadURL(media_url); }
static ECursorType cursor_from_parcel_media(U8 click_action) { // HACK: This is directly referencing an impl name. BAD! // This can be removed when we have a truly generic media browser that only // builds an impl based on the type of url it is passed. //FIXME: how do we handle object in different parcel than us? ECursorType open_cursor = UI_CURSOR_ARROW; LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (!parcel) return open_cursor; std::string media_url = std::string ( parcel->getMediaURL () ); std::string media_type = std::string ( parcel->getMediaType() ); LLStringUtil::trim(media_url); open_cursor = UI_CURSOR_TOOLMEDIAOPEN; LLViewerMediaImpl::EMediaStatus status = LLViewerParcelMedia::getStatus(); switch(status) { case LLViewerMediaImpl::MEDIA_PLAYING: return click_action == CLICK_ACTION_PLAY ? UI_CURSOR_TOOLPAUSE : open_cursor; default: return UI_CURSOR_TOOLPLAY; } }
static void handle_click_action_open_media(LLPointer<LLViewerObject> objectp) { //FIXME: how do we handle object in different parcel than us? LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (!parcel) return; // did we hit an object? if (objectp.isNull()) return; // did we hit a valid face on the object? S32 face = LLToolPie::getInstance()->getPick().mObjectFace; if( face < 0 || face >= objectp->getNumTEs() ) return; // is media playing on this face? if (LLViewerMedia::getMediaImplFromTextureID(objectp->getTE(face)->getID()) != NULL) { handle_click_action_play(); return; } std::string media_url = std::string ( parcel->getMediaURL () ); std::string media_type = std::string ( parcel->getMediaType() ); LLStringUtil::trim(media_url); LLWeb::loadURL(media_url); }
static ECursorType cursor_from_parcel_media(U8 click_action) { // HACK: This is directly referencing an impl name. BAD! // This can be removed when we have a truly generic media browser that only // builds an impl based on the type of url it is passed. //FIXME: how do we handle object in different parcel than us? ECursorType open_cursor = UI_CURSOR_ARROW; LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (!parcel) return open_cursor; std::string media_url = std::string ( parcel->getMediaURL () ); std::string media_type = std::string ( parcel->getMediaType() ); LLStringUtil::trim(media_url); // Get the scheme, see if that is handled as well. LLURI uri(media_url); std::string media_scheme = uri.scheme() != "" ? uri.scheme() : "http"; if( LLMediaManager::getInstance()->supportsMediaType( "LLMediaImplLLMozLib", media_scheme, media_type ) ) { open_cursor = UI_CURSOR_TOOLMEDIAOPEN; } LLMediaBase::EStatus status = LLViewerParcelMedia::getStatus(); switch(status) { case LLMediaBase::STATUS_STARTED: return click_action == CLICK_ACTION_PLAY ? UI_CURSOR_TOOLPAUSE : open_cursor; default: return UI_CURSOR_TOOLPLAY; } }
////////////////////////////////////////////////////////////////////////////////////////// // static void LLViewerParcelMedia::processParcelMediaUpdate( LLMessageSystem *msg, void ** ) { LLUUID media_id; std::string media_url; std::string media_type; S32 media_width = 0; S32 media_height = 0; U8 media_auto_scale = FALSE; U8 media_loop = FALSE; msg->getUUID( "DataBlock", "MediaID", media_id ); char media_url_buffer[257]; msg->getString( "DataBlock", "MediaURL", 255, media_url_buffer ); media_url = media_url_buffer; msg->getU8("DataBlock", "MediaAutoScale", media_auto_scale); if (msg->has("DataBlockExtended")) // do we have the extended data? { char media_type_buffer[257]; msg->getString("DataBlockExtended", "MediaType", 255, media_type_buffer); media_type = media_type_buffer; msg->getU8("DataBlockExtended", "MediaLoop", media_loop); msg->getS32("DataBlockExtended", "MediaWidth", media_width); msg->getS32("DataBlockExtended", "MediaHeight", media_height); } LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); BOOL same = FALSE; if (parcel) { same = ((parcel->getMediaURL() == media_url) && (parcel->getMediaType() == media_type) && (parcel->getMediaID() == media_id) && (parcel->getMediaWidth() == media_width) && (parcel->getMediaHeight() == media_height) && (parcel->getMediaAutoScale() == media_auto_scale) && (parcel->getMediaLoop() == media_loop)); if (!same) { // temporarily store these new values in the parcel parcel->setMediaURL(media_url); parcel->setMediaType(media_type); parcel->setMediaID(media_id); parcel->setMediaWidth(media_width); parcel->setMediaHeight(media_height); parcel->setMediaAutoScale(media_auto_scale); parcel->setMediaLoop(media_loop); play(parcel); } } }
void LLFloaterMediaBrowser::onClickAssign(void* user_data) { LLFloaterMediaBrowser* self = (LLFloaterMediaBrowser*)user_data; LLParcel* parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); if (!parcel) { return; } std::string media_url = self->mAddressCombo->getValue().asString(); LLStringUtil::trim(media_url); if(parcel->getMediaType() != "text/html") { parcel->setMediaURL(media_url); parcel->setMediaCurrentURL(media_url); parcel->setMediaType(std::string("text/html")); LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel, true ); LLViewerParcelMedia::sendMediaNavigateMessage(media_url); LLViewerParcelMedia::stop(); // LLViewerParcelMedia::update( parcel ); } LLViewerParcelMedia::sendMediaNavigateMessage(media_url); }
// 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 ); childSetText("current_url", 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(); } setMediaType(mime_type); mMediaTypeCombo->setEnabled( can_change_media ); childSetText("mime_type", mime_type); 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 ); mMediaResetCtrl->set( parcel->getMediaURLTimeout() ); mMediaResetCtrl->setEnabled( can_change_media ); mMediaResetCtrlLabel->setEnabled( can_change_media ); // 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 ); mResetURLButton->setEnabled( can_change_media ); /*LLFloaterURLEntry* floater_url_entry = (LLFloaterURLEntry*)mURLEntryFloater.get(); if (floater_url_entry) { floater_url_entry->updateFromLandMediaPanel(); }*/ } }
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; static LLCachedControl<LLColor4U> sIconDisabledColor(gColors, "IconDisabledColor"); LLColor4 music_icon_color = (LLColor4)sIconDisabledColor; LLColor4 media_icon_color = (LLColor4)sIconDisabledColor; 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().empty()) { // Set the tooltip // Put this text into xui file media_url = parcel->getMediaURL(); media_type = parcel->getMediaType(); play_media_enabled = true; media_icon_color = LLUI::sColorsGroup->getColor( "IconEnabledColor" ); LLViewerMediaImpl::EMediaStatus status = LLViewerParcelMedia::getStatus(); switch(status) { case LLViewerMediaImpl::MEDIA_NONE: media_show_pause = false; stop_media_enabled = false; break; case LLViewerMediaImpl::MEDIA_LOADING: case LLViewerMediaImpl::MEDIA_LOADED: case LLViewerMediaImpl::MEDIA_PLAYING: // 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 LLViewerMediaImpl::MEDIA_PAUSED: media_show_pause = false; stop_media_enabled = true; break; default: // inherit defaults above break; } } } if (gSavedSettings.getBOOL("AudioStreamingMusic") && gAudiop) { if ( parcel && !parcel->getMusicURL().empty()) { 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; } } // Don't test the mime-type: this is not updated in a consistent basis. The existence of a valid gAudiop is enough guarantee. } 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); }
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().empty()) { // Set the tooltip // Put this text into xui file media_url = parcel->getMediaURL(); media_type = parcel->getMediaType(); play_media_enabled = true; media_icon_color = LLUI::sColorsGroup->getColor( "IconEnabledColor" ); LLViewerMediaImpl::EMediaStatus status = LLViewerParcelMedia::getStatus(); switch(status) { case LLViewerMediaImpl::MEDIA_NONE: media_show_pause = false; stop_media_enabled = false; break; case LLViewerMediaImpl::MEDIA_LOADING: case LLViewerMediaImpl::MEDIA_LOADED: case LLViewerMediaImpl::MEDIA_PLAYING: // 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 LLViewerMediaImpl::MEDIA_PAUSED: media_show_pause = false; stop_media_enabled = true; break; default: // inherit defaults above break; } } } if (gSavedSettings.getBOOL("AudioStreamingMusic") && gAudiop) { if ( parcel && !parcel->getMusicURL().empty()) { 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; } } // Don't test the mime-type: this is not updated in a consistent basis. The existence of a valid gAudiop is enough guarantee. } 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); if(music_show_pause) { LLStreamingAudioInterface *stream = gAudiop ? gAudiop->getStreamingAudioImpl() : NULL; if(stream && stream->getMetaData()) { std::string info_text = "Loading..."; const LLSD& metadata = *(stream->getMetaData()); LLSD artist = metadata.get("ARTIST"); LLSD title = metadata.get("TITLE"); if(artist.isDefined() && title.isDefined()) info_text = artist.asString() + " -- " + title.asString(); else if(title.isDefined()) info_text = std::string("Title: ") + title.asString(); else if(artist.isDefined()) info_text = std::string("Artist: ") + artist.asString(); music_pause_btn->setToolTip(info_text); } else music_pause_btn->setToolTip(mCachedPauseTip); } 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); }
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("AudioStreamingMedia")) { if ( parcel && !parcel->getMediaURL().empty()) { // Set the tooltip // Put this text into xui file media_url = parcel->getMediaURL(); media_type = parcel->getMediaType(); play_media_enabled = true; media_icon_color = LLUI::sColorsGroup->getColor( "IconEnabledColor" ); LLViewerMediaImpl::EMediaStatus status = LLViewerParcelMedia::getStatus(); switch(status) { case LLViewerMediaImpl::MEDIA_NONE: media_show_pause = false; stop_media_enabled = false; break; case LLViewerMediaImpl::MEDIA_LOADING: case LLViewerMediaImpl::MEDIA_LOADED: case LLViewerMediaImpl::MEDIA_PLAYING: // 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 LLViewerMediaImpl::MEDIA_PAUSED: media_show_pause = false; stop_media_enabled = true; break; default: // inherit defaults above break; } } } if (gSavedSettings.getBOOL("AudioStreamingMusic") && gAudiop) { if ( parcel && !parcel->getMusicURL().empty()) { 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; } } // Don't test the mime-type: this is not updated in a consistent basis. The existence of a valid gAudiop is enough guarantee. } const std::string media_icon_name = LLMIMETypes::findIcon(media_type); LLButton* music_play_btn = mMusicPlayBtn; LLButton* music_stop_btn = mMusicStopBtn; LLButton* music_pause_btn = mMusicPauseBtn; LLButton* media_play_btn = mMediaPlayBtn; LLButton* media_stop_btn = mMediaStopBtn; LLButton* media_pause_btn = mMediaPauseBtn; LLIconCtrl* media_icon = mMediaIcon; 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); if(music_show_pause) { LLStreamingAudioInterface *stream = gAudiop ? gAudiop->getStreamingAudioImpl() : NULL; if(stream && stream->getMetaData()) { std::string info_text = "Loading..."; const LLSD& metadata = *(stream->getMetaData()); LLSD artist = metadata.get("ARTIST"); LLSD title = metadata.get("TITLE"); if(artist.isDefined() && title.isDefined()) info_text = artist.asString() + " -- " + title.asString(); else if(title.isDefined()) info_text = getString("Title") + ": " + title.asString(); else if(artist.isDefined()) info_text = getString("Artist") + ": " + artist.asString(); if(music_pause_btn->getToolTip() != info_text) //Has info_text changed since last call? { music_pause_btn->setToolTip(info_text); static LLCachedControl<bool> announce_stream_metadata("AnnounceStreamMetadata"); if(announce_stream_metadata && info_text != sLastTooltip && info_text != "Loading...") //Are we announcing? Don't annoounce what we've last announced. Don't announce Loading. { sLastTooltip = info_text; LLChat chat; chat.mText = getString("Now_playing") + " " + info_text; chat.mSourceType = CHAT_SOURCE_SYSTEM; LLFloaterChat::addChat(chat); } } } else music_pause_btn->setToolTip(mCachedPauseTip); } mMusicIcon->setColor(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); mMediaIcon->setColor(media_icon_color); setToolTip(media_url); }
// 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 ); childSetText("current_url", parcel->getMediaCurrentURL()); mMediaDescEdit->setText(parcel->getMediaDesc()); mMediaDescEdit->setEnabled( can_change_media ); std::string mime_type = parcel->getMediaType(); if (mime_type.empty()) { mime_type = "none/none"; } setMediaType(mime_type); mMediaTypeCombo->setEnabled( can_change_media ); childSetText("mime_type", mime_type); 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 ); mMediaResetCtrl->set( parcel->getMediaURLTimeout() ); mMediaResetCtrl->setEnabled( can_change_media ); mMediaResetCtrlLabel->setEnabled( can_change_media ); // 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 ); mResetURLButton->setEnabled( can_change_media ); mMediaURLFilterCheck->set( parcel->getMediaURLFilterEnable() ); mMediaURLFilterCheck->setEnabled( can_change_media ); LLFloaterURLEntry* floater_url_entry = (LLFloaterURLEntry*)mURLEntryFloater.get(); if (floater_url_entry) { floater_url_entry->updateFromLandMediaPanel(); } // This radial control is really just an inverse mapping to the boolean allow_navigate value. // It is set as a radial merely for user readability. mRadioNavigateControl->setSelectedIndex(! parcel->getMediaAllowNavigate()); mRadioNavigateControl->setEnabled( can_change_media ); mMediaURLFilterDomainEdit->setEnabled( can_change_media ); mMediaURLFilterAddButton->setEnabled( can_change_media ); mMediaURLFilterRemoveButton->setEnabled( can_change_media ); if (mURLFilterList) { mURLFilterList->setEnabled( can_change_media ); mURLFilterList->deleteAllItems(); LLSD list = parcel->getMediaURLFilterList(); for (LLSD::array_iterator i = list.beginArray(); i != list.endArray(); ++i) { std::string domain = (*i).asString(); LLSD element; element["id"] = domain; element["columns"][0]["value"] = domain; mURLFilterList->addElement(element); } } } }
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); }
// 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 ); } }
////////////////////////////////////////////////////////////////////////////////////////// // static void LLViewerParcelMedia::processParcelMediaUpdate( LLMessageSystem *msg, void ** ) { LLUUID media_id; std::string media_url; std::string media_type; S32 media_width = 0; S32 media_height = 0; U8 media_auto_scale = FALSE; U8 media_loop = FALSE; msg->getUUID( "DataBlock", "MediaID", media_id ); char media_url_buffer[257]; msg->getString( "DataBlock", "MediaURL", 255, media_url_buffer ); media_url = media_url_buffer; msg->getU8("DataBlock", "MediaAutoScale", media_auto_scale); if (msg->has("DataBlockExtended")) // do we have the extended data? { char media_type_buffer[257]; msg->getString("DataBlockExtended", "MediaType", 255, media_type_buffer); media_type = media_type_buffer; msg->getU8("DataBlockExtended", "MediaLoop", media_loop); msg->getS32("DataBlockExtended", "MediaWidth", media_width); msg->getS32("DataBlockExtended", "MediaHeight", media_height); } LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel(); BOOL same = FALSE; if (parcel) { same = ((parcel->getMediaURL() == media_url) && (parcel->getMediaType() == media_type) && (parcel->getMediaID() == media_id) && (parcel->getMediaWidth() == media_width) && (parcel->getMediaHeight() == media_height) && (parcel->getMediaAutoScale() == media_auto_scale) && (parcel->getMediaLoop() == media_loop)); if (!same) { // temporarily store these new values in the parcel parcel->setMediaURL(media_url); parcel->setMediaType(media_type); parcel->setMediaID(media_id); parcel->setMediaWidth(media_width); parcel->setMediaHeight(media_height); parcel->setMediaAutoScale(media_auto_scale); parcel->setMediaLoop(media_loop); // Don't filter or play if not already playing. if (sMediaImpl.notNull()) { if (gSavedSettings.getBOOL("MediaEnableFilter")) { llinfos << "Parcel media changed. Filtering media URL." << llendl; filterMediaUrl(parcel); } else { llinfos << "Parcel media changed. Media filter disabled, playing." << llendl; play(parcel); } } } } }