From 9db2de69f15723518b7129dd198332520e958b85 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Wed, 13 Dec 2017 12:47:25 +0200 Subject: MAINT-8061 Consider including folder count along with object count --- indra/newview/llinventorybridge.cpp | 18 +++++++- indra/newview/llinventorybridge.h | 3 ++ indra/newview/llinventorypanel.cpp | 50 ++++++++++++++++++++++ indra/newview/llinventorypanel.h | 2 + indra/newview/llpanelmaininventory.cpp | 10 +++++ indra/newview/llpanelmaininventory.h | 6 ++- .../skins/default/xui/en/panel_main_inventory.xml | 9 ++-- 7 files changed, 90 insertions(+), 8 deletions(-) (limited to 'indra') diff --git a/indra/newview/llinventorybridge.cpp b/indra/newview/llinventorybridge.cpp index 4d1a6451e5..77c77023b1 100644 --- a/indra/newview/llinventorybridge.cpp +++ b/indra/newview/llinventorybridge.cpp @@ -2213,8 +2213,22 @@ std::string LLFolderBridge::getLabelSuffix() const { return llformat(" ( %s ) ", LLTrans::getString("LoadingData").c_str()); } - - return LLInvFVBridge::getLabelSuffix(); + std::string suffix = ""; + if(mShowDescendantsCount) + { + LLInventoryModel::cat_array_t cat_array; + LLInventoryModel::item_array_t item_array; + gInventory.collectDescendents(getUUID(), cat_array, item_array, TRUE); + S32 count = item_array.size(); + if(count > 0) + { + std::ostringstream oss; + oss << count; + suffix = " ( " + oss.str() + " Items )"; + } + } + + return LLInvFVBridge::getLabelSuffix() + suffix; } LLFontGL::StyleFlags LLFolderBridge::getLabelStyle() const diff --git a/indra/newview/llinventorybridge.h b/indra/newview/llinventorybridge.h index fd532c609c..8fa15c082b 100644 --- a/indra/newview/llinventorybridge.h +++ b/indra/newview/llinventorybridge.h @@ -293,6 +293,8 @@ public: virtual std::string getLabelSuffix() const; virtual LLFontGL::StyleFlags getLabelStyle() const; + void setShowDescendantsCount(bool show_count) {mShowDescendantsCount = show_count;} + virtual BOOL renameItem(const std::string& new_name); virtual BOOL removeItem(); @@ -373,6 +375,7 @@ protected: bool mCallingCards; bool mWearables; bool mIsLoading; + bool mShowDescendantsCount; LLTimer mTimeSinceRequestStart; std::string mMessage; LLRootHandle mHandle; diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index 83a8678c86..2762c7af82 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -1110,6 +1110,56 @@ void LLInventoryPanel::onSelectionChange(const std::deque& it fv->startRenamingSelectedItem(); } } + + std::set selected_items = mFolderRoot.get()->getSelectionList(); + LLFolderViewItem* prev_folder_item = getItemByID(mPreviousSelectedFolder); + + if (selected_items.size() == 1) + { + std::set::const_iterator iter = selected_items.begin(); + LLFolderViewItem* folder_item = (*iter); + if(folder_item && (folder_item != prev_folder_item)) + { + LLFolderViewModelItemInventory* fve_listener = static_cast(folder_item->getViewModelItem()); + if (fve_listener && (fve_listener->getInventoryType() == LLInventoryType::IT_CATEGORY)) + { + if(prev_folder_item) + { + LLFolderBridge* prev_bridge = (LLFolderBridge*)prev_folder_item->getViewModelItem(); + if(prev_bridge) + { + prev_bridge->clearDisplayName(); + prev_bridge->setShowDescendantsCount(false); + prev_folder_item->refresh(); + } + } + + LLFolderBridge* bridge = (LLFolderBridge*)folder_item->getViewModelItem(); + if(bridge) + { + bridge->clearDisplayName(); + bridge->setShowDescendantsCount(true); + folder_item->refresh(); + mPreviousSelectedFolder = bridge->getUUID(); + } + } + } + } + else + { + if(prev_folder_item) + { + LLFolderBridge* prev_bridge = (LLFolderBridge*)prev_folder_item->getViewModelItem(); + if(prev_bridge) + { + prev_bridge->clearDisplayName(); + prev_bridge->setShowDescendantsCount(false); + prev_folder_item->refresh(); + } + } + mPreviousSelectedFolder = LLUUID(); + } + } void LLInventoryPanel::doCreate(const LLSD& userdata) diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index ace0ea7f42..3829fb734d 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -258,6 +258,8 @@ protected: LLHandle mFolderRoot; LLScrollContainer* mScroller; + LLUUID mPreviousSelectedFolder; + LLFolderViewModelInventory mInventoryViewModel; LLPointer mGroupedItemBridge; Params mParams; // stored copy of parameter block diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index b004226bd5..db9d61c637 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -708,8 +708,17 @@ void LLPanelMainInventory::updateItemcountText() LLResMgr::getInstance()->getIntegerString(mItemCountString, mItemCount); } + if(mCategoryCount != gInventory.getCategoryCount()) + { + mCategoryCount = gInventory.getCategoryCount(); + mCategoryCountString = ""; + LLLocale locale(LLLocale::USER_LOCALE); + LLResMgr::getInstance()->getIntegerString(mCategoryCountString, mCategoryCount); + } + LLStringUtil::format_map_t string_args; string_args["[ITEM_COUNT]"] = mItemCountString; + string_args["[CATEGORY_COUNT]"] = mCategoryCountString; string_args["[FILTER]"] = getFilterText(); std::string text = ""; @@ -728,6 +737,7 @@ void LLPanelMainInventory::updateItemcountText() } mCounterCtrl->setValue(text); + mCounterCtrl->setToolTip(text); } void LLPanelMainInventory::onFocusReceived() diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h index 2904d5de76..732a3b04e3 100644 --- a/indra/newview/llpanelmaininventory.h +++ b/indra/newview/llpanelmaininventory.h @@ -132,7 +132,7 @@ private: LLFilterEditor* mFilterEditor; LLTabContainer* mFilterTabs; - LLUICtrl* mCounterCtrl; + LLUICtrl* mCounterCtrl; LLHandle mFinderHandle; LLInventoryPanel* mActivePanel; LLInventoryPanel* mWornItemsPanel; @@ -141,7 +141,9 @@ private: std::string mFilterText; std::string mFilterSubString; S32 mItemCount; - std::string mItemCountString; + std::string mItemCountString; + S32 mCategoryCount; + std::string mCategoryCountString; LLComboBox* mSearchTypeCombo; diff --git a/indra/newview/skins/default/xui/en/panel_main_inventory.xml b/indra/newview/skins/default/xui/en/panel_main_inventory.xml index df70398599..d77fbdec0a 100644 --- a/indra/newview/skins/default/xui/en/panel_main_inventory.xml +++ b/indra/newview/skins/default/xui/en/panel_main_inventory.xml @@ -13,26 +13,27 @@ - Fetching [ITEM_COUNT] Items... [FILTER] + Fetching [ITEM_COUNT] Items and [CATEGORY_COUNT] Folders... [FILTER] - [ITEM_COUNT] Items [FILTER] + [ITEM_COUNT] Items and [CATEGORY_COUNT] Folders [FILTER] - Fetched [ITEM_COUNT] Items [FILTER] + Fetched [ITEM_COUNT] Items and [CATEGORY_COUNT] Folders [FILTER] Items: -- cgit v1.2.3