summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelmaininventory.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpanelmaininventory.cpp')
-rw-r--r--indra/newview/llpanelmaininventory.cpp143
1 files changed, 91 insertions, 52 deletions
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index 2466ee5973..377af4384a 100644
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -908,12 +908,12 @@ bool LLPanelMainInventory::handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop,
EAcceptance* accept,
std::string& tooltip_msg)
{
- // Check to see if we are auto scrolling from the last frame
- LLInventoryPanel* panel = (LLInventoryPanel*)this->getActivePanel();
- bool needsToScroll = panel->getScrollableContainer()->canAutoScroll(x, y);
- if(mFilterTabs)
+ if (mFilterTabs)
{
- if(needsToScroll)
+ // Check to see if we are auto scrolling from the last frame
+ LLInventoryPanel* panel = (LLInventoryPanel*)this->getActivePanel();
+ bool needsToScroll = panel->getScrollableContainer()->canAutoScroll(x, y);
+ if (needsToScroll)
{
mFilterTabs->startDragAndDropDelayTimer();
}
@@ -930,9 +930,9 @@ void LLPanelMainInventory::changed(U32)
updateItemcountText();
}
-void LLPanelMainInventory::setFocusFilterEditor()
+void LLPanelMainInventory::setFocusOnFilterEditor()
{
- if(mFilterEditor)
+ if (mFilterEditor)
{
mFilterEditor->setFocus(true);
}
@@ -963,59 +963,103 @@ void LLPanelMainInventory::draw()
void LLPanelMainInventory::updateItemcountText()
{
- if(mItemCount != gInventory.getItemCount())
+ bool update = false;
+ if (mSingleFolderMode)
{
- mItemCount = gInventory.getItemCount();
- mItemCountString = "";
- LLLocale locale(LLLocale::USER_LOCALE);
- LLResMgr::getInstance()->getIntegerString(mItemCountString, mItemCount);
- }
+ LLInventoryModel::cat_array_t* cats;
+ LLInventoryModel::item_array_t* items;
- if(mCategoryCount != gInventory.getCategoryCount())
- {
- mCategoryCount = gInventory.getCategoryCount();
- mCategoryCountString = "";
- LLLocale locale(LLLocale::USER_LOCALE);
- LLResMgr::getInstance()->getIntegerString(mCategoryCountString, mCategoryCount);
+ gInventory.getDirectDescendentsOf(getCurrentSFVRoot(), cats, items);
+ S32 item_count = items ? (S32)items->size() : 0;
+ S32 cat_count = cats ? (S32)cats->size() : 0;
+
+ if (mItemCount != item_count)
+ {
+ mItemCount = item_count;
+ update = true;
+ }
+ if (mCategoryCount != cat_count)
+ {
+ mCategoryCount = cat_count;
+ update = true;
+ }
}
+ else
+ {
+ if (mItemCount != gInventory.getItemCount())
+ {
+ mItemCount = gInventory.getItemCount();
+ update = true;
+ }
- LLStringUtil::format_map_t string_args;
- string_args["[ITEM_COUNT]"] = mItemCountString;
- string_args["[CATEGORY_COUNT]"] = mCategoryCountString;
- string_args["[FILTER]"] = getFilterText();
+ if (mCategoryCount != gInventory.getCategoryCount())
+ {
+ mCategoryCount = gInventory.getCategoryCount();
+ update = true;
+ }
- std::string text = "";
+ EFetchState currentFetchState{ EFetchState::Unknown };
+ if (LLInventoryModelBackgroundFetch::instance().folderFetchActive())
+ {
+ currentFetchState = EFetchState::Fetching;
+ }
+ else if (LLInventoryModelBackgroundFetch::instance().isEverythingFetched())
+ {
+ currentFetchState = EFetchState::Complete;
+ }
- if (LLInventoryModelBackgroundFetch::instance().folderFetchActive())
- {
- text = getString("ItemcountFetching", string_args);
- }
- else if (LLInventoryModelBackgroundFetch::instance().isEverythingFetched())
- {
- text = getString("ItemcountCompleted", string_args);
+ if (mLastFetchState != currentFetchState)
+ {
+ mLastFetchState = currentFetchState;
+ update = true;
+ }
}
- else
+
+ if (mLastFilterText != getFilterText())
{
- text = getString("ItemcountUnknown", string_args);
+ mLastFilterText = getFilterText();
+ update = true;
}
- if (mSingleFolderMode)
+ if (update)
{
- LLInventoryModel::cat_array_t *cats;
- LLInventoryModel::item_array_t *items;
+ mItemCountString = "";
+ LLLocale locale(LLLocale::USER_LOCALE);
+ LLResMgr::getInstance()->getIntegerString(mItemCountString, mItemCount);
- gInventory.getDirectDescendentsOf(getCurrentSFVRoot(), cats, items);
+ mCategoryCountString = "";
+ LLResMgr::getInstance()->getIntegerString(mCategoryCountString, mCategoryCount);
+
+ LLStringUtil::format_map_t string_args;
+ string_args["[ITEM_COUNT]"] = mItemCountString;
+ string_args["[CATEGORY_COUNT]"] = mCategoryCountString;
+ string_args["[FILTER]"] = mLastFilterText;
- if (items && cats)
+ std::string text = "";
+
+ if (mSingleFolderMode)
{
- string_args["[ITEM_COUNT]"] = llformat("%d", items->size());
- string_args["[CATEGORY_COUNT]"] = llformat("%d", cats->size());
text = getString("ItemcountCompleted", string_args);
}
- }
+ else
+ {
+ switch (mLastFetchState)
+ {
+ case EFetchState::Fetching:
+ text = getString("ItemcountFetching", string_args);
+ break;
+ case EFetchState::Complete:
+ text = getString("ItemcountCompleted", string_args);
+ break;
+ default:
+ text = getString("ItemcountUnknown", string_args);
+ break;
+ }
+ }
- mCounterCtrl->setValue(text);
- mCounterCtrl->setToolTip(text);
+ mCounterCtrl->setValue(text);
+ mCounterCtrl->setToolTip(text);
+ }
}
void LLPanelMainInventory::onFocusReceived()
@@ -1215,7 +1259,6 @@ void LLFloaterInventoryFinder::draw()
filtered_by_all_types = false;
}
-
if (!getChild<LLUICtrl>("check_calling_card")->getValue())
{
filter &= ~(0x1 << LLInventoryType::IT_CALLINGCARD);
@@ -1235,8 +1278,6 @@ void LLFloaterInventoryFinder::draw()
}
if (!getChild<LLUICtrl>("check_landmark")->getValue())
-
-
{
filter &= ~(0x1 << LLInventoryType::IT_LANDMARK);
filtered_by_all_types = false;
@@ -1297,9 +1338,8 @@ void LLFloaterInventoryFinder::draw()
filter &= ~(0x1 << LLInventoryType::IT_CATEGORY);
}
-
bool is_sf_mode = mPanelMainInventory->isSingleFolderMode();
- if(is_sf_mode && mPanelMainInventory->isGalleryViewMode())
+ if (is_sf_mode && mPanelMainInventory->isGalleryViewMode())
{
mPanelMainInventory->mCombinationGalleryPanel->getFilter().setShowFolderState(getCheckShowEmpty() ?
LLInventoryFilter::SHOW_ALL_FOLDERS : LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
@@ -1307,7 +1347,7 @@ void LLFloaterInventoryFinder::draw()
}
else
{
- if(is_sf_mode && mPanelMainInventory->isCombinationViewMode())
+ if (is_sf_mode && mPanelMainInventory->isCombinationViewMode())
{
mPanelMainInventory->mCombinationGalleryPanel->getFilter().setShowFolderState(getCheckShowEmpty() ?
LLInventoryFilter::SHOW_ALL_FOLDERS : LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
@@ -1339,9 +1379,8 @@ void LLFloaterInventoryFinder::draw()
}
hours += days * 24;
-
mPanelMainInventory->setFilterTextFromFilter();
- if(is_sf_mode && mPanelMainInventory->isGalleryViewMode())
+ if (is_sf_mode && mPanelMainInventory->isGalleryViewMode())
{
mPanelMainInventory->mCombinationGalleryPanel->getFilter().setHoursAgo(hours);
mPanelMainInventory->mCombinationGalleryPanel->getFilter().setDateRangeLastLogoff(getCheckSinceLogoff());
@@ -1349,7 +1388,7 @@ void LLFloaterInventoryFinder::draw()
}
else
{
- if(is_sf_mode && mPanelMainInventory->isCombinationViewMode())
+ if (is_sf_mode && mPanelMainInventory->isCombinationViewMode())
{
mPanelMainInventory->mCombinationGalleryPanel->getFilter().setHoursAgo(hours);
mPanelMainInventory->mCombinationGalleryPanel->getFilter().setDateRangeLastLogoff(getCheckSinceLogoff());