diff options
author | Jacek Antonelli | 2008-08-15 23:45:27 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:45:27 -0500 |
commit | a8a62201ba762e98dff92cf49033e577fc34d8d4 (patch) | |
tree | 11f8513c5cdc222f2fac0c93eb724c089803c200 /linden/indra/newview/llvoiceremotectrl.cpp | |
parent | Second Life viewer sources 1.18.6.4-RC (diff) | |
download | meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.zip meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.tar.gz meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.tar.bz2 meta-impy-a8a62201ba762e98dff92cf49033e577fc34d8d4.tar.xz |
Second Life viewer sources 1.19.0.0
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/llvoiceremotectrl.cpp | 146 |
1 files changed, 127 insertions, 19 deletions
diff --git a/linden/indra/newview/llvoiceremotectrl.cpp b/linden/indra/newview/llvoiceremotectrl.cpp index 6b3db08..099e528 100644 --- a/linden/indra/newview/llvoiceremotectrl.cpp +++ b/linden/indra/newview/llvoiceremotectrl.cpp | |||
@@ -12,12 +12,12 @@ | |||
12 | * ("GPL"), unless you have obtained a separate licensing agreement | 12 | * ("GPL"), unless you have obtained a separate licensing agreement |
13 | * ("Other License"), formally executed by you and Linden Lab. Terms of | 13 | * ("Other License"), formally executed by you and Linden Lab. Terms of |
14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | 14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or |
15 | * online at http://secondlife.com/developers/opensource/gplv2 | 15 | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 |
16 | * | 16 | * |
17 | * There are special exceptions to the terms and conditions of the GPL as | 17 | * There are special exceptions to the terms and conditions of the GPL as |
18 | * it is applied to this Source Code. View the full text of the exception | 18 | * it is applied to this Source Code. View the full text of the exception |
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 19 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
20 | * online at http://secondlife.com/developers/opensource/flossexception | 20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception |
21 | * | 21 | * |
22 | * By copying, modifying or distributing this software, you acknowledge | 22 | * By copying, modifying or distributing this software, you acknowledge |
23 | * that you have read and understood your obligations described above, | 23 | * that you have read and understood your obligations described above, |
@@ -41,14 +41,33 @@ | |||
41 | #include "llvoiceclient.h" | 41 | #include "llvoiceclient.h" |
42 | #include "llimpanel.h" | 42 | #include "llimpanel.h" |
43 | #include "llfloateractivespeakers.h" | 43 | #include "llfloateractivespeakers.h" |
44 | #include "llfloaterchatterbox.h" | ||
44 | #include "lliconctrl.h" | 45 | #include "lliconctrl.h" |
46 | #include "lloverlaybar.h" | ||
47 | #include "lltextbox.h" | ||
45 | 48 | ||
46 | LLVoiceRemoteCtrl::LLVoiceRemoteCtrl (const LLString& name) : LLPanel(name) | 49 | LLVoiceRemoteCtrl::LLVoiceRemoteCtrl (const LLString& name) : LLPanel(name) |
47 | { | 50 | { |
48 | setIsChrome(TRUE); | 51 | setIsChrome(TRUE); |
49 | 52 | ||
50 | gUICtrlFactory->buildPanel(this, "panel_voice_remote.xml"); | 53 | if (gSavedSettings.getBOOL("ShowVoiceChannelPopup")) |
54 | { | ||
55 | gUICtrlFactory->buildPanel(this, "panel_voice_remote_expanded.xml"); | ||
56 | } | ||
57 | else | ||
58 | { | ||
59 | gUICtrlFactory->buildPanel(this, "panel_voice_remote.xml"); | ||
60 | } | ||
61 | |||
62 | mIsFocusRoot = TRUE; | ||
63 | } | ||
64 | |||
65 | LLVoiceRemoteCtrl::~LLVoiceRemoteCtrl() | ||
66 | { | ||
67 | } | ||
51 | 68 | ||
69 | BOOL LLVoiceRemoteCtrl::postBuild() | ||
70 | { | ||
52 | mTalkBtn = LLUICtrlFactory::getButtonByName(this, "push_to_talk"); | 71 | mTalkBtn = LLUICtrlFactory::getButtonByName(this, "push_to_talk"); |
53 | mTalkBtn->setClickedCallback(onBtnTalkClicked); | 72 | mTalkBtn->setClickedCallback(onBtnTalkClicked); |
54 | mTalkBtn->setHeldDownCallback(onBtnTalkHeld); | 73 | mTalkBtn->setHeldDownCallback(onBtnTalkHeld); |
@@ -56,15 +75,25 @@ LLVoiceRemoteCtrl::LLVoiceRemoteCtrl (const LLString& name) : LLPanel(name) | |||
56 | 75 | ||
57 | mTalkLockBtn = LLUICtrlFactory::getButtonByName(this, "ptt_lock"); | 76 | mTalkLockBtn = LLUICtrlFactory::getButtonByName(this, "ptt_lock"); |
58 | mTalkLockBtn->setClickedCallback(onBtnLock); | 77 | mTalkLockBtn->setClickedCallback(onBtnLock); |
78 | mTalkLockBtn->setCallbackUserData(this); | ||
59 | 79 | ||
60 | mSpeakersBtn = LLUICtrlFactory::getButtonByName(this, "speakers_btn"); | 80 | mSpeakersBtn = LLUICtrlFactory::getButtonByName(this, "speakers_btn"); |
61 | mSpeakersBtn->setClickedCallback(onClickSpeakers); | 81 | mSpeakersBtn->setClickedCallback(onClickSpeakers); |
82 | mSpeakersBtn->setCallbackUserData(this); | ||
62 | 83 | ||
63 | mIsFocusRoot = TRUE; | 84 | childSetAction("show_channel", onClickPopupBtn, this); |
64 | } | 85 | childSetAction("end_call_btn", onClickEndCall, this); |
65 | 86 | ||
66 | LLVoiceRemoteCtrl::~LLVoiceRemoteCtrl() | 87 | LLTextBox* text = LLUICtrlFactory::getTextBoxByName(this, "channel_label"); |
67 | { | 88 | if (text) |
89 | { | ||
90 | text->setUseEllipses(TRUE); | ||
91 | } | ||
92 | |||
93 | childSetAction("voice_channel_bg", onClickVoiceChannel, this); | ||
94 | |||
95 | |||
96 | return TRUE; | ||
68 | } | 97 | } |
69 | 98 | ||
70 | void LLVoiceRemoteCtrl::draw() | 99 | void LLVoiceRemoteCtrl::draw() |
@@ -79,17 +108,6 @@ void LLVoiceRemoteCtrl::draw() | |||
79 | mTalkBtn->setEnabled(voice_active); | 108 | mTalkBtn->setEnabled(voice_active); |
80 | mTalkLockBtn->setEnabled(voice_active); | 109 | mTalkLockBtn->setEnabled(voice_active); |
81 | 110 | ||
82 | // if (voice_active) | ||
83 | // { | ||
84 | // mTalkBtn->setToolTip(""); | ||
85 | // mTalkLockBtn->setToolTip(""); | ||
86 | // } | ||
87 | // else | ||
88 | // { | ||
89 | // mTalkBtn->setToolTip(""); | ||
90 | // mTalkLockBtn->setToolTip(""); | ||
91 | // } | ||
92 | |||
93 | // propagate ptt state to button display, | 111 | // propagate ptt state to button display, |
94 | if (!mTalkBtn->hasMouseCapture()) | 112 | if (!mTalkBtn->hasMouseCapture()) |
95 | { | 113 | { |
@@ -138,6 +156,63 @@ void LLVoiceRemoteCtrl::draw() | |||
138 | icon->setImage(talk_blip_image_id); | 156 | icon->setImage(talk_blip_image_id); |
139 | } | 157 | } |
140 | 158 | ||
159 | LLFloater* voice_floater = LLFloaterChatterBox::getInstance()->getCurrentVoiceFloater(); | ||
160 | LLString active_channel_name; | ||
161 | if (voice_floater) | ||
162 | { | ||
163 | active_channel_name = voice_floater->getShortTitle(); | ||
164 | } | ||
165 | |||
166 | LLVoiceChannel* current_channel = LLVoiceChannel::getCurrentVoiceChannel(); | ||
167 | childSetEnabled("end_call_btn", LLVoiceClient::voiceEnabled() | ||
168 | && current_channel | ||
169 | && current_channel->isActive() | ||
170 | && current_channel != LLVoiceChannelProximal::getInstance()); | ||
171 | |||
172 | childSetValue("channel_label", active_channel_name); | ||
173 | childSetToolTip("voice_channel_bg", active_channel_name); | ||
174 | |||
175 | if (current_channel) | ||
176 | { | ||
177 | LLIconCtrl* voice_channel_icon = LLUICtrlFactory::getIconByName(this, "voice_channel_icon"); | ||
178 | if (voice_channel_icon && voice_floater) | ||
179 | { | ||
180 | voice_channel_icon->setImage(LLUUID(gViewerArt.getString(voice_floater->getUIString("voice_icon")))); | ||
181 | } | ||
182 | |||
183 | LLButton* voice_channel_bg = LLUICtrlFactory::getButtonByName(this, "voice_channel_bg"); | ||
184 | if (voice_channel_bg) | ||
185 | { | ||
186 | LLColor4 bg_color; | ||
187 | if (current_channel->isActive()) | ||
188 | { | ||
189 | bg_color = lerp(LLColor4::green, LLColor4::white, 0.7f); | ||
190 | } | ||
191 | else if (current_channel->getState() == LLVoiceChannel::STATE_ERROR) | ||
192 | { | ||
193 | bg_color = lerp(LLColor4::red, LLColor4::white, 0.7f); | ||
194 | } | ||
195 | else // active, but not connected | ||
196 | { | ||
197 | bg_color = lerp(LLColor4::yellow, LLColor4::white, 0.7f); | ||
198 | } | ||
199 | voice_channel_bg->setImageColor(bg_color); | ||
200 | } | ||
201 | } | ||
202 | |||
203 | LLButton* expand_button = LLUICtrlFactory::getButtonByName(this, "show_channel"); | ||
204 | if (expand_button) | ||
205 | { | ||
206 | if (expand_button->getToggleState()) | ||
207 | { | ||
208 | expand_button->setImageOverlay("arrow_down.tga"); | ||
209 | } | ||
210 | else | ||
211 | { | ||
212 | expand_button->setImageOverlay("arrow_up.tga"); | ||
213 | } | ||
214 | } | ||
215 | |||
141 | LLPanel::draw(); | 216 | LLPanel::draw(); |
142 | } | 217 | } |
143 | 218 | ||
@@ -172,12 +247,45 @@ void LLVoiceRemoteCtrl::onBtnLock(void* user_data) | |||
172 | { | 247 | { |
173 | LLVoiceRemoteCtrl* remotep = (LLVoiceRemoteCtrl*)user_data; | 248 | LLVoiceRemoteCtrl* remotep = (LLVoiceRemoteCtrl*)user_data; |
174 | 249 | ||
175 | remotep->mTalkLockBtn->toggleState(); | ||
176 | gSavedSettings.setBOOL("PTTCurrentlyEnabled", !remotep->mTalkLockBtn->getToggleState()); | 250 | gSavedSettings.setBOOL("PTTCurrentlyEnabled", !remotep->mTalkLockBtn->getToggleState()); |
177 | } | 251 | } |
178 | 252 | ||
253 | //static | ||
254 | void LLVoiceRemoteCtrl::onClickPopupBtn(void* user_data) | ||
255 | { | ||
256 | LLVoiceRemoteCtrl* remotep = (LLVoiceRemoteCtrl*)user_data; | ||
257 | |||
258 | remotep->deleteAllChildren(); | ||
259 | if (gSavedSettings.getBOOL("ShowVoiceChannelPopup")) | ||
260 | { | ||
261 | gUICtrlFactory->buildPanel(remotep, "panel_voice_remote_expanded.xml"); | ||
262 | } | ||
263 | else | ||
264 | { | ||
265 | gUICtrlFactory->buildPanel(remotep, "panel_voice_remote.xml"); | ||
266 | } | ||
267 | gOverlayBar->layoutButtons(); | ||
268 | } | ||
269 | |||
270 | //static | ||
271 | void LLVoiceRemoteCtrl::onClickEndCall(void* user_data) | ||
272 | { | ||
273 | LLVoiceChannel* current_channel = LLVoiceChannel::getCurrentVoiceChannel(); | ||
274 | |||
275 | if (current_channel && current_channel != LLVoiceChannelProximal::getInstance()) | ||
276 | { | ||
277 | current_channel->deactivate(); | ||
278 | } | ||
279 | } | ||
280 | |||
281 | |||
179 | void LLVoiceRemoteCtrl::onClickSpeakers(void *user_data) | 282 | void LLVoiceRemoteCtrl::onClickSpeakers(void *user_data) |
180 | { | 283 | { |
181 | LLFloaterActiveSpeakers::toggleInstance(LLSD()); | 284 | LLFloaterActiveSpeakers::toggleInstance(LLSD()); |
182 | } | 285 | } |
183 | 286 | ||
287 | //static | ||
288 | void LLVoiceRemoteCtrl::onClickVoiceChannel(void* user_data) | ||
289 | { | ||
290 | LLFloaterChatterBox::showInstance(); | ||
291 | } | ||