diff options
author | Igor Borovkov <iborovkov@productengine.com> | 2010-07-06 18:11:14 +0300 |
---|---|---|
committer | Igor Borovkov <iborovkov@productengine.com> | 2010-07-06 18:11:14 +0300 |
commit | 979dc6257a2f69ade29662a879b0fcaa767201fb (patch) | |
tree | b2d122fe84339b5206c283bac27f8114a58f6881 /indra | |
parent | 3e7af3244f20f64b2d1c5ebc8d9f1fa616bee104 (diff) |
EXT-8061 FIXED resetting selection inside accordion (panel outfit edit)
- added resetting lists selection on tabs state changes
- added committing on tab selection change
- added filtering wearables by at first by a selected tab and then by an expended tab
Reviewed by Vadim Savchuk at https://codereview.productengine.com/secondlife/r/696
--HG--
branch : product-engine
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llcofwearables.cpp | 62 | ||||
-rw-r--r-- | indra/newview/llcofwearables.h | 9 | ||||
-rw-r--r-- | indra/newview/llpaneloutfitedit.cpp | 11 |
3 files changed, 79 insertions, 3 deletions
diff --git a/indra/newview/llcofwearables.cpp b/indra/newview/llcofwearables.cpp index f278fb6a7b..d83706de52 100644 --- a/indra/newview/llcofwearables.cpp +++ b/indra/newview/llcofwearables.cpp @@ -281,7 +281,11 @@ LLCOFWearables::LLCOFWearables() : LLPanel(), mAttachments(NULL), mClothing(NULL), mBodyParts(NULL), - mLastSelectedList(NULL) + mLastSelectedList(NULL), + mClothingTab(NULL), + mAttachmentsTab(NULL), + mBodyPartsTab(NULL), + mLastSelectedTab(NULL) { mClothingMenu = new CofClothingContextMenu(this); mAttachmentMenu = new CofAttachmentContextMenu(this); @@ -319,6 +323,16 @@ BOOL LLCOFWearables::postBuild() mAttachments->setComparator(&WEARABLE_NAME_COMPARATOR); mBodyParts->setComparator(&WEARABLE_NAME_COMPARATOR); + + mClothingTab = getChild<LLAccordionCtrlTab>("tab_clothing"); + mClothingTab->setDropDownStateChangedCallback(boost::bind(&LLCOFWearables::onAccordionTabStateChanged, this, _1, _2)); + + mAttachmentsTab = getChild<LLAccordionCtrlTab>("tab_attachments"); + mAttachmentsTab->setDropDownStateChangedCallback(boost::bind(&LLCOFWearables::onAccordionTabStateChanged, this, _1, _2)); + + mBodyPartsTab = getChild<LLAccordionCtrlTab>("tab_body_parts"); + mBodyPartsTab->setDropDownStateChangedCallback(boost::bind(&LLCOFWearables::onAccordionTabStateChanged, this, _1, _2)); + return LLPanel::postBuild(); } @@ -338,6 +352,28 @@ void LLCOFWearables::onSelectionChange(LLFlatListView* selected_list) onCommit(); } +void LLCOFWearables::onAccordionTabStateChanged(LLUICtrl* ctrl, const LLSD& expanded) +{ + bool had_selected_items = mClothing->numSelected() || mAttachments->numSelected() || mBodyParts->numSelected(); + mClothing->resetSelection(true); + mAttachments->resetSelection(true); + mBodyParts->resetSelection(true); + + bool tab_selection_changed = false; + LLAccordionCtrlTab* tab = dynamic_cast<LLAccordionCtrlTab*>(ctrl); + if (tab && tab != mLastSelectedTab) + { + mLastSelectedTab = tab; + tab_selection_changed = true; + } + + if (had_selected_items || tab_selection_changed) + { + //sending commit signal to indicate selection changes + onCommit(); + } +} + void LLCOFWearables::refresh() { typedef std::vector<LLSD> values_vector_t; @@ -617,6 +653,30 @@ LLAssetType::EType LLCOFWearables::getExpandedAccordionAssetType() return result; } +LLAssetType::EType LLCOFWearables::getSelectedAccordionAssetType() +{ + //*TODO share the code with ::getExpandedAccordionAssetType(...) + static LLAccordionCtrl* accordion_ctrl = getChild<LLAccordionCtrl>("cof_wearables_accordion"); + const LLAccordionCtrlTab* selected_tab = accordion_ctrl->getSelectedTab(); + + if (selected_tab == mClothingTab) + { + return LLAssetType::AT_CLOTHING; + } + else if (selected_tab == mAttachmentsTab) + { + return LLAssetType::AT_OBJECT; + } + else if (selected_tab == mBodyPartsTab) + { + return LLAssetType::AT_BODYPART; + } + else + { + return LLAssetType::AT_NONE; + } +} + void LLCOFWearables::onListRightClick(LLUICtrl* ctrl, S32 x, S32 y, LLListContextMenu* menu) { if(menu) diff --git a/indra/newview/llcofwearables.h b/indra/newview/llcofwearables.h index 62f4cfc692..de148e0d46 100644 --- a/indra/newview/llcofwearables.h +++ b/indra/newview/llcofwearables.h @@ -40,6 +40,7 @@ #include "llappearancemgr.h" #include "llinventorymodel.h" +class LLAccordionCtrlTab; class LLListContextMenu; class LLPanelClothingListItem; class LLPanelBodyPartsListItem; @@ -84,6 +85,7 @@ public: void clear(); LLAssetType::EType getExpandedAccordionAssetType(); + LLAssetType::EType getSelectedAccordionAssetType(); LLCOFCallbacks& getCOFCallbacks() { return mCOFCallbacks; } @@ -94,6 +96,7 @@ protected: void addClothingTypesDummies(const LLAppearanceMgr::wearables_by_type_t& clothing_by_type); void onSelectionChange(LLFlatListView* selected_list); + void onAccordionTabStateChanged(LLUICtrl* ctrl, const LLSD& expanded); LLPanelClothingListItem* buildClothingListItem(LLViewerInventoryItem* item, bool first, bool last); LLPanelBodyPartsListItem* buildBodypartListItem(LLViewerInventoryItem* item); @@ -107,6 +110,12 @@ protected: LLFlatListView* mLastSelectedList; + LLAccordionCtrlTab* mClothingTab; + LLAccordionCtrlTab* mAttachmentsTab; + LLAccordionCtrlTab* mBodyPartsTab; + + LLAccordionCtrlTab* mLastSelectedTab; + LLCOFCallbacks mCOFCallbacks; LLListContextMenu* mClothingMenu; diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index 289fe8c570..c397dd5092 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -731,12 +731,19 @@ void LLPanelOutfitEdit::filterWearablesBySelectedItem(void) bool more_than_one_selected = ids.size() > 1; bool is_dummy_item = (ids.size() && dynamic_cast<LLPanelDummyClothingListItem*>(mCOFWearables->getSelectedItem())); - //expanded accordion tab determines filtering when no item is selected + //selected and expanded accordion tabs determine filtering when no item is selected if (nothing_selected) { showWearablesListView(); - switch (mCOFWearables->getExpandedAccordionAssetType()) + //selected accordion tab is more priority than expanded tab when determining filtering + LLAssetType::EType type = mCOFWearables->getSelectedAccordionAssetType(); + if (type == LLAssetType::AT_NONE) + { + type = mCOFWearables->getExpandedAccordionAssetType(); + } + + switch (type) { case LLAssetType::AT_OBJECT: applyListViewFilter(LVIT_ATTACHMENT); |