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/llfloatergroupinfo.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/llfloatergroupinfo.cpp')
-rw-r--r-- | linden/indra/newview/llfloatergroupinfo.cpp | 211 |
1 files changed, 211 insertions, 0 deletions
diff --git a/linden/indra/newview/llfloatergroupinfo.cpp b/linden/indra/newview/llfloatergroupinfo.cpp new file mode 100644 index 0000000..5fc999e --- /dev/null +++ b/linden/indra/newview/llfloatergroupinfo.cpp | |||
@@ -0,0 +1,211 @@ | |||
1 | /** | ||
2 | * @file llfloatergroupinfo.cpp | ||
3 | * @brief LLFloaterGroupInfo 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 | * Floater used both for display of group information and for | ||
30 | * creating new groups. | ||
31 | * | ||
32 | * Help, I'm trapped in a software factory! | ||
33 | */ | ||
34 | |||
35 | #include "llviewerprecompiledheaders.h" | ||
36 | |||
37 | #include "llfloatergroupinfo.h" | ||
38 | |||
39 | #include "llagent.h" | ||
40 | #include "llcachename.h" | ||
41 | #include "llpanelgroup.h" | ||
42 | #include "llviewermessage.h" // for inventory_offer_callback | ||
43 | |||
44 | |||
45 | const char FLOATER_TITLE[] = "Group Information"; | ||
46 | const LLRect FGI_RECT(0, 530, 420, 0); | ||
47 | |||
48 | // | ||
49 | // Globals | ||
50 | // | ||
51 | std::map<LLUUID, LLFloaterGroupInfo*> LLFloaterGroupInfo::sInstances; | ||
52 | |||
53 | //----------------------------------------------------------------------------- | ||
54 | // Implementation | ||
55 | //----------------------------------------------------------------------------- | ||
56 | LLFloaterGroupInfo::LLFloaterGroupInfo(const std::string& name, const LLRect &rect, const std::string& title, const LLUUID& group_id, const std::string& tab_name) | ||
57 | : LLFloater(name, rect, title), | ||
58 | mGroupID( group_id ) | ||
59 | { | ||
60 | // Construct the filename of the group panel xml definition file. | ||
61 | mPanelGroupp = new LLPanelGroup("panel_group.xml", | ||
62 | "PanelGroup", | ||
63 | group_id, | ||
64 | tab_name); | ||
65 | addChild(mPanelGroupp); | ||
66 | } | ||
67 | |||
68 | // virtual | ||
69 | LLFloaterGroupInfo::~LLFloaterGroupInfo() | ||
70 | { | ||
71 | sInstances.erase(mGroupID); | ||
72 | } | ||
73 | |||
74 | BOOL LLFloaterGroupInfo::canClose() | ||
75 | { | ||
76 | // Ask the panel if it is ok to close. | ||
77 | if ( mPanelGroupp ) | ||
78 | { | ||
79 | return mPanelGroupp->canClose(); | ||
80 | } | ||
81 | return TRUE; | ||
82 | } | ||
83 | |||
84 | void LLFloaterGroupInfo::selectTabByName(std::string tab_name) | ||
85 | { | ||
86 | mPanelGroupp->selectTab(tab_name); | ||
87 | } | ||
88 | |||
89 | // static | ||
90 | void LLFloaterGroupInfo::showMyGroupInfo(void *) | ||
91 | { | ||
92 | showFromUUID( gAgent.getGroupID() ); | ||
93 | } | ||
94 | |||
95 | // static | ||
96 | void LLFloaterGroupInfo::showCreateGroup(void *) | ||
97 | { | ||
98 | showFromUUID(LLUUID::null, "general_tab"); | ||
99 | } | ||
100 | |||
101 | // static | ||
102 | void LLFloaterGroupInfo::closeGroup(const LLUUID& group_id) | ||
103 | { | ||
104 | LLFloaterGroupInfo *fgi = get_if_there(sInstances, group_id, (LLFloaterGroupInfo*)NULL); | ||
105 | if (fgi) | ||
106 | { | ||
107 | if (fgi->mPanelGroupp) | ||
108 | { | ||
109 | fgi->mPanelGroupp->close(); | ||
110 | } | ||
111 | } | ||
112 | } | ||
113 | |||
114 | // static | ||
115 | void LLFloaterGroupInfo::closeCreateGroup() | ||
116 | { | ||
117 | closeGroup(LLUUID::null); | ||
118 | } | ||
119 | |||
120 | // static | ||
121 | void LLFloaterGroupInfo::refreshGroup(const LLUUID& group_id) | ||
122 | { | ||
123 | LLFloaterGroupInfo *fgi = get_if_there(sInstances, group_id, (LLFloaterGroupInfo*)NULL); | ||
124 | if (fgi) | ||
125 | { | ||
126 | if (fgi->mPanelGroupp) | ||
127 | { | ||
128 | fgi->mPanelGroupp->refreshData(); | ||
129 | } | ||
130 | } | ||
131 | } | ||
132 | |||
133 | // static | ||
134 | void LLFloaterGroupInfo::callbackLoadGroupName(const LLUUID& id, const char* first, const char* last, BOOL is_group, void* data) | ||
135 | { | ||
136 | LLFloaterGroupInfo *fgi = get_if_there(sInstances, id, (LLFloaterGroupInfo*)NULL); | ||
137 | |||
138 | if (fgi) | ||
139 | { | ||
140 | // Build a new title including the group name. | ||
141 | std::ostringstream title; | ||
142 | title << first << " - " << FLOATER_TITLE; | ||
143 | fgi->setTitle(title.str()); | ||
144 | } | ||
145 | } | ||
146 | |||
147 | // static | ||
148 | void LLFloaterGroupInfo::showFromUUID(const LLUUID& group_id, | ||
149 | const std::string& tab_name) | ||
150 | { | ||
151 | // If we don't have a floater for this group, create one. | ||
152 | LLFloaterGroupInfo *fgi = get_if_there(sInstances, group_id, (LLFloaterGroupInfo*)NULL); | ||
153 | if (!fgi) | ||
154 | { | ||
155 | fgi = new LLFloaterGroupInfo("groupinfo", | ||
156 | FGI_RECT, | ||
157 | FLOATER_TITLE, | ||
158 | group_id, | ||
159 | tab_name); | ||
160 | |||
161 | sInstances[group_id] = fgi; | ||
162 | |||
163 | if (group_id.notNull()) | ||
164 | { | ||
165 | // Look up the group name. | ||
166 | // The callback will insert it into the title. | ||
167 | const BOOL is_group = TRUE; | ||
168 | gCacheName->get(group_id, is_group, callbackLoadGroupName, NULL); | ||
169 | } | ||
170 | } | ||
171 | |||
172 | fgi->selectTabByName(tab_name); | ||
173 | |||
174 | fgi->center(); | ||
175 | fgi->open(); | ||
176 | } | ||
177 | |||
178 | // static | ||
179 | void LLFloaterGroupInfo::showNotice(const char* subject, | ||
180 | const char* message, | ||
181 | const LLUUID& group_id, | ||
182 | const bool& has_inventory, | ||
183 | const char* inventory_name, | ||
184 | LLOfferInfo* inventory_offer) | ||
185 | { | ||
186 | llinfos << "LLFloaterGroupInfo::showNotice : " << subject << llendl; | ||
187 | |||
188 | if (group_id.isNull()) | ||
189 | { | ||
190 | // We need to clean up that inventory offer. | ||
191 | if (inventory_offer) | ||
192 | { | ||
193 | inventory_offer_callback( 1 , inventory_offer); | ||
194 | } | ||
195 | return; | ||
196 | } | ||
197 | |||
198 | // If we don't have a floater for this group, drop this packet on the floor. | ||
199 | LLFloaterGroupInfo *fgi = get_if_there(sInstances, group_id, (LLFloaterGroupInfo*)NULL); | ||
200 | if (!fgi) | ||
201 | { | ||
202 | // We need to clean up that inventory offer. | ||
203 | if (inventory_offer) | ||
204 | { | ||
205 | inventory_offer_callback( 1 , inventory_offer); | ||
206 | } | ||
207 | return; | ||
208 | } | ||
209 | |||
210 | fgi->mPanelGroupp->showNotice(subject,message,has_inventory,inventory_name,inventory_offer); | ||
211 | } | ||