llfloaterfriends.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. /**
  2. * @file llfloaterfriends.h
  3. * @author Phoenix
  4. * @date 2005-01-13
  5. * @brief Declaration of class for displaying the local agent's friends.
  6. *
  7. * $LicenseInfo:firstyear=2005&license=viewergpl$
  8. *
  9. * Copyright (c) 2005-2009, Linden Research, Inc.
  10. *
  11. * Second Life Viewer Source Code
  12. * The source code in this file ("Source Code") is provided by Linden Lab
  13. * to you under the terms of the GNU General Public License, version 2.0
  14. * ("GPL"), unless you have obtained a separate licensing agreement
  15. * ("Other License"), formally executed by you and Linden Lab. Terms of
  16. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  17. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  18. *
  19. * There are special exceptions to the terms and conditions of the GPL as
  20. * it is applied to this Source Code. View the full text of the exception
  21. * in the file doc/FLOSS-exception.txt in this software distribution, or
  22. * online at
  23. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  24. *
  25. * By copying, modifying or distributing this software, you acknowledge
  26. * that you have read and understood your obligations described above,
  27. * and agree to abide by those obligations.
  28. *
  29. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  30. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  31. * COMPLETENESS OR PERFORMANCE.
  32. * $/LicenseInfo$
  33. */
  34. #ifndef LL_LLFLOATERFRIENDS_H
  35. #define LL_LLFLOATERFRIENDS_H
  36. #include "lleventtimer.h"
  37. #include "llfloater.h"
  38. #include "llavatartracker.h"
  39. class LLButton;
  40. class LLFriendObserver;
  41. class LLScrollListCtrl;
  42. class LLScrollListItem;
  43. /**
  44. * @class LLFloaterFriends
  45. * @brief An instance of this class is used for displaying your friends
  46. * and gives you quick access to all agents which a user relationship.
  47. *
  48. * @sa LLFloater
  49. */
  50. class LLFloaterFriends final : public LLFloater,
  51. public LLFloaterSingleton<LLFloaterFriends>,
  52. public LLEventTimer
  53. {
  54. friend class LLUISingleton<LLFloaterFriends, VisibilityPolicy<LLFloater> >;
  55. friend class LLLocalFriendsObserver;
  56. protected:
  57. LOG_CLASS(LLFloaterFriends);
  58. public:
  59. ~LLFloaterFriends() override;
  60. bool postBuild() override;
  61. // LLEventTimer interface
  62. bool tick() override;
  63. private:
  64. // This method is also called by LLLocalFriendsObserver
  65. void updateFriends(U32 changed_mask, const uuid_list_t& buddies);
  66. // Open only via LLFloaterSingleton interface, i.e. showInstance() or
  67. // toggleInstance().
  68. LLFloaterFriends(const LLSD&);
  69. enum FRIENDS_COLUMN_ORDER
  70. {
  71. LIST_ONLINE_STATUS,
  72. LIST_FRIEND_NAME,
  73. LIST_VISIBLE_ONLINE,
  74. LIST_VISIBLE_MAP,
  75. LIST_EDIT_MINE,
  76. LIST_ONLINE_OR_MAP_THEIRS,
  77. LIST_EDIT_THEIRS,
  78. LIST_FRIEND_UPDATE_GEN
  79. };
  80. void refreshNames();
  81. void refreshUI();
  82. void refreshRightsChangeList();
  83. void applyRightsToFriends();
  84. bool addFriend(const LLUUID& agent_id);
  85. bool updateFriendItem(const LLUUID& agent_id);
  86. typedef enum
  87. {
  88. GRANT,
  89. REVOKE
  90. } EGrantRevoke;
  91. typedef fast_hmap<LLUUID, S32> rights_map_t;
  92. void confirmModifyRights(rights_map_t& ids, EGrantRevoke command);
  93. void sendRightsGrant(rights_map_t& ids);
  94. // Returns LLUUID::null if nothing is selected
  95. uuid_vec_t getSelectedIDs();
  96. // Callback methods
  97. static void onSelectName(LLUICtrl* ctrl, void* data);
  98. static bool callbackAddFriendWithMessage(const LLSD& notification,
  99. const LLSD& response);
  100. static void onPickAvatar(const std::vector<std::string>& names,
  101. const std::vector<LLUUID>& ids, void* data);
  102. static void onSearchEdit(const std::string& search_string, void* data);
  103. static void onMaximumSelect(void* data);
  104. static void onClickClose(void* data);
  105. static void onClickProfile(void* data);
  106. static void onClickIM(void* data);
  107. static void onClickOfferTeleport(void* data);
  108. static void onClickRequestTeleport(void* data);
  109. static void onClickPay(void* data);
  110. static void onClickAddFriend(void* data);
  111. static void onClickRemove(void* data);
  112. static void onClickModifyStatus(LLUICtrl* ctrl, void* data);
  113. static bool handleRemove(const LLSD& notification, const LLSD& response);
  114. bool modifyRightsConfirmation(const LLSD& notification,
  115. const LLSD& response, rights_map_t* rights);
  116. private:
  117. LLButton* mIMButton;
  118. LLButton* mProfileButton;
  119. LLButton* mOfferTPButton;
  120. LLButton* mRequestTPButton;
  121. LLButton* mPayButton;
  122. LLButton* mRemoveButton;
  123. LLScrollListCtrl* mFriendsList;
  124. LLScrollListItem* mListComment;
  125. LLFriendObserver* mObserver;
  126. S32 mNumRightsChanged;
  127. LLUUID mAddFriendID;
  128. std::string mAddFriendName;
  129. std::string mFilterString;
  130. };
  131. #endif // LL_LLFLOATERFRIENDS_H