summaryrefslogtreecommitdiff
path: root/indra/newview/lltoast.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/lltoast.cpp')
-rw-r--r--indra/newview/lltoast.cpp52
1 files changed, 32 insertions, 20 deletions
diff --git a/indra/newview/lltoast.cpp b/indra/newview/lltoast.cpp
index 84931e4d2d..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),
- mTimerValue(p.timer_period),
- 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());
}
//--------------------------------------------------------------------------
@@ -103,22 +115,22 @@ void LLToast::setAndStartTimer(F32 period)
{
if(mCanFade)
{
- mTimerValue = period;
+ mToastLifetime = period;
mTimer.start();
}
}
//--------------------------------------------------------------------------
-bool LLToast::timerHasExpired()
+bool LLToast::lifetimeHasExpired()
{
if (mTimer.getStarted())
{
F32 elapsed_time = mTimer.getElapsedTimeF32();
- if (elapsed_time > gSavedSettings.getS32("ToastOpaqueTime"))
+ if ((mToastLifetime - elapsed_time) <= gSavedSettings.getS32("ToastOpaqueTime"))
{
setBackgroundOpaque(FALSE);
}
- if (elapsed_time > mTimerValue)
+ if (elapsed_time > mToastLifetime)
{
return true;
}
@@ -183,7 +195,7 @@ void LLToast::insertPanel(LLPanel* panel)
//--------------------------------------------------------------------------
void LLToast::draw()
{
- if(timerHasExpired())
+ if(lifetimeHasExpired())
{
tick();
}