diff options
author | Maxim Nikolenko <maximnproductengine@lindenlab.com> | 2023-06-07 19:25:09 +0300 |
---|---|---|
committer | Maxim Nikolenko <maximnproductengine@lindenlab.com> | 2023-06-07 19:25:09 +0300 |
commit | 480aa58d159f7874bf3b388b7ea836debc23ceb1 (patch) | |
tree | a50a1290c4aef971c528f2d7b569024d1074d8f4 | |
parent | 0b16cd0da40e8064b4ebf6b7fc679c0d710a7346 (diff) |
SL-19686 don't build inventory root views on init by default
-rw-r--r-- | indra/newview/llinventorypanel.cpp | 179 | ||||
-rw-r--r-- | indra/newview/llinventorypanel.h | 4 | ||||
-rw-r--r-- | indra/newview/llpanelmaininventory.cpp | 8 | ||||
-rw-r--r-- | indra/newview/llpanelmaininventory.h | 1 |
4 files changed, 113 insertions, 79 deletions
diff --git a/indra/newview/llinventorypanel.cpp b/indra/newview/llinventorypanel.cpp index a76769d25a..80f6ed7e32 100644 --- a/indra/newview/llinventorypanel.cpp +++ b/indra/newview/llinventorypanel.cpp @@ -251,52 +251,72 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params) { // save off copy of params mParams = params; - // Clear up the root view - // Note: This needs to be done *before* we build the new folder view - LLUUID root_id = getRootFolderID(); - if (mFolderRoot.get()) - { - removeItemID(root_id); - mFolderRoot.get()->destroyView(); - } - mCommitCallbackRegistrar.pushScope(); // registered as a widget; need to push callback scope ourselves - { - // Determine the root folder in case specified, and - // build the views starting with that folder. + initFolderRoot(); + + // Initialize base class params. + LLPanel::initFromParams(mParams); +} + +LLInventoryPanel::~LLInventoryPanel() +{ + U32 sort_order = getFolderViewModel()->getSorter().getSortOrder(); + if (mSortOrderSetting != INHERIT_SORT_ORDER) + { + gSavedSettings.setU32(mSortOrderSetting, sort_order); + } + + clearFolderRoot(); +} + +void LLInventoryPanel::initFolderRoot() +{ + // Clear up the root view + // Note: This needs to be done *before* we build the new folder view + LLUUID root_id = getRootFolderID(); + if (mFolderRoot.get()) + { + removeItemID(root_id); + mFolderRoot.get()->destroyView(); + } + + mCommitCallbackRegistrar.pushScope(); // registered as a widget; need to push callback scope ourselves + { + // Determine the root folder in case specified, and + // build the views starting with that folder. LLFolderView* folder_view = createFolderRoot(root_id); - mFolderRoot = folder_view->getHandle(); - - addItemID(root_id, mFolderRoot.get()); - } - mCommitCallbackRegistrar.popScope(); - mFolderRoot.get()->setCallbackRegistrar(&mCommitCallbackRegistrar); - mFolderRoot.get()->setEnableRegistrar(&mEnableCallbackRegistrar); - - // Scroller - LLRect scroller_view_rect = getRect(); - scroller_view_rect.translate(-scroller_view_rect.mLeft, -scroller_view_rect.mBottom); - LLScrollContainer::Params scroller_params(mParams.scroll()); - scroller_params.rect(scroller_view_rect); - mScroller = LLUICtrlFactory::create<LLFolderViewScrollContainer>(scroller_params); - addChild(mScroller); - mScroller->addChild(mFolderRoot.get()); - mFolderRoot.get()->setScrollContainer(mScroller); - mFolderRoot.get()->setFollowsAll(); - mFolderRoot.get()->addChild(mFolderRoot.get()->mStatusTextBox); - - // Set up the callbacks from the inventory we're viewing, and then build everything. - mInventoryObserver = new LLInventoryPanelObserver(this); - mInventory->addObserver(mInventoryObserver); - - mCompletionObserver = new LLInvPanelComplObserver(boost::bind(&LLInventoryPanel::onItemsCompletion, this)); - mInventory->addObserver(mCompletionObserver); + mFolderRoot = folder_view->getHandle(); + + addItemID(root_id, mFolderRoot.get()); + } + mCommitCallbackRegistrar.popScope(); + mFolderRoot.get()->setCallbackRegistrar(&mCommitCallbackRegistrar); + mFolderRoot.get()->setEnableRegistrar(&mEnableCallbackRegistrar); + + // Scroller + LLRect scroller_view_rect = getRect(); + scroller_view_rect.translate(-scroller_view_rect.mLeft, -scroller_view_rect.mBottom); + LLScrollContainer::Params scroller_params(mParams.scroll()); + scroller_params.rect(scroller_view_rect); + mScroller = LLUICtrlFactory::create<LLFolderViewScrollContainer>(scroller_params); + addChild(mScroller); + mScroller->addChild(mFolderRoot.get()); + mFolderRoot.get()->setScrollContainer(mScroller); + mFolderRoot.get()->setFollowsAll(); + mFolderRoot.get()->addChild(mFolderRoot.get()->mStatusTextBox); + + // Set up the callbacks from the inventory we're viewing, and then build everything. + mInventoryObserver = new LLInventoryPanelObserver(this); + mInventory->addObserver(mInventoryObserver); + + mCompletionObserver = new LLInvPanelComplObserver(boost::bind(&LLInventoryPanel::onItemsCompletion, this)); + mInventory->addObserver(mCompletionObserver); if (mBuildViewsOnInit && mViewsInitialized == VIEWS_UNINITIALIZED) { // Build view of inventory if we need default full hierarchy and inventory is ready, otherwise do in onIdle. // Initializing views takes a while so always do it onIdle if viewer already loaded. - if (mInventory->isInventoryUsable() + if (mInventory->isInventoryUsable() && LLStartUp::getStartupState() <= STATE_WEARABLES_WAIT) { // Usually this happens on login, so we have less time constraits, but too long and we can cause a disconnect @@ -310,48 +330,34 @@ void LLInventoryPanel::initFromParams(const LLInventoryPanel::Params& params) } } - if (mSortOrderSetting != INHERIT_SORT_ORDER) - { - setSortOrder(gSavedSettings.getU32(mSortOrderSetting)); - } - else - { - setSortOrder(gSavedSettings.getU32(DEFAULT_SORT_ORDER)); - } + if (mSortOrderSetting != INHERIT_SORT_ORDER) + { + setSortOrder(gSavedSettings.getU32(mSortOrderSetting)); + } + else + { + setSortOrder(gSavedSettings.getU32(DEFAULT_SORT_ORDER)); + } - // hide inbox - if (!gSavedSettings.getBOOL("InventoryOutboxMakeVisible")) - { - getFilter().setFilterCategoryTypes(getFilter().getFilterCategoryTypes() & ~(1ULL << LLFolderType::FT_INBOX)); - } + // hide inbox + if (!gSavedSettings.getBOOL("InventoryOutboxMakeVisible")) + { + getFilter().setFilterCategoryTypes(getFilter().getFilterCategoryTypes() & ~(1ULL << LLFolderType::FT_INBOX)); + } // hide marketplace listing box, unless we are a marketplace panel - if (!gSavedSettings.getBOOL("InventoryOutboxMakeVisible") && !mParams.use_marketplace_folders) - { - getFilter().setFilterCategoryTypes(getFilter().getFilterCategoryTypes() & ~(1ULL << LLFolderType::FT_MARKETPLACE_LISTINGS)); + if (!gSavedSettings.getBOOL("InventoryOutboxMakeVisible") && !mParams.use_marketplace_folders) + { + getFilter().setFilterCategoryTypes(getFilter().getFilterCategoryTypes() & ~(1ULL << LLFolderType::FT_MARKETPLACE_LISTINGS)); } - // set the filter for the empty folder if the debug setting is on - if (gSavedSettings.getBOOL("DebugHideEmptySystemFolders")) - { - getFilter().setFilterEmptySystemFolders(); - } - - // keep track of the clipboard state so that we avoid filtering too much - mClipboardState = LLClipboard::instance().getGeneration(); - - // Initialize base class params. - LLPanel::initFromParams(mParams); -} - -LLInventoryPanel::~LLInventoryPanel() -{ - U32 sort_order = getFolderViewModel()->getSorter().getSortOrder(); - if (mSortOrderSetting != INHERIT_SORT_ORDER) + // set the filter for the empty folder if the debug setting is on + if (gSavedSettings.getBOOL("DebugHideEmptySystemFolders")) { - gSavedSettings.setU32(mSortOrderSetting, sort_order); + getFilter().setFilterEmptySystemFolders(); } - clearFolderRoot(); + // keep track of the clipboard state so that we avoid filtering too much + mClipboardState = LLClipboard::instance().getGeneration(); } /*virtual*/ @@ -1889,6 +1895,7 @@ void LLInventoryPanel::setSFViewAndOpenFolder(const LLInventoryPanel* panel, con LLPanelMainInventory* main_inventory = sidepanel_inventory->getMainInventoryPanel(); if (main_inventory && panel->hasAncestor(main_inventory) && !main_inventory->isSingleFolderMode()) { + main_inventory->initSingleFolderRoot(folder_id); main_inventory->toggleViewMode(); main_inventory->setSingleFolderViewRoot(folder_id, false); } @@ -2109,6 +2116,7 @@ LLInventorySingleFolderPanel::LLInventorySingleFolderPanel(const Params& params) : LLInventoryPanel(params) { mBuildChildrenViews = false; + mRootInited = false; getFilter().setSingleFolderMode(true); getFilter().setEmptyLookupMessage("InventorySingleFolderNoMatches"); getFilter().setDefaultEmptyLookupMessage("InventorySingleFolderEmpty"); @@ -2134,10 +2142,25 @@ void LLInventorySingleFolderPanel::setSelectCallback(const boost::function<void( void LLInventorySingleFolderPanel::initFromParams(const Params& p) { mFolderID = gInventory.getRootFolderID(); - Params pane_params(p); - pane_params.open_first_folder = false; - pane_params.start_folder.id = mFolderID; - LLInventoryPanel::initFromParams(pane_params); + + mParams = p; + LLPanel::initFromParams(mParams); +} + +void LLInventorySingleFolderPanel::initFolderRoot(const LLUUID& start_folder_id) +{ + if(mRootInited) return; + + mRootInited = true; + if(start_folder_id.notNull()) + { + mFolderID = start_folder_id; + } + + mParams.open_first_folder = false; + mParams.start_folder.id = mFolderID; + + LLInventoryPanel::initFolderRoot(); mFolderRoot.get()->setSingleFolderMode(true); } diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index 54ecdc8322..f4f6940743 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -268,6 +268,7 @@ public: static void callbackPurgeSelectedItems(const LLSD& notification, const LLSD& response, const std::vector<LLUUID> inventory_selected); void changeFolderRoot(const LLUUID& new_id) {}; + void initFolderRoot(); protected: void openStartFolderOrMyInventory(); // open the first level of inventory @@ -306,6 +307,7 @@ protected: const LLInventoryFolderViewModelBuilder* mInvFVBridgeBuilder; bool mBuildChildrenViews; + bool mRootInited; //-------------------------------------------------------------------- @@ -401,6 +403,8 @@ public: void initFromParams(const Params& p); bool isSelectionRemovable() { return false; } + void initFolderRoot(const LLUUID& start_folder_id = LLUUID::null); + void openInCurrentWindow(const LLSD& userdata); void changeFolderRoot(const LLUUID& new_id); void onForwardFolder(); diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index a28bc33f15..de777fdc1a 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -484,10 +484,10 @@ void LLPanelMainInventory::newFolderWindow(LLUUID folder_id, LLUUID item_to_sele LLPanelMainInventory* main_inventory = sidepanel_inventory->getMainInventoryPanel(); if (main_inventory) { + main_inventory->initSingleFolderRoot(folder_id); main_inventory->toggleViewMode(); if(folder_id.notNull()) { - main_inventory->setSingleFolderViewRoot(folder_id); if(item_to_select.notNull()) { main_inventory->setGallerySelection(item_to_select, true); @@ -1518,6 +1518,11 @@ void LLPanelMainInventory::setActivePanel() mViewModeBtn->setEnabled(mSingleFolderMode || (getAllItemsPanel() == getActivePanel())); } +void LLPanelMainInventory::initSingleFolderRoot(const LLUUID& start_folder_id) +{ + mCombinationInventoryPanel->initFolderRoot(start_folder_id); +} + void LLPanelMainInventory::toggleViewMode() { if(mSingleFolderMode && isCombinationViewMode()) @@ -1586,6 +1591,7 @@ void LLPanelMainInventory::onViewModeClick() } } } + mCombinationInventoryPanel->initFolderRoot(new_root_folder); } toggleViewMode(); diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h index 6d749f269c..ee314d1cf3 100644 --- a/indra/newview/llpanelmaininventory.h +++ b/indra/newview/llpanelmaininventory.h @@ -115,6 +115,7 @@ public: void onViewModeClick(); void toggleViewMode(); + void initSingleFolderRoot(const LLUUID& start_folder_id = LLUUID::null); void onUpFolderClicked(); void onBackFolderClicked(); void onForwardFolderClicked(); |