From f54bf2a1eac3bc61222e5cceba77755bd340f996 Mon Sep 17 00:00:00 2001 From: Alexei Arabadji Date: Thu, 4 Mar 2010 11:35:34 +0200 Subject: =?UTF-8?q?fixed=20EXT-5904=20=E2=80=9COffers=20embedding=20into?= =?UTF-8?q?=20IM=20windows=E2=80=9D,=20made=20all=20type=20offers=20be=20e?= =?UTF-8?q?mbedded=20to=20the=20IM=20floater;=20made=20showing=20offer=20t?= =?UTF-8?q?oast=20if=20IM=20floater=20isn't=20visible;=20corrected=20IM=20?= =?UTF-8?q?message=20counter=20on=20showing=20offer=20toast;?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --HG-- branch : product-engine --- indra/newview/lltoastnotifypanel.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/newview/lltoastnotifypanel.cpp') diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index c47c017143..9108cc9889 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -60,7 +60,8 @@ mInfoPanel(NULL), mControlPanel(NULL), mNumOptions(0), mNumButtons(0), -mAddedDefaultBtn(false) +mAddedDefaultBtn(false), +mCloseNotificationOnDestroy(true) { LLUICtrlFactory::getInstance()->buildPanel(this, "panel_notification.xml"); mInfoPanel = getChild("info_panel"); @@ -257,7 +258,7 @@ LLButton* LLToastNotifyPanel::createButton(const LLSD& form_element, BOOL is_opt LLToastNotifyPanel::~LLToastNotifyPanel() { std::for_each(mBtnCallbackData.begin(), mBtnCallbackData.end(), DeletePointer()); - if (LLNotificationsUtil::find(mNotification->getID()) != NULL) + if (mCloseNotificationOnDestroy && LLNotificationsUtil::find(mNotification->getID()) != NULL) { LLNotifications::getInstance()->cancel(mNotification); } -- cgit v1.2.3 From ded6723781fa87954b4bba9bee98f9a50c6f9d82 Mon Sep 17 00:00:00 2001 From: Denis Serdjuk Date: Tue, 9 Mar 2010 13:42:39 +0200 Subject: fixed Normal Bug EXT-5999 llDialog in 2.0 viewer has different text limits than in 1.23 viewer Cause: Dialog floater had arranged own shape to the shape of toast panel. So there is no way to change such behaviour from xml without changing of other toasts Solution: New param has been added to constructor of toast panel to make possible setting an initial shape of panel before update buttons layout --HG-- branch : product-engine --- indra/newview/lltoastnotifypanel.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'indra/newview/lltoastnotifypanel.cpp') diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index c47c017143..e6d13a7613 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -53,7 +53,7 @@ S32 BUTTON_WIDTH = 90; const LLFontGL* LLToastNotifyPanel::sFont = NULL; const LLFontGL* LLToastNotifyPanel::sFontSmall = NULL; -LLToastNotifyPanel::LLToastNotifyPanel(LLNotificationPtr& notification) : +LLToastNotifyPanel::LLToastNotifyPanel(LLNotificationPtr& notification, const LLRect& rect) : LLToastPanel(notification), mTextBox(NULL), mInfoPanel(NULL), @@ -63,6 +63,10 @@ mNumButtons(0), mAddedDefaultBtn(false) { LLUICtrlFactory::getInstance()->buildPanel(this, "panel_notification.xml"); + if(rect != LLRect::null) + { + this->setShape(rect); + } mInfoPanel = getChild("info_panel"); mControlPanel = getChild("control_panel"); BUTTON_WIDTH = gSavedSettings.getS32("ToastButtonWidth"); @@ -159,7 +163,12 @@ mAddedDefaultBtn(false) * for a scriptdialog toast h_pad can be < 2*HPAD if we have a lot of buttons. * In last case set default h_pad to avoid heaping of buttons */ - h_pad = 2*HPAD; + S32 button_per_row = button_panel_width / BUTTON_WIDTH; + h_pad = (button_panel_width % BUTTON_WIDTH) / (button_per_row - 1);// -1 because we do not need space after last button in a row + if(h_pad < 2*HPAD) // still not enough space between buttons ? + { + h_pad = 2*HPAD; + } } if (mIsScriptDialog) { @@ -224,7 +233,7 @@ LLButton* LLToastNotifyPanel::createButton(const LLSD& form_element, BOOL is_opt p.click_callback.function(boost::bind(&LLToastNotifyPanel::onClickButton, userdata)); p.rect.width = BUTTON_WIDTH; p.auto_resize = false; - p.follows.flags(FOLLOWS_RIGHT | FOLLOWS_LEFT | FOLLOWS_BOTTOM); + p.follows.flags(FOLLOWS_LEFT | FOLLOWS_BOTTOM); if (mIsCaution) { p.image_color(LLUIColorTable::instance().getColor("ButtonCautionImageColor")); -- cgit v1.2.3 From fee3752311907c774b595246f1dbb93ef5b8cd53 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Mon, 15 Mar 2010 18:06:04 +0200 Subject: Implemented normal task EXT-5905 - Resolving offers. Added functionality to make Toasts accept multiple user inputs(clicks on option buttons). --HG-- branch : product-engine --- indra/newview/lltoastnotifypanel.cpp | 89 +++++++++++++++++++++++++++++++++++- 1 file changed, 87 insertions(+), 2 deletions(-) (limited to 'indra/newview/lltoastnotifypanel.cpp') diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 9108cc9889..7c5af4a8bb 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -44,6 +44,7 @@ #include "llrect.h" #include "lltrans.h" #include "llnotificationsutil.h" +#include "llviewermessage.h" const S32 BOTTOM_PAD = VPAD * 3; const S32 IGNORE_BTN_TOP_DELTA = 3*VPAD;//additional ignore_btn padding @@ -185,6 +186,8 @@ mCloseNotificationOnDestroy(true) // we need to keep min width and max height to make visible all buttons, because width of the toast can not be changed adjustPanelForScriptNotice(button_panel_width, button_panel_height); updateButtonsLayout(buttons, h_pad); + // save buttons for later use in disableButtons() + mButtons.assign(buttons.begin(), buttons.end()); } } // adjust panel's height to the text size @@ -334,6 +337,63 @@ void LLToastNotifyPanel::adjustPanelForTipNotice() } } +typedef std::set button_name_set_t; +typedef std::map disable_button_map_t; + +disable_button_map_t initUserGiveItemDisableButtonMap() +{ + // see EXT-5905 for disable rules + + disable_button_map_t disable_map; + button_name_set_t buttons; + + buttons.insert("Show"); + disable_map.insert(std::make_pair("Show", buttons)); + + buttons.insert("Discard"); + disable_map.insert(std::make_pair("Discard", buttons)); + + buttons.insert("Mute"); + disable_map.insert(std::make_pair("Mute", buttons)); + + return disable_map; +} + +button_name_set_t getButtonDisableList(const std::string& notification_name, const std::string& button_name) +{ + static disable_button_map_t user_give_item_disable_map = initUserGiveItemDisableButtonMap(); + + disable_button_map_t::const_iterator it; + disable_button_map_t::const_iterator it_end; + + if("UserGiveItem" == notification_name) + { + it = user_give_item_disable_map.find(button_name); + it_end = user_give_item_disable_map.end(); + } + + if(it_end != it) + { + return it->second; + } + return button_name_set_t(); +} + +void LLToastNotifyPanel::disableButtons(const std::string& notification_name, const std::string& selected_button) +{ + button_name_set_t buttons = getButtonDisableList(notification_name, selected_button); + + std::vector::const_iterator it = mButtons.begin(); + for ( ; it != mButtons.end(); it++) + { + LLButton* btn = it->second; + if(buttons.find(btn->getName()) != buttons.end()) + { + btn->setEnabled(FALSE); + } + } +} + // static void LLToastNotifyPanel::onClickButton(void* data) { @@ -346,8 +406,33 @@ void LLToastNotifyPanel::onClickButton(void* data) { response[button_name] = true; } + + bool is_reusable = self->mNotification->getPayload()["reusable"].asBoolean(); + // 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); + } + self->mNotification->respond(response); - // disable all buttons - self->mControlPanel->setEnabled(FALSE); + if(is_reusable) + { + self->disableButtons(self->mNotification->getName(), button_name); + + if(new_info) + { + self->mNotification->setResponseFunctor( + boost::bind(&LLOfferInfo::inventory_offer_callback, new_info, _1, _2)); + } + } + else + { + // disable all buttons + self->mControlPanel->setEnabled(FALSE); + } } -- cgit v1.2.3 From 97dea26dfca2ebd3d571f80c6e418d7c64779277 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Tue, 16 Mar 2010 15:30:01 +0200 Subject: Updated normal task EXT-5905 - Resolving offers. Implemented requested feature - "Resolving offer in the notification toast shouldn't remove offer panel form IM log until IM session is restarted" --HG-- branch : product-engine --- indra/newview/lltoastnotifypanel.cpp | 43 +++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) (limited to 'indra/newview/lltoastnotifypanel.cpp') diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 77d1d1fc0b..530110239e 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -54,7 +54,9 @@ S32 BUTTON_WIDTH = 90; const LLFontGL* LLToastNotifyPanel::sFont = NULL; const LLFontGL* LLToastNotifyPanel::sFontSmall = NULL; +LLToastNotifyPanel::button_click_signal_t LLToastNotifyPanel::sButtonClickSignal; LLToastNotifyPanel::LLToastNotifyPanel(LLNotificationPtr& notification, const LLRect& rect) : + LLToastPanel(notification), mTextBox(NULL), mInfoPanel(NULL), @@ -202,6 +204,18 @@ mCloseNotificationOnDestroy(true) // adjust panel's height to the text size mInfoPanel->setFollowsAll(); snapToMessageHeight(mTextBox, MAX_LENGTH); + + if(notification->getPayload()["reusable"].asBoolean()) + { + mButtonClickConnection = sButtonClickSignal.connect( + boost::bind(&LLToastNotifyPanel::onToastPanelButtonClicked, this, _1, _2)); + + if(notification->isRespondedTo()) + { + // User selected an option in toast, now disable required buttons in IM window + disableRespondedOptions(notification); + } + } } void LLToastNotifyPanel::addDefaultButton() { @@ -269,6 +283,8 @@ LLButton* LLToastNotifyPanel::createButton(const LLSD& form_element, BOOL is_opt LLToastNotifyPanel::~LLToastNotifyPanel() { + mButtonClickConnection.disconnect(); + std::for_each(mBtnCallbackData.begin(), mBtnCallbackData.end(), DeletePointer()); if (mCloseNotificationOnDestroy && LLNotificationsUtil::find(mNotification->getID()) != NULL) { @@ -431,7 +447,7 @@ void LLToastNotifyPanel::onClickButton(void* data) if(is_reusable) { - self->disableButtons(self->mNotification->getName(), button_name); + sButtonClickSignal(self->mNotification->getID(), button_name); if(new_info) { @@ -445,3 +461,28 @@ void LLToastNotifyPanel::onClickButton(void* data) self->mControlPanel->setEnabled(FALSE); } } + +void LLToastNotifyPanel::onToastPanelButtonClicked(const LLUUID& notification_id, const std::string btn_name) +{ + if(mNotification->getID() == notification_id) + { + disableButtons(mNotification->getName(), btn_name); + } +} + +void LLToastNotifyPanel::disableRespondedOptions(LLNotificationPtr& notification) +{ + LLSD response = notification->getResponse(); + for (LLSD::map_const_iterator response_it = response.beginMap(); + response_it != response.endMap(); ++response_it) + { + if (response_it->second.isBoolean() && response_it->second.asBoolean()) + { + // that after multiple responses there can be many pressed buttons + // need to process them all + disableButtons(notification->getName(), response_it->first); + } + } +} + +// EOF -- cgit v1.2.3 From 02f6a41723245620d364aed071107d5b8cc9a144 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Tue, 16 Mar 2010 15:41:34 +0200 Subject: merge --HG-- branch : product-engine --- indra/newview/lltoastnotifypanel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/lltoastnotifypanel.cpp') diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 530110239e..7805d23f02 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -55,8 +55,8 @@ const LLFontGL* LLToastNotifyPanel::sFont = NULL; const LLFontGL* LLToastNotifyPanel::sFontSmall = NULL; LLToastNotifyPanel::button_click_signal_t LLToastNotifyPanel::sButtonClickSignal; -LLToastNotifyPanel::LLToastNotifyPanel(LLNotificationPtr& notification, const LLRect& rect) : +LLToastNotifyPanel::LLToastNotifyPanel(LLNotificationPtr& notification, const LLRect& rect) : LLToastPanel(notification), mTextBox(NULL), mInfoPanel(NULL), -- cgit v1.2.3 From 30c586e77031f0c9141e8b8b96c344a6a9007876 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Tue, 16 Mar 2010 17:04:55 +0200 Subject: Updated normal task EXT-5905 - Resolving offers. Update for TeleportOffered and OfferFriendship offers. --HG-- branch : product-engine --- indra/newview/lltoastnotifypanel.cpp | 45 ++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) (limited to 'indra/newview/lltoastnotifypanel.cpp') diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 7805d23f02..2f77936cad 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -384,18 +384,59 @@ disable_button_map_t initUserGiveItemDisableButtonMap() return disable_map; } +disable_button_map_t initTeleportOfferedDisableButtonMap() +{ + disable_button_map_t disable_map; + button_name_set_t buttons; + + buttons.insert("Teleport"); + buttons.insert("Cancel"); + + disable_map.insert(std::make_pair("Teleport", buttons)); + disable_map.insert(std::make_pair("Cancel", buttons)); + + return disable_map; +} + +disable_button_map_t initFriendshipOfferedDisableButtonMap() +{ + disable_button_map_t disable_map; + button_name_set_t buttons; + + buttons.insert("Accept"); + buttons.insert("Decline"); + + disable_map.insert(std::make_pair("Accept", buttons)); + disable_map.insert(std::make_pair("Decline", buttons)); + + return disable_map; +} + button_name_set_t getButtonDisableList(const std::string& notification_name, const std::string& button_name) { static disable_button_map_t user_give_item_disable_map = initUserGiveItemDisableButtonMap(); + static disable_button_map_t teleport_offered_disable_map = initTeleportOfferedDisableButtonMap(); + static disable_button_map_t friendship_offered_disable_map = initFriendshipOfferedDisableButtonMap(); disable_button_map_t::const_iterator it; disable_button_map_t::const_iterator it_end; + disable_button_map_t search_map; if("UserGiveItem" == notification_name) { - it = user_give_item_disable_map.find(button_name); - it_end = user_give_item_disable_map.end(); + search_map = user_give_item_disable_map; } + else if("TeleportOffered" == notification_name) + { + search_map = teleport_offered_disable_map; + } + else if("FriendshipOffered" == notification_name) + { + search_map = friendship_offered_disable_map; + } + + it = search_map.find(button_name); + it_end = search_map.end(); if(it_end != it) { -- cgit v1.2.3 From b2cc39d462b33f5fdfed3e6a58dcf467f1b8da46 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Wed, 17 Mar 2010 13:26:34 +0200 Subject: (work in progress) low task EXT-6377 - Embedded offer panels aren't reshaped by height on IM window resize Added new Toast panel class for use in IM floater. New class handles IM floater reshape and updates Toast height. --HG-- branch : product-engine --- indra/newview/lltoastnotifypanel.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'indra/newview/lltoastnotifypanel.cpp') diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 2f77936cad..7d0fb4a46f 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -526,4 +526,28 @@ void LLToastNotifyPanel::disableRespondedOptions(LLNotificationPtr& notification } } + +////////////////////////////////////////////////////////////////////////// + +#include "llscrollcontainer.h" +LLIMToastNotifyPanel::LLIMToastNotifyPanel(LLNotificationPtr& pNotification, const LLRect& rect /* = LLRect::null */) + : LLToastNotifyPanel(pNotification, rect) +{ + mTextBox->setFollowsAll(); +} + +void LLIMToastNotifyPanel::reshape(S32 width, S32 height, BOOL called_from_parent /* = TRUE */) +{ + S32 text_height = mTextBox->getTextBoundingRect().getHeight(); + S32 widget_height = mTextBox->getRect().getHeight(); + S32 delta = text_height - widget_height; + LLRect rc = getRect(); + + rc.setLeftTopAndSize(rc.mLeft, rc.mTop, width, height + delta); + height = rc.getHeight(); + width = rc.getWidth(); + + LLToastPanel::reshape(width, height, called_from_parent); +} + // EOF -- cgit v1.2.3 From f4e8d1dfb23060438f0c68952225d60722295d31 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Wed, 17 Mar 2010 14:06:03 +0200 Subject: Updated normal task EXT-5905 - Resolving offers. Mistyped offer name. --HG-- branch : product-engine --- indra/newview/lltoastnotifypanel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/lltoastnotifypanel.cpp') diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 7d0fb4a46f..3b0708f705 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -430,7 +430,7 @@ button_name_set_t getButtonDisableList(const std::string& notification_name, con { search_map = teleport_offered_disable_map; } - else if("FriendshipOffered" == notification_name) + else if("OfferFriendship" == notification_name) { search_map = friendship_offered_disable_map; } -- cgit v1.2.3 From 3fa6c94511725c444cb146567b446fdcc3bf8709 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Wed, 17 Mar 2010 15:46:55 +0200 Subject: Removed unnesessary include --HG-- branch : product-engine --- indra/newview/lltoastnotifypanel.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/lltoastnotifypanel.cpp') diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index 3b0708f705..d7a3bc1462 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -529,7 +529,6 @@ void LLToastNotifyPanel::disableRespondedOptions(LLNotificationPtr& notification ////////////////////////////////////////////////////////////////////////// -#include "llscrollcontainer.h" LLIMToastNotifyPanel::LLIMToastNotifyPanel(LLNotificationPtr& pNotification, const LLRect& rect /* = LLRect::null */) : LLToastNotifyPanel(pNotification, rect) { -- cgit v1.2.3 From a2150863f97bf4fc49ecc17a2405177abe9d8f73 Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Fri, 19 Mar 2010 17:18:53 +0200 Subject: Updated normal task EXT-5905 - Resolving offers. Reusable notifications are deleted when user closes IM floater(old - when user closes Viewer). --HG-- branch : product-engine --- indra/newview/lltoastnotifypanel.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/newview/lltoastnotifypanel.cpp') diff --git a/indra/newview/lltoastnotifypanel.cpp b/indra/newview/lltoastnotifypanel.cpp index d7a3bc1462..907740a88e 100644 --- a/indra/newview/lltoastnotifypanel.cpp +++ b/indra/newview/lltoastnotifypanel.cpp @@ -205,7 +205,7 @@ mCloseNotificationOnDestroy(true) mInfoPanel->setFollowsAll(); snapToMessageHeight(mTextBox, MAX_LENGTH); - if(notification->getPayload()["reusable"].asBoolean()) + if(notification->isReusable()) { mButtonClickConnection = sButtonClickSignal.connect( boost::bind(&LLToastNotifyPanel::onToastPanelButtonClicked, this, _1, _2)); @@ -288,6 +288,8 @@ LLToastNotifyPanel::~LLToastNotifyPanel() std::for_each(mBtnCallbackData.begin(), mBtnCallbackData.end(), DeletePointer()); if (mCloseNotificationOnDestroy && LLNotificationsUtil::find(mNotification->getID()) != NULL) { + // let reusable notification be deleted + mNotification->setReusable(false); LLNotifications::getInstance()->cancel(mNotification); } } @@ -473,7 +475,7 @@ void LLToastNotifyPanel::onClickButton(void* data) response[button_name] = true; } - bool is_reusable = self->mNotification->getPayload()["reusable"].asBoolean(); + 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()); -- cgit v1.2.3