diff options
| author | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2024-05-10 00:31:15 +0300 | 
|---|---|---|
| committer | Andrey Kleshchev <andreykproductengine@lindenlab.com> | 2024-05-10 00:31:15 +0300 | 
| commit | f8cc05aa3f1fcac27231475ee1c365f71d2169e7 (patch) | |
| tree | 779385c2dc041ab63e29d712761106c015585ed6 | |
| parent | b6d195a7472f2e9860fb6ebe6a0dbc35200c0ddc (diff) | |
viewer#1424 Colored Favorites in Appearance floater
| -rw-r--r-- | indra/newview/lloutfitslist.cpp | 64 | ||||
| -rw-r--r-- | indra/newview/lloutfitslist.h | 9 | 
2 files changed, 68 insertions, 5 deletions
| diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp index 1fa1750933..ededca253b 100644 --- a/indra/newview/lloutfitslist.cpp +++ b/indra/newview/lloutfitslist.cpp @@ -108,10 +108,16 @@ LLOutfitsList::LLOutfitsList()  	,	mListCommands(NULL)  	,	mItemSelected(false)  { +    LLControlVariable* ctrl = gSavedSettings.getControl("InventoryFavoritesColorText"); +    if (ctrl) +    { +        mSavedSettingInvFavColor = ctrl->getSignal()->connect(boost::bind(&LLOutfitsList::handleInvFavColorChange, this)); +    }  }  LLOutfitsList::~LLOutfitsList()  { +    mSavedSettingInvFavColor.disconnect();  }  BOOL LLOutfitsList::postBuild() @@ -254,13 +260,11 @@ void LLOutfitsList::onHighlightBaseOutfit(LLUUID base_id, LLUUID prev_id)  {      if (mOutfitsMap[prev_id])      { -        mOutfitsMap[prev_id]->setTitleFontStyle("NORMAL"); -        mOutfitsMap[prev_id]->setTitleColor(LLUIColorTable::instance().getColor("AccordionHeaderTextColor")); +        ((LLOutfitAccordionCtrlTab*)mOutfitsMap[prev_id])->setOutfitSelected(false);      }      if (mOutfitsMap[base_id])  	{ -		mOutfitsMap[base_id]->setTitleFontStyle("BOLD"); -		mOutfitsMap[base_id]->setTitleColor(LLUIColorTable::instance().getColor("SelectedOutfitTextColor")); +		((LLOutfitAccordionCtrlTab*)mOutfitsMap[base_id])->setOutfitSelected(true);  	}  } @@ -744,6 +748,21 @@ void LLOutfitsList::onOutfitRightClick(LLUICtrl* ctrl, S32 x, S32 y, const LLUUI      }  } + +void LLOutfitsList::handleInvFavColorChange() +{ +    for (outfits_map_t::iterator iter = mOutfitsMap.begin(); +        iter != mOutfitsMap.end(); +        ++iter) +    { +        if (!iter->second) continue; +        LLOutfitAccordionCtrlTab* tab = (LLOutfitAccordionCtrlTab*)iter->second; + +        // refresh font color +        tab->setFavorite(tab->getFavorite()); +    } +} +  LLOutfitListGearMenuBase* LLOutfitsList::createGearMenu()  {      return new LLOutfitListGearMenu(this); @@ -1423,6 +1442,43 @@ BOOL LLOutfitAccordionCtrlTab::handleToolTip(S32 x, S32 y, MASK mask)      return LLAccordionCtrlTab::handleToolTip(x, y, mask);  } +void LLOutfitAccordionCtrlTab::setFavorite(bool is_favorite) +{ +    mIsFavorite = is_favorite; +    static LLUICachedControl<bool> highlight_color("InventoryFavoritesColorText", true); +    if (!mIsSelected && mIsFavorite && highlight_color()) +    { +        setTitleColor(LLUIColorTable::instance().getColor("InventoryFavoriteColor")); +    } +    else +    { +        setTitleColor(LLUIColorTable::instance().getColor("AccordionHeaderTextColor")); +    } +} + +void LLOutfitAccordionCtrlTab::setOutfitSelected(bool val) +{ +    mIsSelected = val; +    if (val) +    { +        setTitleFontStyle("BOLD"); +        setTitleColor(LLUIColorTable::instance().getColor("SelectedOutfitTextColor")); +    } +    else +    { +        setTitleFontStyle("NORMAL"); +        static LLUICachedControl<bool> highlight_color("InventoryFavoritesColorText", true); +        if (mIsFavorite && highlight_color()) +        { +            setTitleColor(LLUIColorTable::instance().getColor("InventoryFavoriteColor")); +        } +        else +        { +            setTitleColor(LLUIColorTable::instance().getColor("AccordionHeaderTextColor")); +        } +    } +} +  void LLOutfitAccordionCtrlTab::drawFavoriteIcon()  {      if (!mIsFavorite) diff --git a/indra/newview/lloutfitslist.h b/indra/newview/lloutfitslist.h index 70ce7d3412..1e053eccc7 100644 --- a/indra/newview/lloutfitslist.h +++ b/indra/newview/lloutfitslist.h @@ -226,7 +226,9 @@ public:      virtual void draw();      virtual BOOL handleToolTip(S32 x, S32 y, MASK mask); -    void setFavorite(bool is_favorite) { mIsFavorite = is_favorite; } +    void setFavorite(bool is_favorite); +    bool getFavorite() const { return mIsFavorite; } +    void setOutfitSelected(bool val);      static LLUIImage* sFavoriteIcon;      static LLUIColor sFgColor; @@ -242,6 +244,7 @@ public:      LLUUID mFolderID;      bool mIsFavorite = false; +    bool mIsSelected = false;  };    /**   * @class LLOutfitsList @@ -368,6 +371,8 @@ private:  	static void onOutfitRename(const LLSD& notification, const LLSD& response); +    void handleInvFavColorChange(); +  	//LLInventoryCategoriesObserver* 	mCategoriesObserver;  	LLAccordionCtrl*				mAccordion; @@ -392,6 +397,8 @@ private:  	 * True if there is a selection inside currently selected outfit  	 */  	bool							mItemSelected; + +    boost::signals2::connection                   mSavedSettingInvFavColor;  };  #endif //LL_LLOUTFITSLIST_H | 
