From d5a949d97a67c8b9e551fc4b22d4c901eaf1d91a Mon Sep 17 00:00:00 2001 From: Maxim Nikolenko Date: Fri, 7 Apr 2023 15:13:47 +0300 Subject: SL-19544 WIP Combination view first pass --- indra/newview/llinventorygallery.cpp | 5 ++ indra/newview/llinventorygallery.h | 1 + indra/newview/llpanelmaininventory.cpp | 90 ++++++++++++++++++++-- indra/newview/llpanelmaininventory.h | 6 ++ .../default/xui/en/panel_inventory_gallery.xml | 2 +- .../skins/default/xui/en/panel_main_inventory.xml | 74 +++++++++++++++++- 6 files changed, 169 insertions(+), 9 deletions(-) (limited to 'indra') diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp index c3e06fafc5..e38f2ef849 100644 --- a/indra/newview/llinventorygallery.cpp +++ b/indra/newview/llinventorygallery.cpp @@ -1128,6 +1128,11 @@ bool LLInventoryGallery::checkAgainstFilterType(const LLUUID& object_id) } return true; } + +bool LLInventoryGallery::hasVisibleItems() +{ + return mItemsAddedCount > 0; +} //----------------------------- // LLInventoryGalleryItem //----------------------------- diff --git a/indra/newview/llinventorygallery.h b/indra/newview/llinventorygallery.h index 98ed91df19..5634c63072 100644 --- a/indra/newview/llinventorygallery.h +++ b/indra/newview/llinventorygallery.h @@ -122,6 +122,7 @@ public: LLInventoryFilter::ESearchType getSearchType() { return mSearchType; } bool hasDescendents(const LLUUID& cat_id); + bool hasVisibleItems(); protected: diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 5535d64d27..e5c0e4cf9c 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -252,6 +252,19 @@ 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(); + 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)); + + mCombinationGalleryPanel = getChild("comb_gallery_view_inv"); + LLInventoryFilter& comb_gallery_filter = mCombinationGalleryPanel->getFilter(); + comb_gallery_filter.setFilterThumbnails(LLInventoryFilter::FILTER_ONLY_THUMBNAILS); + comb_gallery_filter.markDefault(); + mCombinationGalleryPanel->setRootChangedCallback(boost::bind(&LLPanelMainInventory::onCombinationRootChanged, this, true)); + initListCommandsHandlers(); const std::string texture_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getTextureUploadCost()); @@ -887,6 +900,7 @@ void LLPanelMainInventory::draw() } LLPanel::draw(); updateItemcountText(); + updateCombinationVisibility(); } void LLPanelMainInventory::updateItemcountText() @@ -1514,6 +1528,10 @@ void LLPanelMainInventory::onUpFolderClicked() { mInventoryGalleryPanel->setRootFolder(cat->getParentUUID()); } + if(isCombinationViewMode()) + { + mCombinationPanelInventory->changeFolderRoot(cat->getParentUUID()); + } } } } @@ -1528,6 +1546,10 @@ void LLPanelMainInventory::onBackFolderClicked() { mInventoryGalleryPanel->onBackwardFolder(); } + if(isCombinationViewMode()) + { + mCombinationPanelInventory->onBackwardFolder(); + } } void LLPanelMainInventory::onForwardFolderClicked() @@ -1540,6 +1562,10 @@ void LLPanelMainInventory::onForwardFolderClicked() { mInventoryGalleryPanel->onForwardFolder(); } + if(isCombinationViewMode()) + { + mCombinationPanelInventory->onForwardFolder(); + } } void LLPanelMainInventory::setSingleFolderViewRoot(const LLUUID& folder_id, bool clear_nav_history) @@ -2099,6 +2125,26 @@ void LLPanelMainInventory::updateTitle() updateNavButtons(); } +void LLPanelMainInventory::onCombinationRootChanged(bool gallery_clicked) +{ + if(gallery_clicked) + { + mCombinationPanelInventory->changeFolderRoot(mCombinationGalleryPanel->getRootFolder()); + } + else + { + mCombinationGalleryPanel->setRootFolder(mCombinationPanelInventory->getSingleFolderRoot()); + } + + updateTitle(); +} + +void LLPanelMainInventory::updateCombinationVisibility() +{ + getChild("comb_gallery_layout")->setVisible(mCombinationGalleryPanel->hasVisibleItems()); + getChild("border")->setVisible(mCombinationGalleryPanel->hasVisibleItems()); +} + void LLPanelMainInventory::updateNavButtons() { if(isListViewMode()) @@ -2111,6 +2157,11 @@ void LLPanelMainInventory::updateNavButtons() getChild("back_btn")->setEnabled(mInventoryGalleryPanel->isBackwardAvailable()); getChild("forward_btn")->setEnabled(mInventoryGalleryPanel->isForwardAvailable()); } + if(isCombinationViewMode()) + { + getChild("back_btn")->setEnabled(mCombinationPanelInventory->isBackwardAvailable()); + getChild("forward_btn")->setEnabled(mCombinationPanelInventory->isForwardAvailable()); + } const LLViewerInventoryCategory* cat = gInventory.getCategory(getCurrentSFVRoot()); bool up_enabled = (cat && cat->getParentUUID().notNull()); @@ -2131,6 +2182,24 @@ void LLPanelMainInventory::setViewMode(EViewModeType mode) { if(mode != mViewMode) { + std::list forward_history; + std::list backward_history; + switch(mViewMode) + { + case MODE_LIST: + forward_history = mSingleFolderPanelInventory->getNavForwardList(); + backward_history = mSingleFolderPanelInventory->getNavBackwardList(); + break; + case MODE_GALLERY: + forward_history = mInventoryGalleryPanel->getNavForwardList(); + backward_history = mInventoryGalleryPanel->getNavBackwardList(); + break; + case MODE_COMBINATION: + forward_history = mCombinationPanelInventory->getNavForwardList(); + backward_history = mCombinationPanelInventory->getNavBackwardList(); + break; + } + LLUUID cur_root = getCurrentSFVRoot(); mViewMode = mode; @@ -2141,15 +2210,25 @@ void LLPanelMainInventory::setViewMode(EViewModeType mode) if(isListViewMode()) { mSingleFolderPanelInventory->changeFolderRoot(cur_root); - mSingleFolderPanelInventory->setNavForwardList(mInventoryGalleryPanel->getNavForwardList()); - mSingleFolderPanelInventory->setNavBackwardList(mInventoryGalleryPanel->getNavBackwardList()); + mSingleFolderPanelInventory->setNavForwardList(forward_history); + mSingleFolderPanelInventory->setNavBackwardList(backward_history); } if(isGalleryViewMode()) { mInventoryGalleryPanel->setRootFolder(cur_root); - mInventoryGalleryPanel->setNavForwardList(mSingleFolderPanelInventory->getNavForwardList()); - mInventoryGalleryPanel->setNavBackwardList(mSingleFolderPanelInventory->getNavBackwardList()); + mInventoryGalleryPanel->setNavForwardList(forward_history); + mInventoryGalleryPanel->setNavBackwardList(backward_history); } + if(isCombinationViewMode()) + { + mCombinationPanelInventory->changeFolderRoot(cur_root); + mCombinationGalleryPanel->setRootFolder(cur_root); + mCombinationPanelInventory->setNavForwardList(forward_history); + mCombinationPanelInventory->setNavBackwardList(backward_history); + mCombinationGalleryPanel->setNavForwardList(forward_history); + mCombinationGalleryPanel->setNavBackwardList(backward_history); + } + updateNavButtons(); onFilterSelected(); @@ -2178,8 +2257,7 @@ LLUUID LLPanelMainInventory::getCurrentSFVRoot() } if(isCombinationViewMode()) { - //todo: should get actual Combination view root - return mSingleFolderPanelInventory->getSingleFolderRoot(); + return mCombinationPanelInventory->getSingleFolderRoot(); } return LLUUID::null; } diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h index 4a27bbca4e..bc7ed51465 100644 --- a/indra/newview/llpanelmaininventory.h +++ b/indra/newview/llpanelmaininventory.h @@ -160,6 +160,8 @@ protected: bool isSaveTextureEnabled(const LLSD& userdata); void updateItemcountText(); + void updateCombinationVisibility(); + void onFocusReceived(); void onSelectSearchType(); void updateSearchTypeCombo(); @@ -190,6 +192,8 @@ private: EViewModeType mViewMode; LLInventorySingleFolderPanel* mSingleFolderPanelInventory; LLInventoryGallery* mInventoryGalleryPanel; + LLInventorySingleFolderPanel* mCombinationPanelInventory; + LLInventoryGallery* mCombinationGalleryPanel; boost::signals2::connection mListViewRootUpdatedConnection; boost::signals2::connection mGalleryRootUpdatedConnection; @@ -209,6 +213,8 @@ protected: static bool hasSettingsInventory(); void updateTitle(); void updateNavButtons(); + + void onCombinationRootChanged(bool gallery_clicked); /** * Set upload cost in "Upload" sub menu. */ diff --git a/indra/newview/skins/default/xui/en/panel_inventory_gallery.xml b/indra/newview/skins/default/xui/en/panel_inventory_gallery.xml index b32d592bf6..2b80e30696 100644 --- a/indra/newview/skins/default/xui/en/panel_inventory_gallery.xml +++ b/indra/newview/skins/default/xui/en/panel_inventory_gallery.xml @@ -1,7 +1,7 @@ + + + + + + + + + + + + + -- cgit v1.2.3