aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview
diff options
context:
space:
mode:
authorMcCabe Maxsted2010-06-05 11:23:13 -0700
committerJacek Antonelli2010-06-19 02:43:31 -0500
commitf96a6b0675c218b3671085e5c228eb52a1718906 (patch)
tree3e4b271c15c7bfce830fc2a5cb9b99aa315a233c /linden/indra/newview
parentUpdated llcharacter with some bits from Emerald and SnowGlobe (diff)
downloadmeta-impy-f96a6b0675c218b3671085e5c228eb52a1718906.zip
meta-impy-f96a6b0675c218b3671085e5c228eb52a1718906.tar.gz
meta-impy-f96a6b0675c218b3671085e5c228eb52a1718906.tar.bz2
meta-impy-f96a6b0675c218b3671085e5c228eb52a1718906.tar.xz
Ported group titles window from the Cool Viewer and placed it in the groups list
Diffstat (limited to 'linden/indra/newview')
-rw-r--r--linden/indra/newview/CMakeLists.txt3
-rw-r--r--linden/indra/newview/app_settings/settings.xml16
-rw-r--r--linden/indra/newview/hbfloatergrouptitles.cpp246
-rw-r--r--linden/indra/newview/hbfloatergrouptitles.h82
-rw-r--r--linden/indra/newview/llfloatergroups.cpp15
-rw-r--r--linden/indra/newview/llfloatergroups.h2
-rw-r--r--linden/indra/newview/skins/default/xui/en-us/floater_group_titles.xml17
-rw-r--r--linden/indra/newview/skins/default/xui/en-us/panel_groups.xml2
8 files changed, 383 insertions, 0 deletions
diff --git a/linden/indra/newview/CMakeLists.txt b/linden/indra/newview/CMakeLists.txt
index 6be53a4..796e98e 100644
--- a/linden/indra/newview/CMakeLists.txt
+++ b/linden/indra/newview/CMakeLists.txt
@@ -69,6 +69,7 @@ set(viewer_SOURCE_FILES
69 floaterao.cpp 69 floaterao.cpp
70 floaterbusy.cpp 70 floaterbusy.cpp
71 floaterlogin.cpp 71 floaterlogin.cpp
72 hbfloatergrouptitles.cpp
72 hippoGridManager.cpp 73 hippoGridManager.cpp
73 hippoLimits.cpp 74 hippoLimits.cpp
74 hippoRestRequest.cpp 75 hippoRestRequest.cpp
@@ -496,6 +497,7 @@ set(viewer_HEADER_FILES
496 floaterao.h 497 floaterao.h
497 floaterbusy.h 498 floaterbusy.h
498 floaterlogin.h 499 floaterlogin.h
500 hbfloatergrouptitles.h
499 hippoGridManager.h 501 hippoGridManager.h
500 hippoLimits.h 502 hippoLimits.h
501 hippoRestRequest.h 503 hippoRestRequest.h
@@ -1122,6 +1124,7 @@ set(viewer_XUI_FILES
1122 skins/default/xui/en-us/floater_gesture.xml 1124 skins/default/xui/en-us/floater_gesture.xml
1123 skins/default/xui/en-us/floater_god_tools.xml 1125 skins/default/xui/en-us/floater_god_tools.xml
1124 skins/default/xui/en-us/floater_group_info.xml 1126 skins/default/xui/en-us/floater_group_info.xml
1127 skins/default/xui/en-us/floater_group_titles.xml
1125 skins/default/xui/en-us/floater_hardware_settings.xml 1128 skins/default/xui/en-us/floater_hardware_settings.xml
1126 skins/default/xui/en-us/floater_html.xml 1129 skins/default/xui/en-us/floater_html.xml
1127 skins/default/xui/en-us/floater_html_simple.xml 1130 skins/default/xui/en-us/floater_html_simple.xml
diff --git a/linden/indra/newview/app_settings/settings.xml b/linden/indra/newview/app_settings/settings.xml
index 7ce768b..32b29d0 100644
--- a/linden/indra/newview/app_settings/settings.xml
+++ b/linden/indra/newview/app_settings/settings.xml
@@ -141,6 +141,22 @@
141 <integer>0</integer> 141 <integer>0</integer>
142 </array> 142 </array>
143 </map> 143 </map>
144 <key>FloaterGroupTitlesRect</key>
145 <map>
146 <key>Comment</key>
147 <string>Rectangle for group titles window</string>
148 <key>Persist</key>
149 <integer>1</integer>
150 <key>Type</key>
151 <string>Rect</string>
152 <key>Value</key>
153 <array>
154 <integer>0</integer>
155 <integer>400</integer>
156 <integer>500</integer>
157 <integer>0</integer>
158 </array>
159 </map>
144 <key>FloaterPrimImport</key> 160 <key>FloaterPrimImport</key>
145 <map> 161 <map>
146 <key>Comment</key> 162 <key>Comment</key>
diff --git a/linden/indra/newview/hbfloatergrouptitles.cpp b/linden/indra/newview/hbfloatergrouptitles.cpp
new file mode 100644
index 0000000..bd6de9e
--- /dev/null
+++ b/linden/indra/newview/hbfloatergrouptitles.cpp
@@ -0,0 +1,246 @@
1/**
2 * @file hbfloatergrouptitles.h
3 * @brief HBFloaterGroupTitles class implementation
4 *
5 * This class implements a floater where all available group titles are
6 * listed, allowing the user to activate any via simple double-click.
7 *
8 * $LicenseInfo:firstyear=2010&license=viewergpl$
9 *
10 * Copyright (c) 2010, Henri Beauchamp.
11 *
12 * Second Life Viewer Source Code
13 * The source code in this file ("Source Code") is provided by Linden Lab
14 * to you under the terms of the GNU General Public License, version 2.0
15 * ("GPL"), unless you have obtained a separate licensing agreement
16 * ("Other License"), formally executed by you and Linden Lab. Terms of
17 * the GPL can be found in doc/GPL-license.txt in this distribution, or
18 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
19 *
20 * There are special exceptions to the terms and conditions of the GPL as
21 * it is applied to this Source Code. View the full text of the exception
22 * in the file doc/FLOSS-exception.txt in this software distribution, or
23 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
24 *
25 * By copying, modifying or distributing this software, you acknowledge
26 * that you have read and understood your obligations described above,
27 * and agree to abide by those obligations.
28 *
29 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
30 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
31 * COMPLETENESS OR PERFORMANCE.
32 * $/LicenseInfo$
33 */
34
35#include "llviewerprecompiledheaders.h"
36
37#include "message.h"
38#include "roles_constants.h"
39
40#include "hbfloatergrouptitles.h"
41
42#include "llagent.h"
43#include "lluictrlfactory.h"
44#include "llviewercontrol.h"
45
46// static variable
47HBFloaterGroupTitles* HBFloaterGroupTitles::sInstance = NULL;
48
49// helper function
50void update_titles_list(HBFloaterGroupTitles* self);
51
52
53// HBFloaterGroupTitlesObserver class
54
55HBFloaterGroupTitlesObserver::HBFloaterGroupTitlesObserver(HBFloaterGroupTitles* instance, const LLUUID& group_id)
56: LLGroupMgrObserver(group_id),
57 mFloaterInstance(instance)
58{
59 LLGroupMgr::getInstance()->addObserver(this);
60}
61
62// virtual
63HBFloaterGroupTitlesObserver::~HBFloaterGroupTitlesObserver()
64{
65 LLGroupMgr::getInstance()->removeObserver(this);
66}
67
68// virtual
69void HBFloaterGroupTitlesObserver::changed(LLGroupChange gc)
70{
71 if (gc == GC_TITLES)
72 {
73 update_titles_list(mFloaterInstance);
74 }
75}
76
77
78// HBFloaterGroupTitles class
79
80HBFloaterGroupTitles::HBFloaterGroupTitles()
81: LLFloater(std::string("group titles")),
82 mFirstUse(true)
83{
84 LLUICtrlFactory::getInstance()->buildFloater(this, "floater_group_titles.xml", NULL);
85 sInstance = this;
86}
87
88// virtual
89HBFloaterGroupTitles::~HBFloaterGroupTitles()
90{
91 while (!mObservers.empty())
92 {
93 HBFloaterGroupTitlesObserver* observer = mObservers.back();
94 delete observer;
95 mObservers.pop_back();
96 }
97 sInstance = NULL;
98}
99
100// static
101void HBFloaterGroupTitles::toggle()
102{
103 // I hate things that don't toggle -- MC
104 if (!sInstance)
105 {
106 sInstance = new HBFloaterGroupTitles();
107 sInstance->setFocus(TRUE);
108 sInstance->open();
109 }
110 else
111 {
112 if (sInstance->getVisible())
113 {
114 sInstance->close();
115 }
116 else
117 {
118 sInstance->open();
119 }
120 }
121}
122
123BOOL HBFloaterGroupTitles::postBuild()
124{
125 mTitlesList = getChild<LLScrollListCtrl>("titles_list");
126 if (!mTitlesList)
127 {
128 return FALSE;
129 }
130 mTitlesList->setCallbackUserData(this);
131 mTitlesList->setDoubleClickCallback(onActivate);
132 childSetAction("activate", onActivate, this);
133 update_titles_list(this);
134 return TRUE;
135}
136
137// static
138void HBFloaterGroupTitles::onActivate(void* userdata)
139{
140 HBFloaterGroupTitles* self = (HBFloaterGroupTitles*) userdata;
141 LLScrollListItem *item = self->mTitlesList->getFirstSelected();
142 if (!item) return;
143
144 // Set the group if needed.
145 LLUUID old_group_id = gAgent.getGroupID();
146 LLUUID group_id = item->getColumn(LIST_GROUP_ID)->getValue().asUUID();
147 if (group_id != old_group_id)
148 {
149 LLMessageSystem* msg = gMessageSystem;
150 msg->newMessageFast(_PREHASH_ActivateGroup);
151 msg->nextBlockFast(_PREHASH_AgentData);
152 msg->addUUIDFast(_PREHASH_AgentID, gAgent.getID());
153 msg->addUUIDFast(_PREHASH_SessionID, gAgent.getSessionID());
154 msg->addUUIDFast(_PREHASH_GroupID, group_id);
155 gAgent.sendReliableMessage();
156 }
157
158 // Set the title
159 LLGroupMgr::getInstance()->sendGroupTitleUpdate(group_id, item->getUUID());
160 // Force a refresh via the observer
161 if (group_id == LLUUID::null)
162 {
163 group_id = old_group_id;
164 }
165 LLGroupMgr::getInstance()->sendGroupTitlesRequest(group_id);
166}
167
168void update_titles_list(HBFloaterGroupTitles* self)
169{
170 S32 i;
171 S32 count = gAgent.mGroups.count();
172 LLUUID id;
173 LLUUID highlight_id = LLUUID::null;
174 LLUUID current_group_id = gAgent.getGroupID();
175 std::vector<LLGroupTitle>::const_iterator citer;
176 std::string style;
177 LLGroupData* group_datap;
178 LLGroupMgrGroupData* gmgr_datap;
179
180 if (!self || !self->mTitlesList) return;
181 LLCtrlListInterface *title_list = self->mTitlesList->getListInterface();
182
183 self->mTitlesList->deleteAllItems();
184
185 for (i = 0; i < count; ++i)
186 {
187 group_datap = &gAgent.mGroups.get(i);
188 id = group_datap->mID;
189 if (self->mFirstUse)
190 {
191 HBFloaterGroupTitlesObserver* observer = new HBFloaterGroupTitlesObserver(self, id);
192 self->mObservers.push_back(observer);
193 }
194 gmgr_datap = LLGroupMgr::getInstance()->getGroupData(id);
195 if (!gmgr_datap)
196 {
197 LLGroupMgr::getInstance()->sendGroupTitlesRequest(id);
198 continue;
199 }
200 for (citer = gmgr_datap->mTitles.begin(); citer != gmgr_datap->mTitles.end(); citer++)
201 {
202 style = "NORMAL";
203 if (current_group_id == id && citer->mSelected)
204 {
205 style = "BOLD";
206 highlight_id = citer->mRoleID;
207 }
208 LLSD element;
209 element["id"] = citer->mRoleID;
210 element["columns"][LIST_TITLE]["column"] = "title";
211 element["columns"][LIST_TITLE]["value"] = citer->mTitle;
212 element["columns"][LIST_TITLE]["font-style"] = style;
213 element["columns"][LIST_GROUP_NAME]["column"] = "group_name";
214 element["columns"][LIST_GROUP_NAME]["value"] = group_datap->mName;
215 element["columns"][LIST_GROUP_NAME]["font-style"] = style;
216 element["columns"][LIST_GROUP_ID]["column"] = "group_id";
217 element["columns"][LIST_GROUP_ID]["value"] = id;
218
219 title_list->addElement(element, ADD_SORTED);
220 }
221 }
222
223 // add "none" to list at top
224 {
225 style = "NORMAL";
226 if (current_group_id.isNull())
227 {
228 style = "BOLD";
229 }
230 LLSD element;
231 element["id"] = LLUUID::null;
232 element["columns"][LIST_TITLE]["column"] = "title";
233 element["columns"][LIST_TITLE]["value"] = "none";
234 element["columns"][LIST_TITLE]["font-style"] = style;
235 element["columns"][LIST_GROUP_NAME]["column"] = "group_name";
236 element["columns"][LIST_GROUP_NAME]["value"] = "none";
237 element["columns"][LIST_GROUP_NAME]["font-style"] = style;
238 element["columns"][LIST_GROUP_ID]["column"] = "group_id";
239 element["columns"][LIST_GROUP_ID]["value"] = LLUUID::null;
240
241 title_list->addElement(element, ADD_TOP);
242 }
243
244 title_list->selectByValue(highlight_id);
245 self->mFirstUse = false;
246}
diff --git a/linden/indra/newview/hbfloatergrouptitles.h b/linden/indra/newview/hbfloatergrouptitles.h
new file mode 100644
index 0000000..fbfd33c
--- /dev/null
+++ b/linden/indra/newview/hbfloatergrouptitles.h
@@ -0,0 +1,82 @@
1/**
2 * @file hbfloatergrouptitles.h
3 * @brief HBFloaterGroupTitles class definition
4 *
5 * This class implements a floater where all available group titles are
6 * listed, allowing the user to activate any via simple double-click.
7 *
8 * $LicenseInfo:firstyear=2010&license=viewergpl$
9 *
10 * Copyright (c) 2010, Henri Beauchamp.
11 *
12 * Second Life Viewer Source Code
13 * The source code in this file ("Source Code") is provided by Linden Lab
14 * to you under the terms of the GNU General Public License, version 2.0
15 * ("GPL"), unless you have obtained a separate licensing agreement
16 * ("Other License"), formally executed by you and Linden Lab. Terms of
17 * the GPL can be found in doc/GPL-license.txt in this distribution, or
18 * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
19 *
20 * There are special exceptions to the terms and conditions of the GPL as
21 * it is applied to this Source Code. View the full text of the exception
22 * in the file doc/FLOSS-exception.txt in this software distribution, or
23 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception
24 *
25 * By copying, modifying or distributing this software, you acknowledge
26 * that you have read and understood your obligations described above,
27 * and agree to abide by those obligations.
28 *
29 * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
30 * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
31 * COMPLETENESS OR PERFORMANCE.
32 * $/LicenseInfo$
33 */
34
35#ifndef LL_HBFLOATERGROUPTITLES_H
36#define LL_HBFLOATERGROUPTITLES_H
37
38#include "llfloater.h"
39#include "llgroupmgr.h"
40#include "llscrolllistctrl.h"
41
42enum TITLES_COLUMN_ORDER
43{
44 LIST_TITLE,
45 LIST_GROUP_NAME,
46 LIST_GROUP_ID
47};
48class HBFloaterGroupTitles;
49
50class HBFloaterGroupTitlesObserver : public LLGroupMgrObserver
51{
52public:
53 HBFloaterGroupTitlesObserver(HBFloaterGroupTitles* instance, const LLUUID& group_id);
54 /* virtual */ ~HBFloaterGroupTitlesObserver();
55
56 /* virtual */ void changed(LLGroupChange gc);
57
58private:
59 HBFloaterGroupTitles* mFloaterInstance;
60};
61
62class HBFloaterGroupTitles : public LLFloater
63{
64public:
65 HBFloaterGroupTitles();
66 virtual ~HBFloaterGroupTitles();
67
68 static void toggle();
69
70 BOOL postBuild();
71
72 bool mFirstUse;
73 LLScrollListCtrl* mTitlesList;
74 std::vector<HBFloaterGroupTitlesObserver*> mObservers;
75
76private:
77 static void onActivate(void* data);
78
79 static HBFloaterGroupTitles* sInstance;
80};
81
82#endif
diff --git a/linden/indra/newview/llfloatergroups.cpp b/linden/indra/newview/llfloatergroups.cpp
index e94734d..f00489c 100644
--- a/linden/indra/newview/llfloatergroups.cpp
+++ b/linden/indra/newview/llfloatergroups.cpp
@@ -45,6 +45,7 @@
45#include "message.h" 45#include "message.h"
46#include "roles_constants.h" 46#include "roles_constants.h"
47 47
48#include "hbfloatergrouptitles.h"
48#include "llagent.h" 49#include "llagent.h"
49#include "llbutton.h" 50#include "llbutton.h"
50#include "llfloatergroupinfo.h" 51#include "llfloatergroupinfo.h"
@@ -233,6 +234,8 @@ BOOL LLPanelGroups::postBuild()
233 234
234 childSetAction("Invite...", onBtnInvite, this); 235 childSetAction("Invite...", onBtnInvite, this);
235 236
237 childSetAction("Titles...", onBtnTitles, this);
238
236 setDefaultBtn("IM"); 239 setDefaultBtn("IM");
237 240
238 childSetDoubleClickCallback("group list", onBtnIM); 241 childSetDoubleClickCallback("group list", onBtnIM);
@@ -333,6 +336,12 @@ void LLPanelGroups::onBtnSearch(void* userdata)
333 if(self) self->search(); 336 if(self) self->search();
334} 337}
335 338
339void LLPanelGroups::onBtnTitles(void* userdata)
340{
341 LLPanelGroups* self = (LLPanelGroups*)userdata;
342 if(self) self->titles();
343}
344
336void LLPanelGroups::create() 345void LLPanelGroups::create()
337{ 346{
338 llinfos << "LLPanelGroups::create" << llendl; 347 llinfos << "LLPanelGroups::create" << llendl;
@@ -440,6 +449,12 @@ void LLPanelGroups::invite()
440 LLFloaterGroupInvite::showForGroup(group_id); 449 LLFloaterGroupInvite::showForGroup(group_id);
441} 450}
442 451
452void LLPanelGroups::titles()
453{
454 HBFloaterGroupTitles::toggle();
455}
456
457
443// static 458// static
444bool LLPanelGroups::callbackLeaveGroup(const LLSD& notification, const LLSD& response) 459bool LLPanelGroups::callbackLeaveGroup(const LLSD& notification, const LLSD& response)
445{ 460{
diff --git a/linden/indra/newview/llfloatergroups.h b/linden/indra/newview/llfloatergroups.h
index e3c3e26..c0d06e7 100644
--- a/linden/indra/newview/llfloatergroups.h
+++ b/linden/indra/newview/llfloatergroups.h
@@ -112,6 +112,7 @@ protected:
112 static void onBtnSearch(void* userdata); 112 static void onBtnSearch(void* userdata);
113 static void onBtnVote(void* userdata); 113 static void onBtnVote(void* userdata);
114 static void onBtnInvite(void* userdata); 114 static void onBtnInvite(void* userdata);
115 static void onBtnTitles(void* userdata);
115 static void onDoubleClickGroup(void* userdata); 116 static void onDoubleClickGroup(void* userdata);
116 117
117 void create(); 118 void create();
@@ -122,6 +123,7 @@ protected:
122 void search(); 123 void search();
123 void callVote(); 124 void callVote();
124 void invite(); 125 void invite();
126 void titles();
125 127
126 static bool callbackLeaveGroup(const LLSD& notification, const LLSD& response); 128 static bool callbackLeaveGroup(const LLSD& notification, const LLSD& response);
127 129
diff --git a/linden/indra/newview/skins/default/xui/en-us/floater_group_titles.xml b/linden/indra/newview/skins/default/xui/en-us/floater_group_titles.xml
new file mode 100644
index 0000000..5ec037f
--- /dev/null
+++ b/linden/indra/newview/skins/default/xui/en-us/floater_group_titles.xml
@@ -0,0 +1,17 @@
1<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
2<floater name="goup titles" title="Group Titles" rect_control="FloaterGroupTitlesRect"
3 can_close="true" can_drag_on_left="false" can_minimize="true" can_resize="true"
4 min_width="300" min_height="150" width="400" height="500">
5 <scroll_list name="titles_list" can_resize="true" multi_select="false"
6 background_visible="true" draw_border="true" draw_stripes="true" draw_heading="true"
7 height="450" width="380" bottom_delta="-470" top="10" left="10" follows="left|top|right|bottom">
8 <column name="title" label="Title" dynamicwidth="true" />
9 <column name="group_name" label="Group" dynamicwidth="true" />
10 <!--Hidden field, used as storage for UUID, please keep at width 0-->
11 <column name="group_id" label="" width="0" />
12 </scroll_list>
13 <button name="activate" label="Activate" tool_tip="Activate the selected group title"
14 enabled="true" mouse_opaque="true" font="SansSerif" halign="center"
15 height="20" width="90" bottom_delta="-24" left="10" follows="left|bottom"
16 />
17</floater>
diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_groups.xml b/linden/indra/newview/skins/default/xui/en-us/panel_groups.xml
index 0bc7866..e6b78fb 100644
--- a/linden/indra/newview/skins/default/xui/en-us/panel_groups.xml
+++ b/linden/indra/newview/skins/default/xui/en-us/panel_groups.xml
@@ -26,6 +26,8 @@
26 tool_tip="Open Instant Message session" width="80" /> 26 tool_tip="Open Instant Message session" width="80" />
27 <button bottom_delta="-25" follows="top|right" font="SansSerif" height="22" 27 <button bottom_delta="-25" follows="top|right" font="SansSerif" height="22"
28 label="Activate" name="Activate" width="80" /> 28 label="Activate" name="Activate" width="80" />
29 <button bottom_delta="-25" follows="top|right" font="SansSerif" height="22"
30 label="Titles..." name="Titles..." width="80" />
29 <button bottom_delta="-25" follows="top|right" font="SansSerif" height="22" 31 <button bottom_delta="-25" follows="top|right" font="SansSerif" height="22"
30 label="Invite..." name="Invite..." width="80" /> 32 label="Invite..." name="Invite..." width="80" />
31 <button bottom_delta="-25" follows="top|right" font="SansSerif" height="22" 33 <button bottom_delta="-25" follows="top|right" font="SansSerif" height="22"