summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llscreenchannel.cpp2
-rw-r--r--indra/newview/llscreenchannel.h2
-rw-r--r--indra/newview/lltoast.cpp42
-rw-r--r--indra/newview/lltoast.h47
4 files changed, 48 insertions, 45 deletions
diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp
index 816e161f65..04b6d40dfc 100644
--- a/indra/newview/llscreenchannel.cpp
+++ b/indra/newview/llscreenchannel.cpp
@@ -138,7 +138,7 @@ void LLScreenChannel::updatePositionAndSize(LLRect old_world_rect, LLRect new_wo
}
//--------------------------------------------------------------------------
-void LLScreenChannel::addToast(LLToast::Params p)
+void LLScreenChannel::addToast(const LLToast::Params& p)
{
bool store_toast = false, show_toast = false;
diff --git a/indra/newview/llscreenchannel.h b/indra/newview/llscreenchannel.h
index 459c28ac7c..07bbea3014 100644
--- a/indra/newview/llscreenchannel.h
+++ b/indra/newview/llscreenchannel.h
@@ -158,7 +158,7 @@ public:
// 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);
diff --git a/indra/newview/lltoast.cpp b/indra/newview/lltoast.cpp
index 19f56a5cf0..eba43d76a6 100644
--- a/indra/newview/lltoast.cpp
+++ b/indra/newview/lltoast.cpp
@@ -41,17 +41,29 @@
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);
@@ -67,11 +79,11 @@ LLToast::LLToast(LLToast::Params p) : LLModalDialog(LLSD(), p.is_modal),
}
// 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());
}
//--------------------------------------------------------------------------
diff --git a/indra/newview/lltoast.h b/indra/newview/lltoast.h
index 504b83a660..1826c13ebc 100644
--- a/indra/newview/lltoast.h
+++ b/indra/newview/lltoast.h
@@ -57,37 +57,28 @@ public:
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;
-
- 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"))
-
- {};
+ 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();
};
- LLToast(LLToast::Params p);
+ LLToast(const LLToast::Params& p);
virtual ~LLToast();
BOOL postBuild();