diff options
Diffstat (limited to 'indra/newview/llpanelmaininventory.cpp')
-rw-r--r-- | indra/newview/llpanelmaininventory.cpp | 118 |
1 files changed, 50 insertions, 68 deletions
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index ba52da0760..2466ee5973 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) @@ -301,31 +303,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; } } @@ -362,7 +362,7 @@ LLPanelMainInventory::~LLPanelMainInventory( void ) LLInventoryPanel* LLPanelMainInventory::getAllItemsPanel() { - return getChild<LLInventoryPanel>(ALL_ITEMS); + return mAllItemsPanel; } void LLPanelMainInventory::selectAllItemsPanel() @@ -372,7 +372,7 @@ void LLPanelMainInventory::selectAllItemsPanel() bool LLPanelMainInventory::isRecentItemsPanelSelected() { - return (RECENT_ITEMS == getActivePanel()->getName()); + return (mRecentPanel == getActivePanel()); } void LLPanelMainInventory::startSearch() @@ -759,14 +759,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(); } } @@ -816,14 +811,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); } } @@ -1077,8 +1067,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) @@ -1177,7 +1167,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(); @@ -1482,10 +1472,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)); @@ -1528,17 +1518,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())); } @@ -1550,12 +1536,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() @@ -1579,16 +1562,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(); } } } |