PageRenderTime 10ms CodeModel.GetById 2ms app.highlight 5ms RepoModel.GetById 1ms app.codeStats 0ms

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