SL-15312 Legacy profiles remake #9

Cleanup obsolete properties processesing
master
Andrey Kleshchev 2022-04-16 02:09:03 +03:00
parent c9b83e8117
commit 3fb9993a4a
8 changed files with 52 additions and 98 deletions

View File

@ -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);
}
}

View File

@ -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

View File

@ -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<const LLAvatarData*>(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<const LLAvatarData*>(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<const LLAvatarData*>(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<LLAvatarNotes*>(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<LLPanelProfileTab*>(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()

View File

@ -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);

View File

@ -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)

View File

@ -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:

View File

@ -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)

View File

@ -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: