aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpaneldirplaces.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:46 -0500
committerJacek Antonelli2008-08-15 23:44:46 -0500
commit38d6d37f2d982fa959e9e8a4a3f7e1ccfad7b5d4 (patch)
treeadca584755d22ca041a2dbfc35d4eca01f70b32c /linden/indra/newview/llpaneldirplaces.cpp
parentREADME.txt (diff)
downloadmeta-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/llpaneldirplaces.cpp')
-rw-r--r--linden/indra/newview/llpaneldirplaces.cpp168
1 files changed, 168 insertions, 0 deletions
diff --git a/linden/indra/newview/llpaneldirplaces.cpp b/linden/indra/newview/llpaneldirplaces.cpp
new file mode 100644
index 0000000..0082eea
--- /dev/null
+++ b/linden/indra/newview/llpaneldirplaces.cpp
@@ -0,0 +1,168 @@
1/**
2 * @file llpaneldirplaces.cpp
3 * @brief "Places" panel in the Find directory (not popular places, just places)
4 *
5 * Copyright (c) 2001-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#include "llviewerprecompiledheaders.h"
29
30#include "llpaneldirplaces.h"
31
32// linden library includes
33#include "llfontgl.h"
34#include "message.h"
35#include "lldir.h"
36#include "llparcel.h"
37#include "llregionflags.h"
38#include "llqueryflags.h"
39
40// viewer project includes
41#include "llagent.h"
42#include "llbutton.h"
43#include "llcheckboxctrl.h"
44#include "llcombobox.h"
45#include "llfloaterdirectory.h"
46#include "lllineeditor.h"
47#include "llpaneldirbrowser.h"
48#include "lltextbox.h"
49#include "lluiconstants.h"
50#include "llviewercontrol.h"
51#include "llviewermessage.h"
52#include "llworldmap.h"
53
54LLPanelDirPlaces::LLPanelDirPlaces(const std::string& name, LLFloaterDirectory* floater)
55 : LLPanelDirBrowser(name, floater)
56{
57 mMinSearchChars = 3;
58}
59
60BOOL LLPanelDirPlaces::postBuild()
61{
62 LLPanelDirBrowser::postBuild();
63
64 childSetKeystrokeCallback("name", &LLPanelDirBrowser::onKeystrokeName, this);
65
66 childSetAction("Search", &LLPanelDirBrowser::onClickSearchCore, this);
67 childDisable("Search");
68
69 mCurrentSortColumn = "dwell";
70 mCurrentSortAscending = FALSE;
71
72 // Don't prepopulate the places list, as it hurts the database as of 2006-12-04. JC
73 // initialQuery();
74
75 return TRUE;
76}
77
78LLPanelDirPlaces::~LLPanelDirPlaces()
79{
80 // Children all cleaned up by default view destructor.
81}
82
83
84// virtual
85void LLPanelDirPlaces::draw()
86{
87 // You only have a choice if you are mature
88 childSetVisible("incmature", gAgent.mAccess >= SIM_ACCESS_MATURE);
89 childSetValue("incmature", gSavedSettings.getBOOL("ShowMatureSims"));
90
91 LLPanelDirBrowser::draw();
92}
93
94// virtual
95void LLPanelDirPlaces::performQuery()
96{
97 LLString name = childGetValue("name").asString();
98 if (name.length() < mMinSearchChars)
99 {
100 return;
101 }
102
103 LLString catstring = childGetValue("Category").asString();
104
105 // Because LLParcel::C_ANY is -1, must do special check
106 S32 category = 0;
107 if (catstring == "any")
108 {
109 category = LLParcel::C_ANY;
110 }
111 else
112 {
113 category = LLParcel::getCategoryFromString(catstring.c_str());
114 }
115
116 BOOL pg_only = !gSavedSettings.getBOOL("ShowMatureSims")
117 || gAgent.mAccess <= SIM_ACCESS_PG;
118
119 queryCore(name, category, pg_only);
120}
121
122void LLPanelDirPlaces::initialQuery()
123{
124 // All Linden locations in PG/Mature sims, any name.
125 const BOOL pg_only = FALSE;
126 queryCore("", LLParcel::C_LINDEN, pg_only);
127}
128
129void LLPanelDirPlaces::queryCore(const LLString& name,
130 S32 category,
131 BOOL pg_only)
132{
133 setupNewSearch();
134
135 // send the message
136 U32 flags = 0x0;
137
138 if (pg_only)
139 {
140 flags |= DFQ_PG_SIMS_ONLY;
141 }
142
143// JC: Sorting by dwell severely impacts the performance of the query.
144// Instead of sorting on the dataserver, we sort locally once the results
145// are received.
146// IW: Re-enabled dwell sort based on new 3-character minimum description
147// Hopefully we'll move to next-gen Find before this becomes a big problem
148
149 flags |= DFQ_DWELL_SORT;
150
151 LLMessageSystem* msg = gMessageSystem;
152
153 msg->newMessage("DirPlacesQuery");
154 msg->nextBlock("AgentData");
155 msg->addUUID("AgentID", gAgent.getID());
156 msg->addUUID("SessionID", gAgent.getSessionID());
157 msg->nextBlock("QueryData");
158 msg->addUUID("QueryID", getSearchID());
159 msg->addString("QueryText", name);
160 msg->addU32("QueryFlags", flags);
161 msg->addS8("Category", (S8)category);
162 // No longer support queries by region name, too many regions
163 // for combobox, no easy way to do autocomplete. JC
164 msg->addString("SimName", "");
165 msg->addS32Fast(_PREHASH_QueryStart,mSearchStart);
166 gAgent.sendReliableMessage();
167}
168