aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llmediaremotectrl.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:46 -0500
committerJacek Antonelli2008-08-15 23:44:46 -0500
commit38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch)
treeadca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llmediaremotectrl.cpp
parentREADME.txt (diff)
downloadmeta-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 'linden/indra/newview/llmediaremotectrl.cpp')
-rw-r--r--linden/indra/newview/llmediaremotectrl.cpp207
1 files changed, 207 insertions, 0 deletions
diff --git a/linden/indra/newview/llmediaremotectrl.cpp b/linden/indra/newview/llmediaremotectrl.cpp
new file mode 100644
index 0000000..c1fec1c
--- /dev/null
+++ b/linden/indra/newview/llmediaremotectrl.cpp
@@ -0,0 +1,207 @@
1/**
2 * @file llmediaremotectrl.cpp
3 * @brief A remote control for media (video and music)
4 *
5 * Copyright (c) 2005-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#include "llviewerprecompiledheaders.h"
29
30#include "llmediaremotectrl.h"
31
32#include "llui.h"
33#include "lltextbox.h"
34#include "llbutton.h"
35#include "llfocusmgr.h"
36#include "llmediaengine.h"
37#include "llviewercontrol.h"
38#include "llvieweruictrlfactory.h"
39
40////////////////////////////////////////////////////////////////////////////////
41//
42//
43LLMediaRemoteCtrl::
44LLMediaRemoteCtrl ( const std::string& name,
45 const std::string& label,
46 const LLRect& rect,
47 const std::string& xml_file ) :
48 LLPanel ( name, rect, FALSE )
49{
50 setFollows(FOLLOWS_LEFT | FOLLOWS_TOP);
51 setBackgroundVisible(TRUE);
52 setIsChrome(TRUE);
53
54 gUICtrlFactory->buildPanel(this, xml_file);
55
56 playButton = LLUICtrlFactory::getButtonByName(this, "play_btn");
57 stopButton = LLUICtrlFactory::getButtonByName(this, "stop_btn");
58 pauseButton = LLUICtrlFactory::getButtonByName(this, "pause_btn");
59
60 childSetAction("play_btn",onPlayButton,this);
61 childSetAction("stop_btn",onStopButton,this);
62 childSetAction("pause_btn",onPauseButton,this);
63
64 mVolumeSlider = LLViewerUICtrlFactory::getVolumeSliderByName(this, "volume_slider");
65
66 childSetCommitCallback("volume_slider", onCommitVolume, this);
67
68 mIsFocusRoot = TRUE;
69}
70
71////////////////////////////////////////////////////////////////////////////////
72//
73//
74LLMediaRemoteCtrl::
75~LLMediaRemoteCtrl ()
76{
77}
78
79EWidgetType LLMediaRemoteCtrl::getWidgetType() const
80{
81 return WIDGET_TYPE_MEDIA_REMOTE;
82}
83
84LLString LLMediaRemoteCtrl::getWidgetTag() const
85{
86 return LL_MEDIA_REMOTE_CTRL_TAG;
87}
88
89////////////////////////////////////////////////////////////////////////////////
90//
91//
92void
93LLMediaRemoteCtrl::
94setTransportState ( TransportState transportStateIn, BOOL pauseEnabled )
95{
96 transportState = transportStateIn;
97
98 if ( transportState == Play )
99 {
100 playButton->setVisible ( TRUE );
101 playButton->setEnabled ( pauseEnabled );
102
103 pauseButton->setVisible ( FALSE );
104 pauseButton->setEnabled ( FALSE );
105
106 stopButton->setVisible ( TRUE );
107 stopButton->setEnabled ( TRUE );
108 }
109 else
110 if ( transportState == Pause )
111 {
112 playButton->setVisible ( FALSE );
113 playButton->setEnabled ( FALSE );
114
115 pauseButton->setVisible ( TRUE );
116 pauseButton->setEnabled ( TRUE );
117
118 stopButton->setVisible ( TRUE );
119 stopButton->setEnabled ( TRUE );
120 }
121 else
122 if ( transportState == Stop )
123 {
124 playButton->setVisible ( TRUE );
125 playButton->setEnabled ( TRUE );
126
127 pauseButton->setVisible ( FALSE );
128 pauseButton->setEnabled ( FALSE );
129
130 stopButton->setVisible ( TRUE );
131 stopButton->setEnabled ( FALSE );
132 };
133}
134
135////////////////////////////////////////////////////////////////////////////////
136//
137//
138LLMediaRemoteCtrl::TransportState
139LLMediaRemoteCtrl::
140getTransportState ()
141{
142 return transportState;
143}
144
145
146////////////////////////////////////////////////////////////////////////////////
147//
148//
149void
150LLMediaRemoteCtrl::
151setVolume ( F32 volumeIn )
152{
153 mVolumeSlider->setValue ( volumeIn );
154}
155
156////////////////////////////////////////////////////////////////////////////////
157//
158//
159void
160LLMediaRemoteCtrl::
161onCommitVolume ( LLUICtrl* ctrl, void* data )
162{
163 LLMediaRemoteCtrl* self = ( LLMediaRemoteCtrl* ) data;
164
165 LLMediaRemoteCtrlEvent event ( self, (F32)self->mVolumeSlider->getValue().asReal() );
166 self->mediaRemoteCtrlEventEmitter.update ( &LLMediaRemoteCtrlObserver::onVolumeChange, event );
167}
168
169////////////////////////////////////////////////////////////////////////////////
170//
171//
172void
173LLMediaRemoteCtrl::
174onPlayButton ( void* data )
175{
176 LLMediaRemoteCtrl* self = ( LLMediaRemoteCtrl* ) data;
177
178 LLMediaRemoteCtrlEvent event ( self, 0.0f );
179 self->mediaRemoteCtrlEventEmitter.update ( &LLMediaRemoteCtrlObserver::onPlayButtonPressed, event );
180}
181
182////////////////////////////////////////////////////////////////////////////////
183//
184//
185void
186LLMediaRemoteCtrl::
187onPauseButton ( void* data )
188{
189 LLMediaRemoteCtrl* self = ( LLMediaRemoteCtrl* ) data;
190
191 LLMediaRemoteCtrlEvent event ( self, 0.0f );
192 self->mediaRemoteCtrlEventEmitter.update ( &LLMediaRemoteCtrlObserver::onPauseButtonPressed, event );
193}
194
195////////////////////////////////////////////////////////////////////////////////
196//
197//
198void
199LLMediaRemoteCtrl::
200onStopButton ( void* data )
201{
202 LLMediaRemoteCtrl* self = ( LLMediaRemoteCtrl* ) data;
203
204 LLMediaRemoteCtrlEvent event ( self, 0.0f );
205 self->mediaRemoteCtrlEventEmitter.update ( &LLMediaRemoteCtrlObserver::onStopButtonPressed, event );
206}
207