diff options
-rw-r--r-- | indra/newview/llpanelmaininventory.cpp | 63 | ||||
-rw-r--r-- | indra/newview/llpanelmaininventory.h | 4 |
2 files changed, 34 insertions, 33 deletions
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index bbf533b694..fd7085c452 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -154,28 +154,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); @@ -211,17 +213,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) @@ -362,7 +364,7 @@ LLPanelMainInventory::~LLPanelMainInventory( void ) LLInventoryPanel* LLPanelMainInventory::getAllItemsPanel() { - return getChild<LLInventoryPanel>(ALL_ITEMS); + return mAllItemsPanel; } void LLPanelMainInventory::selectAllItemsPanel() @@ -372,7 +374,7 @@ void LLPanelMainInventory::selectAllItemsPanel() bool LLPanelMainInventory::isRecentItemsPanelSelected() { - return (RECENT_ITEMS == getActivePanel()->getName()); + return (mRecentPanel == getActivePanel()); } void LLPanelMainInventory::startSearch() @@ -1077,8 +1079,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) @@ -1482,10 +1484,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)); mEnableCallbackRegistrar.add("Inventory.GearDefault.Check", boost::bind(&LLPanelMainInventory::isActionChecked, this, _2)); @@ -1550,12 +1552,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() diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h index cad2501645..68ac3410d8 100644 --- a/indra/newview/llpanelmaininventory.h +++ b/indra/newview/llpanelmaininventory.h @@ -184,7 +184,9 @@ private: LLUICtrl* mCounterCtrl; LLHandle<LLFloater> mFinderHandle; LLInventoryPanel* mActivePanel; - LLInventoryPanel* mWornItemsPanel; + LLInventoryPanel* mAllItemsPanel = nullptr; + LLInventoryPanel* mRecentPanel = nullptr; + LLInventoryPanel* mWornItemsPanel = nullptr; bool mResortActivePanel; LLSaveFolderState* mSavedFolderState; std::string mFilterText; |