From 60d28437e616a6afda51a368ea40ad49a707d16c Mon Sep 17 00:00:00 2001 From: pavelk_productengine Date: Wed, 8 Apr 2015 19:51:39 +0300 Subject: MAINT-4734 (Separate transaction notices from group notice/invites) 1) added GroupNotice notification type and tab "Group" for it; 2) added Attachment field to group notice notifications which may contain inventory offers, notecards, etc; 3) added Fee field to Group Invite notifications; 4) added notification resize depending on attachment field. --- indra/newview/llfloaternotificationstabbed.cpp | 24 ++- indra/newview/llfloaternotificationstabbed.h | 3 +- indra/newview/llnotificationlistitem.cpp | 166 ++++++++++++++++----- indra/newview/llnotificationlistitem.h | 82 +++++++--- indra/newview/lltoastgroupnotifypanel.cpp | 2 +- indra/newview/llviewermessage.cpp | 1 + indra/newview/skins/default/textures/textures.xml | 2 + .../xui/en/floater_notifications_tabbed.xml | 29 +++- .../xui/en/panel_notification_list_item.xml | 69 ++++++--- 9 files changed, 289 insertions(+), 89 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloaternotificationstabbed.cpp b/indra/newview/llfloaternotificationstabbed.cpp index 05a0af01ce..fd5f1486d9 100644 --- a/indra/newview/llfloaternotificationstabbed.cpp +++ b/indra/newview/llfloaternotificationstabbed.cpp @@ -41,7 +41,8 @@ LLFloaterNotificationsTabbed::LLFloaterNotificationsTabbed(const LLSD& key) : LLTransientDockableFloater(NULL, true, key), mChannel(NULL), mSysWellChiclet(NULL), - mInviteMessageList(NULL), + mGroupInviteMessageList(NULL), + mGroupNoticeMessageList(NULL), mTransactionMessageList(NULL), mSystemMessageList(NULL), mNotificationsSeparator(NULL), @@ -59,10 +60,12 @@ LLFloaterNotificationsTabbed::LLFloaterNotificationsTabbed(const LLSD& key) : LL //--------------------------------------------------------------------------------- BOOL LLFloaterNotificationsTabbed::postBuild() { - mInviteMessageList = getChild("invite_notification_list"); + mGroupInviteMessageList = getChild("group_invite_notification_list"); + mGroupNoticeMessageList = getChild("group_notice_notification_list"); mTransactionMessageList = getChild("transaction_notification_list"); mSystemMessageList = getChild("system_notification_list"); - mNotificationsSeparator->initTaggedList(LLNotificationListItem::getInviteTypes(), mInviteMessageList); + mNotificationsSeparator->initTaggedList(LLNotificationListItem::getGroupInviteTypes(), mGroupInviteMessageList); + mNotificationsSeparator->initTaggedList(LLNotificationListItem::getGroupNoticeTypes(), mGroupNoticeMessageList); mNotificationsSeparator->initTaggedList(LLNotificationListItem::getTransactionTypes(), mTransactionMessageList); mNotificationsSeparator->initUnTaggedList(mSystemMessageList); mNotificationsTabContainer = getChild("notifications_tab_container"); @@ -257,7 +260,8 @@ void LLFloaterNotificationsTabbed::updateNotificationCounters() { updateNotificationCounter(0, mSystemMessageList->size(), "system_tab_title"); updateNotificationCounter(1, mTransactionMessageList->size(), "transactions_tab_title"); - updateNotificationCounter(2, mInviteMessageList->size(), "invitations_tab_title"); + updateNotificationCounter(2, mGroupInviteMessageList->size(), "group_invitations_tab_title"); + updateNotificationCounter(3, mGroupNoticeMessageList->size(), "group_notices_tab_title"); } //--------------------------------------------------------------------------------- @@ -316,7 +320,10 @@ void LLFloaterNotificationsTabbed::getAllItemsOnCurrentTab(std::vector mTransactionMessageList->getItems(items); break; case 2: - mInviteMessageList->getItems(items); + mGroupInviteMessageList->getItems(items); + break; + case 3: + mGroupNoticeMessageList->getItems(items); break; default: break; @@ -379,10 +386,15 @@ void LLFloaterNotificationsTabbed::onStoreToast(LLPanel* info_panel, LLUUID id) LLSD payload = notify->getPayload(); p.notification_name = notify->getName(); p.group_id = payload["group_id"]; - p.sender = payload["name"].asString(); + p.fee = payload["fee"]; + p.subject = payload["subject"].asString(); + p.message = payload["message"].asString(); + p.sender = payload["sender_name"].asString(); p.time_stamp = notify->getDate(); + p.received_time = payload["received_time"].asDate(); p.paid_from_id = payload["from_id"]; p.paid_to_id = payload["dest_id"]; + p.inventory_offer = payload["inventory_offer"]; addItem(p); } diff --git a/indra/newview/llfloaternotificationstabbed.h b/indra/newview/llfloaternotificationstabbed.h index 5191b783f6..8dd20b18c4 100644 --- a/indra/newview/llfloaternotificationstabbed.h +++ b/indra/newview/llfloaternotificationstabbed.h @@ -158,7 +158,8 @@ private: // ID of a toast loaded by user (by clicking notification well item) LLUUID mLoadedToastId; - LLNotificationListView* mInviteMessageList; + LLNotificationListView* mGroupInviteMessageList; + LLNotificationListView* mGroupNoticeMessageList; LLNotificationListView* mTransactionMessageList; LLNotificationListView* mSystemMessageList; LLNotificationSeparator* mNotificationsSeparator; diff --git a/indra/newview/llnotificationlistitem.cpp b/indra/newview/llnotificationlistitem.cpp index 4c4dd07d7f..6b674fcc7d 100644 --- a/indra/newview/llnotificationlistitem.cpp +++ b/indra/newview/llnotificationlistitem.cpp @@ -29,10 +29,13 @@ #include "llnotificationlistitem.h" +#include "llagent.h" +#include "llinventoryicon.h" #include "llwindow.h" #include "v4color.h" #include "lltrans.h" #include "lluicolortable.h" +#include "message.h" LLNotificationListItem::LLNotificationListItem(const Params& p) : LLPanel(p), mParams(p), @@ -42,7 +45,9 @@ LLNotificationListItem::LLNotificationListItem(const Params& p) : LLPanel(p), mCloseBtn(NULL), mCondensedViewPanel(NULL), mExpandedViewPanel(NULL), - mMainPanel(NULL) + mCondensedHeight(0), + mExpandedHeight(0), + mExpandedHeightResize(0) { mNotificationName = p.notification_name; } @@ -60,7 +65,6 @@ BOOL LLNotificationListItem::postBuild() mCondenseBtn = getChild("condense_btn"); mCloseBtn = getChild("close_btn"); mCloseBtnExp = getChild("close_expanded_btn"); - mVerticalStack = getChild("item_vertical_stack"); mTitleBox->setValue(mParams.title); mTitleBoxExp->setValue(mParams.title); @@ -78,14 +82,13 @@ BOOL LLNotificationListItem::postBuild() mCondensedViewPanel = getChild("layout_panel_condensed_view"); mExpandedViewPanel = getChild("layout_panel_expanded_view"); - mMainPanel = getChild("main_panel"); - std::string expanded_heigt_str = getString("item_expanded_height"); - std::string condensed_heigt_str = getString("item_condensed_height"); - - mExpandedHeight = (S32)atoi(expanded_heigt_str.c_str()); - mCondensedHeight = (S32)atoi(condensed_heigt_str.c_str()); + std::string expanded_height_str = getString("item_expanded_height"); + std::string condensed_height_str = getString("item_condensed_height"); + mExpandedHeight = (S32)atoi(expanded_height_str.c_str()); + mCondensedHeight = (S32)atoi(condensed_height_str.c_str()); + setExpanded(FALSE); return rv; } @@ -124,9 +127,13 @@ BOOL LLNotificationListItem::handleMouseUp(S32 x, S32 y, MASK mask) //static LLNotificationListItem* LLNotificationListItem::create(const Params& p) { - if (LLNotificationListItem::getInviteTypes().count(p.notification_name)) + if (LLNotificationListItem::getGroupInviteTypes().count(p.notification_name)) + { + return new LLGroupInviteNotificationListItem(p); + } + else if (LLNotificationListItem::getGroupNoticeTypes().count(p.notification_name)) { - return new LLInviteNotificationListItem(p); + return new LLGroupNoticeNotificationListItem(p); } else if (LLNotificationListItem::getTransactionTypes().count(p.notification_name)) { @@ -136,9 +143,15 @@ LLNotificationListItem* LLNotificationListItem::create(const Params& p) } //static -std::set LLNotificationListItem::getInviteTypes() +std::set LLNotificationListItem::getGroupInviteTypes() +{ + return LLGroupInviteNotificationListItem::getTypes(); +} + + +std::set LLNotificationListItem::getGroupNoticeTypes() { - return LLInviteNotificationListItem::getTypes(); + return LLGroupNoticeNotificationListItem::getTypes(); } //static @@ -164,7 +177,7 @@ void LLNotificationListItem::setExpanded(BOOL value) S32 width = this->getRect().getWidth(); if (value) { - this->reshape(width, mExpandedHeight, FALSE); + this->reshape(width, mExpandedHeight + mExpandedHeightResize, FALSE); } else { @@ -172,13 +185,20 @@ void LLNotificationListItem::setExpanded(BOOL value) } } -std::set LLInviteNotificationListItem::getTypes() +std::set LLGroupInviteNotificationListItem::getTypes() { std::set types; types.insert("JoinGroup"); return types; } +std::set LLGroupNoticeNotificationListItem::getTypes() +{ + std::set types; + types.insert("GroupNotice"); + return types; +} + std::set LLTransactionNotificationListItem::getTypes() { std::set types; @@ -187,14 +207,94 @@ std::set LLTransactionNotificationListItem::getTypes() return types; } -LLInviteNotificationListItem::LLInviteNotificationListItem(const Params& p) +LLGroupNotificationListItem::LLGroupNotificationListItem(const Params& p) : LLNotificationListItem(p), - mSenderBox(NULL) + mSenderOrFeeBox(NULL) +{ +} + +LLGroupInviteNotificationListItem::LLGroupInviteNotificationListItem(const Params& p) + : LLGroupNotificationListItem(p) +{ + buildFromFile("panel_notification_list_item.xml"); +} + +BOOL LLGroupInviteNotificationListItem::postBuild() +{ + BOOL rv = LLGroupNotificationListItem::postBuild(); + setFee(mParams.fee); + return rv; +} + +void LLGroupInviteNotificationListItem::setFee(S32 fee) +{ + LLStringUtil::format_map_t string_args; + string_args["[GROUP_FEE]"] = llformat("%d", fee); + std::string fee_text = getString("group_fee_text", string_args); + mSenderOrFeeBox->setValue(fee_text); + mSenderOrFeeBoxExp->setValue(fee_text); + mSenderOrFeeBox->setVisible(TRUE); + mSenderOrFeeBoxExp->setVisible(TRUE); +} + +LLGroupNoticeNotificationListItem::LLGroupNoticeNotificationListItem(const Params& p) + : LLGroupNotificationListItem(p), + mAttachmentPanel(NULL), + mAttachmentTextBox(NULL), + mAttachmentIcon(NULL), + mAttachmentIconExp(NULL), + mInventoryOffer(NULL) { + if (mParams.inventory_offer.isDefined()) + { + mInventoryOffer = new LLOfferInfo(mParams.inventory_offer); + } + buildFromFile("panel_notification_list_item.xml"); } -BOOL LLInviteNotificationListItem::postBuild() +BOOL LLGroupNoticeNotificationListItem::postBuild() +{ + BOOL rv = LLGroupNotificationListItem::postBuild(); + + mAttachmentTextBox = getChild("attachment_text"); + mAttachmentIcon = getChild("attachment_icon"); + mAttachmentIconExp = getChild("attachment_icon_exp"); + mAttachmentPanel = getChild("attachment_panel"); + mAttachmentPanel->setVisible(FALSE); + + + mTitleBox->setValue(mParams.subject); + mTitleBoxExp->setValue(mParams.subject); + mNoticeTextExp->setValue(mParams.message); + //Workaround: in case server timestamp is 0 - we use the time when notification was actually received + if (mParams.time_stamp.isNull()) + { + mTimeBox->setValue(buildNotificationDate(mParams.received_time)); + mTimeBoxExp->setValue(buildNotificationDate(mParams.received_time)); + } + setSender(mParams.sender); + + if (mInventoryOffer != NULL) + { + mAttachmentTextBox->setValue(mInventoryOffer->mDesc); + mAttachmentIcon->setVisible(TRUE); + + std::string icon_name = LLInventoryIcon::getIconName(mInventoryOffer->mType, + LLInventoryType::IT_TEXTURE); + + mAttachmentIconExp->setValue(icon_name); + mAttachmentIconExp->setVisible(TRUE); + + std::string expanded_height_resize_str = getString("expanded_height_resize_for_attachment"); + mExpandedHeightResize = (S32)atoi(expanded_height_resize_str.c_str()); + + mAttachmentPanel->setVisible(TRUE); + } + return rv; +} + +BOOL LLGroupNotificationListItem::postBuild() { BOOL rv = LLNotificationListItem::postBuild(); @@ -210,10 +310,8 @@ BOOL LLInviteNotificationListItem::postBuild() mGroupId = mParams.group_id; - mSenderBox = getChild("sender_resident"); - mSenderBoxExp = getChild("sender_resident_exp"); - - setSender(mParams.sender); + mSenderOrFeeBox = getChild("sender_or_fee_box"); + mSenderOrFeeBoxExp = getChild("sender_or_fee_box_exp"); LLSD value(mParams.group_id); setGroupId(value); @@ -221,7 +319,7 @@ BOOL LLInviteNotificationListItem::postBuild() return rv; } -void LLInviteNotificationListItem::changed(LLGroupChange gc) +void LLGroupNotificationListItem::changed(LLGroupChange gc) { if (GC_PROPERTIES == gc) { @@ -229,7 +327,7 @@ void LLInviteNotificationListItem::changed(LLGroupChange gc) } } -bool LLInviteNotificationListItem::updateFromCache() +bool LLGroupNotificationListItem::updateFromCache() { LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->getGroupData(mGroupId); if (!group_data) return false; @@ -237,7 +335,7 @@ bool LLInviteNotificationListItem::updateFromCache() return true; } -void LLInviteNotificationListItem::setGroupId(const LLUUID& value) +void LLGroupNotificationListItem::setGroupId(const LLUUID& value) { LLGroupMgr* gm = LLGroupMgr::getInstance(); if (mGroupId.notNull()) @@ -255,7 +353,7 @@ void LLInviteNotificationListItem::setGroupId(const LLUUID& value) } } -void LLInviteNotificationListItem::setGroupName(std::string name) +void LLGroupNotificationListItem::setGroupName(std::string name) { if (!name.empty()) { @@ -272,22 +370,22 @@ void LLInviteNotificationListItem::setGroupName(std::string name) } } -void LLInviteNotificationListItem::setSender(std::string sender) +void LLGroupNoticeNotificationListItem::setSender(std::string sender) { if (!sender.empty()) { LLStringUtil::format_map_t string_args; string_args["[SENDER_RESIDENT]"] = llformat("%s", sender.c_str()); std::string sender_text = getString("sender_resident_text", string_args); - mSenderBox->setValue(sender_text); - mSenderBox->setVisible(TRUE); - mSenderBoxExp->setValue(sender_text); - mSenderBoxExp->setVisible(TRUE); + mSenderOrFeeBox->setValue(sender_text); + mSenderOrFeeBoxExp->setValue(sender_text); + mSenderOrFeeBox->setVisible(TRUE); + mSenderOrFeeBoxExp->setVisible(TRUE); } else { - mSenderBox->setValue(LLStringUtil::null); - mSenderBoxExp->setValue(LLStringUtil::null); - mSenderBox->setVisible(FALSE); - mSenderBoxExp->setVisible(FALSE); + mSenderOrFeeBox->setValue(LLStringUtil::null); + mSenderOrFeeBoxExp->setValue(LLStringUtil::null); + mSenderOrFeeBox->setVisible(FALSE); + mSenderOrFeeBoxExp->setVisible(FALSE); } } diff --git a/indra/newview/llnotificationlistitem.h b/indra/newview/llnotificationlistitem.h index 22003a3a6a..bd76d17fe8 100644 --- a/indra/newview/llnotificationlistitem.h +++ b/indra/newview/llnotificationlistitem.h @@ -35,6 +35,7 @@ #include "llavatariconctrl.h" #include "llgroupmgr.h" +#include "llviewermessage.h" #include @@ -49,15 +50,21 @@ public: LLUUID paid_to_id; std::string notification_name; std::string title; + std::string subject; + std::string message; std::string sender; - LLDate time_stamp; + S32 fee; + LLDate time_stamp; + LLDate received_time; + LLSD inventory_offer; Params() {}; }; static LLNotificationListItem* create(const Params& p); - static std::set getInviteTypes(); static std::set getTransactionTypes(); + static std::set getGroupInviteTypes(); + static std::set getGroupNoticeTypes(); // title void setTitle( std::string title ); @@ -99,43 +106,80 @@ protected: LLButton* mCondenseBtn; LLButton* mCloseBtn; LLButton* mCloseBtnExp; - LLLayoutStack* mVerticalStack; LLPanel* mCondensedViewPanel; LLPanel* mExpandedViewPanel; - LLPanel* mMainPanel; std::string mTitle; std::string mNotificationName; - S32 mCondensedHeight; - S32 mExpandedHeight; + S32 mCondensedHeight; + S32 mExpandedHeight; + S32 mExpandedHeightResize; }; -class LLInviteNotificationListItem +class LLGroupNotificationListItem : public LLNotificationListItem, public LLGroupMgrObserver { public: - static std::set getTypes(); virtual BOOL postBuild(); void setGroupId(const LLUUID& value); // LLGroupMgrObserver observer trigger virtual void changed(LLGroupChange gc); -private: - friend class LLNotificationListItem; - LLInviteNotificationListItem(const Params& p); - LLInviteNotificationListItem(const LLInviteNotificationListItem &); - LLInviteNotificationListItem & operator=(LLInviteNotificationListItem &); - void setSender(std::string sender); - void setGroupName(std::string name); - - bool updateFromCache(); + friend class LLNotificationListItem; +protected: + LLGroupNotificationListItem(const Params& p); LLGroupIconCtrl* mGroupIcon; LLGroupIconCtrl* mGroupIconExp; LLUUID mGroupId; - LLTextBox* mSenderBox; - LLTextBox* mSenderBoxExp; + LLTextBox* mSenderOrFeeBox; + LLTextBox* mSenderOrFeeBoxExp; LLTextBox* mGroupNameBoxExp; + +private: + LLGroupNotificationListItem(const LLGroupNotificationListItem &); + LLGroupNotificationListItem & operator=(LLGroupNotificationListItem &); + + void setGroupName(std::string name); + bool updateFromCache(); +}; + +class LLGroupInviteNotificationListItem + : public LLGroupNotificationListItem +{ +public: + static std::set getTypes(); + virtual BOOL postBuild(); + +private: + friend class LLNotificationListItem; + LLGroupInviteNotificationListItem(const Params& p); + LLGroupInviteNotificationListItem(const LLGroupInviteNotificationListItem &); + LLGroupInviteNotificationListItem & operator=(LLGroupInviteNotificationListItem &); + + void setFee(S32 fee); +}; + +class LLGroupNoticeNotificationListItem + : public LLGroupNotificationListItem +{ +public: + static std::set getTypes(); + virtual BOOL postBuild(); + +private: + friend class LLNotificationListItem; + LLGroupNoticeNotificationListItem(const Params& p); + LLGroupNoticeNotificationListItem(const LLGroupNoticeNotificationListItem &); + LLGroupNoticeNotificationListItem & operator=(LLGroupNoticeNotificationListItem &); + + void setSender(std::string sender); + + LLPanel* mAttachmentPanel; + LLTextBox* mAttachmentTextBox; + LLIconCtrl* mAttachmentIcon; + LLIconCtrl* mAttachmentIconExp; + LLOfferInfo* mInventoryOffer; }; class LLTransactionNotificationListItem : public LLNotificationListItem diff --git a/indra/newview/lltoastgroupnotifypanel.cpp b/indra/newview/lltoastgroupnotifypanel.cpp index e00b18dedb..def5a0ac7c 100755 --- a/indra/newview/lltoastgroupnotifypanel.cpp +++ b/indra/newview/lltoastgroupnotifypanel.cpp @@ -92,7 +92,7 @@ LLToastGroupNotifyPanel::LLToastGroupNotifyPanel(const LLNotificationPtr& notifi +LLTrans::getString("UTCTimeSec")+"] [" +LLTrans::getString("UTCTimeTimezone")+"]"; const LLDate timeStamp = notification->getDate(); - LLDate notice_date = timeStamp.notNull() ? timeStamp : LLDate::now(); + LLDate notice_date = timeStamp.notNull() ? timeStamp : payload["received_time"]; LLSD substitution; substitution["datetime"] = (S32) notice_date.secondsSinceEpoch(); LLStringUtil::format(timeStr, substitution); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 6507794cdd..99db3ff093 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2681,6 +2681,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) payload["sender_name"] = name; payload["group_id"] = group_id; payload["inventory_name"] = item_name; + payload["received_time"] = LLDate::now(); if(info && info->asLLSD()) { payload["inventory_offer"] = info->asLLSD(); diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index e47e0c03f1..4f8962182e 100755 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -798,4 +798,6 @@ with the same filename but different name + + diff --git a/indra/newview/skins/default/xui/en/floater_notifications_tabbed.xml b/indra/newview/skins/default/xui/en/floater_notifications_tabbed.xml index 55ecfb637b..0fdd9ed0c6 100644 --- a/indra/newview/skins/default/xui/en/floater_notifications_tabbed.xml +++ b/indra/newview/skins/default/xui/en/floater_notifications_tabbed.xml @@ -28,9 +28,13 @@ Transactions ([COUNT]) + name="group_invitations_tab_title"> Invitations ([COUNT]) + + Group ([COUNT]) + @@ -72,7 +76,7 @@ follows="left|top|right|bottom" label="Transactions (0)" layout="topleft" - name="TransactionNotificationsTab"> + name="transaction_notifications_tab"> + name="group_invite_notifications_tab"> + + + Group: "[GROUP_NAME]" + + Fee: [GROUP_FEE] + 50 - 200 + 175 + + + 27 - + @@ -49,10 +57,11 @@ use_ellipses="true" word_wrap="true" mouse_opaque="false" name="notification_title" > Group Name:Notice Title N o t i c e T i t l e N o t i c e T i t l e N o t i c e T i t l e N oticeTitle + + use_ellipses="true" word_wrap="false" mouse_opaque="false" name="sender_or_fee_box" visible="false"> Sender: "Resident R e s i d e n t R e s i d e n t" - - -