Commits

richard_linden committed 4d1c1b1

converted LLToast::Params to be a param block

reviewed by James

  • Participants
  • Parent commits 3fd142e

Comments (0)

Files changed (4)

File indra/newview/llscreenchannel.cpp

 }
 
 //--------------------------------------------------------------------------
-void LLScreenChannel::addToast(LLToast::Params p)
+void LLScreenChannel::addToast(const LLToast::Params& p)
 {
 	bool store_toast = false, show_toast = false;
 

File indra/newview/llscreenchannel.h

 	
 	// Operating with toasts
 	// add a toast to a channel
-	void		addToast(LLToast::Params p);
+	void		addToast(const LLToast::Params& p);
 	// kill or modify a toast by its ID
 	void		killToastByNotificationID(LLUUID id);
 	void		modifyToastByNotificationID(LLUUID id, LLPanel* panel);

File indra/newview/lltoast.cpp

 using namespace LLNotificationsUI;
 
 //--------------------------------------------------------------------------
-LLToast::LLToast(LLToast::Params p) :	LLModalDialog(LLSD(), p.is_modal),
-										mPanel(p.panel), 
-										mToastLifetime(p.lifetime_secs),  
-										mNotificationID(p.notif_id),  
-										mSessionID(p.session_id),
-										mCanFade(p.can_fade),
-										mCanBeStored(p.can_be_stored),
-										mHideBtnEnabled(p.enable_hide_btn),
-										mHideBtn(NULL),
-										mNotification(p.notification),
-										mHideBtnPressed(false)
+LLToast::Params::Params() 
+:	can_fade("can_fade", true),
+	can_be_stored("can_be_stored", true),
+	is_modal("is_modal", false),
+	is_tip("is_tip", false),
+	enable_hide_btn("enable_hide_btn", true),
+	force_show("force_show", false),
+	force_store("force_store", false),
+	lifetime_secs("lifetime_secs", gSavedSettings.getS32("NotificationToastLifeTime"))
+{};
+
+LLToast::LLToast(const LLToast::Params& p) 
+:	LLModalDialog(LLSD(), p.is_modal),
+	mPanel(p.panel), 
+	mToastLifetime(p.lifetime_secs),  
+	mNotificationID(p.notif_id),  
+	mSessionID(p.session_id),
+	mCanFade(p.can_fade),
+	mCanBeStored(p.can_be_stored),
+	mHideBtnEnabled(p.enable_hide_btn),
+	mHideBtn(NULL),
+	mNotification(p.notification),
+	mHideBtnPressed(false)
 {
 	LLUICtrlFactory::getInstance()->buildFloater(this, "panel_toast.xml", NULL);
 
 	}
 
 	// init callbacks if present
-	if(!p.on_delete_toast.empty())
-		mOnDeleteToastSignal.connect(p.on_delete_toast);
+	if(!p.on_delete_toast().empty())
+		mOnDeleteToastSignal.connect(p.on_delete_toast());
 
-	if(!p.on_mouse_enter.empty())
-		mOnMouseEnterSignal.connect(p.on_mouse_enter);
+	if(!p.on_mouse_enter().empty())
+		mOnMouseEnterSignal.connect(p.on_mouse_enter());
 }
 
 //--------------------------------------------------------------------------

File indra/newview/lltoast.h

 	typedef boost::function<void (LLToast* toast)> toast_callback_t;
 	typedef boost::signals2::signal<void (LLToast* toast)> toast_signal_t;
 
-	struct Params
+	struct Params : public LLInitParam::Block<Params>
 	{
-		LLPanel*			panel;
-		LLUUID				notif_id;	 //notification ID
-		LLUUID				session_id;	 //im session ID
-		LLNotificationPtr	notification;
-		F32					lifetime_secs;
-		toast_callback_t	on_delete_toast;
-		toast_callback_t	on_mouse_enter;
-		bool				can_fade;
-		bool				can_be_stored;
-		bool				enable_hide_btn;
-		bool				is_modal;
-		bool				is_tip;
-		bool				force_show;
-		bool				force_store;
+		Mandatory<LLPanel*>				panel;
+		Optional<LLUUID>				notif_id,	 //notification ID
+										session_id;	 //im session ID
+		Optional<LLNotificationPtr>		notification;
+		Optional<F32>					lifetime_secs;
+		Optional<toast_callback_t>		on_delete_toast,
+										on_mouse_enter;
+		Optional<bool>					can_fade,
+										can_be_stored,
+										enable_hide_btn,
+										is_modal,
+										is_tip,
+										force_show,
+										force_store;
 
-		Params() :	can_fade(true),
-					can_be_stored(true),
-					is_modal(false),
-					is_tip(false),
-					enable_hide_btn(true),
-					force_show(false),
-					force_store(false),
-					panel(NULL),
-					lifetime_secs(gSavedSettings.getS32("NotificationToastLifeTime"))
 
-		{};
+		Params();
 	};
 
-	LLToast(LLToast::Params p);
+	LLToast(const LLToast::Params& p);
 	virtual ~LLToast();
 	BOOL postBuild();