summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelpeople.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpanelpeople.cpp')
-rw-r--r--indra/newview/llpanelpeople.cpp63
1 files changed, 30 insertions, 33 deletions
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index 6dd800c0c6..3f5191ca12 100644
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -272,6 +272,7 @@ public:
friend class LLInventoryFriendCardObserver;
LLFriendListUpdater(callback_t cb)
: LLAvatarListUpdater(cb, FRIEND_LIST_UPDATE_TIMEOUT)
+ , mIsActive(false)
{
LLAvatarTracker::instance().addObserver(this);
@@ -290,9 +291,12 @@ public:
/*virtual*/ void changed(U32 mask)
{
- // events can arrive quickly in bulk - we need not process EVERY one of them -
- // so we wait a short while to let others pile-in, and process them in aggregate.
- mEventTimer.start();
+ if (mIsActive)
+ {
+ // events can arrive quickly in bulk - we need not process EVERY one of them -
+ // so we wait a short while to let others pile-in, and process them in aggregate.
+ mEventTimer.start();
+ }
// save-up all the mask-bits which have come-in
mMask |= mask;
@@ -301,8 +305,12 @@ public:
/*virtual*/ BOOL tick()
{
+ if (!mIsActive) return FALSE;
+
if (mMask & (LLFriendObserver::ADD | LLFriendObserver::REMOVE | LLFriendObserver::ONLINE))
+ {
updateList();
+ }
// Stop updates.
mEventTimer.stop();
@@ -311,9 +319,20 @@ public:
return FALSE;
}
+ // virtual
+ void setActive(bool active)
+ {
+ mIsActive = active;
+ if (active)
+ {
+ tick();
+ }
+ }
+
private:
U32 mMask;
LLInventoryFriendCardObserver* mInvObserver;
+ bool mIsActive;
/**
* This class is intended for updating Friend List when Inventory Friend Card is added/removed.
@@ -496,22 +515,25 @@ void LLPanelPeople::onFriendsAccordionExpandedCollapsed(LLUICtrl* ctrl, const LL
BOOL LLPanelPeople::postBuild()
{
- setVisibleCallback(boost::bind(&LLPanelPeople::onVisibilityChange, this, _2));
-
mFilterEditor = getChild<LLFilterEditor>("filter_input");
mFilterEditor->setCommitCallback(boost::bind(&LLPanelPeople::onFilterEdit, this, _2));
mTabContainer = getChild<LLTabContainer>("tabs");
mTabContainer->setCommitCallback(boost::bind(&LLPanelPeople::onTabSelected, this, _2));
- mOnlineFriendList = getChild<LLPanel>(FRIENDS_TAB_NAME)->getChild<LLAvatarList>("avatars_online");
- mAllFriendList = getChild<LLPanel>(FRIENDS_TAB_NAME)->getChild<LLAvatarList>("avatars_all");
+ LLPanel* friends_tab = getChild<LLPanel>(FRIENDS_TAB_NAME);
+ // updater is active only if panel is visible to user.
+ friends_tab->setVisibleCallback(boost::bind(&Updater::setActive, mFriendListUpdater, _2));
+ mOnlineFriendList = friends_tab->getChild<LLAvatarList>("avatars_online");
+ mAllFriendList = friends_tab->getChild<LLAvatarList>("avatars_all");
mOnlineFriendList->setNoItemsCommentText(getString("no_friends_online"));
mOnlineFriendList->setShowIcons("FriendsListShowIcons");
mAllFriendList->setNoItemsCommentText(getString("no_friends"));
mAllFriendList->setShowIcons("FriendsListShowIcons");
- mNearbyList = getChild<LLPanel>(NEARBY_TAB_NAME)->getChild<LLAvatarList>("avatar_list");
+ LLPanel* nearby_tab = getChild<LLPanel>(NEARBY_TAB_NAME);
+ nearby_tab->setVisibleCallback(boost::bind(&Updater::setActive, mNearbyListUpdater, _2));
+ mNearbyList = nearby_tab->getChild<LLAvatarList>("avatar_list");
mNearbyList->setNoItemsCommentText(getString("no_one_near"));
mNearbyList->setNoItemsMsg(getString("no_one_near"));
mNearbyList->setNoFilteredItemsMsg(getString("no_one_filtered_near"));
@@ -955,28 +977,6 @@ void LLPanelPeople::setSortOrder(LLAvatarList* list, ESortOrder order, bool save
}
}
-void LLPanelPeople::onVisibilityChange(const LLSD& new_visibility)
-{
- if (new_visibility.asBoolean() == FALSE)
- {
- // Don't update anything while we're invisible.
- mNearbyListUpdater->setActive(FALSE);
- }
- else
- {
- reSelectedCurrentTab();
- }
-}
-
-// Make the tab-container re-select current tab
-// for onTabSelected() callback to get called.
-// (currently this is needed to reactivate nearby list updates
-// when we get visible)
-void LLPanelPeople::reSelectedCurrentTab()
-{
- mTabContainer->selectTab(mTabContainer->getCurrentPanelIndex());
-}
-
bool LLPanelPeople::isRealGroup()
{
return getCurrentItemID() != LLUUID::null;
@@ -1024,7 +1024,6 @@ void LLPanelPeople::onFilterEdit(const std::string& search_string)
void LLPanelPeople::onTabSelected(const LLSD& param)
{
std::string tab_name = getChild<LLPanel>(param.asString())->getName();
- mNearbyListUpdater->setActive(tab_name == NEARBY_TAB_NAME);
updateButtons();
showFriendsAccordionsIfNeeded();
@@ -1388,8 +1387,6 @@ void LLPanelPeople::onOpen(const LLSD& key)
if (!tab_name.empty())
mTabContainer->selectTabByName(tab_name);
- else
- reSelectedCurrentTab();
}
bool LLPanelPeople::notifyChildren(const LLSD& info)