summaryrefslogtreecommitdiff
path: root/indra/newview/llsidepanelinventory.cpp
diff options
context:
space:
mode:
authorLeslie Linden <leslie@lindenlab.com>2011-08-08 15:13:53 -0700
committerLeslie Linden <leslie@lindenlab.com>2011-08-08 15:13:53 -0700
commitb6685b5872a4afe976f39d201868b8d656044e84 (patch)
tree91b138a276cc51078f57ce4f0b059a63fa2230c2 /indra/newview/llsidepanelinventory.cpp
parentd712dde69e29381ab1bf55f27c41bb3b29ef3b59 (diff)
EXP-1065 FIX -- Inventory has slowed to a crawl. Clicking between items has an average one second delay. Same with switching between tabs.
* Removed numerous places in the code that called findChild across the inventory panel unnecessarily. * Conglomerated uses of inbox and outbox inventory panels to the sidepanel class so the pointers can be cached and functionality like selection handling can be done more efficiently. * Optimized LLView::childHasKeyboardFocus() to work backwards up from the focus object rather than searching for children that may or may not turn out to have focus. Reviewed by Richard.
Diffstat (limited to 'indra/newview/llsidepanelinventory.cpp')
-rw-r--r--indra/newview/llsidepanelinventory.cpp92
1 files changed, 68 insertions, 24 deletions
diff --git a/indra/newview/llsidepanelinventory.cpp b/indra/newview/llsidepanelinventory.cpp
index 6f809ba3ca..54198cc577 100644
--- a/indra/newview/llsidepanelinventory.cpp
+++ b/indra/newview/llsidepanelinventory.cpp
@@ -132,6 +132,8 @@ private:
LLSidepanelInventory::LLSidepanelInventory()
: LLPanel()
, mItemPanel(NULL)
+ , mInventoryPanelInbox(NULL)
+ , mInventoryPanelOutbox(NULL)
, mPanelMainInventory(NULL)
, mInboxEnabled(false)
, mOutboxEnabled(false)
@@ -351,7 +353,7 @@ void LLSidepanelInventory::observeInboxModifications(const LLUUID& inboxID)
//
LLPanelMarketplaceInbox * inbox = getChild<LLPanelMarketplaceInbox>(MARKETPLACE_INBOX_PANEL);
- inbox->setupInventoryPanel();
+ mInventoryPanelInbox = inbox->setupInventoryPanel();
}
@@ -380,7 +382,7 @@ void LLSidepanelInventory::observeOutboxModifications(const LLUUID& outboxID)
//
LLPanelMarketplaceOutbox * outbox = getChild<LLPanelMarketplaceOutbox>(MARKETPLACE_OUTBOX_PANEL);
- outbox->setupInventoryPanel();
+ mInventoryPanelOutbox = outbox->setupInventoryPanel();
}
void LLSidepanelInventory::enableInbox(bool enabled)
@@ -529,14 +531,12 @@ void LLSidepanelInventory::onShopButtonClicked()
void LLSidepanelInventory::performActionOnSelection(const std::string &action)
{
- LLPanelMainInventory *panel_main_inventory = mInventoryPanel->getChild<LLPanelMainInventory>("panel_main_inventory");
- LLFolderViewItem* current_item = panel_main_inventory->getActivePanel()->getRootFolder()->getCurSelectedItem();
+ LLFolderViewItem* current_item = mPanelMainInventory->getActivePanel()->getRootFolder()->getCurSelectedItem();
if (!current_item)
{
- LLInventoryPanel* inbox = findChild<LLInventoryPanel>("inventory_inbox");
- if (inbox)
+ if (mInventoryPanelInbox)
{
- current_item = inbox->getRootFolder()->getCurSelectedItem();
+ current_item = mInventoryPanelInbox->getRootFolder()->getCurSelectedItem();
}
if (!current_item)
@@ -545,7 +545,7 @@ void LLSidepanelInventory::performActionOnSelection(const std::string &action)
}
}
- current_item->getListener()->performAction(panel_main_inventory->getActivePanel()->getModel(), action);
+ current_item->getListener()->performAction(mPanelMainInventory->getActivePanel()->getModel(), action);
}
void LLSidepanelInventory::onWearButtonClicked()
@@ -687,19 +687,16 @@ void LLSidepanelInventory::updateVerbs()
bool LLSidepanelInventory::canShare()
{
- LLPanelMainInventory* panel_main_inventory =
- mInventoryPanel->findChild<LLPanelMainInventory>("panel_main_inventory");
-
- LLInventoryPanel* inbox = findChild<LLInventoryPanel>("inventory_inbox");
+ LLInventoryPanel* inbox = mInventoryPanelInbox;
// Avoid flicker in the Recent tab while inventory is being loaded.
if ( (!inbox || inbox->getRootFolder()->getSelectionList().empty())
- && (panel_main_inventory && !panel_main_inventory->getActivePanel()->getRootFolder()->hasVisibleChildren()) )
+ && (mPanelMainInventory && !mPanelMainInventory->getActivePanel()->getRootFolder()->hasVisibleChildren()) )
{
return false;
}
- return ( (panel_main_inventory ? LLAvatarActions::canShareSelectedItems(panel_main_inventory->getActivePanel()) : false)
+ return ( (mPanelMainInventory ? LLAvatarActions::canShareSelectedItems(mPanelMainInventory->getActivePanel()) : false)
|| (inbox ? LLAvatarActions::canShareSelectedItems(inbox) : false) );
}
@@ -724,14 +721,13 @@ bool LLSidepanelInventory::canWearSelected()
LLInventoryItem *LLSidepanelInventory::getSelectedItem()
{
- LLPanelMainInventory *panel_main_inventory = mInventoryPanel->getChild<LLPanelMainInventory>("panel_main_inventory");
- LLFolderViewItem* current_item = panel_main_inventory->getActivePanel()->getRootFolder()->getCurSelectedItem();
+ LLFolderViewItem* current_item = mPanelMainInventory->getActivePanel()->getRootFolder()->getCurSelectedItem();
+
if (!current_item)
{
- LLInventoryPanel* inbox = findChild<LLInventoryPanel>("inventory_inbox");
- if (inbox)
+ if (mInventoryPanelInbox)
{
- current_item = inbox->getRootFolder()->getCurSelectedItem();
+ current_item = mInventoryPanelInbox->getRootFolder()->getCurSelectedItem();
}
if (!current_item)
@@ -748,14 +744,20 @@ U32 LLSidepanelInventory::getSelectedCount()
{
int count = 0;
- LLPanelMainInventory *panel_main_inventory = mInventoryPanel->getChild<LLPanelMainInventory>("panel_main_inventory");
- std::set<LLUUID> selection_list = panel_main_inventory->getActivePanel()->getRootFolder()->getSelectionList();
+ std::set<LLUUID> selection_list = mPanelMainInventory->getActivePanel()->getRootFolder()->getSelectionList();
count += selection_list.size();
- LLInventoryPanel* inbox = findChild<LLInventoryPanel>("inventory_inbox");
- if (inbox)
+ if ((count == 0) && mInboxEnabled && (mInventoryPanelInbox != NULL))
{
- selection_list = inbox->getRootFolder()->getSelectionList();
+ selection_list = mInventoryPanelInbox->getRootFolder()->getSelectionList();
+
+ count += selection_list.size();
+ }
+
+ if ((count == 0) && mOutboxEnabled && (mInventoryPanelOutbox != NULL))
+ {
+ selection_list = mInventoryPanelOutbox->getRootFolder()->getSelectionList();
+
count += selection_list.size();
}
@@ -779,3 +781,45 @@ BOOL LLSidepanelInventory::isMainInventoryPanelActive() const
{
return mInventoryPanel->getVisible();
}
+
+void LLSidepanelInventory::clearSelections(bool clearMain, bool clearInbox, bool clearOutbox)
+{
+ if (clearMain)
+ {
+ LLInventoryPanel * inv_panel = getActivePanel();
+
+ if (inv_panel)
+ {
+ inv_panel->clearSelection();
+ }
+ }
+
+ if (clearInbox && mInboxEnabled && (mInventoryPanelInbox != NULL))
+ {
+ mInventoryPanelInbox->clearSelection();
+ }
+
+ if (clearOutbox && mOutboxEnabled && (mInventoryPanelOutbox != NULL))
+ {
+ mInventoryPanelOutbox->clearSelection();
+ }
+
+ updateVerbs();
+}
+
+std::set<LLUUID> LLSidepanelInventory::getInboxOrOutboxSelectionList()
+{
+ std::set<LLUUID> inventory_selected_uuids;
+
+ if (mInboxEnabled && (mInventoryPanelInbox != NULL))
+ {
+ inventory_selected_uuids = mInventoryPanelInbox->getRootFolder()->getSelectionList();
+ }
+
+ if (inventory_selected_uuids.empty() && mOutboxEnabled && (mInventoryPanelOutbox != NULL))
+ {
+ inventory_selected_uuids = mInventoryPanelOutbox->getRootFolder()->getSelectionList();
+ }
+
+ return inventory_selected_uuids;
+}