From 8a1cb8c00cf75ff1e09c72c2fb487728ec77c66b Mon Sep 17 00:00:00 2001 From: Maxim Nikolenko Date: Wed, 10 May 2023 12:51:08 +0300 Subject: SL-19697 FIXED Clicking on inventory item in list view does not unselect item in gallery view --- indra/newview/llinventorygallery.cpp | 8 ++++++++ indra/newview/llinventorygallery.h | 1 + indra/newview/llpanelmaininventory.cpp | 21 ++++++++++++++++++++- indra/newview/llpanelmaininventory.h | 2 ++ 4 files changed, 31 insertions(+), 1 deletion(-) (limited to 'indra') diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp index 37801c8dd5..9c7e96e97e 100644 --- a/indra/newview/llinventorygallery.cpp +++ b/indra/newview/llinventorygallery.cpp @@ -1056,6 +1056,14 @@ void LLInventoryGallery::deselectItem(const LLUUID& category_id) } } +void LLInventoryGallery::clearSelection() +{ + if(mSelectedItemID != LLUUID::null) + { + changeItemSelection(LLUUID::null); + } +} + void LLInventoryGallery::signalSelectionItemID(const LLUUID& category_id) { mSelectionChangeSignal(category_id); diff --git a/indra/newview/llinventorygallery.h b/indra/newview/llinventorygallery.h index dfb7be6a86..f7065afdae 100644 --- a/indra/newview/llinventorygallery.h +++ b/indra/newview/llinventorygallery.h @@ -116,6 +116,7 @@ public: void computeDifference(const LLInventoryModel::cat_array_t vcats, const LLInventoryModel::item_array_t vitems, uuid_vec_t& vadded, uuid_vec_t& vremoved); void deselectItem(const LLUUID& category_id); + void clearSelection(); void changeItemSelection(const LLUUID& item_id, bool scroll_to_selection = false); void scrollToShowItem(const LLUUID& item_id); void signalSelectionItemID(const LLUUID& category_id); diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 4577c1defa..a8c8ce994d 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -262,7 +262,7 @@ BOOL LLPanelMainInventory::postBuild() LLInventoryFilter& comb_inv_filter = mCombinationInventoryPanel->getFilter(); comb_inv_filter.setFilterThumbnails(LLInventoryFilter::FILTER_EXCLUDE_THUMBNAILS); comb_inv_filter.markDefault(); - mCombinationInventoryPanel->setSelectCallback(boost::bind(&LLPanelMainInventory::onSelectionChange, this, mCombinationInventoryPanel, _1, _2)); + mCombinationInventoryPanel->setSelectCallback(boost::bind(&LLPanelMainInventory::onCombinationInventorySelectionChanged, this, _1, _2)); mCombinationInventoryPanel->setRootChangedCallback(boost::bind(&LLPanelMainInventory::onCombinationRootChanged, this, false)); mCombinationGalleryPanel = getChild("comb_gallery_view_inv"); @@ -270,6 +270,7 @@ BOOL LLPanelMainInventory::postBuild() comb_gallery_filter.setFilterThumbnails(LLInventoryFilter::FILTER_ONLY_THUMBNAILS); comb_gallery_filter.markDefault(); mCombinationGalleryPanel->setRootChangedCallback(boost::bind(&LLPanelMainInventory::onCombinationRootChanged, this, true)); + mCombinationGalleryPanel->setSelectionChangeCallback(boost::bind(&LLPanelMainInventory::onCombinationGallerySelectionChanged, this, _1)); mCombinationScroller = getChild("combination_scroller"); @@ -2296,6 +2297,24 @@ void LLPanelMainInventory::onCombinationRootChanged(bool gallery_clicked) mCombinationInventoryPanel->reshape(1, 1); } +void LLPanelMainInventory::onCombinationGallerySelectionChanged(const LLUUID& category_id) +{ + if(category_id != LLUUID::null) + { + mCombinationInventoryPanel->unSelectAll(); + } +} + +void LLPanelMainInventory::onCombinationInventorySelectionChanged(const std::deque& items, BOOL user_action) +{ + onSelectionChange(mCombinationInventoryPanel, items, user_action); + + if(!items.empty()) + { + mCombinationGalleryPanel->clearSelection(); + } +} + void LLPanelMainInventory::updateCombinationVisibility() { if(mSingleFolderMode diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h index 44beba6b4f..bc010ff37f 100644 --- a/indra/newview/llpanelmaininventory.h +++ b/indra/newview/llpanelmaininventory.h @@ -221,6 +221,8 @@ protected: void updateNavButtons(); void onCombinationRootChanged(bool gallery_clicked); + void onCombinationGallerySelectionChanged(const LLUUID& category_id); + void onCombinationInventorySelectionChanged(const std::deque& items, BOOL user_action); /** * Set upload cost in "Upload" sub menu. */ -- cgit v1.2.3