summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorandreykproductengine <andreykproductengine@lindenlab.com>2019-02-20 20:30:43 +0200
committerandreykproductengine <andreykproductengine@lindenlab.com>2019-02-20 20:30:43 +0200
commit86d28366b1f53f56c444e5a5ccc025cd6b136b36 (patch)
tree05d7ab7a6043c15d974c01bb5e21e540edeed260
parent58adb333680042bedefcd41674d5c91c52862575 (diff)
SL-1811 Slight chat optimization
-rw-r--r--indra/llui/lllayoutstack.cpp8
-rw-r--r--indra/newview/llconversationview.cpp13
-rw-r--r--indra/newview/llfloaterimcontainer.cpp104
-rw-r--r--indra/newview/llfloaterimcontainer.h4
4 files changed, 83 insertions, 46 deletions
diff --git a/indra/llui/lllayoutstack.cpp b/indra/llui/lllayoutstack.cpp
index 69246a2f57..b1ba725c2f 100644
--- a/indra/llui/lllayoutstack.cpp
+++ b/indra/llui/lllayoutstack.cpp
@@ -251,8 +251,14 @@ void LLLayoutStack::draw()
// always clip to stack itself
LLLocalClipRect clip(getLocalRect());
- BOOST_FOREACH(LLLayoutPanel* panelp, mPanels)
+ for (LLLayoutPanel* panelp : mPanels)
{
+ if ((!panelp->getVisible() || panelp->mCollapsed)
+ && (panelp->mVisibleAmt < 0.001f || !mAnimate))
+ {
+ // essentially invisible
+ continue;
+ }
// clip to layout rectangle, not bounding rectangle
LLRect clip_rect = panelp->getRect();
// scale clipping rectangle by visible amount
diff --git a/indra/newview/llconversationview.cpp b/indra/newview/llconversationview.cpp
index dee0a52ce8..59bb9af744 100644
--- a/indra/newview/llconversationview.cpp
+++ b/indra/newview/llconversationview.cpp
@@ -234,6 +234,8 @@ void LLConversationViewSession::draw()
// Draw children if root folder, or any other folder that is open. Do not draw children when animating to closed state or you get rendering overlap.
bool draw_children = getRoot() == static_cast<LLFolderViewFolder*>(this) || isOpen();
+ // Todo/fix this: arrange hides children 'out of bonds', session 'slowly' adjusts container size, unhides children
+ // this process repeats until children fit
for (folders_t::iterator iter = mFolders.begin();
iter != mFolders.end();)
{
@@ -254,9 +256,6 @@ void LLConversationViewSession::draw()
updateLabelRotation();
drawOpenFolderArrow(default_params, sFgColor);
}
-
- refresh();
-
LLView::draw();
}
@@ -568,6 +567,7 @@ void LLConversationViewParticipant::draw()
F32 text_left = (F32)getLabelXPos();
LLColor4 color;
+
LLLocalSpeakerMgr *speakerMgr = LLLocalSpeakerMgr::getInstance();
if (speakerMgr && speakerMgr->isSpeakerToBeRemoved(mUUID))
@@ -579,9 +579,14 @@ void LLConversationViewParticipant::draw()
color = mIsSelected ? sHighlightFgColor : sFgColor;
}
+ LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(getViewModelItem());
+ if (participant_model)
+ {
+ mSpeakingIndicator->setIsModeratorMuted(participant_model->isModeratorMuted());
+ }
+
drawHighlight(show_context, mIsSelected, sHighlightBgColor, sFlashBgColor, sFocusOutlineColor, sMouseOverColor);
drawLabel(font, text_left, y, color, right_x);
- refresh();
LLView::draw();
}
diff --git a/indra/newview/llfloaterimcontainer.cpp b/indra/newview/llfloaterimcontainer.cpp
index 3cfa1133df..30d05ae287 100644
--- a/indra/newview/llfloaterimcontainer.cpp
+++ b/indra/newview/llfloaterimcontainer.cpp
@@ -269,6 +269,9 @@ BOOL LLFloaterIMContainer::postBuild()
// When display name option change, we need to reload all participant names
LLAvatarNameCache::addUseDisplayNamesCallback(boost::bind(&LLFloaterIMContainer::processParticipantsStyleUpdate, this));
+ mParticipantRefreshTimer.setTimerExpirySec(0);
+ mParticipantRefreshTimer.start();
+
return TRUE;
}
@@ -420,14 +423,66 @@ void LLFloaterIMContainer::processParticipantsStyleUpdate()
void LLFloaterIMContainer::idle(void* user_data)
{
LLFloaterIMContainer* self = static_cast<LLFloaterIMContainer*>(user_data);
-
- // Update the distance to agent in the nearby chat session if required
- // Note: it makes no sense of course to update the distance in other session
- if (self->mConversationViewModel.getSorter().getSortOrderParticipants() == LLConversationFilter::SO_DISTANCE)
- {
- self->setNearbyDistances();
- }
- self->mConversationsRoot->update();
+
+ if (!self->getVisible() || self->isMinimized())
+ {
+ return;
+ }
+ self->idleUpdate();
+}
+
+void LLFloaterIMContainer::idleUpdate()
+{
+ if (mTabContainer->getTabCount() == 0)
+ {
+ // Do not close the container when every conversation is torn off because the user
+ // still needs the conversation list. Simply collapse the message pane in that case.
+ collapseMessagesPane(true);
+ }
+
+ U32 sort_order = mConversationViewModel.getSorter().getSortOrderParticipants();
+
+ if (mParticipantRefreshTimer.hasExpired())
+ {
+ const LLConversationItem *current_session = getCurSelectedViewModelItem();
+ if (current_session)
+ {
+ // Update moderator options visibility
+ LLFolderViewModelItemCommon::child_list_t::const_iterator current_participant_model = current_session->getChildrenBegin();
+ LLFolderViewModelItemCommon::child_list_t::const_iterator end_participant_model = current_session->getChildrenEnd();
+ bool is_moderator = isGroupModerator();
+ bool can_ban = haveAbilityToBan();
+ while (current_participant_model != end_participant_model)
+ {
+ LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(*current_participant_model);
+ participant_model->setModeratorOptionsVisible(is_moderator && participant_model->getUUID() != gAgentID);
+ participant_model->setGroupBanVisible(can_ban && participant_model->getUUID() != gAgentID);
+
+ current_participant_model++;
+ }
+ // Update floater's title as required by the currently selected session or use the default title
+ LLFloaterIMSession * conversation_floaterp = LLFloaterIMSession::findInstance(current_session->getUUID());
+ setTitle(conversation_floaterp && conversation_floaterp->needsTitleOverwrite() ? conversation_floaterp->getTitle() : mGeneralTitle);
+ }
+
+ mParticipantRefreshTimer.setTimerExpirySec(1.0f);
+ }
+
+ // Update the distance to agent in the nearby chat session if required
+ // Note: it makes no sense of course to update the distance in other session
+ if (sort_order == LLConversationFilter::SO_DISTANCE)
+ {
+ // almost real-time updates
+ setNearbyDistances(); //calls arrange all
+ }
+ mConversationsRoot->update(); //arranges, resizes, heavy
+
+ // "Manually" resize of mConversationsPane: same as temporarity cancellation of the flag "auto_resize=false" for it
+ if (!mConversationsPane->isCollapsed() && mMessagesPane->isCollapsed())
+ {
+ LLRect stack_rect = mConversationsStack->getRect();
+ mConversationsPane->reshape(stack_rect.getWidth(), stack_rect.getHeight(), true);
+ }
}
bool LLFloaterIMContainer::onConversationModelEvent(const LLSD& event)
@@ -526,39 +581,6 @@ bool LLFloaterIMContainer::onConversationModelEvent(const LLSD& event)
void LLFloaterIMContainer::draw()
{
- if (mTabContainer->getTabCount() == 0)
- {
- // Do not close the container when every conversation is torn off because the user
- // still needs the conversation list. Simply collapse the message pane in that case.
- collapseMessagesPane(true);
- }
-
- const LLConversationItem *current_session = getCurSelectedViewModelItem();
- if (current_session)
- {
- // Update moderator options visibility
- LLFolderViewModelItemCommon::child_list_t::const_iterator current_participant_model = current_session->getChildrenBegin();
- LLFolderViewModelItemCommon::child_list_t::const_iterator end_participant_model = current_session->getChildrenEnd();
- while (current_participant_model != end_participant_model)
- {
- LLConversationItemParticipant* participant_model = dynamic_cast<LLConversationItemParticipant*>(*current_participant_model);
- participant_model->setModeratorOptionsVisible(isGroupModerator() && participant_model->getUUID() != gAgentID);
- participant_model->setGroupBanVisible(haveAbilityToBan() && participant_model->getUUID() != gAgentID);
-
- current_participant_model++;
- }
- // Update floater's title as required by the currently selected session or use the default title
- LLFloaterIMSession * conversation_floaterp = LLFloaterIMSession::findInstance(current_session->getUUID());
- setTitle(conversation_floaterp && conversation_floaterp->needsTitleOverwrite() ? conversation_floaterp->getTitle() : mGeneralTitle);
- }
-
- // "Manually" resize of mConversationsPane: same as temporarity cancellation of the flag "auto_resize=false" for it
- if (!mConversationsPane->isCollapsed() && mMessagesPane->isCollapsed())
- {
- LLRect stack_rect = mConversationsStack->getRect();
- mConversationsPane->reshape(stack_rect.getWidth(), stack_rect.getHeight(), true);
- }
-
LLFloater::draw();
}
diff --git a/indra/newview/llfloaterimcontainer.h b/indra/newview/llfloaterimcontainer.h
index 90fc0c2bdd..78b3572111 100644
--- a/indra/newview/llfloaterimcontainer.h
+++ b/indra/newview/llfloaterimcontainer.h
@@ -180,6 +180,8 @@ private:
void openNearbyChat();
bool isParticipantListExpanded();
+ void idleUpdate(); // for convenience (self) from static idle
+
LLButton* mExpandCollapseBtn;
LLButton* mStubCollapseBtn;
LLButton* mSpeakBtn;
@@ -226,6 +228,8 @@ private:
LLConversationViewModel mConversationViewModel;
LLFolderView* mConversationsRoot;
LLEventStream mConversationsEventStream;
+
+ LLTimer mParticipantRefreshTimer;
};
#endif // LL_LLFLOATERIMCONTAINER_H