aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llmediaremotectrl.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:04 -0500
committerJacek Antonelli2008-08-15 23:45:04 -0500
commit117e22047c5752352342d64e3fb7ce00a4eb8113 (patch)
treee32de2cfba0dda8705ae528fcd1fbe23ba075685 /linden/indra/newview/llmediaremotectrl.cpp
parentSecond Life viewer sources 1.18.0.6 (diff)
downloadmeta-impy-117e22047c5752352342d64e3fb7ce00a4eb8113.zip
meta-impy-117e22047c5752352342d64e3fb7ce00a4eb8113.tar.gz
meta-impy-117e22047c5752352342d64e3fb7ce00a4eb8113.tar.bz2
meta-impy-117e22047c5752352342d64e3fb7ce00a4eb8113.tar.xz
Second Life viewer sources 1.18.1.2
Diffstat (limited to 'linden/indra/newview/llmediaremotectrl.cpp')
-rw-r--r--linden/indra/newview/llmediaremotectrl.cpp167
1 files changed, 27 insertions, 140 deletions
diff --git a/linden/indra/newview/llmediaremotectrl.cpp b/linden/indra/newview/llmediaremotectrl.cpp
index 4549c3b..0d524b0 100644
--- a/linden/indra/newview/llmediaremotectrl.cpp
+++ b/linden/indra/newview/llmediaremotectrl.cpp
@@ -30,179 +30,66 @@
30 30
31#include "llmediaremotectrl.h" 31#include "llmediaremotectrl.h"
32 32
33#include "llui.h" 33#include "lloverlaybar.h"
34#include "lltextbox.h"
35#include "llbutton.h"
36#include "llfocusmgr.h"
37#include "llmediaengine.h"
38#include "llviewercontrol.h"
39#include "llvieweruictrlfactory.h" 34#include "llvieweruictrlfactory.h"
35#include "llpanelaudiovolume.h"
40 36
41//////////////////////////////////////////////////////////////////////////////// 37////////////////////////////////////////////////////////////////////////////////
42// 38//
43// 39//
44LLMediaRemoteCtrl:: 40LLMediaRemoteCtrl::LLMediaRemoteCtrl ( const LLString& name,
45LLMediaRemoteCtrl ( const std::string& name, 41 const LLString& label,
46 const std::string& label, 42 const LLRect& rect,
47 const LLRect& rect, 43 const LLString& xml_file ) :
48 const std::string& xml_file ) :
49 LLPanel ( name, rect, FALSE ) 44 LLPanel ( name, rect, FALSE )
50{ 45{
51 setFollows(FOLLOWS_LEFT | FOLLOWS_TOP);
52 setBackgroundVisible(TRUE);
53 setIsChrome(TRUE); 46 setIsChrome(TRUE);
54 47
55 gUICtrlFactory->buildPanel(this, xml_file); 48 gUICtrlFactory->buildPanel(this, xml_file);
56 49
57 playButton = LLUICtrlFactory::getButtonByName(this, "play_btn");
58 stopButton = LLUICtrlFactory::getButtonByName(this, "stop_btn");
59 pauseButton = LLUICtrlFactory::getButtonByName(this, "pause_btn");
60
61 childSetAction("play_btn",onPlayButton,this);
62 childSetAction("stop_btn",onStopButton,this);
63 childSetAction("pause_btn",onPauseButton,this);
64
65 mVolumeSlider = LLViewerUICtrlFactory::getVolumeSliderByName(this, "volume_slider");
66
67 childSetCommitCallback("volume_slider", onCommitVolume, this);
68
69 mIsFocusRoot = TRUE; 50 mIsFocusRoot = TRUE;
70} 51}
71 52
72//////////////////////////////////////////////////////////////////////////////// 53BOOL LLMediaRemoteCtrl::postBuild()
73//
74//
75LLMediaRemoteCtrl::
76~LLMediaRemoteCtrl ()
77{ 54{
78} 55 childSetAction("media_play",LLOverlayBar::mediaPlay,this);
56 childSetAction("media_stop",LLOverlayBar::mediaStop,this);
57 childSetAction("media_pause",LLOverlayBar::mediaPause,this);
79 58
80EWidgetType LLMediaRemoteCtrl::getWidgetType() const 59 childSetAction("music_play",LLOverlayBar::musicPlay,this);
81{ 60 childSetAction("music_stop",LLOverlayBar::musicStop,this);
82 return WIDGET_TYPE_MEDIA_REMOTE; 61 childSetAction("music_pause",LLOverlayBar::musicPause,this);
83}
84 62
85LLString LLMediaRemoteCtrl::getWidgetTag() const 63 childSetAction("volume",LLOverlayBar::toggleAudioVolumeFloater,this);
86{ 64
87 return LL_MEDIA_REMOTE_CTRL_TAG; 65 return TRUE;
88}
89
90////////////////////////////////////////////////////////////////////////////////
91//
92//
93void
94LLMediaRemoteCtrl::
95setTransportState ( TransportState transportStateIn, BOOL pauseEnabled )
96{
97 transportState = transportStateIn;
98
99 if ( transportState == Play )
100 {
101 playButton->setVisible ( TRUE );
102 playButton->setEnabled ( pauseEnabled );
103
104 pauseButton->setVisible ( FALSE );
105 pauseButton->setEnabled ( FALSE );
106
107 stopButton->setVisible ( TRUE );
108 stopButton->setEnabled ( TRUE );
109 }
110 else
111 if ( transportState == Pause )
112 {
113 playButton->setVisible ( FALSE );
114 playButton->setEnabled ( FALSE );
115
116 pauseButton->setVisible ( TRUE );
117 pauseButton->setEnabled ( TRUE );
118
119 stopButton->setVisible ( TRUE );
120 stopButton->setEnabled ( TRUE );
121 }
122 else
123 if ( transportState == Stop )
124 {
125 playButton->setVisible ( TRUE );
126 playButton->setEnabled ( TRUE );
127
128 pauseButton->setVisible ( FALSE );
129 pauseButton->setEnabled ( FALSE );
130
131 stopButton->setVisible ( TRUE );
132 stopButton->setEnabled ( FALSE );
133 };
134}
135
136////////////////////////////////////////////////////////////////////////////////
137//
138//
139LLMediaRemoteCtrl::TransportState
140LLMediaRemoteCtrl::
141getTransportState ()
142{
143 return transportState;
144}
145
146
147////////////////////////////////////////////////////////////////////////////////
148//
149//
150void
151LLMediaRemoteCtrl::
152setVolume ( F32 volumeIn )
153{
154 mVolumeSlider->setValue ( volumeIn );
155} 66}
156 67
157//////////////////////////////////////////////////////////////////////////////// 68LLMediaRemoteCtrl::~LLMediaRemoteCtrl ()
158//
159//
160void
161LLMediaRemoteCtrl::
162onCommitVolume ( LLUICtrl* ctrl, void* data )
163{ 69{
164 LLMediaRemoteCtrl* self = ( LLMediaRemoteCtrl* ) data;
165
166 LLMediaRemoteCtrlEvent event ( self, (F32)self->mVolumeSlider->getValue().asReal() );
167 self->mediaRemoteCtrlEventEmitter.update ( &LLMediaRemoteCtrlObserver::onVolumeChange, event );
168} 70}
169 71
170//////////////////////////////////////////////////////////////////////////////// 72////////////////////////////////////////////////////////////////////////////////
171// 73//
172// 74//
173void 75EWidgetType LLMediaRemoteCtrl::getWidgetType() const
174LLMediaRemoteCtrl::
175onPlayButton ( void* data )
176{ 76{
177 LLMediaRemoteCtrl* self = ( LLMediaRemoteCtrl* ) data; 77 return WIDGET_TYPE_MEDIA_REMOTE;
178
179 LLMediaRemoteCtrlEvent event ( self, 0.0f );
180 self->mediaRemoteCtrlEventEmitter.update ( &LLMediaRemoteCtrlObserver::onPlayButtonPressed, event );
181} 78}
182 79
183//////////////////////////////////////////////////////////////////////////////// 80LLString LLMediaRemoteCtrl::getWidgetTag() const
184//
185//
186void
187LLMediaRemoteCtrl::
188onPauseButton ( void* data )
189{ 81{
190 LLMediaRemoteCtrl* self = ( LLMediaRemoteCtrl* ) data; 82 return LL_MEDIA_REMOTE_CTRL_TAG;
191
192 LLMediaRemoteCtrlEvent event ( self, 0.0f );
193 self->mediaRemoteCtrlEventEmitter.update ( &LLMediaRemoteCtrlObserver::onPauseButtonPressed, event );
194} 83}
195 84
196//////////////////////////////////////////////////////////////////////////////// 85////////////////////////////////////////////////////////////////////////////////
197// 86//
198// 87//
199void 88void LLMediaRemoteCtrl::draw()
200LLMediaRemoteCtrl::
201onStopButton ( void* data )
202{ 89{
203 LLMediaRemoteCtrl* self = ( LLMediaRemoteCtrl* ) data; 90 LLOverlayBar::enableMusicButtons(this);
204 91 LLOverlayBar::enableMediaButtons(this);
205 LLMediaRemoteCtrlEvent event ( self, 0.0f ); 92 LLPanel::draw();
206 self->mediaRemoteCtrlEventEmitter.update ( &LLMediaRemoteCtrlObserver::onStopButtonPressed, event ); 93 // make volume button reflect of volume floater
94 childSetValue("volume", LLFloaterAudioVolume::instanceVisible(LLSD()));
207} 95}
208