From 3fb9993a4a74c19b872bb96ed4878cd7b7143208 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Sat, 16 Apr 2022 02:09:03 +0300 Subject: SL-15312 Legacy profiles remake #9 Cleanup obsolete properties processesing --- indra/newview/llpanelavatar.cpp | 36 ++++++++++----- indra/newview/llpanelavatar.h | 22 +++++++--- indra/newview/llpanelprofile.cpp | 68 +---------------------------- indra/newview/llpanelprofile.h | 8 ---- indra/newview/llpanelprofileclassifieds.cpp | 4 +- indra/newview/llpanelprofileclassifieds.h | 4 +- indra/newview/llpanelprofilepicks.cpp | 4 +- indra/newview/llpanelprofilepicks.h | 4 +- 8 files changed, 52 insertions(+), 98 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index fada9cc98b..90f3e87ae9 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -76,23 +76,13 @@ LLPanelProfileTab::LLPanelProfileTab() LLPanelProfileTab::~LLPanelProfileTab() { - if(getAvatarId().notNull()) - { - LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(),this); - } } void LLPanelProfileTab::setAvatarId(const LLUUID& avatar_id) { if (avatar_id.notNull()) { - if (getAvatarId().notNull()) - { - LLAvatarPropertiesProcessor::getInstance()->removeObserver(mAvatarId, this); - } mAvatarId = avatar_id; - LLAvatarPropertiesProcessor::getInstance()->addObserver(getAvatarId(), this); - mSelfProfile = (getAvatarId() == gAgentID); } } @@ -130,3 +120,29 @@ void LLPanelProfileTab::setApplyProgress(bool started) } } } + +LLPanelProfilePropertiesPeocessorTab::LLPanelProfilePropertiesPeocessorTab() + : LLPanelProfileTab() +{ +} + +LLPanelProfilePropertiesPeocessorTab::~LLPanelProfilePropertiesPeocessorTab() +{ + if (getAvatarId().notNull()) + { + LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(), this); + } +} + +void LLPanelProfilePropertiesPeocessorTab::setAvatarId(const LLUUID & avatar_id) +{ + if (avatar_id.notNull()) + { + if (getAvatarId().notNull()) + { + LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(), this); + } + LLPanelProfileTab::setAvatarId(avatar_id); + LLAvatarPropertiesProcessor::getInstance()->addObserver(getAvatarId(), this); + } +} diff --git a/indra/newview/llpanelavatar.h b/indra/newview/llpanelavatar.h index fb9ff26ca6..1b47411fdb 100644 --- a/indra/newview/llpanelavatar.h +++ b/indra/newview/llpanelavatar.h @@ -81,7 +81,6 @@ protected: */ class LLPanelProfileTab : public LLPanel - , public LLAvatarPropertiesObserver { public: @@ -105,11 +104,6 @@ public: */ virtual void onOpen(const LLSD& key); - /** - * Processes data received from server. - */ - virtual void processProperties(void* data, EAvatarProcessorType type) = 0; - /** * Clears all data received from server. */ @@ -152,4 +146,20 @@ private: bool mSelfProfile; }; +class LLPanelProfilePropertiesPeocessorTab + : public LLPanelProfileTab + , public LLAvatarPropertiesObserver +{ +public: + LLPanelProfilePropertiesPeocessorTab(); + ~LLPanelProfilePropertiesPeocessorTab(); + + /*virtual*/ void setAvatarId(const LLUUID& avatar_id); + + /** + * Processes data received from server via LLAvatarPropertiesObserver. + */ + virtual void processProperties(void* data, EAvatarProcessorType type) = 0; +}; + #endif // LL_LLPANELAVATAR_H diff --git a/indra/newview/llpanelprofile.cpp b/indra/newview/llpanelprofile.cpp index 175fb4dbdc..7d3a98ba96 100644 --- a/indra/newview/llpanelprofile.cpp +++ b/indra/newview/llpanelprofile.cpp @@ -840,7 +840,6 @@ void LLPanelProfileSecondLife::onOpen(const LLSD& key) resetData(); LLUUID avatar_id = getAvatarId(); - LLAvatarPropertiesProcessor::getInstance()->addObserver(avatar_id, this); BOOL own_profile = getSelfProfile(); @@ -907,19 +906,6 @@ void LLPanelProfileSecondLife::updateData() } } -void LLPanelProfileSecondLife::processProperties(void* data, EAvatarProcessorType type) -{ - - if (APT_PROPERTIES == type) - { - const LLAvatarData* avatar_data = static_cast(data); - if(avatar_data && getAvatarId() == avatar_data->avatar_id) - { - processProfileProperties(avatar_data); - } - } -} - void LLPanelProfileSecondLife::resetData() { resetLoading(); @@ -944,9 +930,6 @@ void LLPanelProfileSecondLife::processProfileProperties(const LLAvatarData* avat LLUUID avatar_id = getAvatarId(); if (!LLAvatarActions::isFriend(avatar_id) && !getSelfProfile()) { - // this is non-friend avatar. Status will be updated from LLAvatarPropertiesProcessor. - // in LLPanelProfileSecondLife::processOnlineStatus() - // subscribe observer to get online status. Request will be sent by LLPanelProfileSecondLife itself. // do not subscribe for friend avatar because online status can be wrong overridden // via LLAvatarData::flags if Preferences: "Only Friends & Groups can see when I am online" is set. @@ -1622,18 +1605,6 @@ BOOL LLPanelProfileWeb::postBuild() return TRUE; } -void LLPanelProfileWeb::processProperties(void* data, EAvatarProcessorType type) -{ - if (APT_PROPERTIES == type) - { - const LLAvatarData* avatar_data = static_cast(data); - if (avatar_data && getAvatarId() == avatar_data->avatar_id) - { - setLoaded(); - } - } -} - void LLPanelProfileWeb::resetData() { mWebBrowser->navigateHome(); @@ -1859,18 +1830,6 @@ void LLPanelProfileFirstLife::onDiscardDescriptionChanges() setDescriptionText(mCurrentDescription); } -void LLPanelProfileFirstLife::processProperties(void* data, EAvatarProcessorType type) -{ - if (APT_PROPERTIES == type) - { - const LLAvatarData* avatar_data = static_cast(data); - if (avatar_data && getAvatarId() == avatar_data->avatar_id) - { - processProperties(avatar_data); - } - } -} - void LLPanelProfileFirstLife::processProperties(const LLAvatarData* avatar_data) { setDescriptionText(avatar_data->fl_about_text); @@ -2012,19 +1971,6 @@ void LLPanelProfileNotes::onDiscardNotesChanges() setNotesText(mCurrentNotes); } -void LLPanelProfileNotes::processProperties(void* data, EAvatarProcessorType type) -{ - if (APT_NOTES == type) - { - LLAvatarNotes* avatar_notes = static_cast(data); - if (avatar_notes && getAvatarId() == avatar_notes->target_id) - { - processProperties(avatar_notes); - LLAvatarPropertiesProcessor::getInstance()->removeObserver(getAvatarId(),this); - } - } -} - void LLPanelProfileNotes::processProperties(LLAvatarNotes* avatar_notes) { mNotesEditor->setValue(avatar_notes->notes); @@ -2064,15 +2010,6 @@ BOOL LLPanelProfile::postBuild() return TRUE; } -void LLPanelProfile::processProperties(void* data, EAvatarProcessorType type) -{ - //*TODO: figure out what this does - mTabContainer->setCommitCallback(boost::bind(&LLPanelProfile::onTabChange, this)); - - // Load data on currently opened tab as well - onTabChange(); -} - void LLPanelProfile::onTabChange() { LLPanelProfileTab* active_panel = dynamic_cast(mTabContainer->getCurrentPanel()); @@ -2120,9 +2057,8 @@ void LLPanelProfile::onOpen(const LLSD& key) updateBtnsVisibility(); - // KC - Not handling pick and classified opening thru onOpen - // because this would make unique profile floaters per slurl - // and result in multiple profile floaters for the same avatar + // Some tabs only request data when opened + mTabContainer->setCommitCallback(boost::bind(&LLPanelProfile::onTabChange, this)); } void LLPanelProfile::updateData() diff --git a/indra/newview/llpanelprofile.h b/indra/newview/llpanelprofile.h index 630bfcfdbc..05be48f1c2 100644 --- a/indra/newview/llpanelprofile.h +++ b/indra/newview/llpanelprofile.h @@ -89,8 +89,6 @@ public: /*virtual*/ BOOL postBuild(); - /*virtual*/ void processProperties(void* data, EAvatarProcessorType type); - void resetData(); /** @@ -214,8 +212,6 @@ public: /*virtual*/ BOOL postBuild(); - /*virtual*/ void processProperties(void* data, EAvatarProcessorType type); - void resetData(); /** @@ -257,7 +253,6 @@ public: /*virtual*/ BOOL postBuild(); - /*virtual*/ void processProperties(void* data, EAvatarProcessorType type); void processProperties(const LLAvatarData* avatar_data); void resetData(); @@ -303,7 +298,6 @@ public: /*virtual*/ BOOL postBuild(); - /*virtual*/ void processProperties(void* data, EAvatarProcessorType type); void processProperties(LLAvatarNotes* avatar_notes); void resetData(); @@ -339,8 +333,6 @@ public: /*virtual*/ void updateData(); - /*virtual*/ void processProperties(void* data, EAvatarProcessorType type); - /*virtual*/ void onOpen(const LLSD& key); void showPick(const LLUUID& pick_id = LLUUID::null); diff --git a/indra/newview/llpanelprofileclassifieds.cpp b/indra/newview/llpanelprofileclassifieds.cpp index 268c99e91b..2769329dca 100644 --- a/indra/newview/llpanelprofileclassifieds.cpp +++ b/indra/newview/llpanelprofileclassifieds.cpp @@ -191,7 +191,7 @@ LLClassifiedHandler gClassifiedHandler; //----------------------------------------------------------------------------- LLPanelProfileClassifieds::LLPanelProfileClassifieds() - : LLPanelProfileTab() + : LLPanelProfilePropertiesPeocessorTab() , mClassifiedToSelectOnLoad(LLUUID::null) , mClassifiedEditOnLoad(false) { @@ -473,7 +473,7 @@ static const S32 CB_ITEM_MATURE = 0; static const S32 CB_ITEM_PG = 1; LLPanelProfileClassified::LLPanelProfileClassified() - : LLPanelProfileTab() + : LLPanelProfilePropertiesPeocessorTab() , mInfoLoaded(false) , mTeleportClicksOld(0) , mMapClicksOld(0) diff --git a/indra/newview/llpanelprofileclassifieds.h b/indra/newview/llpanelprofileclassifieds.h index a85781f4b5..89ce8dae1a 100644 --- a/indra/newview/llpanelprofileclassifieds.h +++ b/indra/newview/llpanelprofileclassifieds.h @@ -68,7 +68,7 @@ public: * Panel for displaying Avatar's picks. */ class LLPanelProfileClassifieds - : public LLPanelProfileTab + : public LLPanelProfilePropertiesPeocessorTab { public: LLPanelProfileClassifieds(); @@ -109,7 +109,7 @@ private: class LLPanelProfileClassified - : public LLPanelProfileTab + : public LLPanelProfilePropertiesPeocessorTab { public: diff --git a/indra/newview/llpanelprofilepicks.cpp b/indra/newview/llpanelprofilepicks.cpp index 406ff2b8de..264d3b78f1 100644 --- a/indra/newview/llpanelprofilepicks.cpp +++ b/indra/newview/llpanelprofilepicks.cpp @@ -120,7 +120,7 @@ LLPickHandler gPickHandler; //----------------------------------------------------------------------------- LLPanelProfilePicks::LLPanelProfilePicks() - : LLPanelProfileTab() + : LLPanelProfilePropertiesPeocessorTab() , mPickToSelectOnLoad(LLUUID::null) { } @@ -370,7 +370,7 @@ bool LLPanelProfilePicks::canDeletePick() //----------------------------------------------------------------------------- LLPanelProfilePick::LLPanelProfilePick() - : LLPanelProfileTab() + : LLPanelProfilePropertiesPeocessorTab() , LLRemoteParcelInfoObserver() , mSnapshotCtrl(NULL) , mPickId(LLUUID::null) diff --git a/indra/newview/llpanelprofilepicks.h b/indra/newview/llpanelprofilepicks.h index aa58e46a9f..8be3e0285b 100644 --- a/indra/newview/llpanelprofilepicks.h +++ b/indra/newview/llpanelprofilepicks.h @@ -44,7 +44,7 @@ class LLTextEditor; * Panel for displaying Avatar's picks. */ class LLPanelProfilePicks - : public LLPanelProfileTab + : public LLPanelProfilePropertiesPeocessorTab { public: LLPanelProfilePicks(); @@ -93,7 +93,7 @@ private: class LLPanelProfilePick - : public LLPanelProfileTab + : public LLPanelProfilePropertiesPeocessorTab , public LLRemoteParcelInfoObserver { public: -- cgit v1.2.3