summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterinventory.cpp
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2009-09-26 18:08:24 -0400
committerNat Goodspeed <nat@lindenlab.com>2009-09-26 18:08:24 -0400
commitbc4444cd78067cbf11d3ffb210375a31a33f96bd (patch)
treed9b8e78db237869e630fec6c71335d1294cec101 /indra/newview/llfloaterinventory.cpp
parent8ddc0c0ac43e9d10bf0262cd1ab3c0e79808fc14 (diff)
parent09bf3c1fec107e9e66514837d208ef62a6b67b91 (diff)
Merge into viewer/viewer-20 yesterday's lindenlab/svn-imports-viewer-20
Diffstat (limited to 'indra/newview/llfloaterinventory.cpp')
-rw-r--r--indra/newview/llfloaterinventory.cpp55
1 files changed, 33 insertions, 22 deletions
diff --git a/indra/newview/llfloaterinventory.cpp b/indra/newview/llfloaterinventory.cpp
index 45a42f994d..27eb12b9cc 100644
--- a/indra/newview/llfloaterinventory.cpp
+++ b/indra/newview/llfloaterinventory.cpp
@@ -569,16 +569,7 @@ void LLFloaterInventory::draw()
{
if (LLInventoryModel::isEverythingFetched())
{
- LLLocale locale(LLLocale::USER_LOCALE);
- std::ostringstream title;
- //title << "Inventory";
- title<<getString("Title");
- std::string item_count_string;
- LLResMgr::getInstance()->getIntegerString(item_count_string, gInventory.getItemCount());
- title << " (" << item_count_string << getString("Items")<<")";
- //TODO:: Translate mFilterText
- title << mFilterText;
- setTitle(title.str());
+ updateTitle();
}
LLFloater::draw();
}
@@ -690,22 +681,30 @@ BOOL LLFloaterInventory::handleKeyHere(KEY key, MASK mask)
}
-void LLFloaterInventory::changed(U32 mask)
+void LLFloaterInventory::updateTitle()
{
- std::ostringstream title;
- //title << "Inventory";
- title<<getString("Title");
+ LLLocale locale(LLLocale::USER_LOCALE);
+ std::string item_count_string;
+ LLResMgr::getInstance()->getIntegerString(item_count_string, gInventory.getItemCount());
+
+ LLStringUtil::format_map_t string_args;
+ string_args["[ITEM_COUNT]"] = item_count_string;
+ string_args["[FILTER]"] = mFilterText;
+
if (LLInventoryModel::backgroundFetchActive())
{
- LLLocale locale(LLLocale::USER_LOCALE);
- std::string item_count_string;
- LLResMgr::getInstance()->getIntegerString(item_count_string, gInventory.getItemCount());
- title << " ( "<< getString("Fetched") << item_count_string << getString("Items")<<")";
+ setTitle(getString("TitleFetching", string_args));
}
- //TODO:: Translate mFilterText
- title << mFilterText;
- setTitle(title.str());
+ else
+ {
+ setTitle(getString("TitleCompleted", string_args));
+ }
+}
+
+void LLFloaterInventory::changed(U32 mask)
+{
+ updateTitle();
}
//----------------------------------------------------------------------------
@@ -1230,7 +1229,11 @@ BOOL LLInventoryPanel::postBuild()
// build everything.
mInventoryObserver = new LLInventoryPanelObserver(this);
mInventory->addObserver(mInventoryObserver);
- rebuildViewsFor(LLUUID::null, LLInventoryObserver::ADD);
+ // build view of inventory if inventory ready, otherwise wait for modelChanged() callback
+ if (mInventory->isInventoryUsable())
+ {
+ rebuildViewsFor(LLUUID::null, LLInventoryObserver::ADD);
+ }
// bit of a hack to make sure the inventory is open.
mFolders->openFolder(std::string("My Inventory"));
@@ -1327,6 +1330,14 @@ void LLInventoryPanel::modelChanged(U32 mask)
LLFastTimer t2(FTM_REFRESH);
bool handled = false;
+
+ // inventory just initialized, do complete build
+ if ((mask & LLInventoryObserver::ADD) && gInventory.getChangedIDs().empty())
+ {
+ rebuildViewsFor(LLUUID::null, LLInventoryObserver::ADD);
+ return;
+ }
+
if(mask & LLInventoryObserver::LABEL)
{
handled = true;