llpaneldirpopular.cpp

Go to the documentation of this file.
00001 
00032 #include "llviewerprecompiledheaders.h"
00033 
00034 #include "llpaneldirpopular.h"
00035 
00036 // linden library includes
00037 #include "llfontgl.h"
00038 #include "message.h"
00039 #include "llqueryflags.h"
00040 
00041 // viewer project includes
00042 #include "llagent.h"
00043 #include "llcheckboxctrl.h"
00044 #include "llviewercontrol.h"
00045 #include "lluiconstants.h"
00046 #include "lltextbox.h"
00047 
00048 LLPanelDirPopular::LLPanelDirPopular(const std::string& name, LLFloaterDirectory* floater)
00049         :       LLPanelDirBrowser(name, floater),
00050                 mRequested(false)
00051 {
00052 }
00053 
00054 BOOL LLPanelDirPopular::postBuild()
00055 {
00056         LLPanelDirBrowser::postBuild();
00057 
00058         childSetCommitCallback("incpictures", onCommitAny, this);
00059         childSetCommitCallback("incmature", onCommitAny, this);
00060 
00061         mCurrentSortColumn = "dwell";
00062         mCurrentSortAscending = FALSE;
00063 
00064         // Don't request popular until first drawn.  JC
00065         // requestPopular();
00066 
00067         return TRUE;
00068 }
00069 
00070 LLPanelDirPopular::~LLPanelDirPopular()
00071 {
00072         // Children all cleaned up by default view destructor.
00073 }
00074 
00075 
00076 // virtual
00077 void LLPanelDirPopular::draw()
00078 {
00079         // You only have a choice if you are mature]
00080         childSetVisible("incmature", !gAgent.isTeen());
00081         childSetValue("incmature", gSavedSettings.getBOOL("ShowMatureSims"));
00082 
00083         LLPanelDirBrowser::draw();
00084         
00085         if (!mRequested)
00086         {
00087                 requestPopular();
00088                 mRequested = true;
00089         }
00090 }
00091 
00092 
00093 void LLPanelDirPopular::requestPopular()
00094 {
00095         LLMessageSystem* msg = gMessageSystem;
00096         BOOL pg_only = !childGetValue("incmature").asBoolean() || gAgent.isTeen();
00097         BOOL pictures_only = childGetValue("incpictures").asBoolean();
00098 
00099         U32 flags = 0x0;
00100         if (pg_only)
00101         {
00102                 flags |= DFQ_PG_SIMS_ONLY;
00103         }
00104         if (pictures_only)
00105         {
00106                 flags |= DFQ_PICTURES_ONLY;
00107         }
00108 
00109         setupNewSearch();
00110 
00111         msg->newMessage("DirPopularQuery");
00112         msg->nextBlock("AgentData");
00113         msg->addUUID("AgentID", gAgent.getID());
00114         msg->addUUID("SessionID", gAgent.getSessionID());
00115         msg->nextBlock("QueryData");
00116         msg->addUUID("QueryID", getSearchID());
00117         msg->addU32("QueryFlags", flags);
00118         gAgent.sendReliableMessage();
00119 }
00120 
00121 
00122 // static
00123 void LLPanelDirPopular::onClickSearch(void* data)
00124 {
00125         LLPanelDirPopular* self = (LLPanelDirPopular*)data;
00126         self->requestPopular();
00127 }
00128 
00129 // static
00130 void LLPanelDirPopular::onCommitAny(LLUICtrl* ctrl, void* data)
00131 {
00132         LLPanelDirPopular* self = (LLPanelDirPopular*)data;
00133         self->requestPopular();
00134 }

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