From 575b750d1c1d3de2c86ad80759a2ba51d671344a Mon Sep 17 00:00:00 2001 From: pavelk_productengine Date: Tue, 24 Feb 2015 17:27:00 +0200 Subject: MAINT-4734 (Separate transaction notices from group notice/invites) - introduced expanded notification view and general condense/expand behaviour for all types of notifications --- indra/newview/llgroupiconctrl.cpp | 2 +- indra/newview/llnotificationlistitem.cpp | 192 +++++++++++++++++---- indra/newview/llnotificationlistitem.h | 36 +++- indra/newview/skins/default/colors.xml | 7 +- .../textures/icons/Outcoming_Transaction_Large.png | Bin 0 -> 4662 bytes .../textures/icons/System_Notification_Large.png | Bin 0 -> 1804 bytes indra/newview/skins/default/textures/textures.xml | 3 + .../xui/en/panel_notification_list_item.xml | 113 ++++++++++-- 8 files changed, 296 insertions(+), 57 deletions(-) create mode 100644 indra/newview/skins/default/textures/icons/Outcoming_Transaction_Large.png create mode 100644 indra/newview/skins/default/textures/icons/System_Notification_Large.png diff --git a/indra/newview/llgroupiconctrl.cpp b/indra/newview/llgroupiconctrl.cpp index 6abf9ea637..26680e1ea5 100755 --- a/indra/newview/llgroupiconctrl.cpp +++ b/indra/newview/llgroupiconctrl.cpp @@ -52,7 +52,7 @@ LLGroupIconCtrl::LLGroupIconCtrl(const LLGroupIconCtrl::Params& p) { LLSD value(p.group_id); setValue(value); - } + } else { LLIconCtrl::setValue(mDefaultIconName); diff --git a/indra/newview/llnotificationlistitem.cpp b/indra/newview/llnotificationlistitem.cpp index 7f0e3460b1..f280dc0ed3 100644 --- a/indra/newview/llnotificationlistitem.cpp +++ b/indra/newview/llnotificationlistitem.cpp @@ -37,9 +37,13 @@ LLNotificationListItem::LLNotificationListItem(const Params& p) : LLPanel(p), mParams(p), mTitleBox(NULL), - mCloseBtn(NULL) + mExpandBtn(NULL), + mCondenseBtn(NULL), + mCloseBtn(NULL), + mCondensedViewPanel(NULL), + mExpandedViewPanel(NULL), + mMainPanel(NULL) { - mID = p.notification_id; mNotificationName = p.notification_name; } @@ -47,13 +51,42 @@ BOOL LLNotificationListItem::postBuild() { BOOL rv = LLPanel::postBuild(); mTitleBox = getChild("notification_title"); + mTitleBoxExp = getChild("notification_title_exp"); + mNoticeTextExp = getChild("notification_text_exp"); + mTimeBox = getChild("notification_time"); + mTimeBoxExp = getChild("notification_time_exp"); + mExpandBtn = getChild("expand_btn"); + 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); + mNoticeTextExp->setValue(mParams.title); + mTimeBox->setValue(buildNotificationDate(mParams.time_stamp)); + mTimeBoxExp->setValue(buildNotificationDate(mParams.time_stamp)); + mExpandBtn->setClickedCallback(boost::bind(&LLNotificationListItem::onClickExpandBtn,this)); + mCondenseBtn->setClickedCallback(boost::bind(&LLNotificationListItem::onClickCondenseBtn,this)); + + //mCloseBtn and mCloseExpandedBtn share the same callback mCloseBtn->setClickedCallback(boost::bind(&LLNotificationListItem::onClickCloseBtn,this)); + mCloseBtnExp->setClickedCallback(boost::bind(&LLNotificationListItem::onClickCloseBtn,this)); + + 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()); + + setExpanded(FALSE); return rv; } @@ -90,10 +123,9 @@ void LLNotificationListItem::onClickCloseBtn() BOOL LLNotificationListItem::handleMouseDown(S32 x, S32 y, MASK mask) { BOOL res = LLPanel::handleMouseDown(x, y, mask); - if(!mCloseBtn->getRect().pointInRect(x, y)) //if(!mCloseBtn->getRect().pointInRect(x, y)) //if(!mCloseBtn->getLocalRect().pointInRect(x, y)) - mOnItemClick(this); + //mOnItemClick(this); return res; } @@ -134,6 +166,36 @@ std::set LLNotificationListItem::getTransactionTypes() return LLTransactionNotificationListItem::getTypes(); } +void LLNotificationListItem::onClickExpandBtn() +{ + setExpanded(TRUE); +} + +void LLNotificationListItem::onClickCondenseBtn() +{ + setExpanded(FALSE); +} + +void setPanelSize(LLView* panel, S32 width, S32 height, BOOL called_from_parent) +{ + LLRect rect = panel->getRect(); + panel->reshape(width, height, called_from_parent); +} + +void LLNotificationListItem::setExpanded(BOOL value) +{ + mCondensedViewPanel->setVisible(!value); + mExpandedViewPanel->setVisible(value); + if (value) + { + setPanelSize(this, 331, mExpandedHeight, FALSE); + } + else + { + setPanelSize(this, 331, mCondensedHeight, FALSE); + } +} + std::set LLInviteNotificationListItem::getTypes() { std::set types; @@ -179,11 +241,21 @@ LLInviteNotificationListItem::LLInviteNotificationListItem(const Params& p) BOOL LLInviteNotificationListItem::postBuild() { BOOL rv = LLNotificationListItem::postBuild(); + mGroupIcon = getChild("group_icon"); + mGroupIconExp = getChild("group_icon_exp"); + mGroupNameBoxExp = getChild("group_name_exp"); + mGroupIcon->setValue(mParams.group_id); - mGroupIcon->setVisible(TRUE); - mGroupID = mParams.group_id; - mSenderBox = getChild("sender_resident"); + mGroupIconExp->setValue(mParams.group_id); + + mGroupIcon->setVisible(TRUE); + mGroupIconExp->setVisible(TRUE); + + mGroupId = mParams.group_id; + + mSenderBox = getChild("sender_resident"); + mSenderBoxExp = getChild("sender_resident_exp"); if (!mParams.sender.empty()) { LLStringUtil::format_map_t string_args; @@ -191,48 +263,106 @@ BOOL LLInviteNotificationListItem::postBuild() std::string sender_text = getString("sender_resident_text", string_args); mSenderBox->setValue(sender_text); mSenderBox->setVisible(TRUE); + mSenderBoxExp->setValue(sender_text); + mSenderBoxExp->setVisible(TRUE); } else { - mSenderBox->setVisible(FALSE); - } + mSenderBox->setVisible(FALSE); + mSenderBoxExp->setVisible(FALSE); + } + + LLSD value(mParams.group_id); + setGroupId(value); + return rv; } +void LLInviteNotificationListItem::changed(LLGroupChange gc) +{ + if (GC_PROPERTIES == gc) + { + updateFromCache(); + } +} + +bool LLInviteNotificationListItem::updateFromCache() +{ + LLGroupMgrGroupData* group_data = LLGroupMgr::getInstance()->getGroupData(mGroupId); + if (!group_data) return false; + if (!group_data->mName.empty()) + { + LLStringUtil::format_map_t string_args; + string_args["[GROUP_NAME]"] = llformat("%s", group_data->mName.c_str()); + std::string group_name = getString("group_name_text", string_args); + mGroupNameBoxExp->setValue(group_name); + mGroupNameBoxExp->setVisible(TRUE); + } + else + { + mGroupNameBoxExp->setValue(LLStringUtil::null); + } + return true; +} + +void LLInviteNotificationListItem::setGroupId(const LLUUID& value) +{ + LLGroupMgr* gm = LLGroupMgr::getInstance(); + if (mGroupId.notNull()) + { + gm->removeObserver(this); + } + + mID = mGroupId; // set LLGroupMgrObserver::mID to make callbacks work + + // Check if cache already contains image_id for that group + if (!updateFromCache()) + { + gm->addObserver(this); + gm->sendGroupPropertiesRequest(mGroupId); + } +} + LLTransactionNotificationListItem::LLTransactionNotificationListItem(const Params& p) : LLNotificationListItem(p), - mTransactionIcon(NULL) + mTransactionIcon(NULL) { - buildFromFile("panel_notification_list_item.xml"); + buildFromFile("panel_notification_list_item.xml"); } BOOL LLTransactionNotificationListItem::postBuild() { - BOOL rv = LLNotificationListItem::postBuild(); - if (mParams.notification_name == "PaymentReceived") - { - mTransactionIcon = getChild("incoming_transaction_icon"); - } - else if (mParams.notification_name == "PaymentSent") - { - mTransactionIcon = getChild("outcoming_transaction_icon"); - } - if(mTransactionIcon) - mTransactionIcon->setVisible(TRUE); - return rv; + BOOL rv = LLNotificationListItem::postBuild(); + if (mParams.notification_name == "PaymentReceived") + { + mTransactionIcon = getChild("incoming_transaction_icon"); + mTransactionIconExp = getChild("incoming_transaction_icon_exp"); + } + else if (mParams.notification_name == "PaymentSent") + { + mTransactionIcon = getChild("outcoming_transaction_icon"); + mTransactionIconExp = getChild("outcoming_transaction_icon_exp"); + } + if(mTransactionIcon) + mTransactionIcon->setVisible(TRUE); + if(mTransactionIconExp) + mTransactionIconExp->setVisible(TRUE); + return rv; } LLSystemNotificationListItem::LLSystemNotificationListItem(const Params& p) : LLNotificationListItem(p), - mSystemNotificationIcon(NULL) + mSystemNotificationIcon(NULL) { - buildFromFile("panel_notification_list_item.xml"); + buildFromFile("panel_notification_list_item.xml"); } BOOL LLSystemNotificationListItem::postBuild() { - BOOL rv = LLNotificationListItem::postBuild(); - mSystemNotificationIcon = getChild("system_notification_icon"); - if (mSystemNotificationIcon) - mSystemNotificationIcon->setVisible(TRUE); - return rv; + BOOL rv = LLNotificationListItem::postBuild(); + mSystemNotificationIcon = getChild("system_notification_icon"); + mSystemNotificationIconExp = getChild("system_notification_icon_exp"); + if (mSystemNotificationIcon) + mSystemNotificationIcon->setVisible(TRUE); + if (mSystemNotificationIconExp) + mSystemNotificationIconExp->setVisible(TRUE); + return rv; } - diff --git a/indra/newview/llnotificationlistitem.h b/indra/newview/llnotificationlistitem.h index da6d792fb8..f5cd9422b5 100644 --- a/indra/newview/llnotificationlistitem.h +++ b/indra/newview/llnotificationlistitem.h @@ -28,6 +28,7 @@ #define LL_LLNOTIFICATIONLISTITEM_H #include "llpanel.h" +#include "lllayoutstack.h" #include "lltextbox.h" #include "llbutton.h" #include "llgroupiconctrl.h" @@ -59,7 +60,7 @@ public: void setTitle( std::string title ); // get item's ID - LLUUID getID() { return mID; } + LLUUID getID() { return mParams.notification_id; } std::string& getTitle() { return mTitle; } std::string& getNotificationName() { return mNotificationName; } @@ -82,18 +83,34 @@ protected: virtual ~LLNotificationListItem(); static std::string buildNotificationDate(const LLDate&); + void setExpanded(BOOL value); + void onClickExpandBtn(); + void onClickCondenseBtn(); void onClickCloseBtn(); Params mParams; LLTextBox* mTitleBox; + LLTextBox* mTitleBoxExp; + LLTextBox* mNoticeTextExp; LLTextBox* mTimeBox; + LLTextBox* mTimeBoxExp; + LLButton* mExpandBtn; + LLButton* mCondenseBtn; LLButton* mCloseBtn; - LLUUID mID; + LLButton* mCloseBtnExp; + LLLayoutStack* mVerticalStack; + LLPanel* mCondensedViewPanel; + LLPanel* mExpandedViewPanel; + LLPanel* mMainPanel; + //LLUUID mID; std::string mTitle; std::string mNotificationName; + S32 mCondensedHeight; + S32 mExpandedHeight; }; -class LLInviteNotificationListItem : public LLNotificationListItem +class LLInviteNotificationListItem + : public LLNotificationListItem, public LLGroupMgrObserver { public: //void setGroupID(const LLUUID& group_id); @@ -102,15 +119,24 @@ 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 &); + bool updateFromCache(); + LLGroupIconCtrl* mGroupIcon; - LLUUID mGroupID; + LLGroupIconCtrl* mGroupIconExp; + LLUUID mGroupId; LLTextBox* mSenderBox; + LLTextBox* mSenderBoxExp; + LLTextBox* mGroupNameBoxExp; }; class LLTransactionNotificationListItem : public LLNotificationListItem @@ -124,6 +150,7 @@ private: LLTransactionNotificationListItem(const LLTransactionNotificationListItem &); LLTransactionNotificationListItem & operator=(LLTransactionNotificationListItem &); LLIconCtrl* mTransactionIcon; + LLIconCtrl* mTransactionIconExp; }; class LLSystemNotificationListItem : public LLNotificationListItem @@ -137,6 +164,7 @@ private: LLSystemNotificationListItem(const LLSystemNotificationListItem &); LLSystemNotificationListItem & operator=(LLSystemNotificationListItem &); LLIconCtrl* mSystemNotificationIcon; + LLIconCtrl* mSystemNotificationIconExp; }; #endif // LL_LLNOTIFICATIONLISTITEM_H diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml index bdc884885f..8533625e50 100755 --- a/indra/newview/skins/default/colors.xml +++ b/indra/newview/skins/default/colors.xml @@ -873,8 +873,11 @@ - - + + + diff --git a/indra/newview/skins/default/textures/icons/Outcoming_Transaction_Large.png b/indra/newview/skins/default/textures/icons/Outcoming_Transaction_Large.png new file mode 100644 index 0000000000..79011edd8b Binary files /dev/null and b/indra/newview/skins/default/textures/icons/Outcoming_Transaction_Large.png differ diff --git a/indra/newview/skins/default/textures/icons/System_Notification_Large.png b/indra/newview/skins/default/textures/icons/System_Notification_Large.png new file mode 100644 index 0000000000..434ce3e8b6 Binary files /dev/null and b/indra/newview/skins/default/textures/icons/System_Notification_Large.png differ diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 66fe119848..eef7d56e75 100755 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -802,7 +802,10 @@ with the same filename but different name + + + diff --git a/indra/newview/skins/default/xui/en/panel_notification_list_item.xml b/indra/newview/skins/default/xui/en/panel_notification_list_item.xml index 9bd9742a20..05b721000f 100644 --- a/indra/newview/skins/default/xui/en/panel_notification_list_item.xml +++ b/indra/newview/skins/default/xui/en/panel_notification_list_item.xml @@ -2,34 +2,49 @@ + bg_alpha_color="PanelNotificationListItem" > Sender: "[SENDER_RESIDENT]" + + Group: "[GROUP_NAME]" + + + 50 + + + 200 + - - - - + + + + + + + - - + + @@ -37,24 +52,84 @@ - - + Sender:Resident - + - - -