PageRenderTime 20ms CodeModel.GetById 1ms app.highlight 14ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/llimpanel.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 212 lines | 104 code | 47 blank | 61 comment | 0 complexity | 6ebffeacaa75eac1c1a642e00592ae55 MD5 | raw file
  1/** 
  2 * @file llimpanel.h
  3 * @brief LLIMPanel class definition
  4 *
  5 * $LicenseInfo:firstyear=2001&license=viewerlgpl$
  6 * Second Life Viewer Source Code
  7 * Copyright (C) 2010, Linden Research, Inc.
  8 * 
  9 * This library is free software; you can redistribute it and/or
 10 * modify it under the terms of the GNU Lesser General Public
 11 * License as published by the Free Software Foundation;
 12 * version 2.1 of the License only.
 13 * 
 14 * This library is distributed in the hope that it will be useful,
 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 17 * Lesser General Public License for more details.
 18 * 
 19 * You should have received a copy of the GNU Lesser General Public
 20 * License along with this library; if not, write to the Free Software
 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 22 * 
 23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 24 * $/LicenseInfo$
 25 */
 26
 27#ifndef LL_IMPANEL_H
 28#define LL_IMPANEL_H
 29
 30#include "lldockablefloater.h"
 31#include "lllogchat.h"
 32#include "lluuid.h"
 33#include "lldarray.h"
 34#include "llinstantmessage.h"
 35#include "llvoiceclient.h"
 36#include "llstyle.h"
 37
 38class LLLineEditor;
 39class LLViewerTextEditor;
 40class LLInventoryItem;
 41class LLInventoryCategory;
 42class LLIMSpeakerMgr;
 43class LLPanelActiveSpeakers;
 44class LLPanelChatControlPanel;
 45
 46class LLFloaterIMPanel : public LLFloater
 47{
 48public:
 49
 50	// The session id is the id of the session this is for. The target
 51	// refers to the user (or group) that where this session serves as
 52	// the default. For example, if you open a session though a
 53	// calling card, a new session id will be generated, but the
 54	// target_id will be the agent referenced by the calling card.
 55	LLFloaterIMPanel(const std::string& session_label,
 56					 const LLUUID& session_id,
 57					 const LLUUID& target_id,
 58					 const std::vector<LLUUID>& ids,
 59					 EInstantMessage dialog);
 60	virtual ~LLFloaterIMPanel();
 61
 62	/*virtual*/ BOOL postBuild();
 63
 64	// Check typing timeout timer.
 65	/*virtual*/ void draw();
 66
 67	/*virtual*/ void onClose(bool app_quitting);
 68	void onVisibilityChange(const LLSD& new_visibility);
 69
 70	// add target ids to the session. 
 71	// Return TRUE if successful, otherwise FALSE.
 72	BOOL inviteToSession(const std::vector<LLUUID>& agent_ids);
 73
 74	void addHistoryLine(const std::string &utf8msg, 
 75						const LLColor4& color = LLColor4::white, 
 76						bool log_to_file = true,
 77						const LLUUID& source = LLUUID::null,
 78						const std::string& name = LLStringUtil::null);
 79
 80	void setInputFocus( BOOL b );
 81
 82	void selectAll();
 83	void selectNone();
 84
 85	S32 getNumUnreadMessages() { return mNumUnreadMessages; }
 86
 87	BOOL handleKeyHere(KEY key, MASK mask);
 88	BOOL handleDragAndDrop(S32 x, S32 y, MASK mask,
 89						   BOOL drop, EDragAndDropType cargo_type,
 90						   void *cargo_data, EAcceptance *accept,
 91						   std::string& tooltip_msg);
 92
 93	static void		onInputEditorFocusReceived( LLFocusableElement* caller, void* userdata );
 94	static void		onInputEditorFocusLost(LLFocusableElement* caller, void* userdata);
 95	static void		onInputEditorKeystroke(LLLineEditor* caller, void* userdata);
 96	static void		onCommitChat(LLUICtrl* caller, void* userdata);
 97	static void		onTabClick( void* userdata );
 98
 99	static void		onClickProfile( void* userdata );
100	static void		onClickGroupInfo( void* userdata );
101	static void		onClickClose( void* userdata );
102	static void		onClickStartCall( void* userdata );
103	static void		onClickEndCall( void* userdata );
104	static void		onClickSend( void* userdata );
105	static void		onClickToggleActiveSpeakers( void* userdata );
106	static void*	createSpeakersPanel(void* data);
107	static void		onKickSpeaker(void* user_data);
108
109	//callbacks for P2P muting and volume control
110	static void onClickMuteVoice(void* user_data);
111	static void onVolumeChange(LLUICtrl* source, void* user_data);
112
113	const LLUUID& getSessionID() const { return mSessionUUID; }
114	const LLUUID& getOtherParticipantID() const { return mOtherParticipantUUID; }
115	void processSessionUpdate(const LLSD& update);
116	EInstantMessage getDialogType() const { return mDialog; }
117	void setDialogType(EInstantMessage dialog) { mDialog = dialog; }
118
119	void sessionInitReplyReceived(const LLUUID& im_session_id);
120
121	// Handle other participant in the session typing.
122	void processIMTyping(const LLIMInfo* im_info, BOOL typing);
123
124private:
125	// Called by UI methods.
126	void sendMsg();
127
128	// for adding agents via the UI. Return TRUE if possible, do it if 
129	BOOL dropCallingCard(LLInventoryItem* item, BOOL drop);
130	BOOL dropCategory(LLInventoryCategory* category, BOOL drop);
131
132	// test if local agent can add agents.
133	BOOL isInviteAllowed() const;
134
135	// Called whenever the user starts or stops typing.
136	// Sends the typing state to the other user if necessary.
137	void setTyping(BOOL typing);
138
139	// Add the "User is typing..." indicator.
140	void addTypingIndicator(const std::string &name);
141
142	// Remove the "User is typing..." indicator.
143	void removeTypingIndicator(const LLIMInfo* im_info);
144
145	void sendTypingState(BOOL typing);
146	
147private:
148	LLLineEditor* mInputEditor;
149	LLViewerTextEditor* mHistoryEditor;
150
151	// The value of the mSessionUUID depends on how the IM session was started:
152	//   one-on-one  ==> random id
153	//   group ==> group_id
154	//   inventory folder ==> folder item_id 
155	//   911 ==> Gaurdian_Angel_Group_ID ^ gAgent.getID()
156	LLUUID mSessionUUID;
157
158	std::string mSessionLabel;
159
160	BOOL mSessionInitialized;
161	LLSD mQueuedMsgsForInit;
162
163	// The value mOtherParticipantUUID depends on how the IM session was started:
164	//   one-on-one = recipient's id
165	//   group ==> group_id
166	//   inventory folder ==> first target id in list
167	//   911 ==> sender
168	LLUUID mOtherParticipantUUID;
169	std::vector<LLUUID> mSessionInitialTargetIDs;
170
171	EInstantMessage mDialog;
172
173	// Are you currently typing?
174	BOOL mTyping;
175
176	// Is other user currently typing?
177	BOOL mOtherTyping;
178
179	// name of other user who is currently typing
180	std::string mOtherTypingName;
181
182	// Where does the "User is typing..." line start?
183	S32 mTypingLineStartIndex;
184	// Where does the "Starting session..." line start?
185	S32 mSessionStartMsgPos;
186	
187	S32 mNumUnreadMessages;
188
189	BOOL mSentTypingState;
190
191	BOOL mShowSpeakersOnConnect;
192
193	BOOL mTextIMPossible;
194	BOOL mProfileButtonEnabled;
195	BOOL mCallBackEnabled;
196
197	LLPanelActiveSpeakers* mSpeakerPanel;
198	
199	// Optimization:  Don't send "User is typing..." until the
200	// user has actually been typing for a little while.  Prevents
201	// extra IMs for brief "lol" type utterences.
202	LLFrameTimer mFirstKeystrokeTimer;
203
204	// Timer to detect when user has stopped typing.
205	LLFrameTimer mLastKeystrokeTimer;
206
207	boost::signals2::connection mFocusCallbackConnection;
208
209	void disableWhileSessionStarting();
210};
211
212#endif  // LL_IMPANEL_H