From 96741727e0d1dbb743fe9dcfff68d52b12617136 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Mon, 15 Jun 2009 03:00:48 -0700 Subject: Applied Dale Glass' patch for VWR-12655: Add support for displaying the title of the song --- linden/indra/newview/app_settings/settings.xml | 11 +++++ linden/indra/newview/lloverlaybar.cpp | 49 ++++++++++++++++++++++ .../default/xui/en-us/panel_preferences_audio.xml | 6 ++- 3 files changed, 65 insertions(+), 1 deletion(-) (limited to 'linden/indra/newview') diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml index 5c76185..7ab215a 100644 --- a/linden/indra/newview/app_settings/settings.xml +++ b/linden/indra/newview/app_settings/settings.xml @@ -7337,6 +7337,17 @@ Value 0 + ShowStreamTitle + + Comment + Show the title of the song playing on the parcel's stream + Persist + 1 + Type + Boolean + Value + 1 + ShowTangentBasis Comment diff --git a/linden/indra/newview/lloverlaybar.cpp b/linden/indra/newview/lloverlaybar.cpp index 91a7375..e1aeeca 100644 --- a/linden/indra/newview/lloverlaybar.cpp +++ b/linden/indra/newview/lloverlaybar.cpp @@ -41,6 +41,7 @@ #include "llagent.h" #include "llbutton.h" #include "llchatbar.h" +#include "llfloaterchat.h" #include "llfocusmgr.h" #include "llimview.h" #include "llmediaremotectrl.h" @@ -72,6 +73,53 @@ LLOverlayBar *gOverlayBar = NULL; extern S32 MENU_BAR_HEIGHT; + +class LLTitleObserver + : public LLMediaObserver +{ +public: + void init(std::string url); + /*virtual*/ void onMediaTitleChange(const EventType& event_in); +private: + LLMediaBase* mMediaSource; +}; + +static LLTitleObserver sTitleObserver; + +static LLRegisterWidget r("media_remote"); + +void LLTitleObserver::init(std::string url) +{ + + if (!gAudiop) + { + return; + } + + mMediaSource = gAudiop->getStreamMedia(); // LLViewerMedia::getSource(); + + if ( mMediaSource ) + { + mMediaSource->addObserver(this); + } +} + +//virtual +void LLTitleObserver::onMediaTitleChange(const EventType& event_in) +{ + if ( !gSavedSettings.getBOOL("ShowStreamTitle") ) + { + return; + } + + LLChat chat; + //TODO: set this in XUI + std::string playing_msg = "Playing: " + event_in.getStringValue(); + chat.mText = playing_msg; + LLFloaterChat::addChat(chat, FALSE, FALSE); +} + + // // Functions // @@ -406,6 +454,7 @@ void LLOverlayBar::toggleMusicPlay(void*) // if ( gAudiop->isInternetStreamPlaying() == 0 ) { gAudiop->startInternetStream(parcel->getMusicURL()); + sTitleObserver.init(parcel->getMusicURL()); } } } diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_audio.xml b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_audio.xml index 92978ab..c960d36 100644 --- a/linden/indra/newview/skins/default/xui/en-us/panel_preferences_audio.xml +++ b/linden/indra/newview/skins/default/xui/en-us/panel_preferences_audio.xml @@ -15,7 +15,7 @@ Streaming Preferences: Audio Preferences: @@ -28,6 +28,10 @@ label="Play Streaming Music When Available (uses more bandwidth)" left="142" mouse_opaque="true" name="streaming_music" radio_style="false" width="339" /> +