diff options
| -rw-r--r-- | indra/llui/llaccordionctrl.cpp | 66 | ||||
| -rw-r--r-- | indra/llui/llaccordionctrl.h | 13 | ||||
| -rw-r--r-- | indra/llui/llaccordionctrltab.cpp | 7 | ||||
| -rw-r--r-- | indra/llui/llaccordionctrltab.h | 5 | ||||
| -rw-r--r-- | indra/newview/lloutfitslist.cpp | 2 | ||||
| -rw-r--r-- | indra/newview/llpanelpeople.cpp | 2 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/panel_outfits_list.xml | 1 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/widgets/accordion.xml | 15 | 
8 files changed, 110 insertions, 1 deletions
diff --git a/indra/llui/llaccordionctrl.cpp b/indra/llui/llaccordionctrl.cpp index 8e0245c451..5f866c49e6 100644 --- a/indra/llui/llaccordionctrl.cpp +++ b/indra/llui/llaccordionctrl.cpp @@ -66,8 +66,11 @@ LLAccordionCtrl::LLAccordionCtrl(const Params& params):LLPanel(params)   , mAutoScrolling( false )   , mAutoScrollRate( 0.f )   , mSelectedTab( NULL ) + , mNoVisibleTabsHelpText(NULL)  { -  mSingleExpansion = params.single_expansion; +	initNoTabsWidget(params.empty_accordion_text); + +	mSingleExpansion = params.single_expansion;  	if(mFitParent && !mSingleExpansion)  	{  		llinfos << "fit_parent works best when combined with single_expansion" << llendl; @@ -78,7 +81,10 @@ LLAccordionCtrl::LLAccordionCtrl() : LLPanel()   , mAutoScrolling( false )   , mAutoScrollRate( 0.f )   , mSelectedTab( NULL ) + , mNoVisibleTabsHelpText(NULL)  { +	initNoTabsWidget(LLTextBox::Params()); +  	mSingleExpansion = false;  	mFitParent = false;  	LLUICtrlFactory::getInstance()->buildPanel(this, "accordion_parent.xml");	 @@ -168,6 +174,8 @@ BOOL LLAccordionCtrl::postBuild()  		}  	} +	updateNoTabsHelpTextVisibility(); +  	return TRUE;  } @@ -187,8 +195,15 @@ void LLAccordionCtrl::reshape(S32 width, S32 height, BOOL called_from_parent)  	rcLocal.mRight = rcLocal.mLeft + width;  	rcLocal.mTop = rcLocal.mBottom + height; +	// get textbox a chance to reshape its content +	mNoVisibleTabsHelpText->reshape(width, height, called_from_parent); +  	setRect(rcLocal); +	// assume that help text is always fit accordion. +	// necessary text paddings can be set via h_pad and v_pad +	mNoVisibleTabsHelpText->setRect(getLocalRect()); +  	arrange();  } @@ -359,6 +374,31 @@ void LLAccordionCtrl::removeCollapsibleCtrl(LLView* view)  	}  } +void	LLAccordionCtrl::initNoTabsWidget(const LLTextBox::Params& tb_params) +{ +	LLTextBox::Params tp = tb_params; +	tp.rect(getLocalRect()); +	mNoVisibleTabsOrigString = tp.initial_value().asString(); +	mNoVisibleTabsHelpText = LLUICtrlFactory::create<LLTextBox>(tp, this); +} + +void	LLAccordionCtrl::updateNoTabsHelpTextVisibility() +{ +	bool visible_exists = false; +	std::vector<LLAccordionCtrlTab*>::const_iterator it = mAccordionTabs.begin(); +	const std::vector<LLAccordionCtrlTab*>::const_iterator it_end = mAccordionTabs.end(); +	for (; it != it_end; ++it) +	{ +		if ((*it)->getVisible()) +		{ +			visible_exists = true; +			break; +		} +	} + +	mNoVisibleTabsHelpText->setVisible(!visible_exists); +} +  void	LLAccordionCtrl::arrangeSinge()  {  	S32 panel_left = BORDER_MARGIN;	  // Margin from left side of Splitter @@ -737,6 +777,20 @@ S32	LLAccordionCtrl::notifyParent(const LLSD& info)  		}  		return 1;  	} +	else if (info.has("child_visibility_change")) +	{ +		BOOL new_visibility = info["child_visibility_change"]; +		if (new_visibility) +		{ +			// there is at least one visible tab +			mNoVisibleTabsHelpText->setVisible(FALSE); +		} +		else +		{ +			// it could be the latest visible tab, check all of them +			updateNoTabsHelpTextVisibility(); +		} +	}  	return LLPanel::notifyParent(info);  }  void	LLAccordionCtrl::reset		() @@ -745,6 +799,16 @@ void	LLAccordionCtrl::reset		()  		mScrollbar->setDocPos(0);  } +void	LLAccordionCtrl::setFilterSubString(const std::string& filter_string) +{ +	LLStringUtil::format_map_t args; +	args["[SEARCH_TERM]"] = LLURI::escape(filter_string); +	std::string text = mNoVisibleTabsOrigString; +	LLStringUtil::format(text, args); + +	mNoVisibleTabsHelpText->setValue(text); +} +  S32 LLAccordionCtrl::calcExpandedTabHeight(S32 tab_index /* = 0 */, S32 available_height /* = 0 */)  {  	if(tab_index < 0) diff --git a/indra/llui/llaccordionctrl.h b/indra/llui/llaccordionctrl.h index a029201c90..2f483eafb2 100644 --- a/indra/llui/llaccordionctrl.h +++ b/indra/llui/llaccordionctrl.h @@ -34,6 +34,7 @@  #define LL_ACCORDIONCTRL_H  #include "llpanel.h" +#include "lltextbox.h"  #include "llscrollbar.h"  #include <vector> @@ -64,10 +65,12 @@ public:  								accordion tabs are responsible for scrolling their content.  								*NOTE fit_parent works best when combined with single_expansion.  								Accordion view should implement getRequiredRect() and provide valid height*/ +		Optional<LLTextBox::Params>	empty_accordion_text;  		Params()  			: single_expansion("single_expansion",false)  			, fit_parent("fit_parent", false) +			, empty_accordion_text("empty_accordion_text")  		{};  	}; @@ -105,7 +108,15 @@ public:  	void	reset		(); +	/** +	 * Sets filter substring as a search_term for help text when there are no any visible tabs. +	 */ +	void	setFilterSubString(const std::string& filter_string); +  private: +	void	initNoTabsWidget(const LLTextBox::Params& tb_params); +	void	updateNoTabsHelpTextVisibility(); +  	void	arrangeSinge();  	void	arrangeMultiple(); @@ -131,6 +142,8 @@ private:  	bool			mAutoScrolling;  	F32				mAutoScrollRate;  	LLAccordionCtrlTab* mSelectedTab; +	LLTextBox*		mNoVisibleTabsHelpText; +	std::string		mNoVisibleTabsOrigString;  }; diff --git a/indra/llui/llaccordionctrltab.cpp b/indra/llui/llaccordionctrltab.cpp index 83e67980a3..83fcc77f2a 100644 --- a/indra/llui/llaccordionctrltab.cpp +++ b/indra/llui/llaccordionctrltab.cpp @@ -409,6 +409,13 @@ void LLAccordionCtrlTab::changeOpenClose(bool is_open)  	}  } +void LLAccordionCtrlTab::handleVisibilityChange(BOOL new_visibility) +{ +	LLUICtrl::handleVisibilityChange(new_visibility); + +	notifyParent(LLSD().with("child_visibility_change", new_visibility)); +} +  BOOL LLAccordionCtrlTab::handleMouseDown(S32 x, S32 y, MASK mask)  {  	if(mCollapsible && mHeaderVisible && mCanOpenClose) diff --git a/indra/llui/llaccordionctrltab.h b/indra/llui/llaccordionctrltab.h index 83a9024a74..be8b464b8e 100644 --- a/indra/llui/llaccordionctrltab.h +++ b/indra/llui/llaccordionctrltab.h @@ -154,6 +154,11 @@ public:  	// Call reshape after changing size  	virtual void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE); +	/** +	 * Raises notifyParent event with "child_visibility_change" = new_visibility +	 */ +	void handleVisibilityChange(BOOL new_visibility); +  	// Changes expand/collapse state and triggers expand/collapse callbacks  	virtual BOOL handleMouseDown(S32 x, S32 y, MASK mask); diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 77db280487..a4ae957c76 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -500,6 +500,8 @@ void LLOutfitsList::onFilteredWearableItemsListRefresh(LLUICtrl* ctrl)  void LLOutfitsList::applyFilter(const std::string& new_filter_substring)  { +	mAccordion->setFilterSubString(new_filter_substring); +  	for (outfits_map_t::iterator  			 iter = mOutfitsMap.begin(),  			 iter_end = mOutfitsMap.end(); diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 0a4af00f78..f16d1d8fda 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -1450,6 +1450,8 @@ void LLPanelPeople::showFriendsAccordionsIfNeeded()  		LLAccordionCtrl* accordion = getChild<LLAccordionCtrl>("friends_accordion");  		accordion->arrange(); +		// *TODO: new empty_accordion_text attribute was implemented in accordion (EXT-7368). +		// this code should be refactored to use it  		// keep help text in a synchronization with accordions visibility.  		updateFriendListHelpText();  	} diff --git a/indra/newview/skins/default/xui/en/panel_outfits_list.xml b/indra/newview/skins/default/xui/en/panel_outfits_list.xml index 5cf94c25d7..5c9ae51a48 100644 --- a/indra/newview/skins/default/xui/en/panel_outfits_list.xml +++ b/indra/newview/skins/default/xui/en/panel_outfits_list.xml @@ -14,6 +14,7 @@       background_visible="true"       bg_alpha_color="DkGray2"       bg_opaque_color="DkGray2" +     empty_accordion_text.value="Didn't find what you're looking for? Try [secondlife:///app/search/all/[SEARCH_TERM] Search]."       follows="all"       height="400"       layout="topleft" diff --git a/indra/newview/skins/default/xui/en/widgets/accordion.xml b/indra/newview/skins/default/xui/en/widgets/accordion.xml new file mode 100644 index 0000000000..b817ba56ca --- /dev/null +++ b/indra/newview/skins/default/xui/en/widgets/accordion.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<accordion + height="100" + name="accordion" + width="200"> +    <empty_accordion_text +     follows="all" +     height="100" +     h_pad="10" +     name="no_visible_items_msg" +     value="There are no visible content here." +     v_pad="15" +     width="200" +     wrap="true "/> +</accordion>  | 
