From 4c7142f4836da9da77ac6ff2910aaa19506a655b Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Fri, 18 May 2012 15:28:08 -0700 Subject: CHUI-96 FIX Cannot dismiss modal dialogs related to merchant outbox notification duplicate suppression now doesn't generate multiple dialogs --- indra/newview/llnotificationalerthandler.cpp | 62 ++++++++++++++-------------- indra/newview/llnotificationhandler.h | 2 +- indra/newview/llscreenchannel.cpp | 17 ++++---- 3 files changed, 40 insertions(+), 41 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llnotificationalerthandler.cpp b/indra/newview/llnotificationalerthandler.cpp index d13e2b629d..2bc9cdd3c1 100644 --- a/indra/newview/llnotificationalerthandler.cpp +++ b/indra/newview/llnotificationalerthandler.cpp @@ -82,39 +82,39 @@ bool LLAlertHandler::processNotification(const LLNotificationPtr& notification) } if (notification->canLogToIM() && notification->hasFormElements()) - { - const std::string name = LLHandlerUtil::getSubstitutionName(notification); - - LLUUID from_id = notification->getPayload()["from_id"]; - - // firstly create session... - LLHandlerUtil::spawnIMSession(name, from_id); - - // ...then log message to have IM Well notified about new message - LLHandlerUtil::logToIMP2P(notification); - } - - LLToastAlertPanel* alert_dialog = new LLToastAlertPanel(notification, mIsModal); - LLToast::Params p; - p.notif_id = notification->getID(); - p.notification = notification; - p.panel = dynamic_cast(alert_dialog); - p.enable_hide_btn = false; - p.can_fade = false; - p.is_modal = mIsModal; - p.on_delete_toast = boost::bind(&LLAlertHandler::onDeleteToast, this, _1); - - // Show alert in middle of progress view (during teleport) (EXT-1093) - LLProgressView* progress = gViewerWindow->getProgressView(); - LLRect rc = progress && progress->getVisible() ? progress->getRect() : gViewerWindow->getWorldViewRectScaled(); - mChannel.get()->updatePositionAndSize(rc); - - LLScreenChannel* channel = dynamic_cast(mChannel.get()); - if(channel) - channel->addToast(p); + { + const std::string name = LLHandlerUtil::getSubstitutionName(notification); + + LLUUID from_id = notification->getPayload()["from_id"]; + + // firstly create session... + LLHandlerUtil::spawnIMSession(name, from_id); + + // ...then log message to have IM Well notified about new message + LLHandlerUtil::logToIMP2P(notification); + } + + LLToastAlertPanel* alert_dialog = new LLToastAlertPanel(notification, mIsModal); + LLToast::Params p; + p.notif_id = notification->getID(); + p.notification = notification; + p.panel = dynamic_cast(alert_dialog); + p.enable_hide_btn = false; + p.can_fade = false; + p.is_modal = mIsModal; + p.on_delete_toast = boost::bind(&LLAlertHandler::onDeleteToast, this, _1); + + // Show alert in middle of progress view (during teleport) (EXT-1093) + LLProgressView* progress = gViewerWindow->getProgressView(); + LLRect rc = progress && progress->getVisible() ? progress->getRect() : gViewerWindow->getWorldViewRectScaled(); + mChannel.get()->updatePositionAndSize(rc); + + LLScreenChannel* channel = dynamic_cast(mChannel.get()); + if(channel) + channel->addToast(p); return false; - } +} void LLAlertHandler::onChange( LLNotificationPtr notification ) { diff --git a/indra/newview/llnotificationhandler.h b/indra/newview/llnotificationhandler.h index 4d54bb78fc..0899625242 100644 --- a/indra/newview/llnotificationhandler.h +++ b/indra/newview/llnotificationhandler.h @@ -258,7 +258,7 @@ public: : LLNotificationChannel("Outbox", "Visible", LLNotificationFilters::filterBy(&LLNotification::getType, "outbox")) {} /*virtual*/ void onAdd(LLNotificationPtr p) { processNotification(p); } - /*virtual*/ void onChange(LLNotificationPtr p) { processNotification(p); } + /*virtual*/ void onChange(LLNotificationPtr p) { } /*virtual*/ void onDelete(LLNotificationPtr p); bool processNotification(const LLNotificationPtr& p); }; diff --git a/indra/newview/llscreenchannel.cpp b/indra/newview/llscreenchannel.cpp index 839ca0f9c5..157821d554 100644 --- a/indra/newview/llscreenchannel.cpp +++ b/indra/newview/llscreenchannel.cpp @@ -499,21 +499,20 @@ void LLScreenChannel::killToastByNotificationID(LLUUID id) void LLScreenChannel::removeToastByNotificationID(LLUUID id) { - std::vector::iterator it = find(mToastList.begin(), mToastList.end(), id); - if( it != mToastList.end()) + std::vector::iterator it = mToastList.begin(); + while( it != mToastList.end()) { + // find next toast with matching id + it = find(it, mToastList.end(), id); deleteToast(it->getToast()); mToastList.erase(it); redrawToasts(); } - else + it = find(mStoredToastList.begin(), mStoredToastList.end(), id); + if (it != mStoredToastList.end()) { - it = find(mStoredToastList.begin(), mStoredToastList.end(), id); - if (it != mStoredToastList.end()) - { - deleteToast(it->getToast()); - mStoredToastList.erase(it); - } + deleteToast(it->getToast()); + mStoredToastList.erase(it); } } -- cgit v1.2.3 From 61bc25211be31ad28b8ae342c17b4ea1c32d955c Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Mon, 21 May 2012 17:16:11 -0700 Subject: CHUI-111 FIX Saved notifications are not sorted in same order after logout and relog. sort notifications in separate list llnotification now uses param block to serialize to llsd --- indra/newview/llnotificationstorage.cpp | 18 ++++++++++++++---- indra/newview/lltoastnotifypanel.cpp | 24 ------------------------ 2 files changed, 14 insertions(+), 28 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llnotificationstorage.cpp b/indra/newview/llnotificationstorage.cpp index fb1adc7ddf..a31b95811e 100644 --- a/indra/newview/llnotificationstorage.cpp +++ b/indra/newview/llnotificationstorage.cpp @@ -84,9 +84,11 @@ bool LLPersistentNotificationStorage::onPersistentChannelChanged(const LLSD& pay return false; } +static LLFastTimer::DeclareTimer FTM_SAVE_NOTIFICATIONS("Save Notifications"); + void LLPersistentNotificationStorage::saveNotifications() { - // TODO - think about save optimization. + LLFastTimer _(FTM_SAVE_NOTIFICATIONS); llofstream notify_file(mFileName.c_str()); if (!notify_file.is_open()) @@ -98,10 +100,15 @@ void LLPersistentNotificationStorage::saveNotifications() LLSD output; LLSD& data = output["data"]; - LLNotificationChannelPtr history_channel = LLNotifications::instance().getChannel("Persistent"); - LLNotificationSet::iterator it = history_channel->begin(); + boost::intrusive_ptr history_channel = boost::dynamic_pointer_cast(LLNotifications::instance().getChannel("Persistent")); + if (!history_channel) + { + return; + } - for ( ; history_channel->end() != it; ++it) + for ( std::vector::iterator it = history_channel->beginHistory(), end_it = history_channel->endHistory(); + it != end_it; + ++it) { LLNotificationPtr notification = *it; @@ -120,8 +127,11 @@ void LLPersistentNotificationStorage::saveNotifications() formatter->format(output, notify_file, LLSDFormatter::OPTIONS_PRETTY); } +static LLFastTimer::DeclareTimer FTM_LOAD_NOTIFICATIONS("Load Notifications"); + void LLPersistentNotificationStorage::loadNotifications() { + LLFastTimer _(FTM_LOAD_NOTIFICATIONS); LLResponderRegistry::registerResponders(); LLNotifications::instance().getChannel("Persistent")-> diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 77a5a5d17d..884df27a18 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -60,19 +60,6 @@ LLToastNotifyPanel::LLToastNotifyPanel(const LLNotificationPtr& notification, co LLInstanceTracker(notification->getID()) { init(rect, show_images); - - - //if(notification->isRespondedTo()) - //{ - // // User selected an option in toast, now disable required buttons in IM window - // disableRespondedOptions(notification); - //} - // - //if(notification->isReusable()) - //{ - // mButtonClickConnection = sButtonClickSignal.connect( - // boost::bind(&LLToastNotifyPanel::disableRespondedOptions, this, notification)); - //} } void LLToastNotifyPanel::addDefaultButton() { @@ -354,17 +341,6 @@ void LLToastNotifyPanel::onClickButton(void* data) { response[button_name] = true; } - - bool is_reusable = self->mNotification->isReusable(); - // When we call respond(), LLOfferInfo will delete itself in inventory_offer_callback(), - // lets copy it while it's still valid. - LLOfferInfo* old_info = static_cast(self->mNotification->getResponder()); - LLOfferInfo* new_info = NULL; - if(is_reusable && old_info) - { - new_info = new LLOfferInfo(*old_info); - self->mNotification->setResponder(new_info); - } // disable all buttons self->mControlPanel->setEnabled(FALSE); -- cgit v1.2.3