From bc9b15a348640ee207274a14ceb87c12150adcb2 Mon Sep 17 00:00:00 2001 From: Paul Guslisty Date: Wed, 12 May 2010 17:38:07 +0300 Subject: EXT-7203 FIXED Re-enabled inventory search for wearables panel - Insert filter editor and inventory panels into layout_stack - restored filter functionality for a list view - added proper switching between flat list view and folder list view - made a little optimization: got rid of redundant findChild calls because of childSetVisible(..., childGetValue(...)); Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/362/ --HG-- branch : product-engine --- indra/newview/llpaneloutfitedit.cpp | 49 +++++- indra/newview/llpaneloutfitedit.h | 16 +- .../skins/default/xui/en/panel_outfit_edit.xml | 192 ++++++++++----------- 3 files changed, 154 insertions(+), 103 deletions(-) diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index 008661221a..1c74c8f26a 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -210,7 +210,11 @@ BOOL LLPanelOutfitEdit::postBuild() mCurrentOutfitName = getChild("curr_outfit_name"); mStatus = getChild("status"); + mFolderViewBtn = getChild("folder_view_btn"); + mListViewBtn = getChild("list_view_btn"); + childSetCommitCallback("filter_button", boost::bind(&LLPanelOutfitEdit::showWearablesFilter, this), NULL); + childSetCommitCallback("folder_view_btn", boost::bind(&LLPanelOutfitEdit::showFilteredFolderWearablesPanel, this), NULL); childSetCommitCallback("list_view_btn", boost::bind(&LLPanelOutfitEdit::showFilteredWearablesPanel, this), NULL); mCOFWearables = getChild("cof_wearables_list"); @@ -267,8 +271,9 @@ BOOL LLPanelOutfitEdit::postBuild() save_registar.add("Outfit.SaveAsNew.Action", boost::bind(&LLPanelOutfitEdit::saveOutfit, this, true)); mSaveMenu = LLUICtrlFactory::getInstance()->createFromFile("menu_save_outfit.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); - mWearableListManager = new LLFilteredWearableListManager( - getChild("filtered_wearables_list"), ALL_ITEMS_MASK); + mWearableItemsPanel = getChild("filtered_wearables_panel"); + mWearableItemsList = getChild("filtered_wearables_list"); + mWearableListManager = new LLFilteredWearableListManager(mWearableItemsList, ALL_ITEMS_MASK); return TRUE; } @@ -289,12 +294,33 @@ void LLPanelOutfitEdit::toggleAddWearablesPanel() void LLPanelOutfitEdit::showWearablesFilter() { - childSetVisible("filter_combobox_panel", childGetValue("filter_button")); + bool filter_visible = childGetValue("filter_button"); + + childSetVisible("filter_panel", filter_visible); + + if(!filter_visible) + { + mSearchFilter->clear(); + onSearchEdit(LLStringUtil::null); + } } void LLPanelOutfitEdit::showFilteredWearablesPanel() { - childSetVisible("filtered_wearables_panel", !childIsVisible("filtered_wearables_panel")); + if(switchPanels(mInventoryItemsPanel, mWearableItemsPanel)) + { + mFolderViewBtn->setToggleState(FALSE); + } + mListViewBtn->setToggleState(TRUE); +} + +void LLPanelOutfitEdit::showFilteredFolderWearablesPanel() +{ + if(switchPanels(mWearableItemsPanel, mInventoryItemsPanel)) + { + mListViewBtn->setToggleState(FALSE); + } + mFolderViewBtn->setToggleState(TRUE); } void LLPanelOutfitEdit::saveOutfit(bool as_new) @@ -359,7 +385,7 @@ void LLPanelOutfitEdit::onSearchEdit(const std::string& string) if (mSearchString == "") { mInventoryItemsPanel->setFilterSubString(LLStringUtil::null); - + mWearableItemsList->setFilterSubString(LLStringUtil::null); // re-open folders that were initially open mSavedFolderState->setApply(TRUE); mInventoryItemsPanel->getRootFolder()->applyFunctorRecursively(*mSavedFolderState); @@ -385,6 +411,8 @@ void LLPanelOutfitEdit::onSearchEdit(const std::string& string) // set new filter string mInventoryItemsPanel->setFilterSubString(mSearchString); + mWearableItemsList->setFilterSubString(mSearchString); + } void LLPanelOutfitEdit::onAddToOutfitClicked(void) @@ -540,4 +568,15 @@ void LLPanelOutfitEdit::updateVerbs() } +bool LLPanelOutfitEdit::switchPanels(LLPanel* switch_from_panel, LLPanel* switch_to_panel) +{ + if(switch_from_panel && switch_to_panel && !switch_to_panel->getVisible()) + { + switch_from_panel->setVisible(FALSE); + switch_to_panel->setVisible(TRUE); + return true; + } + return false; +} + // EOF diff --git a/indra/newview/llpaneloutfitedit.h b/indra/newview/llpaneloutfitedit.h index 04c94e553f..cb8283fca3 100644 --- a/indra/newview/llpaneloutfitedit.h +++ b/indra/newview/llpaneloutfitedit.h @@ -42,6 +42,7 @@ #include "llremoteparcelrequest.h" #include "llinventory.h" +#include "llinventoryitemslist.h" #include "llinventorymodel.h" class LLButton; @@ -87,6 +88,7 @@ public: void toggleAddWearablesPanel(); void showWearablesFilter(); void showFilteredWearablesPanel(); + void showFilteredFolderWearablesPanel(); void saveOutfit(bool as_new = false); void showSaveMenu(); @@ -103,6 +105,14 @@ public: void update(); void updateVerbs(); + /** + * @brief Helper function. Shows one panel instead of another. + * If panels already switched does nothing and returns false. + * @param switch_from_panel panel to hide + * @param switch_to_panel panel to show + * @retun returns true if switching happened, false if not. + */ + bool switchPanels(LLPanel* switch_from_panel, LLPanel* switch_to_panel); private: @@ -115,9 +125,13 @@ private: LLSaveFolderState* mSavedFolderState; std::string mSearchString; LLButton* mEditWearableBtn; + LLButton* mFolderViewBtn; + LLButton* mListViewBtn; LLToggleableMenu* mSaveMenu; - LLFilteredWearableListManager* mWearableListManager; + LLFilteredWearableListManager* mWearableListManager; + LLInventoryItemsList* mWearableItemsList; + LLPanel* mWearableItemsPanel; LLCOFObserver* mCOFObserver; std::vector mLookItemTypes; diff --git a/indra/newview/skins/default/xui/en/panel_outfit_edit.xml b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml index 3200951253..7961664516 100644 --- a/indra/newview/skins/default/xui/en/panel_outfit_edit.xml +++ b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml @@ -215,124 +215,120 @@ tab_group="2" user_resize="true" visible="false"> - - - +