aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpanellandaudio.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/newview/llpanellandaudio.cpp')
-rw-r--r--linden/indra/newview/llpanellandaudio.cpp195
1 files changed, 195 insertions, 0 deletions
diff --git a/linden/indra/newview/llpanellandaudio.cpp b/linden/indra/newview/llpanellandaudio.cpp
new file mode 100644
index 0000000..0247009
--- /dev/null
+++ b/linden/indra/newview/llpanellandaudio.cpp
@@ -0,0 +1,195 @@
1/**
2 * @file llpanellandaudio.cpp
3 * @brief Allows configuration of "media" for a land parcel,
4 * for example movies, web pages, and audio.
5 *
6 * $LicenseInfo:firstyear=2007&license=viewergpl$
7 *
8 * Copyright (c) 2007-2009, Linden Research, Inc.
9 *
10 * Second Life Viewer Source Code
11 * The source code in this file ("Source Code") is provided by Linden Lab
12 * to you under the terms of the GNU General Public License, version 2.0
13 * ("GPL"), unless you have obtained a separate licensing agreement
14 * ("Other License"), formally executed by you and Linden Lab. Terms of
15 * the GPL can be found in doc/GPL-license.txt in this distribution, or
16 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
17 *
18 * There are special exceptions to the terms and conditions of the GPL as
19 * it is applied to this Source Code. View the full text of the exception
20 * in the file doc/FLOSS-exception.txt in this software distribution, or
21 * online at
22 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
23 *
24 * By copying, modifying or distributing this software, you acknowledge
25 * that you have read and understood your obligations described above,
26 * and agree to abide by those obligations.
27 *
28 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
29 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
30 * COMPLETENESS OR PERFORMANCE.
31 * $/LicenseInfo$
32 */
33
34#include "llviewerprecompiledheaders.h"
35
36#include "llpanellandaudio.h"
37
38// viewer includes
39#include "llmimetypes.h"
40#include "llviewerparcelmgr.h"
41#include "llviewerregion.h"
42#include "lluictrlfactory.h"
43
44// library includes
45#include "llcheckboxctrl.h"
46#include "llcombobox.h"
47#include "llfloaterurlentry.h"
48#include "llfocusmgr.h"
49#include "lllineeditor.h"
50#include "llparcel.h"
51#include "lltextbox.h"
52#include "llradiogroup.h"
53#include "llspinctrl.h"
54#include "llsdutil.h"
55#include "lltexturectrl.h"
56#include "roles_constants.h"
57#include "llscrolllistctrl.h"
58
59// Values for the parcel voice settings radio group
60enum
61{
62 kRadioVoiceChatEstate = 0,
63 kRadioVoiceChatPrivate = 1,
64 kRadioVoiceChatDisable = 2
65};
66
67//---------------------------------------------------------------------------
68// LLPanelLandAudio
69//---------------------------------------------------------------------------
70
71LLPanelLandAudio::LLPanelLandAudio(LLParcelSelectionHandle& parcel)
72: LLPanel(std::string("land_media_panel")), mParcel(parcel)
73{
74}
75
76
77// virtual
78LLPanelLandAudio::~LLPanelLandAudio()
79{
80}
81
82
83BOOL LLPanelLandAudio::postBuild()
84{
85 mCheckSoundLocal = getChild<LLCheckBoxCtrl>("check_sound_local");
86 childSetCommitCallback("check_sound_local", onCommitAny, this);
87
88 mRadioVoiceChat = getChild<LLRadioGroup>("parcel_voice_channel");
89 childSetCommitCallback("parcel_voice_channel", onCommitAny, this);
90
91 mMusicURLEdit = getChild<LLLineEditor>("music_url");
92 childSetCommitCallback("music_url", onCommitAny, this);
93
94 mMusicUrlCheck = getChild<LLCheckBoxCtrl>("hide_music_url");
95 childSetCommitCallback("hide_music_url", onCommitAny, this);
96
97 return TRUE;
98}
99
100
101// public
102void LLPanelLandAudio::refresh()
103{
104 LLParcel *parcel = mParcel->getParcel();
105
106 if (!parcel)
107 {
108 clearCtrls();
109 }
110 else
111 {
112 // something selected, hooray!
113
114 // Display options
115 BOOL can_change_media = LLViewerParcelMgr::isParcelModifiableByAgent(parcel, GP_LAND_CHANGE_MEDIA);
116
117 mMusicURLEdit->setText(parcel->getMusicURL());
118 mMusicURLEdit->setEnabled( can_change_media );
119
120 mMusicUrlCheck->set( parcel->getObscureMusic() );
121 mMusicUrlCheck->setEnabled( can_change_media );
122
123 mCheckSoundLocal->set( parcel->getSoundLocal() );
124 mCheckSoundLocal->setEnabled( can_change_media );
125
126 if(parcel->getParcelFlagAllowVoice())
127 {
128 if(parcel->getParcelFlagUseEstateVoiceChannel())
129 mRadioVoiceChat->setSelectedIndex(kRadioVoiceChatEstate);
130 else
131 mRadioVoiceChat->setSelectedIndex(kRadioVoiceChatPrivate);
132 }
133 else
134 {
135 mRadioVoiceChat->setSelectedIndex(kRadioVoiceChatDisable);
136 }
137
138 LLViewerRegion* region = LLViewerParcelMgr::getInstance()->getSelectionRegion();
139 mRadioVoiceChat->setEnabled( region && region->isVoiceEnabled() && can_change_media );
140 }
141}
142// static
143void LLPanelLandAudio::onCommitAny(LLUICtrl*, void *userdata)
144{
145 LLPanelLandAudio *self = (LLPanelLandAudio *)userdata;
146
147 LLParcel* parcel = self->mParcel->getParcel();
148 if (!parcel)
149 {
150 return;
151 }
152
153 // Extract data from UI
154 BOOL sound_local = self->mCheckSoundLocal->get();
155 int voice_setting = self->mRadioVoiceChat->getSelectedIndex();
156 std::string music_url = self->mMusicURLEdit->getText();
157 U8 obscure_music = self->mMusicUrlCheck->get();
158
159
160 BOOL voice_enabled;
161 BOOL voice_estate_chan;
162
163 switch(voice_setting)
164 {
165 default:
166 case kRadioVoiceChatEstate:
167 voice_enabled = TRUE;
168 voice_estate_chan = TRUE;
169 break;
170 case kRadioVoiceChatPrivate:
171 voice_enabled = TRUE;
172 voice_estate_chan = FALSE;
173 break;
174 case kRadioVoiceChatDisable:
175 voice_enabled = FALSE;
176 voice_estate_chan = FALSE;
177 break;
178 }
179
180 // Remove leading/trailing whitespace (common when copying/pasting)
181 LLStringUtil::trim(music_url);
182
183 // Push data into current parcel
184 parcel->setParcelFlag(PF_ALLOW_VOICE_CHAT, voice_enabled);
185 parcel->setParcelFlag(PF_USE_ESTATE_VOICE_CHAN, voice_estate_chan);
186 parcel->setParcelFlag(PF_SOUND_LOCAL, sound_local);
187 parcel->setMusicURL(music_url);
188 parcel->setObscureMusic(obscure_music);
189
190 // Send current parcel data upstream to server
191 LLViewerParcelMgr::getInstance()->sendParcelPropertiesUpdate( parcel );
192
193 // Might have changed properties, so let's redraw!
194 self->refresh();
195}