/indra/newview/lloutfitslist.h

https://bitbucket.org/lindenlab/viewer-beta/ · C++ Header · 215 lines · 77 code · 49 blank · 89 comment · 0 complexity · 42a0a76d8b23d081da22914c7b6c162c MD5 · raw file

  1. /**
  2. * @file lloutfitslist.h
  3. * @brief List of agent's outfits for My Appearance side panel.
  4. *
  5. * $LicenseInfo:firstyear=2010&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_LLOUTFITSLIST_H
  27. #define LL_LLOUTFITSLIST_H
  28. #include "llaccordionctrl.h"
  29. #include "llpanel.h"
  30. // newview
  31. #include "llinventorymodel.h"
  32. #include "llpanelappearancetab.h"
  33. class LLAccordionCtrlTab;
  34. class LLInventoryCategoriesObserver;
  35. class LLOutfitListGearMenu;
  36. class LLWearableItemsList;
  37. class LLListContextMenu;
  38. /**
  39. * @class LLOutfitTabNameComparator
  40. *
  41. * Comparator of outfit tabs.
  42. */
  43. class LLOutfitTabNameComparator : public LLAccordionCtrl::LLTabComparator
  44. {
  45. LOG_CLASS(LLOutfitTabNameComparator);
  46. public:
  47. LLOutfitTabNameComparator() {};
  48. virtual ~LLOutfitTabNameComparator() {};
  49. /*virtual*/ bool compare(const LLAccordionCtrlTab* tab1, const LLAccordionCtrlTab* tab2) const;
  50. };
  51. /**
  52. * @class LLOutfitsList
  53. *
  54. * A list of agents's outfits from "My Outfits" inventory category
  55. * which displays each outfit in an accordion tab with a flat list
  56. * of items inside it.
  57. *
  58. * Starts fetching necessary inventory content on first opening.
  59. */
  60. class LLOutfitsList : public LLPanelAppearanceTab
  61. {
  62. public:
  63. typedef boost::function<void (const LLUUID&)> selection_change_callback_t;
  64. typedef boost::signals2::signal<void (const LLUUID&)> selection_change_signal_t;
  65. LLOutfitsList();
  66. virtual ~LLOutfitsList();
  67. /*virtual*/ BOOL postBuild();
  68. /*virtual*/ void onOpen(const LLSD& info);
  69. void refreshList(const LLUUID& category_id);
  70. // highlits currently worn outfit tab text and unhighlights previously worn
  71. void highlightBaseOutfit();
  72. void performAction(std::string action);
  73. void removeSelected();
  74. void setSelectedOutfitByUUID(const LLUUID& outfit_uuid);
  75. /*virtual*/ void setFilterSubString(const std::string& string);
  76. /*virtual*/ bool isActionEnabled(const LLSD& userdata);
  77. const LLUUID& getSelectedOutfitUUID() const { return mSelectedOutfitUUID; }
  78. /*virtual*/ void getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const;
  79. boost::signals2::connection setSelectionChangeCallback(selection_change_callback_t cb);
  80. // Collects selected items from all selected lists and wears them(if possible- adds, else replaces)
  81. void wearSelectedItems();
  82. /**
  83. * Returns true if there is a selection inside currently selected outfit
  84. */
  85. bool hasItemSelected();
  86. private:
  87. void onOutfitsRemovalConfirmation(const LLSD& notification, const LLSD& response);
  88. /**
  89. * Wrapper for LLCommonUtils::computeDifference. @see LLCommonUtils::computeDifference
  90. */
  91. void computeDifference(const LLInventoryModel::cat_array_t& vcats, uuid_vec_t& vadded, uuid_vec_t& vremoved);
  92. /**
  93. * Updates tab displaying outfit identified by category_id.
  94. */
  95. void updateOutfitTab(const LLUUID& category_id);
  96. /**
  97. * Resets previous selection and stores newly selected list and outfit id.
  98. */
  99. void changeOutfitSelection(LLWearableItemsList* list, const LLUUID& category_id);
  100. /**
  101. *Resets items selection inside outfit
  102. */
  103. void resetItemSelection(LLWearableItemsList* list, const LLUUID& category_id);
  104. /**
  105. * Saves newly selected outfit ID.
  106. */
  107. void setSelectedOutfitUUID(const LLUUID& category_id);
  108. /**
  109. * Removes the outfit from selection.
  110. */
  111. void deselectOutfit(const LLUUID& category_id);
  112. /**
  113. * Try restoring selection for a temporary hidden tab.
  114. *
  115. * A tab may be hidden if it doesn't match current filter.
  116. */
  117. void restoreOutfitSelection(LLAccordionCtrlTab* tab, const LLUUID& category_id);
  118. /**
  119. * Called upon list refresh event to update tab visibility depending on
  120. * the results of applying filter to the title and list items of the tab.
  121. */
  122. void onFilteredWearableItemsListRefresh(LLUICtrl* ctrl);
  123. /**
  124. * Highlights filtered items and hides tabs which haven't passed filter.
  125. */
  126. void applyFilter(const std::string& new_filter_substring);
  127. /**
  128. * Applies filter to the given tab
  129. *
  130. * @see applyFilter()
  131. */
  132. void applyFilterToTab(const LLUUID& category_id, LLAccordionCtrlTab* tab, const std::string& filter_substring);
  133. /**
  134. * Returns true if all selected items can be worn.
  135. */
  136. bool canWearSelected();
  137. void onAccordionTabRightClick(LLUICtrl* ctrl, S32 x, S32 y, const LLUUID& cat_id);
  138. void onWearableItemsListRightClick(LLUICtrl* ctrl, S32 x, S32 y);
  139. void onCOFChanged();
  140. void onSelectionChange(LLUICtrl* ctrl);
  141. static void onOutfitRename(const LLSD& notification, const LLSD& response);
  142. LLInventoryCategoriesObserver* mCategoriesObserver;
  143. LLAccordionCtrl* mAccordion;
  144. LLPanel* mListCommands;
  145. typedef std::map<LLUUID, LLWearableItemsList*> wearables_lists_map_t;
  146. typedef wearables_lists_map_t::value_type wearables_lists_map_value_t;
  147. wearables_lists_map_t mSelectedListsMap;
  148. LLUUID mSelectedOutfitUUID;
  149. // id of currently highlited outfit
  150. LLUUID mHighlightedOutfitUUID;
  151. selection_change_signal_t mSelectionChangeSignal;
  152. typedef std::map<LLUUID, LLAccordionCtrlTab*> outfits_map_t;
  153. typedef outfits_map_t::value_type outfits_map_value_t;
  154. outfits_map_t mOutfitsMap;
  155. // IDs of original items which are worn and linked in COF.
  156. // Used to monitor COF changes for updating items worn state. See EXT-8636.
  157. uuid_vec_t mCOFLinkedItems;
  158. LLOutfitListGearMenu* mGearMenu;
  159. LLListContextMenu* mOutfitMenu;
  160. bool mIsInitialized;
  161. /**
  162. * True if there is a selection inside currently selected outfit
  163. */
  164. bool mItemSelected;
  165. };
  166. #endif //LL_LLOUTFITSLIST_H