diff options
Diffstat (limited to 'linden/indra/newview/llfloateractivespeakers.h')
-rw-r--r-- | linden/indra/newview/llfloateractivespeakers.h | 211 |
1 files changed, 211 insertions, 0 deletions
diff --git a/linden/indra/newview/llfloateractivespeakers.h b/linden/indra/newview/llfloateractivespeakers.h new file mode 100644 index 0000000..f24eca4 --- /dev/null +++ b/linden/indra/newview/llfloateractivespeakers.h | |||
@@ -0,0 +1,211 @@ | |||
1 | /** | ||
2 | * @file llfloateractivespeakers.h | ||
3 | * @brief Management interface for muting and controlling volume of residents currently speaking | ||
4 | * | ||
5 | * Copyright (c) 2005-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * Second Life Viewer Source Code | ||
8 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
9 | * to you under the terms of the GNU General Public License, version 2.0 | ||
10 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
11 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
12 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
13 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
14 | * | ||
15 | * There are special exceptions to the terms and conditions of the GPL as | ||
16 | * it is applied to this Source Code. View the full text of the exception | ||
17 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
18 | * online at http://secondlife.com/developers/opensource/flossexception | ||
19 | * | ||
20 | * By copying, modifying or distributing this software, you acknowledge | ||
21 | * that you have read and understood your obligations described above, | ||
22 | * and agree to abide by those obligations. | ||
23 | * | ||
24 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
25 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
26 | * COMPLETENESS OR PERFORMANCE. | ||
27 | */ | ||
28 | |||
29 | #ifndef LL_LLFLOATERACTIVESPEAKERS_H | ||
30 | #define LL_LLFLOATERACTIVESPEAKERS_H | ||
31 | |||
32 | #include "llfloater.h" | ||
33 | #include "llmemory.h" | ||
34 | #include "llvoiceclient.h" | ||
35 | #include "llframetimer.h" | ||
36 | |||
37 | class LLScrollListCtrl; | ||
38 | class LLButton; | ||
39 | class LLPanelActiveSpeakers; | ||
40 | class LLSpeakerMgr; | ||
41 | class LLVoiceChannel; | ||
42 | |||
43 | |||
44 | // data for a given participant in a voice channel | ||
45 | class LLSpeaker : public LLRefCount | ||
46 | { | ||
47 | public: | ||
48 | typedef enum e_speaker_type | ||
49 | { | ||
50 | SPEAKER_AGENT, | ||
51 | SPEAKER_OBJECT | ||
52 | } ESpeakerType; | ||
53 | |||
54 | typedef enum e_speaker_status | ||
55 | { | ||
56 | STATUS_SPEAKING, | ||
57 | STATUS_HAS_SPOKEN, | ||
58 | STATUS_VOICE_ACTIVE, | ||
59 | STATUS_TEXT_ONLY, | ||
60 | STATUS_NOT_IN_CHANNEL, | ||
61 | STATUS_MUTED | ||
62 | } ESpeakerStatus; | ||
63 | |||
64 | |||
65 | LLSpeaker(const LLUUID& id, const LLString& name = LLString::null, const ESpeakerType type = SPEAKER_AGENT); | ||
66 | ~LLSpeaker(); | ||
67 | |||
68 | void lookupName(); | ||
69 | |||
70 | static void onAvatarNameLookup(const LLUUID& id, const char* first, const char* last, BOOL is_group, void* user_data); | ||
71 | |||
72 | public: | ||
73 | |||
74 | ESpeakerStatus mStatus; // current activity status in speech group | ||
75 | F32 mLastSpokeTime; // timestamp when this speaker last spoke | ||
76 | F32 mSpeechVolume; // current speech amplitude (timea average rms amplitude?) | ||
77 | LLString mDisplayName; // cache user name for this speaker | ||
78 | LLFrameTimer mActivityTimer; // time out speakers when they are not part of current voice channel | ||
79 | BOOL mHasSpoken; // has this speaker said anything this session? | ||
80 | LLColor4 mDotColor; | ||
81 | LLUUID mID; | ||
82 | BOOL mTyping; | ||
83 | S32 mSortIndex; | ||
84 | LLViewHandle mHandle; | ||
85 | ESpeakerType mType; | ||
86 | |||
87 | typedef std::map<LLViewHandle, LLSpeaker*> speaker_map_t; | ||
88 | static speaker_map_t sSpeakers; | ||
89 | }; | ||
90 | |||
91 | class LLSpeakerMgr | ||
92 | { | ||
93 | public: | ||
94 | LLSpeakerMgr(LLVoiceChannel* channelp); | ||
95 | virtual ~LLSpeakerMgr(); | ||
96 | |||
97 | const LLPointer<LLSpeaker> findSpeaker(const LLUUID& avatar_id); | ||
98 | void update(); | ||
99 | void setSpeakerTyping(const LLUUID& speaker_id, BOOL typing); | ||
100 | void speakerChatted(const LLUUID& speaker_id); | ||
101 | LLPointer<LLSpeaker> setSpeaker(const LLUUID& id, | ||
102 | const LLString& name = LLString::null, | ||
103 | LLSpeaker::ESpeakerStatus status = LLSpeaker::STATUS_TEXT_ONLY, | ||
104 | LLSpeaker::ESpeakerType = LLSpeaker::SPEAKER_AGENT); | ||
105 | |||
106 | BOOL isVoiceActive(); | ||
107 | |||
108 | typedef std::vector<LLPointer<LLSpeaker> > speaker_list_t; | ||
109 | void getSpeakerList(speaker_list_t* speaker_list, BOOL include_text); | ||
110 | |||
111 | protected: | ||
112 | virtual void updateSpeakerList(); | ||
113 | |||
114 | typedef std::map<LLUUID, LLPointer<LLSpeaker> > speaker_map_t; | ||
115 | speaker_map_t mSpeakers; | ||
116 | |||
117 | speaker_list_t mSpeakersSorted; | ||
118 | LLFrameTimer mSpeechTimer; | ||
119 | LLVoiceChannel* mVoiceChannel; | ||
120 | }; | ||
121 | |||
122 | class LLIMSpeakerMgr : public LLSpeakerMgr | ||
123 | { | ||
124 | public: | ||
125 | LLIMSpeakerMgr(LLVoiceChannel* channel); | ||
126 | |||
127 | void processSpeakerListUpdate(LLSD update); | ||
128 | void processSpeakerList(LLSD list); | ||
129 | void processSpeakerMap(LLSD list); | ||
130 | protected: | ||
131 | virtual void updateSpeakerList(); | ||
132 | }; | ||
133 | |||
134 | class LLActiveSpeakerMgr : public LLSpeakerMgr | ||
135 | { | ||
136 | public: | ||
137 | LLActiveSpeakerMgr(); | ||
138 | protected: | ||
139 | virtual void updateSpeakerList(); | ||
140 | }; | ||
141 | |||
142 | class LLLocalSpeakerMgr : public LLSpeakerMgr | ||
143 | { | ||
144 | public: | ||
145 | LLLocalSpeakerMgr(); | ||
146 | ~LLLocalSpeakerMgr (); | ||
147 | protected: | ||
148 | virtual void updateSpeakerList(); | ||
149 | }; | ||
150 | |||
151 | |||
152 | class LLFloaterActiveSpeakers : | ||
153 | public LLUISingleton<LLFloaterActiveSpeakers>, | ||
154 | public LLFloater, | ||
155 | public LLVoiceClientParticipantObserver | ||
156 | { | ||
157 | // friend of singleton class to allow construction inside getInstance() since constructor is protected | ||
158 | // to enforce singleton constraint | ||
159 | friend class LLUISingleton<LLFloaterActiveSpeakers>; | ||
160 | public: | ||
161 | virtual ~LLFloaterActiveSpeakers(); | ||
162 | |||
163 | /*virtual*/ BOOL postBuild(); | ||
164 | /*virtual*/ void onClose(bool app_quitting); | ||
165 | /*virtual*/ void draw(); | ||
166 | |||
167 | /*virtual*/ void onChange(); | ||
168 | |||
169 | static void* createSpeakersPanel(void* data); | ||
170 | |||
171 | protected: | ||
172 | LLFloaterActiveSpeakers(const LLSD& seed); | ||
173 | |||
174 | LLPanelActiveSpeakers* mPanel; | ||
175 | }; | ||
176 | |||
177 | class LLPanelActiveSpeakers : public LLPanel | ||
178 | { | ||
179 | public: | ||
180 | LLPanelActiveSpeakers(LLSpeakerMgr* data_source, BOOL show_text_chatters); | ||
181 | virtual ~LLPanelActiveSpeakers(); | ||
182 | |||
183 | /*virtual*/ BOOL postBuild(); | ||
184 | |||
185 | void refreshSpeakers(); | ||
186 | |||
187 | void setSpeaker(const LLUUID& id, | ||
188 | const LLString& name = LLString::null, | ||
189 | LLSpeaker::ESpeakerStatus status = LLSpeaker::STATUS_TEXT_ONLY, | ||
190 | LLSpeaker::ESpeakerType = LLSpeaker::SPEAKER_AGENT); | ||
191 | |||
192 | static void onClickMuteVoice(void* user_data); | ||
193 | static void onClickMuteVoiceCommit(LLUICtrl* ctrl, void* user_data); | ||
194 | static void onClickMuteTextCommit(LLUICtrl* ctrl, void* user_data); | ||
195 | static void onVolumeChange(LLUICtrl* source, void* user_data); | ||
196 | static void onClickProfile(void* user_data); | ||
197 | protected: | ||
198 | LLScrollListCtrl* mSpeakerList; | ||
199 | LLUICtrl* mMuteVoiceCtrl; | ||
200 | LLUICtrl* mMuteTextCtrl; | ||
201 | LLTextBox* mNameText; | ||
202 | LLButton* mProfileBtn; | ||
203 | BOOL mShowTextChatters; | ||
204 | LLSpeakerMgr* mSpeakerMgr; | ||
205 | LLFrameTimer mIconAnimationTimer; | ||
206 | }; | ||
207 | |||
208 | extern LLLocalSpeakerMgr* gLocalSpeakerMgr; | ||
209 | extern LLActiveSpeakerMgr* gActiveChannelSpeakerMgr; | ||
210 | |||
211 | #endif // LL_LLFLOATERACTIVESPEAKERS_H | ||