From 842bc87941d4574fe1ce34186872e43ecef881c3 Mon Sep 17 00:00:00 2001 From: Maxim Nikolenko Date: Wed, 12 Apr 2023 12:56:56 +0300 Subject: SL-19544 WIP update combination gallery visibility after changing filter --- indra/newview/llinventorygallery.cpp | 13 +++++++-- indra/newview/llinventorygallery.h | 1 + indra/newview/llinventorypanel.h | 1 - indra/newview/llpanelmaininventory.cpp | 50 ++++++++++++++++++++-------------- indra/newview/llpanelmaininventory.h | 3 +- 5 files changed, 43 insertions(+), 25 deletions(-) (limited to 'indra') diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp index f0a1fc5751..9766a39e3c 100644 --- a/indra/newview/llinventorygallery.cpp +++ b/indra/newview/llinventorygallery.cpp @@ -270,9 +270,9 @@ void LLInventoryGallery::draw() LLPanel::draw(); if (mGalleryCreated) { - if(!updateRowsIfNeeded() && mFilter->isModified()) + if(!updateRowsIfNeeded()) { - reArrangeRows(); + handleModifiedFilter(); } } } @@ -1138,6 +1138,15 @@ bool LLInventoryGallery::hasVisibleItems() { return mItemsAddedCount > 0; } + +void LLInventoryGallery::handleModifiedFilter() +{ + if(mFilter->isModified()) + { + reArrangeRows(); + } +} + //----------------------------- // LLInventoryGalleryItem //----------------------------- diff --git a/indra/newview/llinventorygallery.h b/indra/newview/llinventorygallery.h index 5634c63072..6bca8a0dc5 100644 --- a/indra/newview/llinventorygallery.h +++ b/indra/newview/llinventorygallery.h @@ -123,6 +123,7 @@ public: bool hasDescendents(const LLUUID& cat_id); bool hasVisibleItems(); + void handleModifiedFilter(); protected: diff --git a/indra/newview/llinventorypanel.h b/indra/newview/llinventorypanel.h index 136d9f75f6..2b152edada 100644 --- a/indra/newview/llinventorypanel.h +++ b/indra/newview/llinventorypanel.h @@ -394,7 +394,6 @@ public: void initFromParams(const Params& p); bool isSelectionRemovable() { return false; } - //void setSelectCallback(const boost::function& items, BOOL user_action)>& cb); void openInCurrentWindow(const LLSD& userdata); void changeFolderRoot(const LLUUID& new_id); diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 48b23c3957..18f80d5d55 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -252,12 +252,12 @@ BOOL LLPanelMainInventory::postBuild() mInventoryGalleryPanel = getChild("gallery_view_inv"); mGalleryRootUpdatedConnection = mInventoryGalleryPanel->setRootChangedCallback(boost::bind(&LLPanelMainInventory::updateTitle, this)); - mCombinationPanelInventory = getChild("comb_single_folder_inv"); - LLInventoryFilter& comb_inv_filter = mCombinationPanelInventory->getFilter(); + mCombinationInventoryPanel = getChild("comb_single_folder_inv"); + LLInventoryFilter& comb_inv_filter = mCombinationInventoryPanel->getFilter(); comb_inv_filter.setFilterThumbnails(LLInventoryFilter::FILTER_EXCLUDE_THUMBNAILS); comb_inv_filter.markDefault(); - mCombinationPanelInventory->setSelectCallback(boost::bind(&LLPanelMainInventory::onSelectionChange, this, mCombinationPanelInventory, _1, _2)); - mCombinationPanelInventory->setRootChangedCallback(boost::bind(&LLPanelMainInventory::onCombinationRootChanged, this, false)); + mCombinationInventoryPanel->setSelectCallback(boost::bind(&LLPanelMainInventory::onSelectionChange, this, mCombinationInventoryPanel, _1, _2)); + mCombinationInventoryPanel->setRootChangedCallback(boost::bind(&LLPanelMainInventory::onCombinationRootChanged, this, false)); mCombinationGalleryPanel = getChild("comb_gallery_view_inv"); LLInventoryFilter& comb_gallery_filter = mCombinationGalleryPanel->getFilter(); @@ -627,7 +627,7 @@ void LLPanelMainInventory::setSearchType(LLInventoryFilter::ESearchType type) } if(mSingleFolderMode && isCombinationViewMode()) { - mCombinationPanelInventory->setSearchType(type); + mCombinationInventoryPanel->setSearchType(type); mCombinationGalleryPanel->setSearchType(type); } else @@ -1579,7 +1579,7 @@ void LLPanelMainInventory::onUpFolderClicked() } if(isCombinationViewMode()) { - mCombinationPanelInventory->changeFolderRoot(cat->getParentUUID()); + mCombinationInventoryPanel->changeFolderRoot(cat->getParentUUID()); } } } @@ -1597,7 +1597,7 @@ void LLPanelMainInventory::onBackFolderClicked() } if(isCombinationViewMode()) { - mCombinationPanelInventory->onBackwardFolder(); + mCombinationInventoryPanel->onBackwardFolder(); } } @@ -1613,7 +1613,7 @@ void LLPanelMainInventory::onForwardFolderClicked() } if(isCombinationViewMode()) { - mCombinationPanelInventory->onForwardFolder(); + mCombinationInventoryPanel->onForwardFolder(); } } @@ -2178,11 +2178,11 @@ void LLPanelMainInventory::onCombinationRootChanged(bool gallery_clicked) { if(gallery_clicked) { - mCombinationPanelInventory->changeFolderRoot(mCombinationGalleryPanel->getRootFolder()); + mCombinationInventoryPanel->changeFolderRoot(mCombinationGalleryPanel->getRootFolder()); } else { - mCombinationGalleryPanel->setRootFolder(mCombinationPanelInventory->getSingleFolderRoot()); + mCombinationGalleryPanel->setRootFolder(mCombinationInventoryPanel->getSingleFolderRoot()); } updateTitle(); @@ -2190,8 +2190,16 @@ void LLPanelMainInventory::onCombinationRootChanged(bool gallery_clicked) void LLPanelMainInventory::updateCombinationVisibility() { - getChild("comb_gallery_layout")->setVisible(mCombinationGalleryPanel->hasVisibleItems()); - getChild("border")->setVisible(mCombinationGalleryPanel->hasVisibleItems()); + if(mSingleFolderMode && isCombinationViewMode()) + { + bool is_gallery_empty = !mCombinationGalleryPanel->hasVisibleItems(); + getChild("comb_gallery_layout")->setVisible(!is_gallery_empty); + getChild("border")->setVisible(!is_gallery_empty); + if(is_gallery_empty) + { + mCombinationGalleryPanel->handleModifiedFilter(); + } + } } void LLPanelMainInventory::updateNavButtons() @@ -2208,8 +2216,8 @@ void LLPanelMainInventory::updateNavButtons() } if(isCombinationViewMode()) { - getChild("back_btn")->setEnabled(mCombinationPanelInventory->isBackwardAvailable()); - getChild("forward_btn")->setEnabled(mCombinationPanelInventory->isForwardAvailable()); + getChild("back_btn")->setEnabled(mCombinationInventoryPanel->isBackwardAvailable()); + getChild("forward_btn")->setEnabled(mCombinationInventoryPanel->isForwardAvailable()); } const LLViewerInventoryCategory* cat = gInventory.getCategory(getCurrentSFVRoot()); @@ -2244,8 +2252,8 @@ void LLPanelMainInventory::setViewMode(EViewModeType mode) backward_history = mInventoryGalleryPanel->getNavBackwardList(); break; case MODE_COMBINATION: - forward_history = mCombinationPanelInventory->getNavForwardList(); - backward_history = mCombinationPanelInventory->getNavBackwardList(); + forward_history = mCombinationInventoryPanel->getNavForwardList(); + backward_history = mCombinationInventoryPanel->getNavBackwardList(); break; } @@ -2270,10 +2278,10 @@ void LLPanelMainInventory::setViewMode(EViewModeType mode) } if(isCombinationViewMode()) { - mCombinationPanelInventory->changeFolderRoot(cur_root); + mCombinationInventoryPanel->changeFolderRoot(cur_root); mCombinationGalleryPanel->setRootFolder(cur_root); - mCombinationPanelInventory->setNavForwardList(forward_history); - mCombinationPanelInventory->setNavBackwardList(backward_history); + mCombinationInventoryPanel->setNavForwardList(forward_history); + mCombinationInventoryPanel->setNavBackwardList(backward_history); mCombinationGalleryPanel->setNavForwardList(forward_history); mCombinationGalleryPanel->setNavBackwardList(backward_history); } @@ -2306,7 +2314,7 @@ LLUUID LLPanelMainInventory::getCurrentSFVRoot() } if(isCombinationViewMode()) { - return mCombinationPanelInventory->getSingleFolderRoot(); + return mCombinationInventoryPanel->getSingleFolderRoot(); } return LLUUID::null; } @@ -2337,7 +2345,7 @@ void LLPanelMainInventory::setGallerySelection(const LLUUID& item_id) } else { - mCombinationPanelInventory->setSelection(item_id, false); + mCombinationInventoryPanel->setSelection(item_id, false); } } } diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h index 1067892959..8bc8f4e2e6 100644 --- a/indra/newview/llpanelmaininventory.h +++ b/indra/newview/llpanelmaininventory.h @@ -193,7 +193,8 @@ private: EViewModeType mViewMode; LLInventorySingleFolderPanel* mSingleFolderPanelInventory; LLInventoryGallery* mInventoryGalleryPanel; - LLInventorySingleFolderPanel* mCombinationPanelInventory; + + LLInventorySingleFolderPanel* mCombinationInventoryPanel; LLInventoryGallery* mCombinationGalleryPanel; boost::signals2::connection mListViewRootUpdatedConnection; -- cgit v1.2.3