Skip to content
Snippets Groups Projects
Commit 619090ba authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Add music url history to parcel about

parent a9fe1b8e
No related branches found
No related tags found
2 merge requests!3Update to main branch,!2Rebase onto current main branch
......@@ -1489,6 +1489,17 @@
<key>Value</key>
<integer>0</integer>
</map>
<key>StreamList</key>
<map>
<key>Comment</key>
<string>Saved list of parcel audio streams</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>LLSD</string>
<key>Value</key>
<string />
</map>
<key>VoiceMultiInstance</key>
<map>
<key>Comment</key>
......
......@@ -34,6 +34,7 @@
#include "llviewerparcelmgr.h"
#include "llviewerregion.h"
#include "lluictrlfactory.h"
#include "llviewercontrol.h"
// library includes
#include "llcheckboxctrl.h"
......@@ -88,8 +89,8 @@ BOOL LLPanelLandAudio::postBuild()
mCheckParcelVoiceLocal = getChild<LLCheckBoxCtrl>("parcel_enable_voice_channel_local");
childSetCommitCallback("parcel_enable_voice_channel_local", onCommitAny, this);
mMusicURLEdit = getChild<LLLineEditor>("music_url");
childSetCommitCallback("music_url", onCommitAny, this);
mMusicURLEdit = getChild<LLComboBox>("music_url");
mMusicURLEdit->setCommitCallback(boost::bind(&LLPanelLandAudio::onCommitMusicUrl, this));
mCheckAVSoundAny = getChild<LLCheckBoxCtrl>("all av sound check");
childSetCommitCallback("all av sound check", onCommitAny, this);
......@@ -151,8 +152,18 @@ void LLPanelLandAudio::refresh()
mCheckParcelEnableVoice->set(allow_voice);
mCheckParcelVoiceLocal->set(!parcel->getParcelFlagUseEstateVoiceChannel());
mMusicURLEdit->setText(parcel->getMusicURL());
mMusicURLEdit->setEnabled( can_change_media );
const std::string& current_url = parcel->getMusicURL();
mMusicURLEdit->clearRows();
LLSD stream_list = gSavedSettings.getLLSD("StreamList");
const LLSD streams = stream_list["audio"];
for (LLSD::array_const_iterator s_itr = streams.beginArray(), s_end = streams.endArray(); s_itr != s_end; ++s_itr)
{
mMusicURLEdit->add(LLSD(*s_itr));
}
mMusicURLEdit->addSeparator(ADD_TOP);
mMusicURLEdit->add(LLSD(current_url), ADD_TOP);
mMusicURLEdit->selectByValue(current_url);
mMusicURLEdit->setEnabled(can_change_media);
BOOL can_change_av_sounds = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_OPTIONS) && parcel->getHaveNewParcelLimitData();
mCheckAVSoundAny->set(parcel->getAllowAnyAVSounds());
......@@ -178,7 +189,7 @@ void LLPanelLandAudio::onCommitAny(LLUICtrl*, void *userdata)
// Extract data from UI
BOOL sound_local = self->mCheckSoundLocal->get();
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();
......@@ -210,3 +221,25 @@ void LLPanelLandAudio::onCommitAny(LLUICtrl*, void *userdata)
// Might have changed properties, so let's redraw!
self->refresh();
}
void LLPanelLandAudio::onCommitMusicUrl()
{
std::string music_url = mMusicURLEdit->getSimple();
LLStringUtil::trim(music_url);
if (!music_url.empty())
{
LLSD stream_list = gSavedSettings.getLLSD("StreamList");
const LLSD streams = stream_list["audio"];
bool found = false;
for (LLSD::array_const_iterator s_itr = streams.beginArray(), s_end = streams.endArray(); s_itr != s_end; ++s_itr)
{
if (LLStringUtil::compareInsensitive((LLSD(*s_itr)).asString(), music_url) == 0)
found = true;
}
if (!found)
stream_list["audio"].append(music_url);
gSavedSettings.setLLSD("StreamList", stream_list);
}
onCommitAny(mMusicURLEdit, this);
}
......@@ -28,11 +28,12 @@
#ifndef LLPANELLANDAUDIO_H
#define LLPANELLANDAUDIO_H
#include "lllineeditor.h"
#include "llpanel.h"
#include "llparcelselection.h"
#include "lluifwd.h" // widget pointer types
class LLComboBox;
class LLPanelLandAudio
: public LLPanel
{
......@@ -44,13 +45,14 @@ class LLPanelLandAudio
private:
static void onCommitAny(LLUICtrl* ctrl, void *userdata);
void onCommitMusicUrl();
private:
LLCheckBoxCtrl* mCheckSoundLocal;
LLCheckBoxCtrl* mCheckParcelEnableVoice;
LLCheckBoxCtrl* mCheckEstateDisabledVoice;
LLCheckBoxCtrl* mCheckParcelVoiceLocal;
LLLineEditor* mMusicURLEdit;
LLComboBox* mMusicURLEdit;
LLCheckBoxCtrl* mCheckAVSoundAny;
LLCheckBoxCtrl* mCheckAVSoundGroup;
LLCheckBoxCtrl* mCheckObscureMOAP;
......
......@@ -1842,12 +1842,14 @@ Only large parcels can be listed in search.
width="364">
Music URL:
</text>
<line_editor
<combo_box
allow_text_entry="true"
allow_new_values="true"
follows="left|top|right"
height="23"
layout="topleft"
left="100"
max_length_bytes="255"
max_chars="255"
name="music_url"
top_delta="0"
right="-15"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment