From 2e067b02c19d0fcf1eecd62175ad9dfa76aaf03a Mon Sep 17 00:00:00 2001 From: Ansariel Date: Sun, 21 Apr 2013 18:05:08 +0200 Subject: [PATCH] Improve performance in standalone radar (don't parse XMLs on each update); people panel will need to be looked at after CHUI merge --- indra/newview/fsfloaterradar.cpp | 48 +++++++++++++------------------- indra/newview/fsfloaterradar.h | 9 ++++-- 2 files changed, 27 insertions(+), 30 deletions(-) diff --git a/indra/newview/fsfloaterradar.cpp b/indra/newview/fsfloaterradar.cpp index c480cac41d..622e397052 100644 --- a/indra/newview/fsfloaterradar.cpp +++ b/indra/newview/fsfloaterradar.cpp @@ -60,6 +60,21 @@ FSFloaterRadar::~FSFloaterRadar() BOOL FSFloaterRadar::postBuild() { + mFilterEditor = getChild("filter_input"); + mFilterEditor->setCommitCallback(boost::bind(&FSFloaterRadar::onFilterEdit, this, _2)); + + mProfileButton = getChild("view_profile_btn"); + mIMButton = getChild("im_btn"); + mCallButton = getChild("call_btn"); + mTeleportButton = getChild("teleport_btn"); + mShareButton = getChild("share_btn"); + + mProfileButton->setCommitCallback(boost::bind(&FSFloaterRadar::onViewProfileButtonClicked, this)); + mIMButton->setCommitCallback(boost::bind(&FSFloaterRadar::onImButtonClicked, this)); + mCallButton->setCommitCallback(boost::bind(&FSFloaterRadar::onCallButtonClicked, this)); + mTeleportButton->setCommitCallback(boost::bind(&FSFloaterRadar::onTeleportButtonClicked, this)); + mShareButton->setCommitCallback(boost::bind(&FSFloaterRadar::onShareButtonClicked, this)); + mRadarPanel = findChild("panel_radar"); if (!mRadarPanel) { @@ -67,15 +82,6 @@ BOOL FSFloaterRadar::postBuild() } mRadarChangeConnection = mRadarPanel->setChangeCallback(boost::bind(&FSFloaterRadar::updateButtons, this)); - mFilterEditor = getChild("filter_input"); - mFilterEditor->setCommitCallback(boost::bind(&FSFloaterRadar::onFilterEdit, this, _2)); - - buttonSetAction("view_profile_btn", boost::bind(&FSFloaterRadar::onViewProfileButtonClicked, this)); - buttonSetAction("im_btn", boost::bind(&FSFloaterRadar::onImButtonClicked, this)); - buttonSetAction("call_btn", boost::bind(&FSFloaterRadar::onCallButtonClicked, this)); - buttonSetAction("teleport_btn", boost::bind(&FSFloaterRadar::onTeleportButtonClicked, this)); - buttonSetAction("share_btn", boost::bind(&FSFloaterRadar::onShareButtonClicked, this)); - LLVoiceClient::getInstance()->addObserver(this); // call this method in case some list is empty and buttons can be in inconsistent state @@ -103,20 +109,6 @@ void FSFloaterRadar::onChange(EStatusType status, const std::string &channelURI, updateButtons(); } -void FSFloaterRadar::buttonSetEnabled(const std::string& btn_name, bool enabled) -{ - // To make sure we're referencing the right widget (a child of the button bar). - LLButton* button = getChild("button_bar")->getChild(btn_name); - button->setEnabled(enabled); -} - -void FSFloaterRadar::buttonSetAction(const std::string& btn_name, const commit_signal_t::slot_type& cb) -{ - // To make sure we're referencing the right widget (a child of the button bar). - LLButton* button = getChild("button_bar")->getChild(btn_name); - button->setClickedCallback(cb); -} - void FSFloaterRadar::updateButtons() { LLUUID selected_id; @@ -135,11 +127,11 @@ void FSFloaterRadar::updateButtons() } // [/RLBa:KB] - buttonSetEnabled("view_profile_btn",item_selected); - buttonSetEnabled("share_btn", item_selected); - buttonSetEnabled("im_btn", multiple_selected); // allow starting the friends conference for multiple selection - buttonSetEnabled("call_btn", multiple_selected && enable_calls); - buttonSetEnabled("teleport_btn", multiple_selected /* && LLAvatarActions::canOfferTeleport(selected_uuids) */ ); // LO - Dont block the TP button at all. + mProfileButton->setEnabled(item_selected); + mShareButton->setEnabled(item_selected); + mIMButton->setEnabled(multiple_selected); // allow starting the friends conference for multiple selection + mCallButton->setEnabled(multiple_selected && enable_calls); + mTeleportButton->setEnabled(multiple_selected /* && LLAvatarActions::canOfferTeleport(selected_uuids) */ ); // LO - Dont block the TP button at all. } void FSFloaterRadar::onFilterEdit(const std::string& search_string) diff --git a/indra/newview/fsfloaterradar.h b/indra/newview/fsfloaterradar.h index be5adac52f..56f93aeee6 100644 --- a/indra/newview/fsfloaterradar.h +++ b/indra/newview/fsfloaterradar.h @@ -33,6 +33,7 @@ #include "fsradar.h" #include "llvoiceclient.h" +class LLButton; class LLFilterEditor; class FSFloaterRadar @@ -53,8 +54,6 @@ public: private: void updateButtons(); - void buttonSetEnabled(const std::string& btn_name, bool enabled); - void buttonSetAction(const std::string& btn_name, const commit_signal_t::slot_type& cb); // UI callbacks void onFilterEdit(const std::string& search_string); @@ -68,6 +67,12 @@ private: FSPanelRadar* mRadarPanel; LLFilterEditor* mFilterEditor; + LLButton* mProfileButton; + LLButton* mShareButton; + LLButton* mIMButton; + LLButton* mCallButton; + LLButton* mTeleportButton; + std::string mFilterSubString; std::string mFilterSubStringOrig;