diff options
author | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
commit | 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch) | |
tree | adca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/lloverlaybar.cpp | |
parent | README.txt (diff) | |
download | meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2 meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz |
Second Life viewer sources 1.13.2.12
Diffstat (limited to '')
-rw-r--r-- | linden/indra/newview/lloverlaybar.cpp | 584 |
1 files changed, 584 insertions, 0 deletions
diff --git a/linden/indra/newview/lloverlaybar.cpp b/linden/indra/newview/lloverlaybar.cpp new file mode 100644 index 0000000..a978914 --- /dev/null +++ b/linden/indra/newview/lloverlaybar.cpp | |||
@@ -0,0 +1,584 @@ | |||
1 | /** | ||
2 | * @file lloverlaybar.cpp | ||
3 | * @brief LLOverlayBar class implementation | ||
4 | * | ||
5 | * Copyright (c) 2002-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
8 | * to you under the terms of the GNU General Public License, version 2.0 | ||
9 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
10 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
11 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
12 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
13 | * | ||
14 | * There are special exceptions to the terms and conditions of the GPL as | ||
15 | * it is applied to this Source Code. View the full text of the exception | ||
16 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
17 | * online at http://secondlife.com/developers/opensource/flossexception | ||
18 | * | ||
19 | * By copying, modifying or distributing this software, you acknowledge | ||
20 | * that you have read and understood your obligations described above, | ||
21 | * and agree to abide by those obligations. | ||
22 | * | ||
23 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
24 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
25 | * COMPLETENESS OR PERFORMANCE. | ||
26 | */ | ||
27 | |||
28 | // Temporary buttons that appear at the bottom of the screen when you | ||
29 | // are in a mode. | ||
30 | |||
31 | #include "llviewerprecompiledheaders.h" | ||
32 | |||
33 | #include "lloverlaybar.h" | ||
34 | |||
35 | #include "audioengine.h" | ||
36 | #include "llparcel.h" | ||
37 | |||
38 | #include "llagent.h" | ||
39 | #include "llbutton.h" | ||
40 | #include "llviewercontrol.h" | ||
41 | #include "llimview.h" | ||
42 | #include "lltextbox.h" | ||
43 | #include "llvoavatar.h" | ||
44 | #include "llmediaengine.h" | ||
45 | #include "viewer.h" | ||
46 | #include "llui.h" | ||
47 | #include "llviewermenu.h" // handle_reset_view() | ||
48 | #include "llviewerparcelmgr.h" | ||
49 | #include "llwebbrowserctrl.h" | ||
50 | #include "llvieweruictrlfactory.h" | ||
51 | #include "llviewerimagelist.h" | ||
52 | #include "llviewerwindow.h" | ||
53 | #include "llfocusmgr.h" | ||
54 | |||
55 | // | ||
56 | // Globals | ||
57 | // | ||
58 | |||
59 | LLOverlayBar *gOverlayBar = NULL; | ||
60 | |||
61 | extern S32 MENU_BAR_HEIGHT; | ||
62 | |||
63 | // | ||
64 | // Functions | ||
65 | // | ||
66 | |||
67 | |||
68 | //static | ||
69 | void* LLOverlayBar::createMediaRemote(void* userdata) | ||
70 | { | ||
71 | |||
72 | LLOverlayBar *self = (LLOverlayBar*)userdata; | ||
73 | |||
74 | |||
75 | self->mMediaRemote = new LLMediaRemoteCtrl ( "media_remote", | ||
76 | "media", | ||
77 | LLRect(), | ||
78 | "panel_media_remote.xml"); | ||
79 | return self->mMediaRemote; | ||
80 | } | ||
81 | |||
82 | |||
83 | |||
84 | void* LLOverlayBar::createMusicRemote(void* userdata) | ||
85 | { | ||
86 | |||
87 | LLOverlayBar *self = (LLOverlayBar*)userdata; | ||
88 | |||
89 | self->mMusicRemote = new LLMediaRemoteCtrl ( "music_remote", | ||
90 | "music", | ||
91 | LLRect(), | ||
92 | "panel_music_remote.xml" ); | ||
93 | return self->mMusicRemote; | ||
94 | } | ||
95 | |||
96 | |||
97 | |||
98 | |||
99 | LLOverlayBar::LLOverlayBar(const std::string& name, const LLRect& rect) | ||
100 | : LLPanel(name, rect, FALSE) // not bordered | ||
101 | { | ||
102 | setMouseOpaque(FALSE); | ||
103 | setIsChrome(TRUE); | ||
104 | |||
105 | isBuilt = FALSE; | ||
106 | |||
107 | LLCallbackMap::map_t factory_map; | ||
108 | factory_map["media_remote"] = LLCallbackMap(LLOverlayBar::createMediaRemote, this); | ||
109 | factory_map["music_remote"] = LLCallbackMap(LLOverlayBar::createMusicRemote, this); | ||
110 | |||
111 | gUICtrlFactory->buildPanel(this, "panel_overlaybar.xml", &factory_map); | ||
112 | |||
113 | childSetAction("IM Received",onClickIMReceived,this); | ||
114 | childSetAction("Set Not Busy",onClickSetNotBusy,this); | ||
115 | childSetAction("Release Keys",onClickReleaseKeys,this); | ||
116 | childSetAction("Mouselook",onClickMouselook,this); | ||
117 | childSetAction("Stand Up",onClickStandUp,this); | ||
118 | |||
119 | mMusicRemote->addObserver ( this ); | ||
120 | |||
121 | if ( gAudiop ) | ||
122 | { | ||
123 | mMusicRemote->setVolume ( gSavedSettings.getF32 ( "AudioLevelMusic" ) ); | ||
124 | mMusicRemote->setTransportState ( LLMediaRemoteCtrl::Stop, FALSE ); | ||
125 | }; | ||
126 | |||
127 | mIsFocusRoot = TRUE; | ||
128 | |||
129 | mMediaRemote->addObserver ( this ); | ||
130 | mMediaRemote->setVolume ( gSavedSettings.getF32 ( "MediaAudioVolume" ) ); | ||
131 | |||
132 | isBuilt = true; | ||
133 | |||
134 | layoutButtons(); | ||
135 | } | ||
136 | |||
137 | LLOverlayBar::~LLOverlayBar() | ||
138 | { | ||
139 | // LLView destructor cleans up children | ||
140 | |||
141 | mMusicRemote->remObserver ( this ); | ||
142 | mMediaRemote->remObserver ( this ); | ||
143 | } | ||
144 | |||
145 | EWidgetType LLOverlayBar::getWidgetType() const | ||
146 | { | ||
147 | return WIDGET_TYPE_OVERLAY_BAR; | ||
148 | } | ||
149 | |||
150 | LLString LLOverlayBar::getWidgetTag() const | ||
151 | { | ||
152 | return LL_OVERLAY_BAR_TAG; | ||
153 | } | ||
154 | |||
155 | // virtual | ||
156 | void LLOverlayBar::reshape(S32 width, S32 height, BOOL called_from_parent) | ||
157 | { | ||
158 | LLView::reshape(width, height, called_from_parent); | ||
159 | |||
160 | if (isBuilt) | ||
161 | { | ||
162 | layoutButtons(); | ||
163 | } | ||
164 | } | ||
165 | |||
166 | |||
167 | void LLOverlayBar::layoutButtons() | ||
168 | { | ||
169 | S32 width = mRect.getWidth(); | ||
170 | if (width > 800) width = 800; | ||
171 | |||
172 | S32 count = getChildCount(); | ||
173 | const S32 PAD = gSavedSettings.getS32("StatusBarPad"); | ||
174 | |||
175 | F32 segment_width = (F32)(width) / (F32)count; | ||
176 | |||
177 | S32 btn_width = lltrunc(segment_width - PAD); | ||
178 | |||
179 | S32 remote_width = mMusicRemote->getRect().getWidth(); | ||
180 | |||
181 | // Evenly space all views | ||
182 | LLRect r; | ||
183 | S32 i = 0; | ||
184 | for (child_list_const_iter_t child_iter = getChildList()->begin(); | ||
185 | child_iter != getChildList()->end(); ++child_iter) | ||
186 | { | ||
187 | LLView *view = *child_iter; | ||
188 | r = view->getRect(); | ||
189 | r.mLeft = (width) - llround((i+1)*segment_width); | ||
190 | r.mRight = r.mLeft + btn_width; | ||
191 | view->setRect(r); | ||
192 | i++; | ||
193 | } | ||
194 | |||
195 | // Fix up remotes to have constant width because they can't shrink | ||
196 | r = mMusicRemote->getRect(); | ||
197 | r.mRight = r.mLeft + remote_width; | ||
198 | mMusicRemote->setRect(r); | ||
199 | |||
200 | r = mMediaRemote->getRect(); | ||
201 | r.mLeft = mMusicRemote->getRect().mRight + PAD; | ||
202 | r.mRight = r.mLeft + remote_width; | ||
203 | mMediaRemote->setRect(r); | ||
204 | |||
205 | updateRect(); | ||
206 | } | ||
207 | |||
208 | void LLOverlayBar::draw() | ||
209 | { | ||
210 | // retrieve rounded rect image | ||
211 | LLUUID image_id; | ||
212 | image_id.set(gViewerArt.getString("rounded_square.tga")); | ||
213 | LLViewerImage* imagep = gImageList.getImage(image_id, MIPMAP_FALSE, TRUE); | ||
214 | |||
215 | if (imagep) | ||
216 | { | ||
217 | LLGLSTexture texture_enabled; | ||
218 | LLViewerImage::bindTexture(imagep); | ||
219 | |||
220 | const S32 PAD = gSavedSettings.getS32("StatusBarPad"); | ||
221 | |||
222 | // draw rounded rect tabs behind all children | ||
223 | LLRect r; | ||
224 | // focus highlights | ||
225 | LLColor4 color = gColors.getColor("FloaterFocusBorderColor"); | ||
226 | glColor4fv(color.mV); | ||
227 | if(gFocusMgr.childHasKeyboardFocus(gBottomPanel)) | ||
228 | { | ||
229 | for (child_list_const_iter_t child_iter = getChildList()->begin(); | ||
230 | child_iter != getChildList()->end(); ++child_iter) | ||
231 | { | ||
232 | LLView *view = *child_iter; | ||
233 | if(view->getEnabled() && view->getVisible()) | ||
234 | { | ||
235 | r = view->getRect(); | ||
236 | gl_segmented_rect_2d_tex(r.mLeft - PAD/3 - 1, | ||
237 | r.mTop + 3, | ||
238 | r.mRight + PAD/3 + 1, | ||
239 | r.mBottom, | ||
240 | imagep->getWidth(), | ||
241 | imagep->getHeight(), | ||
242 | 16, | ||
243 | ROUNDED_RECT_TOP); | ||
244 | } | ||
245 | } | ||
246 | } | ||
247 | |||
248 | // main tabs | ||
249 | for (child_list_const_iter_t child_iter = getChildList()->begin(); | ||
250 | child_iter != getChildList()->end(); ++child_iter) | ||
251 | { | ||
252 | LLView *view = *child_iter; | ||
253 | if(view->getEnabled() && view->getVisible()) | ||
254 | { | ||
255 | r = view->getRect(); | ||
256 | // draw a nice little pseudo-3D outline | ||
257 | color = gColors.getColor("DefaultShadowDark"); | ||
258 | glColor4fv(color.mV); | ||
259 | gl_segmented_rect_2d_tex(r.mLeft - PAD/3 + 1, r.mTop + 2, r.mRight + PAD/3, r.mBottom, | ||
260 | imagep->getWidth(), imagep->getHeight(), 16, ROUNDED_RECT_TOP); | ||
261 | color = gColors.getColor("DefaultHighlightLight"); | ||
262 | glColor4fv(color.mV); | ||
263 | gl_segmented_rect_2d_tex(r.mLeft - PAD/3, r.mTop + 2, r.mRight + PAD/3 - 3, r.mBottom, | ||
264 | imagep->getWidth(), imagep->getHeight(), 16, ROUNDED_RECT_TOP); | ||
265 | // here's the main background. Note that it overhangs on the bottom so as to hide the | ||
266 | // focus highlight on the bottom panel, thus producing the illusion that the focus highlight | ||
267 | // continues around the tabs | ||
268 | color = gColors.getColor("FocusBackgroundColor"); | ||
269 | glColor4fv(color.mV); | ||
270 | gl_segmented_rect_2d_tex(r.mLeft - PAD/3 + 1, r.mTop + 1, r.mRight + PAD/3 - 1, r.mBottom - 1, | ||
271 | imagep->getWidth(), imagep->getHeight(), 16, ROUNDED_RECT_TOP); | ||
272 | } | ||
273 | } | ||
274 | } | ||
275 | |||
276 | // draw children on top | ||
277 | LLPanel::draw(); | ||
278 | } | ||
279 | |||
280 | |||
281 | // Per-frame updates of visibility | ||
282 | void LLOverlayBar::refresh() | ||
283 | { | ||
284 | BOOL im_received = gIMView->getIMReceived(); | ||
285 | childSetVisible("IM Received", im_received); | ||
286 | childSetEnabled("IM Received", im_received); | ||
287 | |||
288 | BOOL busy = gAgent.getBusy(); | ||
289 | childSetVisible("Set Not Busy", busy); | ||
290 | childSetEnabled("Set Not Busy", busy); | ||
291 | |||
292 | BOOL controls_grabbed = gAgent.anyControlGrabbed(); | ||
293 | |||
294 | childSetVisible("Release Keys", controls_grabbed); | ||
295 | childSetEnabled("Release Keys", controls_grabbed); | ||
296 | |||
297 | |||
298 | BOOL mouselook_grabbed; | ||
299 | mouselook_grabbed = gAgent.isControlGrabbed(CONTROL_ML_LBUTTON_DOWN_INDEX) | ||
300 | || gAgent.isControlGrabbed(CONTROL_ML_LBUTTON_UP_INDEX); | ||
301 | |||
302 | |||
303 | childSetVisible("Mouselook", mouselook_grabbed); | ||
304 | childSetEnabled("Mouselook", mouselook_grabbed); | ||
305 | |||
306 | BOOL sitting = FALSE; | ||
307 | if (gAgent.getAvatarObject()) | ||
308 | { | ||
309 | sitting = gAgent.getAvatarObject()->mIsSitting; | ||
310 | childSetVisible("Stand Up", sitting); | ||
311 | childSetEnabled("Stand Up", sitting); | ||
312 | |||
313 | } | ||
314 | |||
315 | if ( gAudiop ) | ||
316 | { | ||
317 | LLParcel* parcel = gParcelMgr->getAgentParcel(); | ||
318 | if (!parcel | ||
319 | || !parcel->getMusicURL() | ||
320 | || !parcel->getMusicURL()[0] | ||
321 | || !gSavedSettings.getBOOL("AudioStreamingMusic")) | ||
322 | { | ||
323 | mMusicRemote->setVisible(FALSE); | ||
324 | mMusicRemote->setEnabled(FALSE); | ||
325 | } | ||
326 | else | ||
327 | { | ||
328 | mMusicRemote->setVisible(TRUE); | ||
329 | mMusicRemote->setEnabled(TRUE); | ||
330 | |||
331 | S32 musicPlaying = gAudiop->isInternetStreamPlaying(); | ||
332 | |||
333 | if ( musicPlaying == 0 ) // stopped | ||
334 | { | ||
335 | mMusicRemote->setTransportState ( LLMediaRemoteCtrl::Stop, FALSE ); | ||
336 | } | ||
337 | else | ||
338 | if ( musicPlaying == 1 ) // playing | ||
339 | { | ||
340 | mMusicRemote->setTransportState ( LLMediaRemoteCtrl::Play, FALSE ); | ||
341 | if (gAudiop) | ||
342 | { | ||
343 | gAudiop->setInternetStreamGain ( gSavedSettings.getF32 ( "AudioLevelMusic" ) ); | ||
344 | } | ||
345 | } | ||
346 | else | ||
347 | if ( musicPlaying == 2 ) // paused | ||
348 | { | ||
349 | mMusicRemote->setTransportState ( LLMediaRemoteCtrl::Stop, FALSE ); | ||
350 | } | ||
351 | } | ||
352 | } | ||
353 | |||
354 | // if there is a url and a texture and media is enabled and available and media streaming is on... (phew!) | ||
355 | if ( LLMediaEngine::getInstance () && | ||
356 | LLMediaEngine::getInstance ()->getUrl ().length () && | ||
357 | LLMediaEngine::getInstance ()->getImageUUID ().notNull () && | ||
358 | LLMediaEngine::getInstance ()->isEnabled () && | ||
359 | LLMediaEngine::getInstance ()->isAvailable () && | ||
360 | gSavedSettings.getBOOL ( "AudioStreamingVideo" ) ) | ||
361 | { | ||
362 | // display remote control | ||
363 | mMediaRemote->setVisible ( TRUE ); | ||
364 | mMediaRemote->setEnabled ( TRUE ); | ||
365 | |||
366 | if ( LLMediaEngine::getInstance ()->getMediaRenderer () ) | ||
367 | { | ||
368 | if ( LLMediaEngine::getInstance ()->getMediaRenderer ()->isPlaying () || | ||
369 | LLMediaEngine::getInstance ()->getMediaRenderer ()->isLooping () ) | ||
370 | { | ||
371 | mMediaRemote->setTransportState ( LLMediaRemoteCtrl::Pause, TRUE ); | ||
372 | } | ||
373 | else | ||
374 | if ( LLMediaEngine::getInstance ()->getMediaRenderer ()->isPaused () ) | ||
375 | { | ||
376 | mMediaRemote->setTransportState ( LLMediaRemoteCtrl::Play, TRUE ); | ||
377 | } | ||
378 | else | ||
379 | { | ||
380 | mMediaRemote->setTransportState ( LLMediaRemoteCtrl::Stop, TRUE ); | ||
381 | }; | ||
382 | }; | ||
383 | } | ||
384 | else | ||
385 | { | ||
386 | mMediaRemote->setVisible ( FALSE ); | ||
387 | mMediaRemote->setEnabled ( FALSE ); | ||
388 | mMediaRemote->setTransportState ( LLMediaRemoteCtrl::Stop, TRUE ); | ||
389 | }; | ||
390 | |||
391 | BOOL any_button = (childIsVisible("IM Received") | ||
392 | || childIsVisible("Set Not Busy") | ||
393 | || childIsVisible("Release Keys") | ||
394 | || childIsVisible("Mouselook") | ||
395 | || childIsVisible("Stand Up") | ||
396 | || mMusicRemote->getVisible() | ||
397 | || mMediaRemote->getVisible() ); | ||
398 | |||
399 | |||
400 | // turn off the whole bar in mouselook | ||
401 | if (gAgent.cameraMouselook()) | ||
402 | { | ||
403 | setVisible(FALSE); | ||
404 | } | ||
405 | else | ||
406 | { | ||
407 | setVisible(any_button); | ||
408 | }; | ||
409 | } | ||
410 | |||
411 | //----------------------------------------------------------------------- | ||
412 | // Static functions | ||
413 | //----------------------------------------------------------------------- | ||
414 | |||
415 | // static | ||
416 | void LLOverlayBar::onClickIMReceived(void*) | ||
417 | { | ||
418 | gIMView->setFloaterOpen(TRUE); | ||
419 | } | ||
420 | |||
421 | |||
422 | // static | ||
423 | void LLOverlayBar::onClickSetNotBusy(void*) | ||
424 | { | ||
425 | gAgent.clearBusy(); | ||
426 | } | ||
427 | |||
428 | |||
429 | // static | ||
430 | void LLOverlayBar::onClickReleaseKeys(void*) | ||
431 | { | ||
432 | gAgent.forceReleaseControls(); | ||
433 | } | ||
434 | |||
435 | // static | ||
436 | void LLOverlayBar::onClickResetView(void* data) | ||
437 | { | ||
438 | handle_reset_view(); | ||
439 | } | ||
440 | |||
441 | //static | ||
442 | void LLOverlayBar::onClickMouselook(void*) | ||
443 | { | ||
444 | gAgent.changeCameraToMouselook(); | ||
445 | } | ||
446 | |||
447 | //static | ||
448 | void LLOverlayBar::onClickStandUp(void*) | ||
449 | { | ||
450 | gAgent.setControlFlags(AGENT_CONTROL_STAND_UP); | ||
451 | } | ||
452 | |||
453 | //////////////////////////////////////////////////////////////////////////////// | ||
454 | // | ||
455 | // | ||
456 | void | ||
457 | LLOverlayBar:: | ||
458 | onVolumeChange ( const LLMediaRemoteCtrlObserver::EventType& eventIn ) | ||
459 | { | ||
460 | LLUICtrl* control = eventIn.getControl (); | ||
461 | F32 value = eventIn.getValue (); | ||
462 | |||
463 | if ( control == mMusicRemote ) | ||
464 | { | ||
465 | if (gAudiop) | ||
466 | { | ||
467 | gAudiop->setInternetStreamGain ( value ); | ||
468 | }; | ||
469 | gSavedSettings.setF32 ( "AudioLevelMusic", value ); | ||
470 | } | ||
471 | else | ||
472 | if ( control == mMediaRemote ) | ||
473 | { | ||
474 | LLMediaEngine::getInstance ()->setVolume ( value ); | ||
475 | gSavedSettings.setF32 ( "MediaAudioVolume", value ); | ||
476 | |||
477 | }; | ||
478 | } | ||
479 | |||
480 | //////////////////////////////////////////////////////////////////////////////// | ||
481 | // | ||
482 | // | ||
483 | void | ||
484 | LLOverlayBar:: | ||
485 | onStopButtonPressed ( const LLMediaRemoteCtrlObserver::EventType& eventIn ) | ||
486 | { | ||
487 | LLUICtrl* control = eventIn.getControl (); | ||
488 | |||
489 | if ( control == mMusicRemote ) | ||
490 | { | ||
491 | if ( gAudiop ) | ||
492 | { | ||
493 | gAudiop->stopInternetStream (); | ||
494 | }; | ||
495 | mMusicRemote->setTransportState ( LLMediaRemoteCtrl::Stop, FALSE ); | ||
496 | } | ||
497 | else | ||
498 | if ( control == mMediaRemote ) | ||
499 | { | ||
500 | LLMediaEngine::getInstance ()->stop (); | ||
501 | mMediaRemote->setTransportState ( LLMediaRemoteCtrl::Stop, TRUE ); | ||
502 | }; | ||
503 | } | ||
504 | |||
505 | //////////////////////////////////////////////////////////////////////////////// | ||
506 | // | ||
507 | // | ||
508 | void LLOverlayBar::onPlayButtonPressed( const LLMediaRemoteCtrlObserver::EventType& eventIn ) | ||
509 | { | ||
510 | LLUICtrl* control = eventIn.getControl (); | ||
511 | |||
512 | LLParcel* parcel = gParcelMgr->getAgentParcel(); | ||
513 | if ( control == mMusicRemote ) | ||
514 | { | ||
515 | if (gAudiop) | ||
516 | { | ||
517 | if ( parcel ) | ||
518 | { | ||
519 | // this doesn't work properly when crossing parcel boundaries - even when the | ||
520 | // stream is stopped, it doesn't return the right thing - commenting out for now. | ||
521 | //if ( gAudiop->isInternetStreamPlaying() == 0 ) | ||
522 | //{ | ||
523 | const char* music_url = parcel->getMusicURL(); | ||
524 | |||
525 | gAudiop->startInternetStream(music_url); | ||
526 | |||
527 | mMusicRemote->setTransportState ( LLMediaRemoteCtrl::Play, FALSE ); | ||
528 | //} | ||
529 | } | ||
530 | }; | ||
531 | |||
532 | // CP: this is the old way of doing things (click play each time on a parcel to start stream) | ||
533 | //if (gAudiop) | ||
534 | //{ | ||
535 | // if (gAudiop->isInternetStreamPlaying() > 0) | ||
536 | // { | ||
537 | // gAudiop->pauseInternetStream ( 0 ); | ||
538 | // } | ||
539 | // else | ||
540 | // { | ||
541 | // if (parcel) | ||
542 | // { | ||
543 | // const char* music_url = parcel->getMusicURL(); | ||
544 | // gAudiop->startInternetStream(music_url); | ||
545 | // } | ||
546 | // } | ||
547 | //}; | ||
548 | //mMusicRemote->setTransportState ( LLMediaRemoteCtrl::Stop, FALSE ); | ||
549 | } | ||
550 | else | ||
551 | if ( control == mMediaRemote ) | ||
552 | { | ||
553 | LLParcel* parcel = gParcelMgr->getAgentParcel(); | ||
554 | if (parcel) | ||
555 | { | ||
556 | LLString path( "" ); | ||
557 | LLMediaEngine::getInstance ()->convertImageAndLoadUrl( true, false, path ); | ||
558 | mMediaRemote->setTransportState ( LLMediaRemoteCtrl::Play, TRUE ); | ||
559 | } | ||
560 | }; | ||
561 | } | ||
562 | |||
563 | //////////////////////////////////////////////////////////////////////////////// | ||
564 | // | ||
565 | // | ||
566 | void LLOverlayBar::onPauseButtonPressed( const LLMediaRemoteCtrlObserver::EventType& eventIn ) | ||
567 | { | ||
568 | LLUICtrl* control = eventIn.getControl (); | ||
569 | |||
570 | if ( control == mMusicRemote ) | ||
571 | { | ||
572 | if (gAudiop) | ||
573 | { | ||
574 | gAudiop->pauseInternetStream ( 1 ); | ||
575 | }; | ||
576 | mMusicRemote->setTransportState ( LLMediaRemoteCtrl::Play, FALSE ); | ||
577 | } | ||
578 | else | ||
579 | if ( control == mMediaRemote ) | ||
580 | { | ||
581 | LLMediaEngine::getInstance ()->pause (); | ||
582 | mMediaRemote->setTransportState ( LLMediaRemoteCtrl::Pause, TRUE ); | ||
583 | }; | ||
584 | } | ||