From 1aad52fd14383214a0552d51c1c4e7f8adaaf100 Mon Sep 17 00:00:00 2001 From: Kadah_Coba Date: Thu, 1 Aug 2013 00:59:04 -0700 Subject: [PATCH] Fixed legacy-legacy people search profile preview to work more than once Cleaned up unneeded code --- indra/newview/fsfloatersearch.cpp | 25 ++++++++----------------- indra/newview/fsfloatersearch.h | 3 +++ indra/newview/fspanelprofile.cpp | 7 +++++++ indra/newview/fspanelprofile.h | 10 +++++++--- 4 files changed, 25 insertions(+), 20 deletions(-) diff --git a/indra/newview/fsfloatersearch.cpp b/indra/newview/fsfloatersearch.cpp index f305ca5beb..597e8c00be 100644 --- a/indra/newview/fsfloatersearch.cpp +++ b/indra/newview/fsfloatersearch.cpp @@ -79,14 +79,6 @@ LLRadioGroup* mSearchRadio; LLComboBox* mCategoryPlaces; LLComboBox* mCategoryEvents; -static const std::string PANEL_PROFILE = "panel_profile_secondlife"; -static const std::string PANEL_WEB = "panel_profile_web"; -static const std::string PANEL_INTERESTS = "panel_profile_interests"; -static const std::string PANEL_PICKS = "panel_profile_picks"; -static const std::string PANEL_CLASSIFIEDS = "panel_profile_classified"; -static const std::string PANEL_FIRSTLIFE = "panel_profile_firstlife"; -static const std::string PANEL_NOTES = "panel_profile_notes"; - //////////////////////////////////////// // Observer Classes // //////////////////////////////////////// @@ -344,12 +336,13 @@ BOOL FSFloaterSearch::postBuild() resetVerbs(); // If skin has legacy full profile view, use it - LLPanel* panel_people = getChild("panel_ls_people"); + FSPanelSearchPeople* panel_people = findChild("panel_ls_people"); mPanelProfile = panel_people->findChild("panel_profile_view"); if (mPanelProfile) { mPanelProfile->setVisible(false); panel_people->childSetAction("people_profile_btn", boost::bind(&FSFloaterSearch::onBtnPeopleProfile, this)); + panel_people->setUseLegacyResultBehavior(TRUE); } mDetailsPanel = getChild("panel_ls_details"); @@ -616,14 +609,6 @@ void FSFloaterSearch::avatarNameUpdatedCallback(const LLUUID& id, const LLAvatar { mDetailTitle->setValue(av_name.getCompleteName()); setLoadingProgress(false); - - // FSPanelProfileSecondLife* panel_profile = findChild(PANEL_PROFILE); - // if (panel_profile) - // { - // FSPanelProfileWeb* panel_web = findChild(PANEL_WEB); - // panel_profile->onAvatarNameCache(id, av_name); - // if (panel_web) panel_web->onAvatarNameCache(id, av_name); - // } } // Otherwise possibly a request for an older selection, ignore it. } @@ -1048,6 +1033,12 @@ void FSPanelSearchPeople::processSearchReply(LLMessageSystem* msg, void**) { search_results->selectFirstItem(); search_results->setFocus(TRUE); + + // Load the first result + if (self->getUseLegacyResultBehavior()) + { + self->onSelectItem(); + } } } diff --git a/indra/newview/fsfloatersearch.h b/indra/newview/fsfloatersearch.h index 0bf4635731..d146506a97 100644 --- a/indra/newview/fsfloatersearch.h +++ b/indra/newview/fsfloatersearch.h @@ -150,6 +150,7 @@ public: FSPanelSearchPeople(); void onSearchPanelOpen(FSFloaterSearch* parent); static void processSearchReply(LLMessageSystem* msg, void**); + void setUseLegacyResultBehavior(BOOL use_legacy) { mUseLegacyResultBehavior = use_legacy; } protected: private: /*virtual*/ BOOL postBuild(); @@ -169,12 +170,14 @@ private: void setLoadingProgress(bool started); const LLUUID& getQueryID() const { return mQueryID; } + const BOOL getUseLegacyResultBehavior() const { return mUseLegacyResultBehavior; } int mNumResultsReturned; S32 mStartSearch; S32 mResultsReceived; LLSD mResultsContent; LLUUID mQueryID; + BOOL mUseLegacyResultBehavior; FSFloaterSearch* mParent; LLSearchComboBox* mSearchComboBox; diff --git a/indra/newview/fspanelprofile.cpp b/indra/newview/fspanelprofile.cpp index 929199182b..2bac60f621 100644 --- a/indra/newview/fspanelprofile.cpp +++ b/indra/newview/fspanelprofile.cpp @@ -2118,6 +2118,12 @@ void FSPanelProfile::onTabChange() void FSPanelProfile::onOpen(const LLSD& key) { + // don't reload the same profile + if (getAvatarId() == key) + { + return; + } + FSPanelProfileTab::onOpen(key); mPanelSecondlife = findChild(PANEL_SECONDLIFE); @@ -2137,6 +2143,7 @@ void FSPanelProfile::onOpen(const LLSD& key) mPanelNotes->onOpen(getAvatarId()); //always request the base profile info + resetLoading(); updateData(); if ( (false) && (getAvatarId() == gAgent.getID())) diff --git a/indra/newview/fspanelprofile.h b/indra/newview/fspanelprofile.h index 3c35c14afe..2da1b7f2d8 100644 --- a/indra/newview/fspanelprofile.h +++ b/indra/newview/fspanelprofile.h @@ -60,17 +60,17 @@ public: /** * Sets avatar ID, sets panel as observer of avatar related info replies from server. */ - virtual void setAvatarId(const LLUUID& id); + void setAvatarId(const LLUUID& id); /** * Processes data received from server. */ - /*virtual*/ void processProperties(void* data, EAvatarProcessorType type) = 0; + virtual void processProperties(void* data, EAvatarProcessorType type) = 0; /** * Returns avatar ID. */ - virtual const LLUUID& getAvatarId() { return mAvatarId; } + const LLUUID& getAvatarId() { return mAvatarId; } /** * Clears panel data if viewing avatar info for first time and sends update data request. @@ -85,6 +85,10 @@ protected: virtual void enableControls(); + // mLoading: FALSE: Initial state, can request + // TRUE: Data requested, skip duplicate requests (happens due to LLUI's habit of repeated callbacks) + // mLoaded: FALSE: Initial state, show loading indicator + // TRUE: Data recieved, which comes in a single message, hide indicator bool getIsLoading() { return mLoading; } void setIsLoading() { mLoading = TRUE; } bool getIsLoaded() { return mLoaded; }