llpaneldirplaces.cpp

Go to the documentation of this file.
00001 
00032 #include "llviewerprecompiledheaders.h"
00033 
00034 #include "llpaneldirplaces.h"
00035 
00036 // linden library includes
00037 #include "llfontgl.h"
00038 #include "message.h"
00039 #include "lldir.h"
00040 #include "llparcel.h"
00041 #include "llregionflags.h"
00042 #include "llqueryflags.h"
00043 
00044 // viewer project includes
00045 #include "llagent.h"
00046 #include "llbutton.h"
00047 #include "llcheckboxctrl.h"
00048 #include "llcombobox.h"
00049 #include "llfloaterdirectory.h"
00050 #include "lllineeditor.h"
00051 #include "llpaneldirbrowser.h"
00052 #include "lltextbox.h"
00053 #include "lluiconstants.h"
00054 #include "llviewercontrol.h"
00055 #include "llviewermessage.h"
00056 #include "llworldmap.h"
00057 
00058 LLPanelDirPlaces::LLPanelDirPlaces(const std::string& name, LLFloaterDirectory* floater)
00059         :       LLPanelDirBrowser(name, floater)
00060 {
00061         mMinSearchChars = 3;
00062 }
00063 
00064 BOOL LLPanelDirPlaces::postBuild()
00065 {
00066         LLPanelDirBrowser::postBuild();
00067 
00068         childSetKeystrokeCallback("name", &LLPanelDirBrowser::onKeystrokeName, this);
00069 
00070         childSetAction("Search", &LLPanelDirBrowser::onClickSearchCore, this);
00071         childDisable("Search");
00072 
00073         mCurrentSortColumn = "dwell";
00074         mCurrentSortAscending = FALSE;
00075 
00076         // Don't prepopulate the places list, as it hurts the database as of 2006-12-04. JC
00077         // initialQuery();
00078 
00079         return TRUE;
00080 }
00081 
00082 LLPanelDirPlaces::~LLPanelDirPlaces()
00083 {
00084         // Children all cleaned up by default view destructor.
00085 }
00086 
00087 
00088 // virtual
00089 void LLPanelDirPlaces::draw()
00090 {
00091         // You only have a choice if you are mature
00092         childSetVisible("incmature", !gAgent.isTeen());
00093         childSetValue("incmature", gSavedSettings.getBOOL("ShowMatureSims"));
00094         
00095         LLPanelDirBrowser::draw();
00096 }
00097 
00098 // virtual
00099 void LLPanelDirPlaces::performQuery()
00100 {
00101         LLString name = childGetValue("name").asString();
00102         if (name.length() < mMinSearchChars)
00103         {
00104                 return;
00105         }
00106 
00107         LLString catstring = childGetValue("Category").asString();
00108         
00109         // Because LLParcel::C_ANY is -1, must do special check
00110         S32 category = 0;
00111         if (catstring == "any")
00112         {
00113                 category = LLParcel::C_ANY;
00114         }
00115         else
00116         {
00117                 category = LLParcel::getCategoryFromString(catstring.c_str());
00118         }
00119 
00120         BOOL pg_only = !gSavedSettings.getBOOL("ShowMatureSims") 
00121                                    || gAgent.isTeen();
00122 
00123         queryCore(name, category, pg_only);
00124 }
00125 
00126 void LLPanelDirPlaces::initialQuery()
00127 {
00128         // All Linden locations in PG/Mature sims, any name.
00129         const BOOL pg_only = FALSE;
00130         queryCore("", LLParcel::C_LINDEN, pg_only);
00131 }
00132 
00133 void LLPanelDirPlaces::queryCore(const LLString& name, 
00134                                                                  S32 category, 
00135                                                                  BOOL pg_only)
00136 {
00137         setupNewSearch();
00138 
00139         // send the message
00140         U32 flags = 0x0;
00141 
00142         if (pg_only)
00143         {
00144                 flags |= DFQ_PG_PARCELS_ONLY;
00145         }
00146 
00147 // JC: Sorting by dwell severely impacts the performance of the query.
00148 // Instead of sorting on the dataserver, we sort locally once the results
00149 // are received.
00150 // IW: Re-enabled dwell sort based on new 3-character minimum description
00151 // Hopefully we'll move to next-gen Find before this becomes a big problem
00152 
00153         flags |= DFQ_DWELL_SORT;
00154 
00155         LLMessageSystem* msg = gMessageSystem;
00156 
00157         msg->newMessage("DirPlacesQuery");
00158         msg->nextBlock("AgentData");
00159         msg->addUUID("AgentID", gAgent.getID());
00160         msg->addUUID("SessionID", gAgent.getSessionID());
00161         msg->nextBlock("QueryData");
00162         msg->addUUID("QueryID", getSearchID());
00163         msg->addString("QueryText", name);
00164         msg->addU32("QueryFlags", flags);
00165         msg->addS8("Category", (S8)category);
00166         // No longer support queries by region name, too many regions
00167         // for combobox, no easy way to do autocomplete. JC
00168         msg->addString("SimName", "");
00169         msg->addS32Fast(_PREHASH_QueryStart,mSearchStart);
00170         gAgent.sendReliableMessage();
00171 }
00172 

Generated on Thu Jul 1 06:08:56 2010 for Second Life Viewer by  doxygen 1.4.7