diff options
Diffstat (limited to 'indra/newview/llscreenchannel.cpp')
-rw-r--r-- | indra/newview/llscreenchannel.cpp | 69 |
1 files changed, 27 insertions, 42 deletions
diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp index 10561f5701..68996673be 100644 --- a/indra/newview/llscreenchannel.cpp +++ b/indra/newview/llscreenchannel.cpp @@ -49,15 +49,14 @@ using namespace LLNotificationsUI; bool LLScreenChannel::mWasStartUpToastShown = false; //-------------------------------------------------------------------------- -LLScreenChannel::LLScreenChannel(): mOverflowToastPanel(NULL), - mStartUpToastPanel(NULL), - mToastAlignment(NA_BOTTOM), - mCanStoreToasts(true), - mHiddenToastsNum(0), - mOverflowToastHidden(false), - mIsHovering(false), - mControlHovering(false) +LLScreenChannel::LLScreenChannel(LLUUID& id): mOverflowToastPanel(NULL), mStartUpToastPanel(NULL), + mToastAlignment(NA_BOTTOM), mCanStoreToasts(true), + mHiddenToastsNum(0), mOverflowToastHidden(false), + mIsHovering(false), mControlHovering(false), + mShowToasts(false) { + mID = id; + setFollows(FOLLOWS_RIGHT | FOLLOWS_BOTTOM | FOLLOWS_TOP); mOverflowFormatString = LLTrans::getString("OverflowInfoChannelString"); @@ -89,22 +88,11 @@ void LLScreenChannel::reshape(S32 width, S32 height, BOOL called_from_parent) //-------------------------------------------------------------------------- void LLScreenChannel::addToast(LLToast::Params p) { - bool isSysWellWndShown = LLFloaterReg::getInstance("syswell_window")->getVisible(); - // we show toast in the following cases: - // - the StartUp Toast is already hidden and the SysWell's window is hidden - // - the SysWell's window is shown, but notification is a tip. We can't store it, so we show it - // - the channel has a CENTRE allignment, so it is intended for alerts. We always show alerts - bool show_toast = (mWasStartUpToastShown && !isSysWellWndShown) || (isSysWellWndShown && p.is_tip) || mToastAlignment == NA_CENTRE; - bool store_toast = !show_toast && !p.is_tip && mCanStoreToasts; - - // if we can't show or store a toast, then do nothing, just send ignore to a notification - if(!show_toast && !store_toast) + bool store_toast = !mShowToasts && p.can_be_stored && mCanStoreToasts; + + if(!mShowToasts && !store_toast) { - if(p.notification) - { - p.notification->setIgnored(TRUE); - p.notification->respond(p.notification->getResponseTemplate()); - } + mOnRejectToast(p); return; } @@ -112,14 +100,13 @@ void LLScreenChannel::addToast(LLToast::Params p) mOverflowToastHidden = false; - getRootView()->addChild(new_toast_elem.toast); new_toast_elem.toast->setOnFadeCallback(boost::bind(&LLScreenChannel::onToastFade, this, new_toast_elem.toast)); if(mControlHovering) { new_toast_elem.toast->setOnToastHoverCallback(boost::bind(&LLScreenChannel::onToastHover, this, _1, _2)); } - if(show_toast) + if(mShowToasts) { mToastList.push_back(new_toast_elem); showToasts(); @@ -136,8 +123,7 @@ void LLScreenChannel::onToastFade(LLToast* toast) { std::vector<ToastElem>::iterator it = find(mToastList.begin(), mToastList.end(), static_cast<LLPanel*>(toast)); - // *TODO: toast->isViewed() - seems unnecessary - bool destroy_toast = toast->isViewed() || !mCanStoreToasts || !toast->getCanBeStored(); + bool destroy_toast = !mCanStoreToasts || !toast->getCanBeStored(); if(destroy_toast) { mToastList.erase(it); @@ -369,7 +355,8 @@ void LLScreenChannel::showToastsTop() void LLScreenChannel::createOverflowToast(S32 bottom, F32 timer) { LLRect toast_rect; - LLToast::Params p; // *TODO: fill structure + LLToast::Params p; + p.timer_period = timer; mOverflowToastPanel = new LLToast(p); if(!mOverflowToastPanel) @@ -393,8 +380,6 @@ void LLScreenChannel::createOverflowToast(S32 bottom, F32 timer) 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()); mOverflowToastPanel->setRect(toast_rect); - mOverflowToastPanel->setAndStartTimer(timer); - getRootView()->addChild(mOverflowToastPanel); text_box->setValue(text); text_box->setVisible(TRUE); @@ -407,7 +392,6 @@ void LLScreenChannel::createOverflowToast(S32 bottom, F32 timer) void LLScreenChannel::onOverflowToastHide() { mOverflowToastHidden = true; - // *TODO: check whether it is needed: closeOverflowToastPanel(); } //-------------------------------------------------------------------------- @@ -415,7 +399,7 @@ void LLScreenChannel::closeOverflowToastPanel() { if(mOverflowToastPanel != NULL) { - mOverflowToastPanel->close(); + mOverflowToastPanel->closeFloater(); mOverflowToastPanel = NULL; } } @@ -424,7 +408,8 @@ void LLScreenChannel::closeOverflowToastPanel() void LLScreenChannel::createStartUpToast(S32 notif_num, S32 bottom, F32 timer) { LLRect toast_rect; - LLToast::Params p; // *TODO: fill structure + LLToast::Params p; + p.timer_period = timer; mStartUpToastPanel = new LLToast(p); if(!mStartUpToastPanel) @@ -453,8 +438,6 @@ void LLScreenChannel::createStartUpToast(S32 notif_num, S32 bottom, F32 timer) 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()); mStartUpToastPanel->setRect(toast_rect); - mStartUpToastPanel->setAndStartTimer(timer); - getRootView()->addChild(mStartUpToastPanel); text_box->setValue(text); text_box->setVisible(TRUE); @@ -480,8 +463,7 @@ void LLScreenChannel::closeStartUpToast() { if(mStartUpToastPanel != NULL) { - LLScreenChannel::setStartUpToastShown(); - mStartUpToastPanel->close(); + mStartUpToastPanel->closeFloater(); mStartUpToastPanel = NULL; } } @@ -500,8 +482,8 @@ void LLScreenChannel::removeToastsFromChannel() hideToastsFromScreen(); for(std::vector<ToastElem>::iterator it = mToastList.begin(); it != mToastList.end(); it++) { - (*it).toast->close(); - //toast->mOnToastDestroy(toast, LLSD()); //TODO: check OnToastDestroy handler for chat + // *TODO: ivestigate mOnToastDestroy callback - change name or/and place + (*it).toast->mOnToastDestroy((*it).toast); } mToastList.clear(); } @@ -515,9 +497,12 @@ void LLScreenChannel::removeAndStoreAllVisibleToasts() hideToastsFromScreen(); for(std::vector<ToastElem>::iterator it = mToastList.begin(); it != mToastList.end(); it++) { - mStoredToastList.push_back(*it); - mOnStoreToast((*it).toast->getPanel(), (*it).id); - (*it).toast->stopTimer(); + if((*it).toast->getCanBeStored()) + { + mStoredToastList.push_back(*it); + mOnStoreToast((*it).toast->getPanel(), (*it).id); + (*it).toast->stopTimer(); + } (*it).toast->setVisible(FALSE); } |