diff options
| -rw-r--r-- | indra/newview/llchiclet.cpp | 78 | ||||
| -rw-r--r-- | indra/newview/llchiclet.h | 72 | ||||
| -rw-r--r-- | indra/newview/llscriptfloater.cpp | 11 | 
3 files changed, 160 insertions, 1 deletions
diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index d533743cfc..0e83f88989 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -1456,6 +1456,28 @@ void LLChicletGroupIconCtrl::setValue(const LLSD& value )  //////////////////////////////////////////////////////////////////////////  ////////////////////////////////////////////////////////////////////////// +LLChicletInvOfferIconCtrl::LLChicletInvOfferIconCtrl(const Params& p) +: LLChicletAvatarIconCtrl(p) + , mDefaultIcon(p.default_icon) +{ +} + +void LLChicletInvOfferIconCtrl::setValue(const LLSD& value ) +{ +	if(value.asUUID().isNull()) +	{ +		LLIconCtrl::setValue(mDefaultIcon); +	} +	else +	{ +		LLChicletAvatarIconCtrl::setValue(value); +	} +} + +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +  LLChicletSpeakerCtrl::LLChicletSpeakerCtrl(const Params&p)   : LLOutputMonitorCtrl(p)  { @@ -1507,4 +1529,60 @@ BOOL LLScriptChiclet::handleMouseDown(S32 x, S32 y, MASK mask)  	return LLChiclet::handleMouseDown(x, y, mask);  } +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// + +static const std::string INVENTORY_USER_OFFER	("UserGiveItem"); + +LLInvOfferChiclet::Params::Params() +{ +	// *TODO Vadim: Get rid of hardcoded values. +	rect(CHICLET_RECT); +	icon.rect(CHICLET_ICON_RECT); +} + +LLInvOfferChiclet::LLInvOfferChiclet(const Params&p) + : LLIMChiclet(p) + , mChicletIconCtrl(NULL) +{ +	LLChicletInvOfferIconCtrl::Params icon_params = p.icon; +	mChicletIconCtrl = LLUICtrlFactory::create<LLChicletInvOfferIconCtrl>(icon_params); +	// Let "new message" icon be on top, else it will be hidden behind chiclet icon. +	addChildInBack(mChicletIconCtrl); +} + +void LLInvOfferChiclet::setSessionId(const LLUUID& session_id) +{ +	setShowNewMessagesIcon( getSessionId() != session_id ); + +	LLIMChiclet::setSessionId(session_id); +	LLUUID notification_id = LLScriptFloaterManager::getInstance()->findNotificationId(session_id); +	LLNotificationPtr notification = LLNotifications::getInstance()->find(notification_id); +	if(notification) +	{ +		setToolTip(notification->getSubstitutions()["TITLE"].asString()); +	} + +	if ( notification && notification->getName() == INVENTORY_USER_OFFER ) +	{ +		mChicletIconCtrl->setValue(notification->getPayload()["from_id"]); +	} +	else +	{ +		mChicletIconCtrl->setValue(LLUUID::null); +	} +} + +void LLInvOfferChiclet::onMouseDown() +{ +	LLScriptFloaterManager::instance().toggleScriptFloater(getSessionId()); +} + +BOOL LLInvOfferChiclet::handleMouseDown(S32 x, S32 y, MASK mask) +{ +	onMouseDown(); +	return LLChiclet::handleMouseDown(x, y, mask); +} +  // EOF diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h index ed4bcbc6ac..c75ad2b546 100644 --- a/indra/newview/llchiclet.h +++ b/indra/newview/llchiclet.h @@ -148,6 +148,39 @@ protected:  };  /** + * Class for displaying icon in inventory offer chiclet. + */ +class LLChicletInvOfferIconCtrl : public LLChicletAvatarIconCtrl +{ +public: + +	struct Params : +		public LLInitParam::Block<Params, LLChicletAvatarIconCtrl::Params> +	{ +		Optional<std::string> default_icon; + +		Params() +		 : default_icon("default_icon", "Generic_Object_Small") +		{ +			avatar_id = LLUUID::null; +		}; +	}; + +	/** +	 * Sets icon, if value is LLUUID::null - default icon will be set. +	 */ +	virtual void setValue(const LLSD& value ); + +protected: + +	LLChicletInvOfferIconCtrl(const Params& p); +	friend class LLUICtrlFactory; + +private: +	std::string mDefaultIcon; +}; + +/**   * Class for displaying of speaker's voice indicator    */  class LLChicletSpeakerCtrl : public LLOutputMonitorCtrl @@ -585,6 +618,45 @@ private:  };  /** + * Chiclet for inventory offer script floaters. + */ +class LLInvOfferChiclet: public LLIMChiclet +{ +public: + +	struct Params : public LLInitParam::Block<Params, LLIMChiclet::Params> +	{ +		Optional<LLChicletInvOfferIconCtrl::Params> icon; + +		Params(); +	}; + +	/*virtual*/ void setSessionId(const LLUUID& session_id); + +	/*virtual*/ void setCounter(S32 counter){} + +	/*virtual*/ S32 getCounter() { return 0; } + +	/** +	 * Toggle script floater +	 */ +	/*virtual*/ void onMouseDown(); + +	/** +	 * Override default handler +	 */ +	/*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); + + +protected: +	LLInvOfferChiclet(const Params&); +	friend class LLUICtrlFactory; + +private: +	LLChicletInvOfferIconCtrl* mChicletIconCtrl; +}; + +/**   * Implements Group chat chiclet.   */  class LLIMGroupChiclet : public LLIMChiclet, public LLGroupMgrObserver diff --git a/indra/newview/llscriptfloater.cpp b/indra/newview/llscriptfloater.cpp index 7c4f3d3608..155172128b 100644 --- a/indra/newview/llscriptfloater.cpp +++ b/indra/newview/llscriptfloater.cpp @@ -212,7 +212,16 @@ void LLScriptFloaterManager::onAddNotification(const LLUUID& notification_id)  	LLNotificationData nd = {notification_id};  	mNotifications.insert(std::make_pair(object_id, nd)); -	LLBottomTray::getInstance()->getChicletPanel()->createChiclet<LLScriptChiclet>(object_id); +	// Create inventory offer chiclet for offer type notifications +	LLNotificationPtr notification = LLNotifications::getInstance()->find(notification_id); +	if( notification && notification->getType() == "offer" ) +	{ +		LLBottomTray::instance().getChicletPanel()->createChiclet<LLInvOfferChiclet>(object_id); +	} +	else +	{ +		LLBottomTray::getInstance()->getChicletPanel()->createChiclet<LLScriptChiclet>(object_id); +	}  	toggleScriptFloater(object_id);  }  | 
