Improve performance in standalone radar (don't parse XMLs on each update); people panel will need to be looked at after CHUI merge

master
Ansariel 2013-04-21 18:05:08 +02:00
parent 0356c62b42
commit 2e067b02c1
2 changed files with 27 additions and 30 deletions

View File

@ -60,6 +60,21 @@ FSFloaterRadar::~FSFloaterRadar()
BOOL FSFloaterRadar::postBuild()
{
mFilterEditor = getChild<LLFilterEditor>("filter_input");
mFilterEditor->setCommitCallback(boost::bind(&FSFloaterRadar::onFilterEdit, this, _2));
mProfileButton = getChild<LLButton>("view_profile_btn");
mIMButton = getChild<LLButton>("im_btn");
mCallButton = getChild<LLButton>("call_btn");
mTeleportButton = getChild<LLButton>("teleport_btn");
mShareButton = getChild<LLButton>("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<FSPanelRadar>("panel_radar");
if (!mRadarPanel)
{
@ -67,15 +82,6 @@ BOOL FSFloaterRadar::postBuild()
}
mRadarChangeConnection = mRadarPanel->setChangeCallback(boost::bind(&FSFloaterRadar::updateButtons, this));
mFilterEditor = getChild<LLFilterEditor>("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<LLView>("button_bar")->getChild<LLButton>(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<LLView>("button_bar")->getChild<LLButton>(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)

View File

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