summaryrefslogtreecommitdiff
path: root/indra/newview/llinventoryitemslist.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llinventoryitemslist.cpp')
-rw-r--r--indra/newview/llinventoryitemslist.cpp48
1 files changed, 39 insertions, 9 deletions
diff --git a/indra/newview/llinventoryitemslist.cpp b/indra/newview/llinventoryitemslist.cpp
index 9719de4650..750cdfb678 100644
--- a/indra/newview/llinventoryitemslist.cpp
+++ b/indra/newview/llinventoryitemslist.cpp
@@ -40,11 +40,13 @@
// llcommon
#include "llcommonutils.h"
+// llui
#include "lliconctrl.h"
+#include "lltextutil.h"
+#include "llcallbacklist.h"
#include "llinventoryfunctions.h"
#include "llinventorymodel.h"
-#include "lltextutil.h"
#include "lltrans.h"
////////////////////////////////////////////////////////////////////////////////
@@ -130,7 +132,7 @@ BOOL LLPanelInventoryListItemBase::postBuild()
setIconCtrl(getChild<LLIconCtrl>("item_icon"));
setTitleCtrl(getChild<LLTextBox>("item_name"));
- mIconImage = get_item_icon(mItem->getType(), mItem->getInventoryType(), mItem->getFlags(), FALSE);
+ mIconImage = LLInventoryIcon::getIcon(mItem->getType(), mItem->getInventoryType(), mItem->getIsLinkType(), mItem->getFlags(), FALSE);
setNeedsRefresh(true);
@@ -320,6 +322,7 @@ LLInventoryItemsList::Params::Params()
LLInventoryItemsList::LLInventoryItemsList(const LLInventoryItemsList::Params& p)
: LLFlatListViewEx(p)
, mNeedsRefresh(false)
+, mForceRefresh(false)
{
// TODO: mCommitOnSelectionChange is set to "false" in LLFlatListView
// but reset to true in all derived classes. This settings might need to
@@ -327,11 +330,15 @@ LLInventoryItemsList::LLInventoryItemsList(const LLInventoryItemsList::Params& p
setCommitOnSelectionChange(true);
setNoFilteredItemsMsg(LLTrans::getString("InventoryNoMatchingItems"));
+
+ gIdleCallbacks.addFunction(idle, this);
}
// virtual
LLInventoryItemsList::~LLInventoryItemsList()
-{}
+{
+ gIdleCallbacks.deleteFunction(idle, this);
+}
void LLInventoryItemsList::refreshList(const LLInventoryModel::item_array_t item_array)
{
@@ -344,12 +351,30 @@ void LLInventoryItemsList::refreshList(const LLInventoryModel::item_array_t item
mNeedsRefresh = true;
}
-void LLInventoryItemsList::draw()
+boost::signals2::connection LLInventoryItemsList::setRefreshCompleteCallback(const commit_signal_t::slot_type& cb)
+{
+ return mRefreshCompleteSignal.connect(cb);
+}
+
+void LLInventoryItemsList::doIdle()
{
- LLFlatListViewEx::draw();
- if(mNeedsRefresh)
+ if (!mNeedsRefresh) return;
+
+ if (isInVisibleChain() || mForceRefresh)
{
refresh();
+
+ mRefreshCompleteSignal(this, LLSD());
+ }
+}
+
+//static
+void LLInventoryItemsList::idle(void* user_data)
+{
+ LLInventoryItemsList* self = static_cast<LLInventoryItemsList*>(user_data);
+ if ( self )
+ { // Do the real idle
+ self->doIdle();
}
}
@@ -363,7 +388,7 @@ void LLInventoryItemsList::refresh()
computeDifference(getIDs(), added_items, removed_items);
bool add_limit_exceeded = false;
- unsigned nadded = 0;
+ unsigned int nadded = 0;
uuid_vec_t::const_iterator it = added_items.begin();
for( ; added_items.end() != it; ++it)
@@ -375,8 +400,12 @@ void LLInventoryItemsList::refresh()
}
LLViewerInventoryItem* item = gInventory.getItem(*it);
// Do not rearrange items on each adding, let's do that on filter call
- addNewItem(item, false);
- ++nadded;
+ llassert(item);
+ if (item)
+ {
+ addNewItem(item, false);
+ ++nadded;
+ }
}
it = removed_items.begin();
@@ -390,6 +419,7 @@ void LLInventoryItemsList::refresh()
bool needs_refresh = add_limit_exceeded;
setNeedsRefresh(needs_refresh);
+ setForceRefresh(needs_refresh);
}
void LLInventoryItemsList::computeDifference(