From 23469c00de6a8bfb4f62265801db94fd34d770ab Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Sat, 29 Dec 2012 07:45:05 -0500 Subject: [PATCH] Satisfy Issue 411: Song list in local chat - not a floater AnnounceStreamMetadata debug setting. "Announce music stream's metadata in local chat when tuned in" checkbox added to vanity main preferences. Made the words Title and Artist translatable, as well as the "Now playing" string. --- indra/newview/app_settings/settings.xml | 11 ++++++++++ indra/newview/ascentprefsvan.cpp | 6 ++++++ indra/newview/ascentprefsvan.h | 1 + indra/newview/llmediaremotectrl.cpp | 21 ++++++++++++++++--- .../xui/en-us/panel_media_remote_expanded.xml | 3 +++ .../en-us/panel_preferences_ascent_vanity.xml | 1 + 6 files changed, 40 insertions(+), 3 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 988a2b196..5bca1ce16 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -843,6 +843,17 @@ This should be as low as possible, but too low may break functionality Value 1 + AnnounceStreamMetadata + + Comment + Announce the metadata of the track playing, in chat, during streams. + Persist + 1 + Type + Boolean + Value + 0 + InventorySortOrder Comment diff --git a/indra/newview/ascentprefsvan.cpp b/indra/newview/ascentprefsvan.cpp index 5fdc90bed..e51e3c0e2 100644 --- a/indra/newview/ascentprefsvan.cpp +++ b/indra/newview/ascentprefsvan.cpp @@ -36,6 +36,8 @@ #include "ascentprefsvan.h" //project includes +#include "llaudioengine.h" //For gAudiop +#include "llstreamingaudio.h" //For LLStreamingAudioInterface #include "llcolorswatch.h" #include "llvoavatarself.h" #include "llagent.h" @@ -54,6 +56,8 @@ LLPrefsAscentVan::LLPrefsAscentVan() { LLUICtrlFactory::getInstance()->buildPanel(this, "panel_preferences_ascent_vanity.xml"); + childSetVisible("announce_streaming_metadata", gAudiop && gAudiop->getStreamingAudioImpl() && gAudiop->getStreamingAudioImpl()->supportsMetaData()); + childSetCommitCallback("tag_spoofing_combobox", onCommitClientTag, this); childSetCommitCallback("show_my_tag_check", onCommitCheckBox, this); @@ -180,6 +184,7 @@ void LLPrefsAscentVan::refreshValues() mDisableChatAnimation = gSavedSettings.getBOOL("SGDisableChatAnimation"); mAddNotReplace = gSavedSettings.getBOOL("LiruAddNotReplace"); mTurnAround = gSavedSettings.getBOOL("TurnAroundWhenWalkingBackwards"); + mAnnounceStreamMetadata = gSavedSettings.getBOOL("AnnounceStreamMetadata"); //Tags\Colors ---------------------------------------------------------------------------- mAscentUseTag = gSavedSettings.getBOOL("AscentUseTag"); @@ -256,6 +261,7 @@ void LLPrefsAscentVan::cancel() gSavedSettings.setBOOL("SGDisableChatAnimation", mDisableChatAnimation); gSavedSettings.setBOOL("LiruAddNotReplace", mAddNotReplace); gSavedSettings.setBOOL("TurnAroundWhenWalkingBackwards", mTurnAround); + gSavedSettings.setBOOL("AnnounceStreamMetadata", mAnnounceStreamMetadata); //Tags\Colors ---------------------------------------------------------------------------- gSavedSettings.setBOOL("AscentUseTag", mAscentUseTag); diff --git a/indra/newview/ascentprefsvan.h b/indra/newview/ascentprefsvan.h index ec96b8cac..fd2cd7044 100644 --- a/indra/newview/ascentprefsvan.h +++ b/indra/newview/ascentprefsvan.h @@ -60,6 +60,7 @@ protected: bool mDisableChatAnimation; bool mAddNotReplace; bool mTurnAround; + bool mAnnounceStreamMetadata; //Tags\Colors BOOL mAscentUseTag; std::string mReportClientUUID; diff --git a/indra/newview/llmediaremotectrl.cpp b/indra/newview/llmediaremotectrl.cpp index 50d3276b8..e5fa89e16 100644 --- a/indra/newview/llmediaremotectrl.cpp +++ b/indra/newview/llmediaremotectrl.cpp @@ -35,6 +35,8 @@ #include "llmediaremotectrl.h" #include "llaudioengine.h" +#include "llchat.h" +#include "llfloaterchat.h" #include "lliconctrl.h" #include "llmimetypes.h" #include "lloverlaybar.h" @@ -53,6 +55,7 @@ // static LLRegisterWidget r("media_remote"); +static std::string sLastTooltip; LLMediaRemoteCtrl::LLMediaRemoteCtrl() { @@ -263,10 +266,22 @@ void LLMediaRemoteCtrl::enableMediaButtons() if(artist.isDefined() && title.isDefined()) info_text = artist.asString() + " -- " + title.asString(); else if(title.isDefined()) - info_text = std::string("Title: ") + title.asString(); + info_text = getString("Title") + ": " + title.asString(); else if(artist.isDefined()) - info_text = std::string("Artist: ") + artist.asString(); - music_pause_btn->setToolTip(info_text); + 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 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); diff --git a/indra/newview/skins/default/xui/en-us/panel_media_remote_expanded.xml b/indra/newview/skins/default/xui/en-us/panel_media_remote_expanded.xml index 726653614..94702ca97 100644 --- a/indra/newview/skins/default/xui/en-us/panel_media_remote_expanded.xml +++ b/indra/newview/skins/default/xui/en-us/panel_media_remote_expanded.xml @@ -15,6 +15,9 @@ Pause + Title + Artist + Now playing No Media Specified diff --git a/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_vanity.xml b/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_vanity.xml index e60190d45..ea9031f65 100644 --- a/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_vanity.xml +++ b/indra/newview/skins/default/xui/en-us/panel_preferences_ascent_vanity.xml @@ -9,6 +9,7 @@ +