/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. #ifndef LL_IMPANEL_H
  27. #define LL_IMPANEL_H
  28. #include "lldockablefloater.h"
  29. #include "lllogchat.h"
  30. #include "lluuid.h"
  31. #include "lldarray.h"
  32. #include "llinstantmessage.h"
  33. #include "llvoiceclient.h"
  34. #include "llstyle.h"
  35. class LLLineEditor;
  36. class LLViewerTextEditor;
  37. class LLInventoryItem;
  38. class LLInventoryCategory;
  39. class LLIMSpeakerMgr;
  40. class LLPanelActiveSpeakers;
  41. class LLPanelChatControlPanel;
  42. class LLFloaterIMPanel : public LLFloater
  43. {
  44. public:
  45. // The session id is the id of the session this is for. The target
  46. // refers to the user (or group) that where this session serves as
  47. // the default. For example, if you open a session though a
  48. // calling card, a new session id will be generated, but the
  49. // target_id will be the agent referenced by the calling card.
  50. LLFloaterIMPanel(const std::string& session_label,
  51. const LLUUID& session_id,
  52. const LLUUID& target_id,
  53. const std::vector<LLUUID>& ids,
  54. EInstantMessage dialog);
  55. virtual ~LLFloaterIMPanel();
  56. /*virtual*/ BOOL postBuild();
  57. // Check typing timeout timer.
  58. /*virtual*/ void draw();
  59. /*virtual*/ void onClose(bool app_quitting);
  60. void onVisibilityChange(const LLSD& new_visibility);
  61. // add target ids to the session.
  62. // Return TRUE if successful, otherwise FALSE.
  63. BOOL inviteToSession(const std::vector<LLUUID>& agent_ids);
  64. void addHistoryLine(const std::string &utf8msg,
  65. const LLColor4& color = LLColor4::white,
  66. bool log_to_file = true,
  67. const LLUUID& source = LLUUID::null,
  68. const std::string& name = LLStringUtil::null);
  69. void setInputFocus( BOOL b );
  70. void selectAll();
  71. void selectNone();
  72. S32 getNumUnreadMessages() { return mNumUnreadMessages; }
  73. BOOL handleKeyHere(KEY key, MASK mask);
  74. BOOL handleDragAndDrop(S32 x, S32 y, MASK mask,
  75. BOOL drop, EDragAndDropType cargo_type,
  76. void *cargo_data, EAcceptance *accept,
  77. std::string& tooltip_msg);
  78. static void onInputEditorFocusReceived( LLFocusableElement* caller, void* userdata );
  79. static void onInputEditorFocusLost(LLFocusableElement* caller, void* userdata);
  80. static void onInputEditorKeystroke(LLLineEditor* caller, void* userdata);
  81. static void onCommitChat(LLUICtrl* caller, void* userdata);
  82. static void onTabClick( void* userdata );
  83. static void onClickProfile( void* userdata );
  84. static void onClickGroupInfo( void* userdata );
  85. static void onClickClose( void* userdata );
  86. static void onClickStartCall( void* userdata );
  87. static void onClickEndCall( void* userdata );
  88. static void onClickSend( void* userdata );
  89. static void onClickToggleActiveSpeakers( void* userdata );
  90. static void* createSpeakersPanel(void* data);
  91. static void onKickSpeaker(void* user_data);
  92. //callbacks for P2P muting and volume control
  93. static void onClickMuteVoice(void* user_data);
  94. static void onVolumeChange(LLUICtrl* source, void* user_data);
  95. const LLUUID& getSessionID() const { return mSessionUUID; }
  96. const LLUUID& getOtherParticipantID() const { return mOtherParticipantUUID; }
  97. void processSessionUpdate(const LLSD& update);
  98. EInstantMessage getDialogType() const { return mDialog; }
  99. void setDialogType(EInstantMessage dialog) { mDialog = dialog; }
  100. void sessionInitReplyReceived(const LLUUID& im_session_id);
  101. // Handle other participant in the session typing.
  102. void processIMTyping(const LLIMInfo* im_info, BOOL typing);
  103. private:
  104. // Called by UI methods.
  105. void sendMsg();
  106. // for adding agents via the UI. Return TRUE if possible, do it if
  107. BOOL dropCallingCard(LLInventoryItem* item, BOOL drop);
  108. BOOL dropCategory(LLInventoryCategory* category, BOOL drop);
  109. // test if local agent can add agents.
  110. BOOL isInviteAllowed() const;
  111. // Called whenever the user starts or stops typing.
  112. // Sends the typing state to the other user if necessary.
  113. void setTyping(BOOL typing);
  114. // Add the "User is typing..." indicator.
  115. void addTypingIndicator(const std::string &name);
  116. // Remove the "User is typing..." indicator.
  117. void removeTypingIndicator(const LLIMInfo* im_info);
  118. void sendTypingState(BOOL typing);
  119. private:
  120. LLLineEditor* mInputEditor;
  121. LLViewerTextEditor* mHistoryEditor;
  122. // The value of the mSessionUUID depends on how the IM session was started:
  123. // one-on-one ==> random id
  124. // group ==> group_id
  125. // inventory folder ==> folder item_id
  126. // 911 ==> Gaurdian_Angel_Group_ID ^ gAgent.getID()
  127. LLUUID mSessionUUID;
  128. std::string mSessionLabel;
  129. BOOL mSessionInitialized;
  130. LLSD mQueuedMsgsForInit;
  131. // The value mOtherParticipantUUID depends on how the IM session was started:
  132. // one-on-one = recipient's id
  133. // group ==> group_id
  134. // inventory folder ==> first target id in list
  135. // 911 ==> sender
  136. LLUUID mOtherParticipantUUID;
  137. std::vector<LLUUID> mSessionInitialTargetIDs;
  138. EInstantMessage mDialog;
  139. // Are you currently typing?
  140. BOOL mTyping;
  141. // Is other user currently typing?
  142. BOOL mOtherTyping;
  143. // name of other user who is currently typing
  144. std::string mOtherTypingName;
  145. // Where does the "User is typing..." line start?
  146. S32 mTypingLineStartIndex;
  147. // Where does the "Starting session..." line start?
  148. S32 mSessionStartMsgPos;
  149. S32 mNumUnreadMessages;
  150. BOOL mSentTypingState;
  151. BOOL mShowSpeakersOnConnect;
  152. BOOL mTextIMPossible;
  153. BOOL mProfileButtonEnabled;
  154. BOOL mCallBackEnabled;
  155. LLPanelActiveSpeakers* mSpeakerPanel;
  156. // Optimization: Don't send "User is typing..." until the
  157. // user has actually been typing for a little while. Prevents
  158. // extra IMs for brief "lol" type utterences.
  159. LLFrameTimer mFirstKeystrokeTimer;
  160. // Timer to detect when user has stopped typing.
  161. LLFrameTimer mLastKeystrokeTimer;
  162. boost::signals2::connection mFocusCallbackConnection;
  163. void disableWhileSessionStarting();
  164. };
  165. #endif // LL_IMPANEL_H