diff options
author | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-08-15 23:44:46 -0500 |
commit | 38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch) | |
tree | adca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llfloateravatarinfo.cpp | |
parent | README.txt (diff) | |
download | meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.zip meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.gz meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.bz2 meta-impy-38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4.tar.xz |
Second Life viewer sources 1.13.2.12
Diffstat (limited to 'linden/indra/newview/llfloateravatarinfo.cpp')
-rw-r--r-- | linden/indra/newview/llfloateravatarinfo.cpp | 300 |
1 files changed, 300 insertions, 0 deletions
diff --git a/linden/indra/newview/llfloateravatarinfo.cpp b/linden/indra/newview/llfloateravatarinfo.cpp new file mode 100644 index 0000000..a429cc2 --- /dev/null +++ b/linden/indra/newview/llfloateravatarinfo.cpp | |||
@@ -0,0 +1,300 @@ | |||
1 | /** | ||
2 | * @file llfloateravatarinfo.cpp | ||
3 | * @brief LLFloaterAvatarInfo class implementation | ||
4 | * | ||
5 | * Copyright (c) 2002-2007, Linden Research, Inc. | ||
6 | * | ||
7 | * The source code in this file ("Source Code") is provided by Linden Lab | ||
8 | * to you under the terms of the GNU General Public License, version 2.0 | ||
9 | * ("GPL"), unless you have obtained a separate licensing agreement | ||
10 | * ("Other License"), formally executed by you and Linden Lab. Terms of | ||
11 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | ||
12 | * online at http://secondlife.com/developers/opensource/gplv2 | ||
13 | * | ||
14 | * There are special exceptions to the terms and conditions of the GPL as | ||
15 | * it is applied to this Source Code. View the full text of the exception | ||
16 | * in the file doc/FLOSS-exception.txt in this software distribution, or | ||
17 | * online at http://secondlife.com/developers/opensource/flossexception | ||
18 | * | ||
19 | * By copying, modifying or distributing this software, you acknowledge | ||
20 | * that you have read and understood your obligations described above, | ||
21 | * and agree to abide by those obligations. | ||
22 | * | ||
23 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | ||
24 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | ||
25 | * COMPLETENESS OR PERFORMANCE. | ||
26 | */ | ||
27 | |||
28 | /** | ||
29 | * Avatar information as shown in a floating window from right-click | ||
30 | * Profile. Used for editing your own avatar info. Just a wrapper | ||
31 | * for LLPanelAvatar, shared with the Find directory. | ||
32 | */ | ||
33 | |||
34 | // system includes | ||
35 | |||
36 | // linden prefix includes | ||
37 | #include "llviewerprecompiledheaders.h" | ||
38 | |||
39 | // self include | ||
40 | #include "llfloateravatarinfo.h" | ||
41 | |||
42 | // linden library includes | ||
43 | #include "llcachename.h" | ||
44 | #include "llfontgl.h" | ||
45 | #include "llinventory.h" | ||
46 | #include "message.h" | ||
47 | |||
48 | // viewer project includes | ||
49 | #include "llagentdata.h" | ||
50 | #include "llbutton.h" | ||
51 | #include "llcallingcard.h" | ||
52 | #include "llcheckboxctrl.h" | ||
53 | #include "llfloaterworldmap.h" | ||
54 | #include "llfloatermute.h" | ||
55 | #include "llfloaterrate.h" | ||
56 | #include "llinventoryview.h" | ||
57 | #include "lllineeditor.h" | ||
58 | #include "llmutelist.h" | ||
59 | #include "llscrolllistctrl.h" | ||
60 | #include "lltabcontainer.h" | ||
61 | #include "llimview.h" | ||
62 | #include "lluiconstants.h" | ||
63 | #include "llviewerobject.h" | ||
64 | #include "llviewerobjectlist.h" | ||
65 | #include "llviewerregion.h" | ||
66 | #include "llviewborder.h" | ||
67 | #include "llinventorymodel.h" | ||
68 | #include "lltextbox.h" | ||
69 | #include "lltexturectrl.h" | ||
70 | #include "llviewertexteditor.h" | ||
71 | #include "llpanelavatar.h" | ||
72 | |||
73 | #include "llvieweruictrlfactory.h" | ||
74 | |||
75 | const char FLOATER_TITLE[] = "Profile"; | ||
76 | const LLRect FAI_RECT(0, 530, 420, 0); | ||
77 | |||
78 | const S32 RULER0 = 90; | ||
79 | const S32 RULER1 = RULER0 + 5; | ||
80 | const S32 RULER2 = RULER1 + 75; | ||
81 | const S32 RULER3 = RULER2 + 90; | ||
82 | const S32 RULER4 = RULER3 + 10; | ||
83 | |||
84 | //----------------------------------------------------------------------------- | ||
85 | // Globals | ||
86 | //----------------------------------------------------------------------------- | ||
87 | |||
88 | LLMap< const LLUUID, LLFloaterAvatarInfo* > gAvatarInfoInstances; | ||
89 | |||
90 | |||
91 | //----------------------------------------------------------------------------- | ||
92 | // Member functions | ||
93 | //----------------------------------------------------------------------------- | ||
94 | |||
95 | //---------------------------------------------------------------------------- | ||
96 | |||
97 | void* LLFloaterAvatarInfo::createPanelAvatar(void* data) | ||
98 | { | ||
99 | LLFloaterAvatarInfo* self = (LLFloaterAvatarInfo*)data; | ||
100 | self->mPanelAvatarp = new LLPanelAvatar("PanelAv", LLRect(), TRUE); // allow edit self | ||
101 | return self->mPanelAvatarp; | ||
102 | } | ||
103 | |||
104 | //---------------------------------------------------------------------------- | ||
105 | |||
106 | |||
107 | // static | ||
108 | void LLFloaterAvatarInfo::onCommitNotes(LLUICtrl*, void* userdata) | ||
109 | { | ||
110 | LLFloaterAvatarInfo* self = (LLFloaterAvatarInfo*)userdata; | ||
111 | |||
112 | self->mPanelAvatarp->sendAvatarNotesUpdate(); | ||
113 | } | ||
114 | |||
115 | BOOL LLFloaterAvatarInfo::postBuild() | ||
116 | { | ||
117 | |||
118 | return TRUE; | ||
119 | } | ||
120 | |||
121 | LLFloaterAvatarInfo::LLFloaterAvatarInfo(const std::string& name, const LLRect &rect, const LLUUID &avatar_id) | ||
122 | : LLPreview(name, rect, FLOATER_TITLE, LLUUID::null, LLUUID::null), | ||
123 | mAvatarID( avatar_id ), | ||
124 | mSuggestedOnlineStatus(ONLINE_STATUS_UNKNOWN) | ||
125 | { | ||
126 | mAutoFocus = TRUE; | ||
127 | |||
128 | LLCallbackMap::map_t factory_map; | ||
129 | |||
130 | factory_map["Panel Avatar"] = LLCallbackMap(createPanelAvatar, this); | ||
131 | |||
132 | gUICtrlFactory->buildFloater(this, "floater_profile.xml", &factory_map); | ||
133 | |||
134 | |||
135 | if(mPanelAvatarp) | ||
136 | { | ||
137 | mPanelAvatarp->selectTab(0); | ||
138 | } | ||
139 | |||
140 | gAvatarInfoInstances.addData(avatar_id, this); | ||
141 | |||
142 | |||
143 | } | ||
144 | |||
145 | // virtual | ||
146 | LLFloaterAvatarInfo::~LLFloaterAvatarInfo() | ||
147 | { | ||
148 | // child views automatically deleted | ||
149 | gAvatarInfoInstances.removeData(mAvatarID); | ||
150 | |||
151 | } | ||
152 | |||
153 | void LLFloaterAvatarInfo::resetGroupList() | ||
154 | { | ||
155 | // only get these updates asynchronously via the group floater, which works on the agent only | ||
156 | if (mAvatarID != gAgentID) | ||
157 | { | ||
158 | return; | ||
159 | } | ||
160 | |||
161 | mPanelAvatarp->resetGroupList(); | ||
162 | } | ||
163 | |||
164 | |||
165 | // Open profile to a certian tab. | ||
166 | // static | ||
167 | void LLFloaterAvatarInfo::showFromObject(const LLUUID &avatar_id, std::string tab_name) | ||
168 | { | ||
169 | if(avatar_id.isNull()) | ||
170 | { | ||
171 | return; | ||
172 | } | ||
173 | |||
174 | LLFloaterAvatarInfo *floater = NULL; | ||
175 | if (gAvatarInfoInstances.checkData(avatar_id)) | ||
176 | { | ||
177 | // ...bring that window to front | ||
178 | floater = gAvatarInfoInstances.getData(avatar_id); | ||
179 | } | ||
180 | else | ||
181 | { | ||
182 | floater = new LLFloaterAvatarInfo("avatarinfo", FAI_RECT, | ||
183 | avatar_id); | ||
184 | floater->center(); | ||
185 | floater->mPanelAvatarp->setAvatarID(avatar_id, "", ONLINE_STATUS_UNKNOWN); | ||
186 | |||
187 | } | ||
188 | |||
189 | floater->mPanelAvatarp->selectTabByName(tab_name); | ||
190 | floater->open(); | ||
191 | } | ||
192 | |||
193 | // static | ||
194 | void LLFloaterAvatarInfo::showFromDirectory(const LLUUID &avatar_id) | ||
195 | { | ||
196 | if(avatar_id.isNull()) | ||
197 | { | ||
198 | return; | ||
199 | } | ||
200 | |||
201 | LLFloaterAvatarInfo *floater; | ||
202 | if (gAvatarInfoInstances.checkData(avatar_id)) | ||
203 | { | ||
204 | // ...bring that window to front | ||
205 | floater = gAvatarInfoInstances.getData(avatar_id); | ||
206 | floater->open(); | ||
207 | } | ||
208 | else | ||
209 | { | ||
210 | floater = new LLFloaterAvatarInfo("avatarinfo", FAI_RECT, | ||
211 | avatar_id); | ||
212 | floater->center(); | ||
213 | floater->mPanelAvatarp->setAvatarID(avatar_id, "", ONLINE_STATUS_UNKNOWN); | ||
214 | floater->open(); | ||
215 | } | ||
216 | if(floater) | ||
217 | { | ||
218 | floater->mPanelAvatarp->disableRate(); | ||
219 | } | ||
220 | } | ||
221 | |||
222 | |||
223 | // static | ||
224 | void LLFloaterAvatarInfo::showFromAvatar(LLViewerObject *avatar) | ||
225 | { | ||
226 | if (gAvatarInfoInstances.checkData(avatar->getID())) | ||
227 | { | ||
228 | // ...bring that window to front | ||
229 | LLFloaterAvatarInfo *f = gAvatarInfoInstances.getData(avatar->getID()); | ||
230 | f->open(); | ||
231 | } | ||
232 | else | ||
233 | { | ||
234 | LLFloaterAvatarInfo *floater = new LLFloaterAvatarInfo("avatarinfo", FAI_RECT, | ||
235 | avatar->getID() ); | ||
236 | floater->center(); | ||
237 | floater->open(); | ||
238 | } | ||
239 | } | ||
240 | |||
241 | |||
242 | // static | ||
243 | void LLFloaterAvatarInfo::showFromFriend(const LLUUID& agent_id, BOOL online) | ||
244 | { | ||
245 | if(agent_id.isNull()) | ||
246 | { | ||
247 | return; | ||
248 | } | ||
249 | if (gAvatarInfoInstances.checkData( agent_id )) | ||
250 | { | ||
251 | // ...bring that window to front | ||
252 | LLFloaterAvatarInfo *f = gAvatarInfoInstances.getData( agent_id ); | ||
253 | f->open(); | ||
254 | } | ||
255 | else | ||
256 | { | ||
257 | LLFloaterAvatarInfo *floater = new LLFloaterAvatarInfo("avatarinfo", FAI_RECT, | ||
258 | agent_id); | ||
259 | floater->center(); | ||
260 | floater->mSuggestedOnlineStatus = online ? ONLINE_STATUS_YES : ONLINE_STATUS_NO; | ||
261 | } | ||
262 | } | ||
263 | |||
264 | |||
265 | void LLFloaterAvatarInfo::showProfileCallback(S32 option, void *userdata) | ||
266 | { | ||
267 | if (option == 0) | ||
268 | { | ||
269 | showFromObject(gAgentID); | ||
270 | } | ||
271 | } | ||
272 | |||
273 | |||
274 | //// virtual | ||
275 | void LLFloaterAvatarInfo::draw() | ||
276 | { | ||
277 | LLFloater::draw(); | ||
278 | } | ||
279 | |||
280 | LLFloaterAvatarInfo* LLFloaterAvatarInfo::getInstance(const LLUUID &id) | ||
281 | { | ||
282 | return gAvatarInfoInstances.getIfThere(gAgentID); | ||
283 | } | ||
284 | |||
285 | void LLFloaterAvatarInfo::loadAsset() | ||
286 | { | ||
287 | if (mPanelAvatarp) { | ||
288 | mPanelAvatarp->setAvatarID(mAvatarID, "", mSuggestedOnlineStatus); | ||
289 | mAssetStatus = PREVIEW_ASSET_LOADING; | ||
290 | } | ||
291 | } | ||
292 | |||
293 | LLPreview::EAssetStatus LLFloaterAvatarInfo::getAssetStatus() | ||
294 | { | ||
295 | if (mPanelAvatarp && mPanelAvatarp->haveData()) | ||
296 | { | ||
297 | mAssetStatus = PREVIEW_ASSET_LOADED; | ||
298 | } | ||
299 | return mAssetStatus; | ||
300 | } | ||