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/llpaneldirland.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/llpaneldirland.cpp')
-rw-r--r-- | linden/indra/newview/llpaneldirland.cpp | 220 |
1 files changed, 220 insertions, 0 deletions
diff --git a/linden/indra/newview/llpaneldirland.cpp b/linden/indra/newview/llpaneldirland.cpp new file mode 100644 index 0000000..9e123d9 --- /dev/null +++ b/linden/indra/newview/llpaneldirland.cpp | |||
@@ -0,0 +1,220 @@ | |||
1 | /** | ||
2 | * @file llpaneldirland.cpp | ||
3 | * @brief Land For Sale and Auction in the Find directory. | ||
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 "llpaneldirland.h" | ||
31 | |||
32 | // linden library includes | ||
33 | #include "llfontgl.h" | ||
34 | #include "llparcel.h" | ||
35 | #include "llqueryflags.h" | ||
36 | #include "message.h" | ||
37 | |||
38 | // viewer project includes | ||
39 | #include "llagent.h" | ||
40 | #include "llcheckboxctrl.h" | ||
41 | #include "llcombobox.h" | ||
42 | #include "lllineeditor.h" | ||
43 | #include "llscrolllistctrl.h" | ||
44 | #include "llstatusbar.h" | ||
45 | #include "lluiconstants.h" | ||
46 | #include "lltextbox.h" | ||
47 | #include "llviewercontrol.h" | ||
48 | #include "llviewermessage.h" | ||
49 | |||
50 | //----------------------------------------------------------------------------- | ||
51 | // Constants | ||
52 | //----------------------------------------------------------------------------- | ||
53 | |||
54 | static const char FIND_ALL[] = "All Types"; | ||
55 | static const char FIND_AUCTION[] = "Auction"; | ||
56 | static const char FIND_MAINLANDSALES[] = "Mainland Sales"; | ||
57 | static const char FIND_ESTATESALES[] = "Estate Sales"; | ||
58 | static const char FIND_NEWBIE[] = "First Land"; | ||
59 | |||
60 | const char PG_ONLY[] = "PG only"; | ||
61 | const char MATURE_ONLY[] = "Mature only"; | ||
62 | const char PG_MATURE[] = "PG & Mature"; | ||
63 | |||
64 | LLPanelDirLand::LLPanelDirLand(const std::string& name, LLFloaterDirectory* floater) | ||
65 | : LLPanelDirBrowser(name, floater) | ||
66 | { | ||
67 | } | ||
68 | |||
69 | BOOL LLPanelDirLand::postBuild() | ||
70 | { | ||
71 | LLPanelDirBrowser::postBuild(); | ||
72 | |||
73 | childSetValue("type", gSavedSettings.getString("FindLandType")); | ||
74 | |||
75 | if (gAgent.mAccess <= SIM_ACCESS_PG) | ||
76 | { | ||
77 | childSetValue("rating", PG_ONLY); | ||
78 | childDisable("rating"); | ||
79 | } | ||
80 | |||
81 | childSetCommitCallback("pricecheck", onCommitPrice, this); | ||
82 | childSetCommitCallback("areacheck", onCommitArea, this); | ||
83 | |||
84 | childSetValue("priceedit", gStatusBar->getBalance()); | ||
85 | childSetEnabled("priceedit", gSavedSettings.getBOOL("FindLandPrice")); | ||
86 | childSetPrevalidate("priceedit", LLLineEditor::prevalidateNonNegativeS32); | ||
87 | |||
88 | childSetEnabled("areaedit", gSavedSettings.getBOOL("FindLandArea")); | ||
89 | childSetPrevalidate("areaedit", LLLineEditor::prevalidateNonNegativeS32); | ||
90 | |||
91 | childSetAction("Search", onClickSearchCore, this); | ||
92 | setDefaultBtn("Search"); | ||
93 | |||
94 | mCurrentSortColumn = "per_meter"; | ||
95 | |||
96 | LLScrollListCtrl* results = (LLScrollListCtrl*)getChildByName("results"); | ||
97 | if (results) | ||
98 | { | ||
99 | results->setSortChangedCallback(onClickSort); | ||
100 | results->sortByColumn(mCurrentSortColumn,mCurrentSortAscending); | ||
101 | } | ||
102 | |||
103 | return TRUE; | ||
104 | } | ||
105 | |||
106 | LLPanelDirLand::~LLPanelDirLand() | ||
107 | { | ||
108 | // Children all cleaned up by default view destructor. | ||
109 | } | ||
110 | |||
111 | |||
112 | void LLPanelDirLand::onClickSort(void* data) | ||
113 | { | ||
114 | LLPanelDirLand* self = (LLPanelDirLand*)data; | ||
115 | if (!self) return; | ||
116 | self->performQuery(); | ||
117 | } | ||
118 | |||
119 | // static | ||
120 | void LLPanelDirLand::onCommitPrice(LLUICtrl* ctrl, void* data) | ||
121 | { | ||
122 | LLPanelDirLand* self = (LLPanelDirLand*)data; | ||
123 | LLCheckBoxCtrl* check = (LLCheckBoxCtrl*)ctrl; | ||
124 | |||
125 | if (!self || !check) return; | ||
126 | self->childSetEnabled("priceedit", check->get()); | ||
127 | } | ||
128 | |||
129 | // static | ||
130 | void LLPanelDirLand::onCommitArea(LLUICtrl* ctrl, void* data) | ||
131 | { | ||
132 | LLPanelDirLand* self = (LLPanelDirLand*)data; | ||
133 | LLCheckBoxCtrl* check = (LLCheckBoxCtrl*)ctrl; | ||
134 | |||
135 | if (!self || !check) return; | ||
136 | self->childSetEnabled("areaedit", check->get()); | ||
137 | } | ||
138 | |||
139 | void LLPanelDirLand::performQuery() | ||
140 | { | ||
141 | LLMessageSystem* msg = gMessageSystem; | ||
142 | |||
143 | setupNewSearch(); | ||
144 | |||
145 | // We could change the UI to allow arbitrary combinations of these options | ||
146 | U32 search_type = ST_ALL; | ||
147 | const std::string& type = childGetValue("type").asString(); | ||
148 | if(!type.empty()) | ||
149 | { | ||
150 | if (FIND_AUCTION == type) search_type = ST_AUCTION; | ||
151 | else if(FIND_MAINLANDSALES == type) search_type = ST_MAINLAND; | ||
152 | else if(FIND_ESTATESALES == type) search_type = ST_ESTATE; | ||
153 | else if(FIND_NEWBIE == type) search_type = ST_NEWBIE; | ||
154 | } | ||
155 | |||
156 | U32 query_flags = 0x0; | ||
157 | if (gAgent.mAccess <= SIM_ACCESS_PG) query_flags |= DFQ_PG_SIMS_ONLY; | ||
158 | |||
159 | const std::string& rating = childGetValue("rating").asString(); | ||
160 | if (rating == PG_ONLY) | ||
161 | { | ||
162 | query_flags |= DFQ_PG_SIMS_ONLY; | ||
163 | } | ||
164 | else if (rating == MATURE_ONLY) | ||
165 | { | ||
166 | query_flags |= DFQ_MATURE_SIMS_ONLY; | ||
167 | } | ||
168 | |||
169 | LLScrollListCtrl* list = (LLScrollListCtrl*)getChildByName("results"); | ||
170 | if (list) | ||
171 | { | ||
172 | std::string sort_name = list->getSortColumnName(); | ||
173 | BOOL sort_asc = list->getSortAscending(); | ||
174 | |||
175 | if (sort_name == "name") | ||
176 | { | ||
177 | query_flags |= DFQ_NAME_SORT; | ||
178 | } | ||
179 | else if (sort_name == "price") | ||
180 | { | ||
181 | query_flags |= DFQ_PRICE_SORT; | ||
182 | } | ||
183 | else if (sort_name == "per_meter") | ||
184 | { | ||
185 | query_flags |= DFQ_PER_METER_SORT; | ||
186 | } | ||
187 | else if (sort_name == "area") | ||
188 | { | ||
189 | query_flags |= DFQ_AREA_SORT; | ||
190 | } | ||
191 | |||
192 | if (sort_asc) | ||
193 | { | ||
194 | query_flags |= DFQ_SORT_ASC; | ||
195 | } | ||
196 | } | ||
197 | |||
198 | if (childGetValue("pricecheck").asBoolean()) | ||
199 | { | ||
200 | query_flags |= DFQ_LIMIT_BY_PRICE; | ||
201 | } | ||
202 | |||
203 | if (childGetValue("areacheck").asBoolean()) | ||
204 | { | ||
205 | query_flags |= DFQ_LIMIT_BY_AREA; | ||
206 | } | ||
207 | |||
208 | msg->newMessage("DirLandQuery"); | ||
209 | msg->nextBlock("AgentData"); | ||
210 | msg->addUUID("AgentID", gAgent.getID()); | ||
211 | msg->addUUID("SessionID", gAgent.getSessionID()); | ||
212 | msg->nextBlock("QueryData"); | ||
213 | msg->addUUID("QueryID", getSearchID()); | ||
214 | msg->addU32("QueryFlags", query_flags); | ||
215 | msg->addU32("SearchType", search_type); | ||
216 | msg->addS32("Price", childGetValue("priceedit").asInteger()); | ||
217 | msg->addS32("Area", childGetValue("areaedit").asInteger()); | ||
218 | msg->addS32Fast(_PREHASH_QueryStart,mSearchStart); | ||
219 | gAgent.sendReliableMessage(); | ||
220 | } | ||