/indra/newview/lloutfitobserver.h

https://bitbucket.org/lindenlab/viewer-beta/ · C++ Header · 96 lines · 37 code · 25 blank · 34 comment · 0 complexity · 066f4b03a38cd8519b64b99d26a5d995 MD5 · raw file

  1. /**
  2. * @file lloutfitobserver.h
  3. * @brief Outfit observer facade.
  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_OUTFITOBSERVER_H
  27. #define LL_OUTFITOBSERVER_H
  28. #include "llsingleton.h"
  29. #include "llmd5.h"
  30. /**
  31. * Outfit observer facade that provides simple possibility to subscribe on
  32. * BOF(base outfit) replaced, BOF changed, COF(current outfit) changed events.
  33. */
  34. class LLOutfitObserver: public LLInventoryObserver, public LLSingleton<LLOutfitObserver>
  35. {
  36. public:
  37. virtual ~LLOutfitObserver();
  38. friend class LLSingleton<LLOutfitObserver>;
  39. virtual void changed(U32 mask);
  40. void notifyOutfitLockChanged() { mOutfitLockChanged(); }
  41. typedef boost::signals2::signal<void (void)> signal_t;
  42. void addBOFReplacedCallback(const signal_t::slot_type& cb) { mBOFReplaced.connect(cb); }
  43. void addBOFChangedCallback(const signal_t::slot_type& cb) { mBOFChanged.connect(cb); }
  44. void addCOFChangedCallback(const signal_t::slot_type& cb) { mCOFChanged.connect(cb); }
  45. void addCOFSavedCallback(const signal_t::slot_type& cb) { mCOFSaved.connect(cb); }
  46. void addOutfitLockChangedCallback(const signal_t::slot_type& cb) { mOutfitLockChanged.connect(cb); }
  47. protected:
  48. LLOutfitObserver();
  49. /** Get a version of an inventory category specified by its UUID */
  50. static S32 getCategoryVersion(const LLUUID& cat_id);
  51. static const std::string& getCategoryName(const LLUUID& cat_id);
  52. bool checkCOF();
  53. void checkBaseOutfit();
  54. //last version number of a COF category
  55. S32 mCOFLastVersion;
  56. LLUUID mBaseOutfitId;
  57. S32 mBaseOutfitLastVersion;
  58. std::string mLastBaseOutfitName;
  59. bool mLastOutfitDirtiness;
  60. LLMD5 mItemNameHash;
  61. private:
  62. signal_t mBOFReplaced;
  63. signal_t mBOFChanged;
  64. signal_t mCOFChanged;
  65. signal_t mCOFSaved;
  66. /**
  67. * Signal for changing state of outfit lock.
  68. */
  69. signal_t mOutfitLockChanged;
  70. };
  71. #endif /* LL_OUTFITOBSERVER_H */