diff options
| author | Dmitry Oleshko <doleshko@productengine.com> | 2009-11-04 16:35:48 +0200 | 
|---|---|---|
| committer | Dmitry Oleshko <doleshko@productengine.com> | 2009-11-04 16:35:48 +0200 | 
| commit | 347f2614804d2b681358822c6bd018409aadde83 (patch) | |
| tree | 9f6a76e0b8f9a2627d0702c5ee28655c3314d4a8 | |
| parent | e634f2f42d5a7165f4cab2910f144144bc7a31d0 (diff) | |
implemented a normal Sub-task (EXT-988) Change indication of unread messges in chiclets
--HG--
branch : product-engine
| -rw-r--r-- | indra/newview/llchiclet.cpp | 98 | ||||
| -rw-r--r-- | indra/newview/llchiclet.h | 32 | 
2 files changed, 68 insertions, 62 deletions
diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index 8a4650763f..594385b4ef 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -198,9 +198,38 @@ void LLChiclet::setValue(const LLSD& value)  //////////////////////////////////////////////////////////////////////////  ////////////////////////////////////////////////////////////////////////// -LLIMChiclet::LLIMChiclet(const LLChiclet::Params& p) +LLIMChiclet::LLIMChiclet(const LLIMChiclet::Params& p)  : LLChiclet(p) +, mNewMessagesIcon(NULL) +, mCounterCtrl(NULL) +{ +	// initialize an overlay icon for new messages +	LLIconCtrl::Params icon_params; +	icon_params.visible = false; +	icon_params.image = LLUI::getUIImage(p.new_messages_icon_name); +	mNewMessagesIcon = LLUICtrlFactory::create<LLIconCtrl>(icon_params); +	// adjust size and position of an icon +	LLRect chiclet_rect = p.rect; +	LLRect overlay_icon_rect = LLRect(chiclet_rect.getWidth()/2, chiclet_rect.mTop, chiclet_rect.mRight, chiclet_rect.getHeight()/2);  +	// shift an icon a little bit to the right and up corner of a chiclet +	overlay_icon_rect.translate(overlay_icon_rect.getWidth()/4, overlay_icon_rect.getHeight()/4); +	mNewMessagesIcon->setRect(overlay_icon_rect); +	addChild(mNewMessagesIcon); + +	setShowCounter(false); +} + +void LLIMChiclet::setShowNewMessagesIcon(bool show) +{ +	if(mNewMessagesIcon) +	{ +		mNewMessagesIcon->setVisible(show); +	} +} + +bool LLIMChiclet::getShowNewMessagesIcon()  { +	return mNewMessagesIcon->getVisible();  }  void LLIMChiclet::onMouseDown() @@ -274,7 +303,7 @@ LLIMP2PChiclet::Params::Params()  , show_speaker("show_speaker")  {  	// *TODO Vadim: Get rid of hardcoded values. -	rect(LLRect(0, 25, 45, 0)); +	rect(LLRect(0, 25, 25, 0));  	avatar_icon.name("avatar_icon");  	avatar_icon.follows.flags(FOLLOWS_LEFT | FOLLOWS_TOP | FOLLOWS_BOTTOM); @@ -293,6 +322,7 @@ LLIMP2PChiclet::Params::Params()  	unread_notifications.v_pad(5);  	unread_notifications.text_color(LLColor4::white);  	unread_notifications.mouse_opaque(false); +	unread_notifications.visible(false);  	speaker.name("speaker");  	speaker.rect(LLRect(45, 25, 65, 0)); @@ -303,7 +333,6 @@ LLIMP2PChiclet::Params::Params()  LLIMP2PChiclet::LLIMP2PChiclet(const Params& p)  : LLIMChiclet(p)  , mChicletIconCtrl(NULL) -, mCounterCtrl(NULL)  , mSpeakerCtrl(NULL)  , mPopupMenu(NULL)  { @@ -322,28 +351,14 @@ LLIMP2PChiclet::LLIMP2PChiclet(const Params& p)  	mSpeakerCtrl = LLUICtrlFactory::create<LLChicletSpeakerCtrl>(speaker_params);  	addChild(mSpeakerCtrl); +	sendChildToFront(mNewMessagesIcon);  	setShowSpeaker(p.show_speaker);  }  void LLIMP2PChiclet::setCounter(S32 counter)  {  	mCounterCtrl->setCounter(counter); - -	if(getShowCounter()) -	{ -		LLRect counter_rect = mCounterCtrl->getRect(); -		LLRect required_rect = mCounterCtrl->getRequiredRect(); -		bool needs_resize = required_rect.getWidth() != counter_rect.getWidth(); - -		if(needs_resize) -		{ -			counter_rect.mRight = counter_rect.mLeft + required_rect.getWidth(); -			mCounterCtrl->reshape(counter_rect.getWidth(), counter_rect.getHeight()); -			mCounterCtrl->setRect(counter_rect); - -			onChicletSizeChanged(); -		} -	} +	setShowNewMessagesIcon(counter);  }  LLRect LLIMP2PChiclet::getRequiredRect() @@ -458,7 +473,7 @@ LLAdHocChiclet::Params::Params()  , avatar_icon_color("avatar_icon_color", LLColor4::green)  {  	// *TODO Vadim: Get rid of hardcoded values. -	rect(LLRect(0, 25, 45, 0)); +	rect(LLRect(0, 25, 25, 0));  	avatar_icon.name("avatar_icon");  	avatar_icon.follows.flags(FOLLOWS_LEFT | FOLLOWS_TOP | FOLLOWS_BOTTOM); @@ -477,6 +492,8 @@ LLAdHocChiclet::Params::Params()  	unread_notifications.v_pad(5);  	unread_notifications.text_color(LLColor4::white);  	unread_notifications.mouse_opaque(false); +	unread_notifications.visible(false); +  	speaker.name("speaker");  	speaker.rect(LLRect(45, 25, 65, 0)); @@ -487,7 +504,6 @@ LLAdHocChiclet::Params::Params()  LLAdHocChiclet::LLAdHocChiclet(const Params& p)  : LLIMChiclet(p)  , mChicletIconCtrl(NULL) -, mCounterCtrl(NULL)  , mSpeakerCtrl(NULL)  , mPopupMenu(NULL)  { @@ -508,6 +524,7 @@ LLAdHocChiclet::LLAdHocChiclet(const Params& p)  	mSpeakerCtrl = LLUICtrlFactory::create<LLChicletSpeakerCtrl>(speaker_params);  	addChild(mSpeakerCtrl); +	sendChildToFront(mNewMessagesIcon);  	setShowSpeaker(p.show_speaker);  } @@ -521,22 +538,7 @@ void LLAdHocChiclet::setSessionId(const LLUUID& session_id)  void LLAdHocChiclet::setCounter(S32 counter)  {  	mCounterCtrl->setCounter(counter); - -	if(getShowCounter()) -	{ -		LLRect counter_rect = mCounterCtrl->getRect(); -		LLRect required_rect = mCounterCtrl->getRequiredRect(); -		bool needs_resize = required_rect.getWidth() != counter_rect.getWidth(); - -		if(needs_resize) -		{ -			counter_rect.mRight = counter_rect.mLeft + required_rect.getWidth(); -			mCounterCtrl->reshape(counter_rect.getWidth(), counter_rect.getHeight()); -			mCounterCtrl->setRect(counter_rect); - -			onChicletSizeChanged(); -		} -	} +	setShowNewMessagesIcon(counter);  }  LLRect LLAdHocChiclet::getRequiredRect() @@ -565,7 +567,7 @@ BOOL LLAdHocChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask)  LLIMGroupChiclet::Params::Params()  : group_icon("group_icon")  { -	rect(LLRect(0, 25, 45, 0)); +	rect(LLRect(0, 25, 25, 0));  	group_icon.name("group_icon"); @@ -581,6 +583,7 @@ LLIMGroupChiclet::Params::Params()  	unread_notifications.font_halign(LLFontGL::HCENTER);  	unread_notifications.v_pad(5);  	unread_notifications.text_color(LLColor4::white); +	unread_notifications.visible(false);  	speaker.name("speaker");  	speaker.rect(LLRect(45, 25, 65, 0)); @@ -592,7 +595,6 @@ LLIMGroupChiclet::LLIMGroupChiclet(const Params& p)  : LLIMChiclet(p)  , LLGroupMgrObserver(LLUUID::null)  , mChicletIconCtrl(NULL) -, mCounterCtrl(NULL)  , mSpeakerCtrl(NULL)  , mPopupMenu(NULL)  { @@ -611,6 +613,7 @@ LLIMGroupChiclet::LLIMGroupChiclet(const Params& p)  	mSpeakerCtrl = LLUICtrlFactory::create<LLChicletSpeakerCtrl>(speaker_params);  	addChild(mSpeakerCtrl); +	sendChildToFront(mNewMessagesIcon);  	setShowSpeaker(p.show_speaker);  } @@ -622,22 +625,7 @@ LLIMGroupChiclet::~LLIMGroupChiclet()  void LLIMGroupChiclet::setCounter(S32 counter)  {  	mCounterCtrl->setCounter(counter); - -	if(getShowCounter()) -	{ -		LLRect counter_rect = mCounterCtrl->getRect(); -		LLRect required_rect = mCounterCtrl->getRequiredRect(); -		bool needs_resize = required_rect.getWidth() != counter_rect.getWidth(); - -		if(needs_resize) -		{ -			counter_rect.mRight = counter_rect.mLeft + required_rect.getWidth(); -			mCounterCtrl->reshape(counter_rect.getWidth(), counter_rect.getHeight()); -			mCounterCtrl->setRect(counter_rect); - -			onChicletSizeChanged(); -		} -	} +	setShowNewMessagesIcon(counter);  }  LLRect LLIMGroupChiclet::getRequiredRect() diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h index f82259c73e..a830240b7d 100644 --- a/indra/newview/llchiclet.h +++ b/indra/newview/llchiclet.h @@ -278,6 +278,14 @@ public:  		TYPE_GROUP,  		TYPE_AD_HOC  	}; +	struct Params : public LLInitParam::Block<Params, LLChiclet::Params> +	{ +		Optional<std::string> new_messages_icon_name; + +		Params() : new_messages_icon_name("new_messages_icon_name", "icn_voice-localchat.tga") +		{} +	}; +  	/*virtual*/ ~LLIMChiclet() {}; @@ -308,6 +316,16 @@ public:  	virtual bool getShowSpeaker() {return mShowSpeaker;};  	/* +	* Shows/hides overlay icon concerning new unread messages. +	*/ +	virtual void setShowNewMessagesIcon(bool show); + +	/* +	* Returns visibility of overlay icon concerning new unread messages. +	*/ +	virtual bool getShowNewMessagesIcon(); + +	/*  	 * Draws border around chiclet.  	*/  	/*virtual*/ void draw(); @@ -335,7 +353,7 @@ public:  protected: -	LLIMChiclet(const LLChiclet::Params& p); +	LLIMChiclet(const LLIMChiclet::Params& p);  	/*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); @@ -343,6 +361,9 @@ protected:  	bool mShowSpeaker; +	LLIconCtrl* mNewMessagesIcon; +	LLChicletNotificationCounterCtrl* mCounterCtrl; +  	/** the id of another participant, either an avatar id or a group id*/  	LLUUID mOtherParticipantId; @@ -374,7 +395,7 @@ public:  class LLIMP2PChiclet : public LLIMChiclet  {  public: -	struct Params : public LLInitParam::Block<Params, LLChiclet::Params> +	struct Params : public LLInitParam::Block<Params, LLIMChiclet::Params>  	{  		Optional<LLChicletAvatarIconCtrl::Params> avatar_icon; @@ -436,7 +457,6 @@ protected:  private:  	LLChicletAvatarIconCtrl* mChicletIconCtrl; -	LLChicletNotificationCounterCtrl* mCounterCtrl;  	LLChicletSpeakerCtrl* mSpeakerCtrl;  	LLMenuGL* mPopupMenu;  }; @@ -447,7 +467,7 @@ private:  class LLAdHocChiclet : public LLIMChiclet  {  public: -	struct Params : public LLInitParam::Block<Params, LLChiclet::Params> +	struct Params : public LLInitParam::Block<Params, LLIMChiclet::Params>  	{  		Optional<LLChicletAvatarIconCtrl::Params> avatar_icon; @@ -497,7 +517,6 @@ protected:  private:  	LLChicletAvatarIconCtrl* mChicletIconCtrl; -	LLChicletNotificationCounterCtrl* mCounterCtrl;  	LLChicletSpeakerCtrl* mSpeakerCtrl;  	LLMenuGL* mPopupMenu;  }; @@ -509,7 +528,7 @@ class LLIMGroupChiclet : public LLIMChiclet, public LLGroupMgrObserver  {  public: -	struct Params : public LLInitParam::Block<Params, LLChiclet::Params> +	struct Params : public LLInitParam::Block<Params, LLIMChiclet::Params>  	{  		Optional<LLChicletGroupIconCtrl::Params> group_icon; @@ -578,7 +597,6 @@ protected:  private:  	LLChicletGroupIconCtrl* mChicletIconCtrl; -	LLChicletNotificationCounterCtrl* mCounterCtrl;  	LLChicletSpeakerCtrl* mSpeakerCtrl;  	LLMenuGL* mPopupMenu;  };  | 
