From 96be4a4e6826d487c3d60b80cb7cf570d8fa5d95 Mon Sep 17 00:00:00 2001 From: Cinders Date: Thu, 14 Mar 2013 20:42:35 -0600 Subject: [PATCH] FIRE-593: Audio stream URL drop down in About Land --- indra/newview/app_settings/settings.xml | 11 +++ indra/newview/llpanellandaudio.cpp | 75 ++++++++++++++++++- indra/newview/llpanellandaudio.h | 19 ++++- .../default/xui/en/floater_about_land.xml | 26 ++++++- 4 files changed, 121 insertions(+), 10 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index a2d9f07eab..2635bcdd67 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -20073,5 +20073,16 @@ Change of this parameter will affect the layout of buttons in notification toast Value 44e98907-3764-119f-1c13-cba9945d2ff4 + FSStreamList + + Comment + Saved list of media streams + Persist + 1 + Type + LLSD + Value + + diff --git a/indra/newview/llpanellandaudio.cpp b/indra/newview/llpanellandaudio.cpp index e7bdc51b4a..e5a0d91bd0 100644 --- a/indra/newview/llpanellandaudio.cpp +++ b/indra/newview/llpanellandaudio.cpp @@ -40,7 +40,7 @@ #include "llcombobox.h" #include "llfloaterurlentry.h" #include "llfocusmgr.h" -#include "lllineeditor.h" +//#include "lllineeditor.h" // FIRE-593 - Unused since we use a combobox instead #include "llparcel.h" #include "lltextbox.h" #include "llradiogroup.h" @@ -50,6 +50,8 @@ #include "roles_constants.h" #include "llscrolllistctrl.h" +#include "llviewercontrol.h" // FIRE-593 - Needed for gSavedSettings where we store our media list + // Values for the parcel voice settings radio group enum { @@ -88,8 +90,17 @@ BOOL LLPanelLandAudio::postBuild() mCheckParcelVoiceLocal = getChild("parcel_enable_voice_channel_local"); childSetCommitCallback("parcel_enable_voice_channel_local", onCommitAny, this); - mMusicURLEdit = getChild("music_url"); +// FIRE-593 - We use a combobox now, not a line editor, also set callbacks for new add/remove stream buttons + //mMusicURLEdit = getChild("music_url"); + mMusicURLEdit = getChild("music_url"); childSetCommitCallback("music_url", onCommitAny, this); + + mBtnStreamAdd = getChild("stream_add_btn"); + childSetCommitCallback("stream_add_btn", onBtnStreamAdd, this); + + mBtnStreamDelete = getChild("stream_delete_btn"); + childSetCommitCallback("stream_delete_btn", onBtnStreamDelete, this); +// mCheckAVSoundAny = getChild("all av sound check"); childSetCommitCallback("all av sound check", onCommitAny, this); @@ -148,7 +159,25 @@ void LLPanelLandAudio::refresh() mCheckParcelEnableVoice->set(allow_voice); mCheckParcelVoiceLocal->set(!parcel->getParcelFlagUseEstateVoiceChannel()); - mMusicURLEdit->setText(parcel->getMusicURL()); +// FIRE-593 - Populate the audio combobox with our saved urls, then add the parcel's current url up top. + //mMusicURLEdit->setText(parcel->getMusicURL()); + std::string current_url = parcel->getMusicURL(); + mMusicURLEdit->clearRows(); + LLSD streamlist = gSavedSettings.getLLSD("FSStreamList"); + LLSD streams = streamlist["audio"]; + + for(LLSD::array_iterator s_itr = streams.beginArray(); s_itr != streams.endArray(); ++s_itr) + { + mMusicURLEdit->add(LLSD(*s_itr)); + lldebugs << "adding: " << *s_itr << " to the audio stream combo." << llendl; + } + mMusicURLEdit->addSeparator(ADD_TOP); + mMusicURLEdit->add(LLSD(current_url), ADD_TOP); + mMusicURLEdit->selectByValue(current_url); + + mBtnStreamAdd->setEnabled( can_change_media ); + mBtnStreamDelete->setEnabled( can_change_media ); +// mMusicURLEdit->setEnabled( can_change_media ); BOOL can_change_av_sounds = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_OPTIONS) && parcel->getHaveNewParcelLimitData(); @@ -172,7 +201,10 @@ void LLPanelLandAudio::onCommitAny(LLUICtrl*, void *userdata) // Extract data from UI BOOL sound_local = self->mCheckSoundLocal->get(); - std::string music_url = self->mMusicURLEdit->getText(); +// FIRE-593 - It's a combobox now + //std::string music_url = self->mMusicURLEdit->getText(); + std::string music_url = self->mMusicURLEdit->getSimple(); +// BOOL voice_enabled = self->mCheckParcelEnableVoice->get(); BOOL voice_estate_chan = !self->mCheckParcelVoiceLocal->get(); @@ -201,3 +233,38 @@ void LLPanelLandAudio::onCommitAny(LLUICtrl*, void *userdata) // Might have changed properties, so let's redraw! self->refresh(); } + +// FIRE-593 - Add/remove streams from the list with these. They're fantastic! +// static +void LLPanelLandAudio::onBtnStreamAdd(LLUICtrl*, void *userdata) +{ + LLPanelLandAudio *self = (LLPanelLandAudio *)userdata; + + std::string music_url = self->mMusicURLEdit->getSimple(); + LLStringUtil::trim(music_url); + + if (!music_url.empty()) + { + LLSD streamlist = gSavedSettings.getLLSD("FSStreamList"); + streamlist["audio"].append(music_url); + gSavedSettings.setLLSD("FSStreamList", streamlist); + self->refresh(); + } +} + +// static +void LLPanelLandAudio::onBtnStreamDelete(LLUICtrl*, void *userdata) +{ + LLPanelLandAudio *self = (LLPanelLandAudio *)userdata; + + std::string music_url = self->mMusicURLEdit->getSimple(); + LLStringUtil::trim(music_url); + + LLSD streamlist = gSavedSettings.getLLSD("FSStreamList"); + + // TODO: Make this remove specific items from the list instead of flushing the whole list. + streamlist.clear(); + gSavedSettings.setLLSD("FSStreamList", streamlist); + self->refresh(); +} +// diff --git a/indra/newview/llpanellandaudio.h b/indra/newview/llpanellandaudio.h index 32a45100f4..fda4a02e40 100644 --- a/indra/newview/llpanellandaudio.h +++ b/indra/newview/llpanellandaudio.h @@ -28,7 +28,11 @@ #ifndef LLPANELLANDAUDIO_H #define LLPANELLANDAUDIO_H -#include "lllineeditor.h" +// FIRE-593 - We use a combobox now, not a lineeditor +//#include "lllineeditor.h" +#include "llcombobox.h" +#include "llbutton.h" +// #include "llpanel.h" #include "llparcelselection.h" #include "lluifwd.h" // widget pointer types @@ -44,13 +48,22 @@ public: private: static void onCommitAny(LLUICtrl* ctrl, void *userdata); +// FIRE-593 - Add/remove streams from the list + static void onBtnStreamAdd(LLUICtrl* ctrl, void *userdata); + static void onBtnStreamDelete(LLUICtrl* ctrl, void *userdata); +// private: LLCheckBoxCtrl* mCheckSoundLocal; LLCheckBoxCtrl* mCheckParcelEnableVoice; LLCheckBoxCtrl* mCheckEstateDisabledVoice; - LLCheckBoxCtrl* mCheckParcelVoiceLocal; - LLLineEditor* mMusicURLEdit; + LLCheckBoxCtrl* mCheckParcelVoiceLocal; +// FIRE-593 - Use a combobox, also add buttons so we can add/remove items from it. + //LLLineEditor* mMusicURLEdit; + LLComboBox* mMusicURLEdit; + LLButton* mBtnStreamAdd; + LLButton* mBtnStreamDelete; +// LLCheckBoxCtrl* mMusicUrlCheck; LLCheckBoxCtrl* mCheckAVSoundAny; LLCheckBoxCtrl* mCheckAVSoundGroup; diff --git a/indra/newview/skins/default/xui/en/floater_about_land.xml b/indra/newview/skins/default/xui/en/floater_about_land.xml index c55ad93ab1..fb75f7aeb9 100644 --- a/indra/newview/skins/default/xui/en/floater_about_land.xml +++ b/indra/newview/skins/default/xui/en/floater_about_land.xml @@ -1837,16 +1837,36 @@ Only large parcels can be listed in search. width="364"> Music URL: - +