aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview/llpaneldirplaces.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:54 -0500
committerJacek Antonelli2008-08-15 23:45:54 -0500
commitd0b03a62fd799317d5da0bd56615739ce3b5b052 (patch)
tree8bc79bbbb52e18294f62810d9fa66ce136f90e2d /linden/indra/newview/llpaneldirplaces.cpp
parentSecond Life viewer sources 1.20.8 (diff)
downloadmeta-impy-d0b03a62fd799317d5da0bd56615739ce3b5b052.zip
meta-impy-d0b03a62fd799317d5da0bd56615739ce3b5b052.tar.gz
meta-impy-d0b03a62fd799317d5da0bd56615739ce3b5b052.tar.bz2
meta-impy-d0b03a62fd799317d5da0bd56615739ce3b5b052.tar.xz
Second Life viewer sources 1.20.9
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llpaneldirplaces.cpp168
1 files changed, 152 insertions, 16 deletions
diff --git a/linden/indra/newview/llpaneldirplaces.cpp b/linden/indra/newview/llpaneldirplaces.cpp
index 3980fb4..b75218b 100644
--- a/linden/indra/newview/llpaneldirplaces.cpp
+++ b/linden/indra/newview/llpaneldirplaces.cpp
@@ -33,37 +33,173 @@
33 33
34#include "llpaneldirplaces.h" 34#include "llpaneldirplaces.h"
35 35
36#include "llwebbrowserctrl.h" 36// linden library includes
37//#include "llfontgl.h"
38#include "message.h"
39//#include "lldir.h"
40#include "llparcel.h" // parcel categories
41//#include "llregionflags.h"
42#include "llqueryflags.h"
43
44// viewer project includes
45#include "llagent.h" // getID(), isTeen()
46//#include "llbutton.h"
47//#include "llcheckboxctrl.h"
48//#include "llcombobox.h"
49//#include "llfloaterdirectory.h"
50//#include "lllineeditor.h"
51#include "llviewerwindow.h" // alertXml()
52#include "llpaneldirbrowser.h"
53//#include "lltextbox.h"
54//#include "lluiconstants.h"
55#include "llviewercontrol.h" // gSavedSettings
56#include "llviewermessage.h"
57//#include "llworldmap.h"
37 58
38LLPanelDirPlaces::LLPanelDirPlaces(const std::string& name, LLFloaterDirectory* floater) 59LLPanelDirPlaces::LLPanelDirPlaces(const std::string& name, LLFloaterDirectory* floater)
39: LLPanelDirFind(name, floater, "places_browser") 60 : LLPanelDirBrowser(name, floater)
61{
62 // MBW -- HACK!!!
63 // This looks like some sort of compiler bug. We have a mysterious crash during initialization on powerpc boxes.
64 // The crash seems unrelated to this code, but the commit that introduced it was narrowed down to this file.
65 // Adding llinfos calls to both the constructor and destructor here makes the crash go away, even though they don't get called before the point of the crash.
66 // This is wrong on many levels and scares the hell out of me.
67 llinfos << "called" << llendl;
68 mMinSearchChars = 3;
69}
70
71BOOL LLPanelDirPlaces::postBuild()
72{
73 LLPanelDirBrowser::postBuild();
74
75 childSetKeystrokeCallback("name", &LLPanelDirBrowser::onKeystrokeName, this);
76
77 childSetAction("Search", &LLPanelDirBrowser::onClickSearchCore, this);
78 childDisable("Search");
79
80 mCurrentSortColumn = "dwell";
81 mCurrentSortAscending = FALSE;
82
83 // Don't prepopulate the places list, as it hurts the database as of 2006-12-04. JC
84 // initialQuery();
85
86 return TRUE;
87}
88
89LLPanelDirPlaces::~LLPanelDirPlaces()
40{ 90{
91 // MBW -- HACK!!!
92 // This looks like some sort of compiler bug. We have a mysterious crash during initialization on powerpc boxes.
93 // The crash seems unrelated to this code, but the commit that introduced it was narrowed down to this file.
94 // Adding llinfos calls to both the constructor and destructor here makes the crash go away, even though they don't get called before the point of the crash.
95 // This is wrong on many levels and scares the hell out of me.
96 llinfos << "called" << llendl;
97 // Children all cleaned up by default view destructor.
41} 98}
42 99
43 100
44void LLPanelDirPlaces::search(const std::string& search_text) 101// virtual
102void LLPanelDirPlaces::draw()
103{
104 // You only have a choice if you are mature
105 childSetVisible("incmature", !gAgent.isTeen());
106 childSetValue("incmature", gSavedSettings.getBOOL("ShowMatureSims"));
107
108 LLPanelDirBrowser::draw();
109}
110
111// virtual
112void LLPanelDirPlaces::performQuery()
45{ 113{
46 if (!search_text.empty()) 114 LLString place_name = childGetValue("name").asString();
115 if (place_name.length() < mMinSearchChars)
47 { 116 {
48 bool mature = childGetValue( "mature_check" ).asBoolean(); 117 return;
49 std::string selected_collection = "Places"; 118 }
50 std::string url = buildSearchURL(search_text, selected_collection, mature); 119
51 if (mWebBrowser) 120 // "hi " is three chars but not a long-enough search
52 { 121 std::string query_string = place_name;
53 mWebBrowser->navigateTo(url); 122 LLString::trim( query_string );
54 } 123 bool query_was_filtered = (query_string != place_name);
124
125 // possible we threw away all the short words in the query so check length
126 if ( query_string.length() < mMinSearchChars )
127 {
128 gViewerWindow->alertXml("SeachFilteredOnShortWordsEmpty");
129 return;
130 };
131
132 // if we filtered something out, display a popup
133 if ( query_was_filtered )
134 {
135 LLString::format_map_t args;
136 args["[FINALQUERY]"] = query_string;
137 gViewerWindow->alertXml("SeachFilteredOnShortWords", args);
138 };
139
140 LLString catstring = childGetValue("Category").asString();
141
142 // Because LLParcel::C_ANY is -1, must do special check
143 S32 category = 0;
144 if (catstring == "any")
145 {
146 category = LLParcel::C_ANY;
55 } 147 }
56 else 148 else
57 { 149 {
58 // empty search text 150 category = LLParcel::getCategoryFromString(catstring.c_str());
59 navigateToDefaultPage();
60 } 151 }
61 152
62 childSetText("search_editor", search_text); 153 BOOL pg_only = !gSavedSettings.getBOOL("ShowMatureSims")
154 || gAgent.isTeen();
155
156 queryCore(query_string, category, pg_only);
63} 157}
64 158
65LLPanelDirPlaces::~LLPanelDirPlaces() 159void LLPanelDirPlaces::initialQuery()
66{ 160{
67 // Children all cleaned up by default view destructor. 161 // All Linden locations in PG/Mature sims, any name.
162 const BOOL pg_only = FALSE;
163 queryCore("", LLParcel::C_LINDEN, pg_only);
164}
165
166void LLPanelDirPlaces::queryCore(const LLString& name,
167 S32 category,
168 BOOL pg_only)
169{
170 setupNewSearch();
171
172 // send the message
173 U32 flags = 0x0;
174
175 if (pg_only)
176 {
177 flags |= DFQ_PG_PARCELS_ONLY;
178 }
179
180// JC: Sorting by dwell severely impacts the performance of the query.
181// Instead of sorting on the dataserver, we sort locally once the results
182// are received.
183// IW: Re-enabled dwell sort based on new 3-character minimum description
184// Hopefully we'll move to next-gen Find before this becomes a big problem
185
186 flags |= DFQ_DWELL_SORT;
187
188 LLMessageSystem* msg = gMessageSystem;
189
190 msg->newMessage("DirPlacesQuery");
191 msg->nextBlock("AgentData");
192 msg->addUUID("AgentID", gAgent.getID());
193 msg->addUUID("SessionID", gAgent.getSessionID());
194 msg->nextBlock("QueryData");
195 msg->addUUID("QueryID", getSearchID());
196 msg->addString("QueryText", name);
197 msg->addU32("QueryFlags", flags);
198 msg->addS8("Category", (S8)category);
199 // No longer support queries by region name, too many regions
200 // for combobox, no easy way to do autocomplete. JC
201 msg->addString("SimName", "");
202 msg->addS32Fast(_PREHASH_QueryStart,mSearchStart);
203 gAgent.sendReliableMessage();
68} 204}
69 205