diff options
Diffstat (limited to 'indra/newview/llscreenchannel.cpp')
-rw-r--r-- | indra/newview/llscreenchannel.cpp | 57 |
1 files changed, 32 insertions, 25 deletions
diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp index a72100a9b3..e4dbcbd219 100644 --- a/indra/newview/llscreenchannel.cpp +++ b/indra/newview/llscreenchannel.cpp @@ -44,7 +44,6 @@ #include "lltrans.h" #include "lldockablefloater.h" -#include "llimpanel.h" #include "llsyswellwindow.h" #include "llimfloater.h" @@ -138,7 +137,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; @@ -191,19 +190,22 @@ void LLScreenChannel::onToastFade(LLToast* toast) { std::vector<ToastElem>::iterator it = find(mToastList.begin(), mToastList.end(), static_cast<LLPanel*>(toast)); - bool delete_toast = !mCanStoreToasts || !toast->getCanBeStored(); - if(delete_toast) - { - mToastList.erase(it); - deleteToast(toast); - } - else + if(it != mToastList.end()) { - storeToast((*it)); - mToastList.erase(it); - } + bool delete_toast = !mCanStoreToasts || !toast->getCanBeStored(); + if(delete_toast) + { + mToastList.erase(it); + deleteToast(toast); + } + else + { + storeToast((*it)); + mToastList.erase(it); + } - redrawToasts(); + redrawToasts(); + } } //-------------------------------------------------------------------------- @@ -247,6 +249,7 @@ void LLScreenChannel::loadStoredToastsToChannel() for(it = mStoredToastList.begin(); it != mStoredToastList.end(); ++it) { + (*it).toast->setIsHidden(false); (*it).toast->resetTimer(); mToastList.push_back((*it)); } @@ -266,6 +269,7 @@ void LLScreenChannel::loadStoredToastByNotificationIDToChannel(LLUUID id) mOverflowToastHidden = false; LLToast* toast = (*it).toast; + toast->setIsHidden(false); toast->resetTimer(); mToastList.push_back((*it)); mStoredToastList.erase(it); @@ -381,7 +385,7 @@ void LLScreenChannel::showToastsBottom() if(it != mToastList.rbegin()) { bottom = (*(it-1)).toast->getRect().mTop; - toast_margin = gSavedSettings.getS32("ToastMargin"); + toast_margin = gSavedSettings.getS32("ToastGap"); } toast_rect = (*it).toast->getRect(); @@ -394,7 +398,7 @@ void LLScreenChannel::showToastsBottom() { if( it != mToastList.rend()-1) { - stop_showing_toasts = ((*it).toast->getRect().mTop + gSavedSettings.getS32("OverflowToastHeight") + gSavedSettings.getS32("ToastMargin")) > getRect().mTop; + stop_showing_toasts = ((*it).toast->getRect().mTop + gSavedSettings.getS32("OverflowToastHeight") + gSavedSettings.getS32("ToastGap")) > getRect().mTop; } } @@ -412,7 +416,7 @@ void LLScreenChannel::showToastsBottom() (*it).toast->stopTimer(); mHiddenToastsNum++; } - createOverflowToast(bottom, gSavedSettings.getS32("NotificationToastTime")); + createOverflowToast(bottom, gSavedSettings.getS32("NotificationTipToastLifeTime")); } } @@ -426,7 +430,7 @@ void LLScreenChannel::showToastsCentre() for(it = mToastList.rbegin(); it != mToastList.rend(); ++it) { toast_rect = (*it).toast->getRect(); - toast_rect.setLeftTopAndSize(getRect().mLeft - toast_rect.getWidth() / 2, bottom + toast_rect.getHeight() / 2 + gSavedSettings.getS32("ToastMargin"), toast_rect.getWidth() ,toast_rect.getHeight()); + toast_rect.setLeftTopAndSize(getRect().mLeft - toast_rect.getWidth() / 2, bottom + toast_rect.getHeight() / 2 + gSavedSettings.getS32("ToastGap"), toast_rect.getWidth() ,toast_rect.getHeight()); (*it).toast->setRect(toast_rect); (*it).toast->setVisible(TRUE); @@ -443,13 +447,13 @@ void LLScreenChannel::createOverflowToast(S32 bottom, F32 timer) { LLRect toast_rect; LLToast::Params p; - p.timer_period = timer; + p.lifetime_secs = timer; mOverflowToastPanel = new LLToast(p); if(!mOverflowToastPanel) return; - mOverflowToastPanel->setOnFadeCallback(boost::bind(&LLScreenChannel::onOverflowToastHide, this)); + mOverflowToastPanel->setOnFadeCallback(boost::bind(&LLScreenChannel::closeOverflowToastPanel, this)); LLTextBox* text_box = mOverflowToastPanel->getChild<LLTextBox>("toast_text"); LLIconCtrl* icon = mOverflowToastPanel->getChild<LLIconCtrl>("icon"); @@ -465,7 +469,7 @@ void LLScreenChannel::createOverflowToast(S32 bottom, F32 timer) toast_rect = mOverflowToastPanel->getRect(); mOverflowToastPanel->reshape(getRect().getWidth(), toast_rect.getHeight(), true); - toast_rect.setLeftTopAndSize(getRect().mLeft, bottom + toast_rect.getHeight()+gSavedSettings.getS32("ToastMargin"), getRect().getWidth(), toast_rect.getHeight()); + toast_rect.setLeftTopAndSize(getRect().mLeft, bottom + toast_rect.getHeight()+gSavedSettings.getS32("ToastGap"), getRect().getWidth(), toast_rect.getHeight()); mOverflowToastPanel->setRect(toast_rect); text_box->setValue(text); @@ -514,11 +518,12 @@ void LLScreenChannel::closeOverflowToastPanel() } //-------------------------------------------------------------------------- -void LLScreenChannel::createStartUpToast(S32 notif_num, S32 bottom, F32 timer) +void LLScreenChannel::createStartUpToast(S32 notif_num, F32 timer) { LLRect toast_rect; LLToast::Params p; - p.timer_period = timer; + p.lifetime_secs = timer; + p.enable_hide_btn = false; mStartUpToastPanel = new LLToast(p); if(!mStartUpToastPanel) @@ -545,13 +550,15 @@ void LLScreenChannel::createStartUpToast(S32 notif_num, S32 bottom, F32 timer) toast_rect = mStartUpToastPanel->getRect(); mStartUpToastPanel->reshape(getRect().getWidth(), toast_rect.getHeight(), true); - toast_rect.setLeftTopAndSize(getRect().mLeft, bottom + toast_rect.getHeight()+gSavedSettings.getS32("ToastMargin"), getRect().getWidth(), toast_rect.getHeight()); + toast_rect.setLeftTopAndSize(0, toast_rect.getHeight()+gSavedSettings.getS32("ToastGap"), getRect().getWidth(), toast_rect.getHeight()); mStartUpToastPanel->setRect(toast_rect); text_box->setValue(text); text_box->setVisible(TRUE); icon->setVisible(TRUE); + addChild(mStartUpToastPanel); + mStartUpToastPanel->setVisible(TRUE); } @@ -572,7 +579,7 @@ void LLScreenChannel::closeStartUpToast() { if(mStartUpToastPanel != NULL) { - mStartUpToastPanel->closeFloater(); + mStartUpToastPanel->setVisible(FALSE); mStartUpToastPanel = NULL; } } @@ -703,7 +710,7 @@ void LLScreenChannel::updateShowToastsState() LLRect this_rect = getRect(); if(floater->getVisible() && floater->isDocked()) { - channel_bottom += (floater->getRect().getHeight() + gSavedSettings.getS32("ToastMargin")); + channel_bottom += (floater->getRect().getHeight() + gSavedSettings.getS32("ToastGap")); } if(channel_bottom != this_rect.mBottom) |