Annotation of /trunk/indra/newview/llfloateractivespeakers.h
Parent Directory
|
Revision Log
Revision 137 - (view) (download)
| 1 : | mjm | 135 | /** |
| 2 : | * @file llfloateractivespeakers.h | ||
| 3 : | * @brief Management interface for muting and controlling volume of residents currently speaking | ||
| 4 : | * | ||
| 5 : | * $LicenseInfo:firstyear=2005&license=viewergpl$ | ||
| 6 : | * | ||
| 7 : | mjm | 137 | * Copyright (c) 2005-2010, Linden Research, Inc. |
| 8 : | mjm | 135 | * |
| 9 : | * Second Life Viewer Source Code | ||
| 10 : | * The source code in this file ("Source Code") is provided by Linden Lab | ||
| 11 : | * to you under the terms of the GNU General Public License, version 2.0 | ||
| 12 : | * ("GPL"), unless you have obtained a separate licensing agreement | ||
| 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 | ||
| 15 : | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 | ||
| 16 : | * | ||
| 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 | ||
| 19 : | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
| 20 : | * online at | ||
| 21 : | * http://secondlifegrid.net/programs/open_source/licensing/flossexception | ||
| 22 : | * | ||
| 23 : | * By copying, modifying or distributing this software, you acknowledge | ||
| 24 : | * that you have read and understood your obligations described above, | ||
| 25 : | * and agree to abide by those obligations. | ||
| 26 : | * | ||
| 27 : | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
| 28 : | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
| 29 : | * COMPLETENESS OR PERFORMANCE. | ||
| 30 : | * $/LicenseInfo$ | ||
| 31 : | */ | ||
| 32 : | |||
| 33 : | #ifndef LL_LLFLOATERACTIVESPEAKERS_H | ||
| 34 : | #define LL_LLFLOATERACTIVESPEAKERS_H | ||
| 35 : | |||
| 36 : | #include "llfloater.h" | ||
| 37 : | #include "llmemory.h" | ||
| 38 : | #include "llvoiceclient.h" | ||
| 39 : | #include "llframetimer.h" | ||
| 40 : | #include "llevent.h" | ||
| 41 : | #include <list> | ||
| 42 : | |||
| 43 : | class LLScrollListCtrl; | ||
| 44 : | class LLButton; | ||
| 45 : | class LLPanelActiveSpeakers; | ||
| 46 : | class LLSpeakerMgr; | ||
| 47 : | class LLVoiceChannel; | ||
| 48 : | |||
| 49 : | |||
| 50 : | // data for a given participant in a voice channel | ||
| 51 : | class LLSpeaker : public LLRefCount, public LLObservable, public LLHandleProvider<LLSpeaker> | ||
| 52 : | { | ||
| 53 : | public: | ||
| 54 : | typedef enum e_speaker_type | ||
| 55 : | { | ||
| 56 : | SPEAKER_AGENT, | ||
| 57 : | SPEAKER_OBJECT, | ||
| 58 : | SPEAKER_EXTERNAL // Speaker that doesn't map to an avatar or object (i.e. PSTN caller in a group) | ||
| 59 : | } ESpeakerType; | ||
| 60 : | |||
| 61 : | typedef enum e_speaker_status | ||
| 62 : | { | ||
| 63 : | STATUS_SPEAKING, | ||
| 64 : | STATUS_HAS_SPOKEN, | ||
| 65 : | STATUS_VOICE_ACTIVE, | ||
| 66 : | STATUS_TEXT_ONLY, | ||
| 67 : | STATUS_NOT_IN_CHANNEL, | ||
| 68 : | STATUS_MUTED | ||
| 69 : | } ESpeakerStatus; | ||
| 70 : | |||
| 71 : | |||
| 72 : | LLSpeaker(const LLUUID& id, const std::string& name = LLStringUtil::null, const ESpeakerType type = SPEAKER_AGENT); | ||
| 73 : | ~LLSpeaker() {}; | ||
| 74 : | void lookupName(); | ||
| 75 : | |||
| 76 : | static void onAvatarNameLookup(const LLUUID& id, const std::string& first, const std::string& last, BOOL is_group, void* user_data); | ||
| 77 : | |||
| 78 : | ESpeakerStatus mStatus; // current activity status in speech group | ||
| 79 : | F32 mLastSpokeTime; // timestamp when this speaker last spoke | ||
| 80 : | F32 mSpeechVolume; // current speech amplitude (timea average rms amplitude?) | ||
| 81 : | std::string mDisplayName; // cache user name for this speaker | ||
| 82 : | LLFrameTimer mActivityTimer; // time out speakers when they are not part of current voice channel | ||
| 83 : | BOOL mHasSpoken; // has this speaker said anything this session? | ||
| 84 : | LLColor4 mDotColor; | ||
| 85 : | LLUUID mID; | ||
| 86 : | BOOL mTyping; | ||
| 87 : | S32 mSortIndex; | ||
| 88 : | ESpeakerType mType; | ||
| 89 : | BOOL mIsModerator; | ||
| 90 : | BOOL mModeratorMutedVoice; | ||
| 91 : | BOOL mModeratorMutedText; | ||
| 92 : | }; | ||
| 93 : | |||
| 94 : | class LLSpeakerTextModerationEvent : public LLEvent | ||
| 95 : | { | ||
| 96 : | public: | ||
| 97 : | LLSpeakerTextModerationEvent(LLSpeaker* source); | ||
| 98 : | /*virtual*/ LLSD getValue(); | ||
| 99 : | }; | ||
| 100 : | |||
| 101 : | class LLSpeakerVoiceModerationEvent : public LLEvent | ||
| 102 : | { | ||
| 103 : | public: | ||
| 104 : | LLSpeakerVoiceModerationEvent(LLSpeaker* source); | ||
| 105 : | /*virtual*/ LLSD getValue(); | ||
| 106 : | }; | ||
| 107 : | |||
| 108 : | class LLSpeakerListChangeEvent : public LLEvent | ||
| 109 : | { | ||
| 110 : | public: | ||
| 111 : | LLSpeakerListChangeEvent(LLSpeakerMgr* source, const LLUUID& speaker_id); | ||
| 112 : | /*virtual*/ LLSD getValue(); | ||
| 113 : | |||
| 114 : | private: | ||
| 115 : | const LLUUID& mSpeakerID; | ||
| 116 : | }; | ||
| 117 : | |||
| 118 : | class LLSpeakerMgr : public LLObservable | ||
| 119 : | { | ||
| 120 : | public: | ||
| 121 : | LLSpeakerMgr(LLVoiceChannel* channelp); | ||
| 122 : | virtual ~LLSpeakerMgr(); | ||
| 123 : | |||
| 124 : | const LLPointer<LLSpeaker> findSpeaker(const LLUUID& avatar_id); | ||
| 125 : | void update(BOOL resort_ok); | ||
| 126 : | void setSpeakerTyping(const LLUUID& speaker_id, BOOL typing); | ||
| 127 : | void speakerChatted(const LLUUID& speaker_id); | ||
| 128 : | LLPointer<LLSpeaker> setSpeaker(const LLUUID& id, | ||
| 129 : | const std::string& name = LLStringUtil::null, | ||
| 130 : | LLSpeaker::ESpeakerStatus status = LLSpeaker::STATUS_TEXT_ONLY, | ||
| 131 : | LLSpeaker::ESpeakerType = LLSpeaker::SPEAKER_AGENT); | ||
| 132 : | |||
| 133 : | BOOL isVoiceActive(); | ||
| 134 : | |||
| 135 : | typedef std::vector<LLPointer<LLSpeaker> > speaker_list_t; | ||
| 136 : | void getSpeakerList(speaker_list_t* speaker_list, BOOL include_text); | ||
| 137 : | const LLUUID getSessionID(); | ||
| 138 : | |||
| 139 : | protected: | ||
| 140 : | virtual void updateSpeakerList(); | ||
| 141 : | |||
| 142 : | typedef std::map<LLUUID, LLPointer<LLSpeaker> > speaker_map_t; | ||
| 143 : | speaker_map_t mSpeakers; | ||
| 144 : | |||
| 145 : | speaker_list_t mSpeakersSorted; | ||
| 146 : | LLFrameTimer mSpeechTimer; | ||
| 147 : | LLVoiceChannel* mVoiceChannel; | ||
| 148 : | }; | ||
| 149 : | |||
| 150 : | class LLIMSpeakerMgr : public LLSpeakerMgr | ||
| 151 : | { | ||
| 152 : | public: | ||
| 153 : | LLIMSpeakerMgr(LLVoiceChannel* channel); | ||
| 154 : | |||
| 155 : | void updateSpeakers(const LLSD& update); | ||
| 156 : | void setSpeakers(const LLSD& speakers); | ||
| 157 : | protected: | ||
| 158 : | virtual void updateSpeakerList(); | ||
| 159 : | }; | ||
| 160 : | |||
| 161 : | class LLActiveSpeakerMgr : public LLSpeakerMgr, public LLSingleton<LLActiveSpeakerMgr> | ||
| 162 : | { | ||
| 163 : | public: | ||
| 164 : | LLActiveSpeakerMgr(); | ||
| 165 : | protected: | ||
| 166 : | virtual void updateSpeakerList(); | ||
| 167 : | }; | ||
| 168 : | |||
| 169 : | class LLLocalSpeakerMgr : public LLSpeakerMgr, public LLSingleton<LLLocalSpeakerMgr> | ||
| 170 : | { | ||
| 171 : | public: | ||
| 172 : | LLLocalSpeakerMgr(); | ||
| 173 : | ~LLLocalSpeakerMgr (); | ||
| 174 : | protected: | ||
| 175 : | virtual void updateSpeakerList(); | ||
| 176 : | }; | ||
| 177 : | |||
| 178 : | |||
| 179 : | class LLFloaterActiveSpeakers : | ||
| 180 : | public LLFloaterSingleton<LLFloaterActiveSpeakers>, | ||
| 181 : | public LLFloater, | ||
| 182 : | public LLVoiceClientParticipantObserver | ||
| 183 : | { | ||
| 184 : | // friend of singleton class to allow construction inside getInstance() since constructor is protected | ||
| 185 : | // to enforce singleton constraint | ||
| 186 : | friend class LLUISingleton<LLFloaterActiveSpeakers, VisibilityPolicy<LLFloater> >; | ||
| 187 : | public: | ||
| 188 : | virtual ~LLFloaterActiveSpeakers(); | ||
| 189 : | |||
| 190 : | /*virtual*/ BOOL postBuild(); | ||
| 191 : | /*virtual*/ void onOpen(); | ||
| 192 : | /*virtual*/ void onClose(bool app_quitting); | ||
| 193 : | /*virtual*/ void draw(); | ||
| 194 : | |||
| 195 : | /*virtual*/ void onChange(); | ||
| 196 : | |||
| 197 : | static void* createSpeakersPanel(void* data); | ||
| 198 : | |||
| 199 : | protected: | ||
| 200 : | LLFloaterActiveSpeakers(const LLSD& seed); | ||
| 201 : | |||
| 202 : | LLPanelActiveSpeakers* mPanel; | ||
| 203 : | }; | ||
| 204 : | |||
| 205 : | class LLPanelActiveSpeakers : public LLPanel | ||
| 206 : | { | ||
| 207 : | public: | ||
| 208 : | LLPanelActiveSpeakers(LLSpeakerMgr* data_source, BOOL show_text_chatters); | ||
| 209 : | |||
| 210 : | /*virtual*/ BOOL postBuild(); | ||
| 211 : | |||
| 212 : | void handleSpeakerSelect(); | ||
| 213 : | void refreshSpeakers(); | ||
| 214 : | |||
| 215 : | void setSpeaker(const LLUUID& id, | ||
| 216 : | const std::string& name = LLStringUtil::null, | ||
| 217 : | LLSpeaker::ESpeakerStatus status = LLSpeaker::STATUS_TEXT_ONLY, | ||
| 218 : | LLSpeaker::ESpeakerType = LLSpeaker::SPEAKER_AGENT); | ||
| 219 : | |||
| 220 : | void setVoiceModerationCtrlMode(const BOOL& moderated_voice); | ||
| 221 : | |||
| 222 : | static void onClickMuteVoice(void* user_data); | ||
| 223 : | static void onClickMuteVoiceCommit(LLUICtrl* ctrl, void* user_data); | ||
| 224 : | static void onClickMuteTextCommit(LLUICtrl* ctrl, void* user_data); | ||
| 225 : | static void onVolumeChange(LLUICtrl* source, void* user_data); | ||
| 226 : | static void onClickProfile(void* user_data); | ||
| 227 : | static void onDoubleClickSpeaker(void* user_data); | ||
| 228 : | static void onSelectSpeaker(LLUICtrl* source, void* user_data); | ||
| 229 : | static void onSortChanged(void* user_data); | ||
| 230 : | static void onModeratorMuteVoice(LLUICtrl* ctrl, void* user_data); | ||
| 231 : | static void onModeratorMuteText(LLUICtrl* ctrl, void* user_data); | ||
| 232 : | static void onChangeModerationMode(LLUICtrl* ctrl, void* user_data); | ||
| 233 : | |||
| 234 : | protected: | ||
| 235 : | class SpeakerMuteListener : public LLSimpleListener | ||
| 236 : | { | ||
| 237 : | public: | ||
| 238 : | SpeakerMuteListener(LLPanelActiveSpeakers* panel) : mPanel(panel) {} | ||
| 239 : | |||
| 240 : | /*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata); | ||
| 241 : | |||
| 242 : | LLPanelActiveSpeakers* mPanel; | ||
| 243 : | }; | ||
| 244 : | |||
| 245 : | friend class SpeakerAddListener; | ||
| 246 : | class SpeakerAddListener : public LLSimpleListener | ||
| 247 : | { | ||
| 248 : | public: | ||
| 249 : | SpeakerAddListener(LLPanelActiveSpeakers* panel) : mPanel(panel) {} | ||
| 250 : | |||
| 251 : | /*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata); | ||
| 252 : | |||
| 253 : | LLPanelActiveSpeakers* mPanel; | ||
| 254 : | }; | ||
| 255 : | |||
| 256 : | friend class SpeakerRemoveListener; | ||
| 257 : | class SpeakerRemoveListener : public LLSimpleListener | ||
| 258 : | { | ||
| 259 : | public: | ||
| 260 : | SpeakerRemoveListener(LLPanelActiveSpeakers* panel) : mPanel(panel) {} | ||
| 261 : | |||
| 262 : | /*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata); | ||
| 263 : | |||
| 264 : | LLPanelActiveSpeakers* mPanel; | ||
| 265 : | }; | ||
| 266 : | |||
| 267 : | |||
| 268 : | friend class SpeakerClearListener; | ||
| 269 : | class SpeakerClearListener : public LLSimpleListener | ||
| 270 : | { | ||
| 271 : | public: | ||
| 272 : | SpeakerClearListener(LLPanelActiveSpeakers* panel) : mPanel(panel) {} | ||
| 273 : | |||
| 274 : | /*virtual*/ bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata); | ||
| 275 : | |||
| 276 : | LLPanelActiveSpeakers* mPanel; | ||
| 277 : | }; | ||
| 278 : | |||
| 279 : | void addSpeaker(const LLUUID& id); | ||
| 280 : | void removeSpeaker(const LLUUID& id); | ||
| 281 : | |||
| 282 : | |||
| 283 : | LLScrollListCtrl* mSpeakerList; | ||
| 284 : | LLUICtrl* mMuteVoiceCtrl; | ||
| 285 : | LLUICtrl* mMuteTextCtrl; | ||
| 286 : | LLTextBox* mNameText; | ||
| 287 : | LLButton* mProfileBtn; | ||
| 288 : | BOOL mShowTextChatters; | ||
| 289 : | LLSpeakerMgr* mSpeakerMgr; | ||
| 290 : | LLFrameTimer mIconAnimationTimer; | ||
| 291 : | LLPointer<SpeakerMuteListener> mSpeakerMuteListener; | ||
| 292 : | LLPointer<SpeakerAddListener> mSpeakerAddListener; | ||
| 293 : | LLPointer<SpeakerRemoveListener> mSpeakerRemoveListener; | ||
| 294 : | LLPointer<SpeakerClearListener> mSpeakerClearListener; | ||
| 295 : | }; | ||
| 296 : | |||
| 297 : | |||
| 298 : | #endif // LL_LLFLOATERACTIVESPEAKERS_H |
| ViewVC Help | |
| Powered by ViewVC 1.0.0 |

