llfloaterchat.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /**
  2. * @file llfloaterchat.h
  3. * @brief LLFloaterChat class definition
  4. *
  5. * $LicenseInfo:firstyear=2002&license=viewergpl$
  6. *
  7. * Copyright (c) 2002-2009, Linden Research, Inc.
  8. *
  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. * Actually the "Chat History" floater.
  34. * Should be llfloaterchathistory, not llfloaterchat.
  35. */
  36. #ifndef LL_LLFLOATERCHAT_H
  37. #define LL_LLFLOATERCHAT_H
  38. #include <map>
  39. #include "llfloater.h"
  40. class LLAvatarName;
  41. class LLButton;
  42. class LLChat;
  43. class LLChatBar;
  44. class LLPanelActiveSpeakers;
  45. class LLViewerTextEditor;
  46. class LLFloaterChat final : public LLFloater,
  47. public LLUISingleton<LLFloaterChat, LLFloaterChat>
  48. {
  49. protected:
  50. LOG_CLASS(LLFloaterChat);
  51. public:
  52. LLFloaterChat(const LLSD& seed);
  53. ~LLFloaterChat() override {}
  54. void setVisible(bool b) override;
  55. void draw() override;
  56. bool postBuild() override;
  57. void onClose(bool app_quitting) override;
  58. void onVisibilityChange(bool cur_visibility) override;
  59. void setMinimized(bool minimize) override;
  60. void onFocusReceived() override;
  61. void onFocusLost() override;
  62. void updateConsoleVisibility();
  63. static void setHistoryCursorAndScrollToEnd();
  64. static bool isOwnNameInText(const std::string& text_line);
  65. // Add chat to console and history list.
  66. // Color based on source, type, distance.
  67. static void addChat(LLChat& chat, bool from_im = false,
  68. bool local_agent = false);
  69. // Add chat to history alone.
  70. static void addChatHistory(LLChat& chat, bool log_to_file = true);
  71. static void loadHistory();
  72. // Visibility policy for LLUISingleton
  73. static bool visible(LLFloater* instance, const LLSD& key);
  74. static void show(LLFloater* instance, const LLSD& key);
  75. static void hide(LLFloater* instance, const LLSD& key);
  76. static void focus();
  77. static bool isFocused();
  78. static void resolveSLURLs(const LLChat& chat);
  79. static void substituteSLURL(const LLUUID& id, const std::string& slurl,
  80. const std::string& substitute);
  81. static void substitutionDone(const LLUUID& id);
  82. private:
  83. static void* createSpeakersPanel(void* data);
  84. static void* createChatPanel(void* data);
  85. static void onClickMute(void* data);
  86. static void onClickToggleShowMute(LLUICtrl* ctrl, void* data);
  87. static void onClickToggleActiveSpeakers(void* userdata);
  88. static void chatFromLog(S32 type, const LLSD& data, void* userdata);
  89. private:
  90. LLChatBar* mChatBarPanel;
  91. LLPanelActiveSpeakers* mSpeakerPanel;
  92. LLButton* mToggleActiveSpeakersBtn;
  93. LLViewerTextEditor* mHistoryWithoutMutes;
  94. LLViewerTextEditor* mHistoryWithMutes;
  95. uuid_list_t mPendingIds;
  96. bool mFocused;
  97. };
  98. extern const std::string gChatFloaterName;
  99. #endif