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.cpp220
1 files changed, 115 insertions, 105 deletions
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index 622698c5fa..e4503a69d2 100644
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -156,28 +156,30 @@ bool LLPanelMainInventory::postBuild()
//panel->getFilter().markDefault();
// Set up the default inv. panel/filter settings.
- mActivePanel = getChild<LLInventoryPanel>(ALL_ITEMS);
- if (mActivePanel)
+ mAllItemsPanel = getChild<LLInventoryPanel>(ALL_ITEMS);
+ if (mAllItemsPanel)
{
// "All Items" is the previous only view, so it gets the InventorySortOrder
- mActivePanel->setSortOrder(gSavedSettings.getU32(LLInventoryPanel::DEFAULT_SORT_ORDER));
- mActivePanel->getFilter().markDefault();
- mActivePanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
- mActivePanel->setSelectCallback(boost::bind(&LLPanelMainInventory::onSelectionChange, this, mActivePanel, _1, _2));
+ mAllItemsPanel->setSortOrder(gSavedSettings.getU32(LLInventoryPanel::DEFAULT_SORT_ORDER));
+ mAllItemsPanel->getFilter().markDefault();
+ mAllItemsPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState);
+ mAllItemsPanel->setSelectCallback(boost::bind(&LLPanelMainInventory::onSelectionChange, this, mAllItemsPanel, _1, _2));
mResortActivePanel = true;
}
- LLInventoryPanel* recent_items_panel = getChild<LLInventoryPanel>(RECENT_ITEMS);
- if (recent_items_panel)
+ mActivePanel = mAllItemsPanel;
+
+ mRecentPanel = getChild<LLInventoryPanel>(RECENT_ITEMS);
+ if (mRecentPanel)
{
// assign default values until we will be sure that we have setting to restore
- recent_items_panel->setSinceLogoff(true);
- recent_items_panel->setSortOrder(LLInventoryFilter::SO_DATE);
- recent_items_panel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
- LLInventoryFilter& recent_filter = recent_items_panel->getFilter();
+ mRecentPanel->setSinceLogoff(true);
+ mRecentPanel->setSortOrder(LLInventoryFilter::SO_DATE);
+ mRecentPanel->setShowFolderState(LLInventoryFilter::SHOW_NON_EMPTY_FOLDERS);
+ LLInventoryFilter& recent_filter = mRecentPanel->getFilter();
recent_filter.setFilterObjectTypes(recent_filter.getFilterObjectTypes() & ~(0x1 << LLInventoryType::IT_CATEGORY));
recent_filter.setEmptyLookupMessage("InventoryNoMatchingRecentItems");
recent_filter.markDefault();
- recent_items_panel->setSelectCallback(boost::bind(&LLPanelMainInventory::onSelectionChange, this, recent_items_panel, _1, _2));
+ mRecentPanel->setSelectCallback(boost::bind(&LLPanelMainInventory::onSelectionChange, this, mRecentPanel, _1, _2));
}
mWornItemsPanel = getChild<LLInventoryPanel>(WORN_ITEMS);
@@ -213,17 +215,17 @@ bool LLPanelMainInventory::postBuild()
// Load the persistent "Recent Items" settings.
// Note that the "All Items" settings do not persist.
- if(recent_items_panel)
+ if(mRecentPanel)
{
- if(savedFilterState.has(recent_items_panel->getFilter().getName()))
+ if(savedFilterState.has(mRecentPanel->getFilter().getName()))
{
LLSD recent_items = savedFilterState.get(
- recent_items_panel->getFilter().getName());
+ mRecentPanel->getFilter().getName());
LLInventoryFilter::Params p;
LLParamSDParser parser;
parser.readSD(recent_items, p);
- recent_items_panel->getFilter().fromParams(p);
- recent_items_panel->setSortOrder(gSavedSettings.getU32(LLInventoryPanel::RECENTITEMS_SORT_ORDER));
+ mRecentPanel->getFilter().fromParams(p);
+ mRecentPanel->setSortOrder(gSavedSettings.getU32(LLInventoryPanel::RECENTITEMS_SORT_ORDER));
}
}
if(mActivePanel)
@@ -303,31 +305,29 @@ LLPanelMainInventory::~LLPanelMainInventory( void )
// for example, LLParamSDParser doesn't know about U64,
// so some FilterOps params should be revised.
LLSD filterRoot;
- LLInventoryPanel* all_items_panel = getChild<LLInventoryPanel>(ALL_ITEMS);
- if (all_items_panel)
+ if (mAllItemsPanel)
{
LLSD filterState;
LLInventoryPanel::InventoryState p;
- all_items_panel->getFilter().toParams(p.filter);
- all_items_panel->getRootViewModel().getSorter().toParams(p.sort);
+ mAllItemsPanel->getFilter().toParams(p.filter);
+ mAllItemsPanel->getRootViewModel().getSorter().toParams(p.sort);
if (p.validateBlock(false))
{
LLParamSDParser().writeSD(filterState, p);
- filterRoot[all_items_panel->getName()] = filterState;
+ filterRoot[mAllItemsPanel->getName()] = filterState;
}
}
- LLInventoryPanel* panel = findChild<LLInventoryPanel>(RECENT_ITEMS);
- if (panel)
+ if (mRecentPanel)
{
LLSD filterState;
LLInventoryPanel::InventoryState p;
- panel->getFilter().toParams(p.filter);
- panel->getRootViewModel().getSorter().toParams(p.sort);
+ mRecentPanel->getFilter().toParams(p.filter);
+ mRecentPanel->getRootViewModel().getSorter().toParams(p.sort);
if (p.validateBlock(false))
{
LLParamSDParser().writeSD(filterState, p);
- filterRoot[panel->getName()] = filterState;
+ filterRoot[mRecentPanel->getName()] = filterState;
}
}
@@ -364,7 +364,7 @@ LLPanelMainInventory::~LLPanelMainInventory( void )
LLInventoryPanel* LLPanelMainInventory::getAllItemsPanel()
{
- return getChild<LLInventoryPanel>(ALL_ITEMS);
+ return mAllItemsPanel;
}
void LLPanelMainInventory::selectAllItemsPanel()
@@ -374,7 +374,7 @@ void LLPanelMainInventory::selectAllItemsPanel()
bool LLPanelMainInventory::isRecentItemsPanelSelected()
{
- return (RECENT_ITEMS == getActivePanel()->getName());
+ return (mRecentPanel == getActivePanel());
}
void LLPanelMainInventory::startSearch()
@@ -761,14 +761,9 @@ void LLPanelMainInventory::onClearSearch()
}
mFilterSubString = "";
- LLSidepanelInventory * sidepanel_inventory = getParentSidepanelInventory();
- if (sidepanel_inventory)
+ if (mInboxPanel)
{
- LLPanelMarketplaceInbox* inbox_panel = sidepanel_inventory->getChild<LLPanelMarketplaceInbox>("marketplace_inbox");
- if (inbox_panel)
- {
- inbox_panel->onClearSearch();
- }
+ mInboxPanel->onClearSearch();
}
}
@@ -818,14 +813,9 @@ void LLPanelMainInventory::onFilterEdit(const std::string& search_string )
// set new filter string
setFilterSubString(mFilterSubString);
- LLSidepanelInventory * sidepanel_inventory = getParentSidepanelInventory();
- if (sidepanel_inventory)
+ if (mInboxPanel)
{
- LLPanelMarketplaceInbox* inbox_panel = sidepanel_inventory->getChild<LLPanelMarketplaceInbox>("marketplace_inbox");
- if (inbox_panel)
- {
- inbox_panel->onFilterEdit(search_string);
- }
+ mInboxPanel->onFilterEdit(search_string);
}
}
@@ -975,59 +965,87 @@ 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);
- }
-
- LLStringUtil::format_map_t string_args;
- string_args["[ITEM_COUNT]"] = mItemCountString;
- string_args["[CATEGORY_COUNT]"] = mCategoryCountString;
- string_args["[FILTER]"] = getFilterText();
-
- std::string text = "";
+ gInventory.getDirectDescendentsOf(getCurrentSFVRoot(), cats, items);
+ S32 item_count = items ? (S32)items->size() : 0;
+ S32 cat_count = cats ? (S32)cats->size() : 0;
- if (LLInventoryModelBackgroundFetch::instance().folderFetchActive())
- {
- text = getString("ItemcountFetching", string_args);
+ if (mItemCount != item_count)
+ {
+ mItemCount = item_count;
+ update = true;
+ }
+ if (mCategoryCount != cat_count)
+ {
+ mCategoryCount = cat_count;
+ update = true;
+ }
}
- else if (LLInventoryModelBackgroundFetch::instance().isEverythingFetched())
+ else
{
- text = getString("ItemcountCompleted", string_args);
+ if (mItemCount != gInventory.getItemCount())
+ {
+ mItemCount = gInventory.getItemCount();
+ update = true;
+ }
+
+ if (mCategoryCount != gInventory.getCategoryCount())
+ {
+ mCategoryCount = gInventory.getCategoryCount();
+ 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
+ {
+ if (LLInventoryModelBackgroundFetch::instance().folderFetchActive())
+ {
+ text = getString("ItemcountFetching", string_args);
+ }
+ else if (LLInventoryModelBackgroundFetch::instance().isEverythingFetched())
+ {
+ text = getString("ItemcountCompleted", string_args);
+ }
+ else
+ {
+ text = getString("ItemcountUnknown", string_args);
+ }
+ }
- mCounterCtrl->setValue(text);
- mCounterCtrl->setToolTip(text);
+ mCounterCtrl->setValue(text);
+ mCounterCtrl->setToolTip(text);
+ }
}
void LLPanelMainInventory::onFocusReceived()
@@ -1079,8 +1097,8 @@ void LLPanelMainInventory::toggleFindOptions()
void LLPanelMainInventory::setSelectCallback(const LLFolderView::signal_t::slot_type& cb)
{
- getChild<LLInventoryPanel>(ALL_ITEMS)->setSelectCallback(cb);
- getChild<LLInventoryPanel>(RECENT_ITEMS)->setSelectCallback(cb);
+ mAllItemsPanel->setSelectCallback(cb);
+ mRecentPanel->setSelectCallback(cb);
}
void LLPanelMainInventory::onSelectionChange(LLInventoryPanel *panel, const std::deque<LLFolderViewItem*>& items, bool user_action)
@@ -1179,7 +1197,7 @@ void LLFloaterInventoryFinder::updateElementsFromFilter()
return;
// Get data needed for filter display
- U32 filter_types = mFilter->getFilterObjectTypes();
+ U32 filter_types = (U32)mFilter->getFilterObjectTypes();
LLInventoryFilter::EFolderShow show_folders = mFilter->getShowFolderState();
U32 hours = mFilter->getHoursAgo();
U32 date_search_direction = mFilter->getDateSearchDirection();
@@ -1484,10 +1502,10 @@ void LLFloaterInventoryFinder::selectNoTypes(void* user_data)
void LLPanelMainInventory::initListCommandsHandlers()
{
childSetAction("add_btn", boost::bind(&LLPanelMainInventory::onAddButtonClick, this));
- childSetAction("view_mode_btn", boost::bind(&LLPanelMainInventory::onViewModeClick, this));
- childSetAction("up_btn", boost::bind(&LLPanelMainInventory::onUpFolderClicked, this));
- childSetAction("back_btn", boost::bind(&LLPanelMainInventory::onBackFolderClicked, this));
- childSetAction("forward_btn", boost::bind(&LLPanelMainInventory::onForwardFolderClicked, this));
+ mViewModeBtn->setCommitCallback(boost::bind(&LLPanelMainInventory::onViewModeClick, this));
+ mUpBtn->setCommitCallback(boost::bind(&LLPanelMainInventory::onUpFolderClicked, this));
+ mBackBtn->setCommitCallback(boost::bind(&LLPanelMainInventory::onBackFolderClicked, this));
+ mForwardBtn->setCommitCallback(boost::bind(&LLPanelMainInventory::onForwardFolderClicked, this));
mCommitCallbackRegistrar.add("Inventory.GearDefault.Custom.Action", { boost::bind(&LLPanelMainInventory::onCustomAction, this, _2), cb_info::UNTRUSTED_BLOCK });
mEnableCallbackRegistrar.add("Inventory.GearDefault.Check", boost::bind(&LLPanelMainInventory::isActionChecked, this, _2));
@@ -1530,17 +1548,13 @@ void LLPanelMainInventory::onAddButtonClick()
void LLPanelMainInventory::setActivePanel()
{
// Todo: should cover gallery mode in some way
- if(mSingleFolderMode && isListViewMode())
- {
- mActivePanel = getChild<LLInventoryPanel>("comb_single_folder_inv");
- }
- else if(mSingleFolderMode && isCombinationViewMode())
+ if(mSingleFolderMode && (isListViewMode() || isCombinationViewMode()))
{
- mActivePanel = getChild<LLInventoryPanel>("comb_single_folder_inv");
+ mActivePanel = mCombinationInventoryPanel;
}
else
{
- mActivePanel = (LLInventoryPanel*)getChild<LLTabContainer>("inventory filter tabs")->getCurrentPanel();
+ mActivePanel = (LLInventoryPanel*)mFilterTabs->getCurrentPanel();
}
mViewModeBtn->setEnabled(mSingleFolderMode || (getAllItemsPanel() == getActivePanel()));
}
@@ -1552,12 +1566,9 @@ void LLPanelMainInventory::initSingleFolderRoot(const LLUUID& start_folder_id)
void LLPanelMainInventory::initInventoryViews()
{
- LLInventoryPanel* all_item = getChild<LLInventoryPanel>(ALL_ITEMS);
- all_item->initializeViewBuilding();
- LLInventoryPanel* recent_item = getChild<LLInventoryPanel>(RECENT_ITEMS);
- recent_item->initializeViewBuilding();
- LLInventoryPanel* worn_item = getChild<LLInventoryPanel>(WORN_ITEMS);
- worn_item->initializeViewBuilding();
+ mAllItemsPanel->initializeViewBuilding();
+ mRecentPanel->initializeViewBuilding();
+ mWornItemsPanel->initializeViewBuilding();
}
void LLPanelMainInventory::toggleViewMode()
@@ -1581,16 +1592,15 @@ void LLPanelMainInventory::toggleViewMode()
updateTitle();
onFilterSelected();
- LLSidepanelInventory* sidepanel_inventory = getParentSidepanelInventory();
- if (sidepanel_inventory)
+ if (mParentSidepanel)
{
if(mSingleFolderMode)
{
- sidepanel_inventory->hideInbox();
+ mParentSidepanel->hideInbox();
}
else
{
- sidepanel_inventory->toggleInbox();
+ mParentSidepanel->toggleInbox();
}
}
}