From b31631934a7caa0fe331cd25e745e8b9c9485798 Mon Sep 17 00:00:00 2001 From: pavelk_productengine Date: Tue, 3 Feb 2015 19:44:25 +0200 Subject: MAINT-4734 (Separate transaction notices from group notice/invites) - added code to sort notifications between tabs: Invites, Transactions, System messages - made cosmetic changes according to comment from 27/Jan/15 in Jira - added code to show correct number of notifications on each tab - added code to close all notifications on current tab via "Delete all" button --- indra/newview/llnotificationlistitem.cpp | 196 +++++++++++++++++++++++++++++++ 1 file changed, 196 insertions(+) create mode 100644 indra/newview/llnotificationlistitem.cpp (limited to 'indra/newview/llnotificationlistitem.cpp') diff --git a/indra/newview/llnotificationlistitem.cpp b/indra/newview/llnotificationlistitem.cpp new file mode 100644 index 0000000000..a55c7b8541 --- /dev/null +++ b/indra/newview/llnotificationlistitem.cpp @@ -0,0 +1,196 @@ +/** + * @file llnotificationlistitem.cpp + * @brief // TODO + * + * $LicenseInfo:firstyear=2000&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2015, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + + +#include "llviewerprecompiledheaders.h" // must be first include + +#include "llnotificationlistitem.h" + +#include "llwindow.h" +#include "v4color.h" +#include "lltrans.h" +#include "lluicolortable.h" + +LLNotificationListItem::LLNotificationListItem(const Params& p) : LLPanel(p), + mTitleBox(NULL), + mCloseBtn(NULL), + mSenderBox(NULL) +{ + buildFromFile( "panel_notification_tabbed_item.xml"); + + mTitleBox = getChild("GroupName_NoticeTitle"); + mTimeBox = getChild("Time_Box"); + mCloseBtn = getChild("close_btn"); + mSenderBox = getChild("Sender_Resident"); + + mTitleBox->setValue(p.title); + mTimeBox->setValue(buildNotificationDate(p.time_stamp)); + mSenderBox->setVisible(FALSE); + + mCloseBtn->setClickedCallback(boost::bind(&LLNotificationListItem::onClickCloseBtn,this)); + + mID = p.notification_id; + mNotificationName = p.notification_name; +} + +LLNotificationListItem::~LLNotificationListItem() +{ +} + +//static +std::string LLNotificationListItem::buildNotificationDate(const LLDate& time_stamp) +{ + std::string timeStr = "[" + LLTrans::getString("LTimeMthNum") + "]/[" + +LLTrans::getString("LTimeDay")+"]/[" + +LLTrans::getString("LTimeYear")+"] [" + +LLTrans::getString("LTimeHour")+"]:[" + +LLTrans::getString("LTimeMin")+"]"; + + LLSD substitution; + substitution["datetime"] = time_stamp; + LLStringUtil::format(timeStr, substitution); + return timeStr; +} + +//--------------------------------------------------------------------------------- +//void LLNotificationTabbedItem::setTitle( std::string title ) +//{ +// mTitleBox->setValue(title); +//} + +void LLNotificationListItem::onClickCloseBtn() +{ + mOnItemClose(this); +} + +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); + + return res; +} + +void LLNotificationListItem::onMouseEnter(S32 x, S32 y, MASK mask) +{ + //setTransparentColor(LLUIColorTable::instance().getColor( "SysWellItemSelected" )); +} + +void LLNotificationListItem::onMouseLeave(S32 x, S32 y, MASK mask) +{ + //setTransparentColor(LLUIColorTable::instance().getColor( "SysWellItemUnselected" )); +} + +//static +LLNotificationListItem* LLNotificationListItem::create(const Params& p) +{ + if (LLNotificationListItem::getInviteTypes().count(p.notification_name)) + { + return new LLInviteNotificationListItem(p); + } + else if (LLNotificationListItem::getTransactionTypes().count(p.notification_name)) + { + return new LLTransactionNotificationListItem(p); + } + return new LLSystemNotificationListItem(p); +} + +//static +std::set LLNotificationListItem::getInviteTypes() +{ + return LLInviteNotificationListItem::getTypes(); +} + +//static +std::set LLNotificationListItem::getTransactionTypes() +{ + return LLTransactionNotificationListItem::getTypes(); +} + +std::set LLInviteNotificationListItem::getTypes() +{ + std::set types; + types.insert("JoinGroup"); + return types; +} + +std::set LLTransactionNotificationListItem::getTypes() +{ + std::set types; + types.insert("PaymentReceived"); + types.insert("PaymentSent"); + return types; +} + +std::set LLSystemNotificationListItem::getTypes() +{ + std::set types; + types.insert("AddPrimitiveFailure"); + types.insert("AddToNavMeshNoCopy"); + types.insert("AssetServerTimeoutObjReturn"); + types.insert("AvatarEjected"); + types.insert("AutoUnmuteByIM"); + types.insert("AutoUnmuteByInventory"); + types.insert("AutoUnmuteByMoney"); + types.insert("BuyInventoryFailedNoMoney"); + types.insert("DeactivatedGesturesTrigger"); + types.insert("DeedFailedNoPermToDeedForGroup"); + types.insert("WhyAreYouTryingToWearShrubbery"); + types.insert("YouDiedAndGotTPHome"); + types.insert("YouFrozeAvatar"); + + types.insert("OfferCallingCard"); + //ExpireExplanation + return types; +} + +LLInviteNotificationListItem::LLInviteNotificationListItem(const Params& p) + : LLNotificationListItem(p) +{ + mGroupIcon = getChild("group_icon_small"); + mGroupIcon->setValue(p.group_id); + mGroupID = p.group_id; + if (!p.sender.empty()) + { + LLStringUtil::format_map_t string_args; + string_args["[SENDER_RESIDENT]"] = llformat("%s", p.sender); + std::string sender_text = getString("sender_resident_text", string_args); + mSenderBox->setValue(sender_text); + mSenderBox->setVisible(TRUE); + } +} + +LLTransactionNotificationListItem::LLTransactionNotificationListItem(const Params& p) + : LLNotificationListItem(p) +{} + +LLSystemNotificationListItem::LLSystemNotificationListItem(const Params& p) + :LLNotificationListItem(p) +{} + -- cgit v1.2.3 From 5f96f3bba20fcacbe7115b7d27bc50cad56850d4 Mon Sep 17 00:00:00 2001 From: pavelkproductengine Date: Wed, 4 Feb 2015 15:48:22 +0200 Subject: MAINT-4734 (Separate transaction notices from group notice/invites) - fixed Mac build --- indra/newview/llnotificationlistitem.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llnotificationlistitem.cpp') diff --git a/indra/newview/llnotificationlistitem.cpp b/indra/newview/llnotificationlistitem.cpp index a55c7b8541..4fdd6b1a54 100644 --- a/indra/newview/llnotificationlistitem.cpp +++ b/indra/newview/llnotificationlistitem.cpp @@ -179,7 +179,7 @@ LLInviteNotificationListItem::LLInviteNotificationListItem(const Params& p) if (!p.sender.empty()) { LLStringUtil::format_map_t string_args; - string_args["[SENDER_RESIDENT]"] = llformat("%s", p.sender); + string_args["[SENDER_RESIDENT]"] = llformat("%s", p.sender.c_str()); std::string sender_text = getString("sender_resident_text", string_args); mSenderBox->setValue(sender_text); mSenderBox->setVisible(TRUE); -- cgit v1.2.3 From 9d8bbe16007ef9292a04856f55f71016cf1220bf Mon Sep 17 00:00:00 2001 From: pavelk_productengine Date: Tue, 10 Feb 2015 19:56:32 +0200 Subject: MAINT-4734 (Separate transaction notices from group notice/invites) - introduced different design for System, Incoming/Outcoming Transactions, Invites --- indra/newview/llnotificationlistitem.cpp | 120 +++++++++++++++++++++---------- 1 file changed, 81 insertions(+), 39 deletions(-) (limited to 'indra/newview/llnotificationlistitem.cpp') diff --git a/indra/newview/llnotificationlistitem.cpp b/indra/newview/llnotificationlistitem.cpp index 4fdd6b1a54..7f0e3460b1 100644 --- a/indra/newview/llnotificationlistitem.cpp +++ b/indra/newview/llnotificationlistitem.cpp @@ -35,25 +35,26 @@ #include "lluicolortable.h" LLNotificationListItem::LLNotificationListItem(const Params& p) : LLPanel(p), + mParams(p), mTitleBox(NULL), - mCloseBtn(NULL), - mSenderBox(NULL) + mCloseBtn(NULL) { - buildFromFile( "panel_notification_tabbed_item.xml"); + mID = p.notification_id; + mNotificationName = p.notification_name; +} - mTitleBox = getChild("GroupName_NoticeTitle"); - mTimeBox = getChild("Time_Box"); +BOOL LLNotificationListItem::postBuild() +{ + BOOL rv = LLPanel::postBuild(); + mTitleBox = getChild("notification_title"); + mTimeBox = getChild("notification_time"); mCloseBtn = getChild("close_btn"); - mSenderBox = getChild("Sender_Resident"); - mTitleBox->setValue(p.title); - mTimeBox->setValue(buildNotificationDate(p.time_stamp)); - mSenderBox->setVisible(FALSE); + mTitleBox->setValue(mParams.title); + mTimeBox->setValue(buildNotificationDate(mParams.time_stamp)); mCloseBtn->setClickedCallback(boost::bind(&LLNotificationListItem::onClickCloseBtn,this)); - - mID = p.notification_id; - mNotificationName = p.notification_name; + return rv; } LLNotificationListItem::~LLNotificationListItem() @@ -151,46 +152,87 @@ std::set LLTransactionNotificationListItem::getTypes() std::set LLSystemNotificationListItem::getTypes() { std::set types; - types.insert("AddPrimitiveFailure"); - types.insert("AddToNavMeshNoCopy"); - types.insert("AssetServerTimeoutObjReturn"); - types.insert("AvatarEjected"); - types.insert("AutoUnmuteByIM"); - types.insert("AutoUnmuteByInventory"); - types.insert("AutoUnmuteByMoney"); - types.insert("BuyInventoryFailedNoMoney"); - types.insert("DeactivatedGesturesTrigger"); - types.insert("DeedFailedNoPermToDeedForGroup"); - types.insert("WhyAreYouTryingToWearShrubbery"); - types.insert("YouDiedAndGotTPHome"); - types.insert("YouFrozeAvatar"); - - types.insert("OfferCallingCard"); - //ExpireExplanation + //types.insert("AddPrimitiveFailure"); + //types.insert("AddToNavMeshNoCopy"); + //types.insert("AssetServerTimeoutObjReturn"); + //types.insert("AvatarEjected"); + //types.insert("AutoUnmuteByIM"); + //types.insert("AutoUnmuteByInventory"); + //types.insert("AutoUnmuteByMoney"); + //types.insert("BuyInventoryFailedNoMoney"); + //types.insert("DeactivatedGesturesTrigger"); + //types.insert("DeedFailedNoPermToDeedForGroup"); + //types.insert("WhyAreYouTryingToWearShrubbery"); + //types.insert("YouDiedAndGotTPHome"); + //types.insert("YouFrozeAvatar"); + //types.insert("OfferCallingCard"); return types; } LLInviteNotificationListItem::LLInviteNotificationListItem(const Params& p) - : LLNotificationListItem(p) + : LLNotificationListItem(p), + mSenderBox(NULL) { - mGroupIcon = getChild("group_icon_small"); - mGroupIcon->setValue(p.group_id); - mGroupID = p.group_id; - if (!p.sender.empty()) + buildFromFile("panel_notification_list_item.xml"); +} + +BOOL LLInviteNotificationListItem::postBuild() +{ + BOOL rv = LLNotificationListItem::postBuild(); + mGroupIcon = getChild("group_icon"); + mGroupIcon->setValue(mParams.group_id); + mGroupIcon->setVisible(TRUE); + mGroupID = mParams.group_id; + mSenderBox = getChild("sender_resident"); + if (!mParams.sender.empty()) { LLStringUtil::format_map_t string_args; - string_args["[SENDER_RESIDENT]"] = llformat("%s", p.sender.c_str()); + string_args["[SENDER_RESIDENT]"] = llformat("%s", mParams.sender.c_str()); std::string sender_text = getString("sender_resident_text", string_args); mSenderBox->setValue(sender_text); mSenderBox->setVisible(TRUE); - } + } else { + mSenderBox->setVisible(FALSE); + } + return rv; } LLTransactionNotificationListItem::LLTransactionNotificationListItem(const Params& p) - : LLNotificationListItem(p) -{} + : LLNotificationListItem(p), + mTransactionIcon(NULL) +{ + 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; +} LLSystemNotificationListItem::LLSystemNotificationListItem(const Params& p) - :LLNotificationListItem(p) -{} + : LLNotificationListItem(p), + mSystemNotificationIcon(NULL) +{ + 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; +} -- cgit v1.2.3 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/llnotificationlistitem.cpp | 192 ++++++++++++++++++++++++++----- 1 file changed, 161 insertions(+), 31 deletions(-) (limited to 'indra/newview/llnotificationlistitem.cpp') 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; } - -- cgit v1.2.3 From b147d659dc0c94a972f1c82f16536b374ee10c19 Mon Sep 17 00:00:00 2001 From: pavelk_productengine Date: Tue, 17 Mar 2015 18:26:28 +0200 Subject: MAINT-4734 (Separate transaction notices from group notice/invites) 1) stripped off attachment field; 2) made logos (group's, sender's, etc) in expanded view the same size as in condensed view; 3) turned on notification showing upon click; 4) fixed cropped right border of Invite and Transactions notifications; 5) enabled "Collapse All" button; 6) stripped off unnecessary icons. --- indra/newview/llnotificationlistitem.cpp | 152 +++++++++++++------------------ 1 file changed, 61 insertions(+), 91 deletions(-) (limited to 'indra/newview/llnotificationlistitem.cpp') diff --git a/indra/newview/llnotificationlistitem.cpp b/indra/newview/llnotificationlistitem.cpp index f280dc0ed3..4c4dd07d7f 100644 --- a/indra/newview/llnotificationlistitem.cpp +++ b/indra/newview/llnotificationlistitem.cpp @@ -1,8 +1,8 @@ /** * @file llnotificationlistitem.cpp - * @brief // TODO + * @brief * - * $LicenseInfo:firstyear=2000&license=viewerlgpl$ + * $LicenseInfo:firstyear=2015&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2015, Linden Research, Inc. * @@ -109,37 +109,18 @@ std::string LLNotificationListItem::buildNotificationDate(const LLDate& time_sta return timeStr; } -//--------------------------------------------------------------------------------- -//void LLNotificationTabbedItem::setTitle( std::string title ) -//{ -// mTitleBox->setValue(title); -//} - void LLNotificationListItem::onClickCloseBtn() { mOnItemClose(this); } -BOOL LLNotificationListItem::handleMouseDown(S32 x, S32 y, MASK mask) +BOOL LLNotificationListItem::handleMouseUp(S32 x, S32 y, MASK mask) { - BOOL res = LLPanel::handleMouseDown(x, y, mask); - //if(!mCloseBtn->getRect().pointInRect(x, y)) - //if(!mCloseBtn->getLocalRect().pointInRect(x, y)) - //mOnItemClick(this); - + BOOL res = LLPanel::handleMouseUp(x, y, mask); + mOnItemClick(this); return res; } -void LLNotificationListItem::onMouseEnter(S32 x, S32 y, MASK mask) -{ - //setTransparentColor(LLUIColorTable::instance().getColor( "SysWellItemSelected" )); -} - -void LLNotificationListItem::onMouseLeave(S32 x, S32 y, MASK mask) -{ - //setTransparentColor(LLUIColorTable::instance().getColor( "SysWellItemUnselected" )); -} - //static LLNotificationListItem* LLNotificationListItem::create(const Params& p) { @@ -176,23 +157,18 @@ 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); + S32 width = this->getRect().getWidth(); if (value) { - setPanelSize(this, 331, mExpandedHeight, FALSE); + this->reshape(width, mExpandedHeight, FALSE); } - else + else { - setPanelSize(this, 331, mCondensedHeight, FALSE); + this->reshape(width, mCondensedHeight, FALSE); } } @@ -211,31 +187,11 @@ std::set LLTransactionNotificationListItem::getTypes() return types; } -std::set LLSystemNotificationListItem::getTypes() -{ - std::set types; - //types.insert("AddPrimitiveFailure"); - //types.insert("AddToNavMeshNoCopy"); - //types.insert("AssetServerTimeoutObjReturn"); - //types.insert("AvatarEjected"); - //types.insert("AutoUnmuteByIM"); - //types.insert("AutoUnmuteByInventory"); - //types.insert("AutoUnmuteByMoney"); - //types.insert("BuyInventoryFailedNoMoney"); - //types.insert("DeactivatedGesturesTrigger"); - //types.insert("DeedFailedNoPermToDeedForGroup"); - //types.insert("WhyAreYouTryingToWearShrubbery"); - //types.insert("YouDiedAndGotTPHome"); - //types.insert("YouFrozeAvatar"); - //types.insert("OfferCallingCard"); - return types; -} - LLInviteNotificationListItem::LLInviteNotificationListItem(const Params& p) - : LLNotificationListItem(p), - mSenderBox(NULL) + : LLNotificationListItem(p), + mSenderBox(NULL) { - buildFromFile("panel_notification_list_item.xml"); + buildFromFile("panel_notification_list_item.xml"); } BOOL LLInviteNotificationListItem::postBuild() @@ -256,19 +212,8 @@ BOOL LLInviteNotificationListItem::postBuild() mSenderBox = getChild("sender_resident"); mSenderBoxExp = getChild("sender_resident_exp"); - if (!mParams.sender.empty()) - { - LLStringUtil::format_map_t string_args; - string_args["[SENDER_RESIDENT]"] = llformat("%s", mParams.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); - } else { - mSenderBox->setVisible(FALSE); - mSenderBoxExp->setVisible(FALSE); - } + + setSender(mParams.sender); LLSD value(mParams.group_id); setGroupId(value); @@ -288,18 +233,7 @@ 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); - } + setGroupName(group_data->mName); return true; } @@ -311,7 +245,7 @@ void LLInviteNotificationListItem::setGroupId(const LLUUID& value) gm->removeObserver(this); } - mID = mGroupId; // set LLGroupMgrObserver::mID to make callbacks work + mID = mGroupId; // Check if cache already contains image_id for that group if (!updateFromCache()) @@ -321,9 +255,45 @@ void LLInviteNotificationListItem::setGroupId(const LLUUID& value) } } +void LLInviteNotificationListItem::setGroupName(std::string name) +{ + if (!name.empty()) + { + LLStringUtil::format_map_t string_args; + string_args["[GROUP_NAME]"] = llformat("%s", name.c_str()); + std::string group_box_str = getString("group_name_text", string_args); + mGroupNameBoxExp->setValue(group_box_str); + mGroupNameBoxExp->setVisible(TRUE); + } + else + { + mGroupNameBoxExp->setValue(LLStringUtil::null); + mGroupNameBoxExp->setVisible(FALSE); + } +} + +void LLInviteNotificationListItem::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); + } else { + mSenderBox->setValue(LLStringUtil::null); + mSenderBoxExp->setValue(LLStringUtil::null); + mSenderBox->setVisible(FALSE); + mSenderBoxExp->setVisible(FALSE); + } +} + LLTransactionNotificationListItem::LLTransactionNotificationListItem(const Params& p) : LLNotificationListItem(p), - mTransactionIcon(NULL) + mAvatarIcon(NULL) { buildFromFile("panel_notification_list_item.xml"); } @@ -331,20 +301,20 @@ LLTransactionNotificationListItem::LLTransactionNotificationListItem(const Param BOOL LLTransactionNotificationListItem::postBuild() { BOOL rv = LLNotificationListItem::postBuild(); + mAvatarIcon = getChild("avatar_icon"); + mAvatarIconExp = getChild("avatar_icon_exp"); if (mParams.notification_name == "PaymentReceived") { - mTransactionIcon = getChild("incoming_transaction_icon"); - mTransactionIconExp = getChild("incoming_transaction_icon_exp"); + mAvatarIcon->setValue(mParams.paid_from_id); + mAvatarIconExp->setValue(mParams.paid_from_id); } else if (mParams.notification_name == "PaymentSent") { - mTransactionIcon = getChild("outcoming_transaction_icon"); - mTransactionIconExp = getChild("outcoming_transaction_icon_exp"); + mAvatarIcon->setValue(mParams.paid_to_id); + mAvatarIconExp->setValue(mParams.paid_to_id); } - if(mTransactionIcon) - mTransactionIcon->setVisible(TRUE); - if(mTransactionIconExp) - mTransactionIconExp->setVisible(TRUE); + mAvatarIcon->setVisible(TRUE); + mAvatarIconExp->setVisible(TRUE); return rv; } -- cgit v1.2.3 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/llnotificationlistitem.cpp | 166 ++++++++++++++++++++++++------- 1 file changed, 132 insertions(+), 34 deletions(-) (limited to 'indra/newview/llnotificationlistitem.cpp') 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); } } -- cgit v1.2.3 From f479235aaa94555ee0ea7a663187ae9930d7d5f4 Mon Sep 17 00:00:00 2001 From: pavelkproductengine Date: Tue, 19 May 2015 13:20:46 +0300 Subject: MAINT-4734 (Separate transaction notices from group notice/invites) 1) disabled popup show (toast) when clicking on notification in expanded view; 2) made attachment in Group Notice notification clickable (copied logic from LLToastGroupNotifyPanel); 3) removed border around notification text in expanded view and made lighter background; 4) removed border around attachment field in expanded notification view. --- indra/newview/llnotificationlistitem.cpp | 55 ++++++++++++++++++++++++++++++-- 1 file changed, 53 insertions(+), 2 deletions(-) (limited to 'indra/newview/llnotificationlistitem.cpp') diff --git a/indra/newview/llnotificationlistitem.cpp b/indra/newview/llnotificationlistitem.cpp index 6b674fcc7d..8e7671897d 100644 --- a/indra/newview/llnotificationlistitem.cpp +++ b/indra/newview/llnotificationlistitem.cpp @@ -57,7 +57,7 @@ BOOL LLNotificationListItem::postBuild() BOOL rv = LLPanel::postBuild(); mTitleBox = getChild("notification_title"); mTitleBoxExp = getChild("notification_title_exp"); - mNoticeTextExp = getChild("notification_text_exp"); + mNoticeTextExp = getChild("notification_text_exp"); mTimeBox = getChild("notification_time"); mTimeBoxExp = getChild("notification_time_exp"); @@ -115,6 +115,7 @@ std::string LLNotificationListItem::buildNotificationDate(const LLDate& time_sta void LLNotificationListItem::onClickCloseBtn() { mOnItemClose(this); + close(); } BOOL LLNotificationListItem::handleMouseUp(S32 x, S32 y, MASK mask) @@ -278,14 +279,17 @@ BOOL LLGroupNoticeNotificationListItem::postBuild() if (mInventoryOffer != NULL) { mAttachmentTextBox->setValue(mInventoryOffer->mDesc); + mAttachmentTextBox->setVisible(TRUE); mAttachmentIcon->setVisible(TRUE); std::string icon_name = LLInventoryIcon::getIconName(mInventoryOffer->mType, LLInventoryType::IT_TEXTURE); - mAttachmentIconExp->setValue(icon_name); mAttachmentIconExp->setVisible(TRUE); + mAttachmentTextBox->setClickedCallback(boost::bind( + &LLGroupNoticeNotificationListItem::onClickAttachment, this)); + std::string expanded_height_resize_str = getString("expanded_height_resize_for_attachment"); mExpandedHeightResize = (S32)atoi(expanded_height_resize_str.c_str()); @@ -388,6 +392,53 @@ void LLGroupNoticeNotificationListItem::setSender(std::string sender) mSenderOrFeeBoxExp->setVisible(FALSE); } } +void LLGroupNoticeNotificationListItem::close() +{ + // The group notice dialog may be an inventory offer. + // If it has an inventory save button and that button is still enabled + // Then we need to send the inventory declined message + if (mInventoryOffer != NULL) + { + mInventoryOffer->forceResponse(IOR_DECLINE); + mInventoryOffer = NULL; + } +} + +void LLGroupNoticeNotificationListItem::onClickAttachment() +{ + if (mInventoryOffer != NULL) { + mInventoryOffer->forceResponse(IOR_ACCEPT); + + static const LLUIColor textColor = LLUIColorTable::instance().getColor( + "GroupNotifyDimmedTextColor"); + mAttachmentTextBox->setColor(textColor); + mAttachmentIconExp->setEnabled(FALSE); + + //if attachment isn't openable - notify about saving + if (!isAttachmentOpenable(mInventoryOffer->mType)) { + LLNotifications::instance().add("AttachmentSaved", LLSD(), LLSD()); + } + + mInventoryOffer = NULL; + } +} + +//static +bool LLGroupNoticeNotificationListItem::isAttachmentOpenable(LLAssetType::EType type) +{ + switch (type) + { + case LLAssetType::AT_LANDMARK: + case LLAssetType::AT_NOTECARD: + case LLAssetType::AT_IMAGE_JPEG: + case LLAssetType::AT_IMAGE_TGA: + case LLAssetType::AT_TEXTURE: + case LLAssetType::AT_TEXTURE_TGA: + return true; + default: + return false; + } +} LLTransactionNotificationListItem::LLTransactionNotificationListItem(const Params& p) : LLNotificationListItem(p), -- cgit v1.2.3 From 33c5a3974c210af259d3572193bcdcd65137d888 Mon Sep 17 00:00:00 2001 From: Mnikolenko ProductEngine Date: Mon, 13 Jul 2015 17:52:42 +0300 Subject: MAINT-5369 FIXED Unable to accept group invite using Notification floater --- indra/newview/llnotificationlistitem.cpp | 64 +++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) (limited to 'indra/newview/llnotificationlistitem.cpp') diff --git a/indra/newview/llnotificationlistitem.cpp b/indra/newview/llnotificationlistitem.cpp index 8e7671897d..23a2399ed3 100644 --- a/indra/newview/llnotificationlistitem.cpp +++ b/indra/newview/llnotificationlistitem.cpp @@ -30,13 +30,14 @@ #include "llnotificationlistitem.h" #include "llagent.h" +#include "llgroupactions.h" #include "llinventoryicon.h" #include "llwindow.h" #include "v4color.h" #include "lltrans.h" #include "lluicolortable.h" #include "message.h" - +#include "llnotificationsutil.h" LLNotificationListItem::LLNotificationListItem(const Params& p) : LLPanel(p), mParams(p), mTitleBox(NULL), @@ -224,9 +225,70 @@ BOOL LLGroupInviteNotificationListItem::postBuild() { BOOL rv = LLGroupNotificationListItem::postBuild(); setFee(mParams.fee); + mInviteButtonPanel = getChild("button_panel"); + mInviteButtonPanel->setVisible(TRUE); + mJoinBtn = getChild("join_btn"); + mDeclineBtn = getChild("decline_btn"); + mInfoBtn = getChild("info_btn"); + + mJoinBtn->setClickedCallback(boost::bind(&LLGroupInviteNotificationListItem::onClickJoinBtn,this)); + mDeclineBtn->setClickedCallback(boost::bind(&LLGroupInviteNotificationListItem::onClickDeclineBtn,this)); + mInfoBtn->setClickedCallback(boost::bind(&LLGroupInviteNotificationListItem::onClickInfoBtn,this)); + + std::string expanded_height_resize_str = getString("expanded_height_resize_for_attachment"); + mExpandedHeightResize = (S32)atoi(expanded_height_resize_str.c_str()); + return rv; } +void LLGroupInviteNotificationListItem::onClickJoinBtn() +{ + if (!gAgent.canJoinGroups()) + { + LLNotificationsUtil::add("JoinedTooManyGroups"); + return; + } + + if(mParams.fee > 0) + { + LLSD args; + args["COST"] = llformat("%d", mParams.fee); + // Set the fee for next time to 0, so that we don't keep + // asking about a fee. + LLSD next_payload; + next_payload["group_id"]= mParams.group_id; + next_payload["transaction_id"]= mParams.transaction_id; + next_payload["fee"] = 0; + LLNotificationsUtil::add("JoinGroupCanAfford", args, next_payload); + } + else + { + send_improved_im(mParams.group_id, + std::string("name"), + std::string("message"), + IM_ONLINE, + IM_GROUP_INVITATION_ACCEPT, + mParams.transaction_id); + } + LLNotificationListItem::onClickCloseBtn(); +} + +void LLGroupInviteNotificationListItem::onClickDeclineBtn() +{ + send_improved_im(mParams.group_id, + std::string("name"), + std::string("message"), + IM_ONLINE, + IM_GROUP_INVITATION_DECLINE, + mParams.transaction_id); + LLNotificationListItem::onClickCloseBtn(); +} + +void LLGroupInviteNotificationListItem::onClickInfoBtn() +{ + LLGroupActions::show(mParams.group_id); +} + void LLGroupInviteNotificationListItem::setFee(S32 fee) { LLStringUtil::format_map_t string_args; -- cgit v1.2.3 From 8b498ab961f14cfb03834422c4b2b33a91f91f6e Mon Sep 17 00:00:00 2001 From: Mnikolenko ProductEngine Date: Thu, 16 Jul 2015 13:19:14 +0300 Subject: MAINT-5396 FIXED Group notice timestamps are no longer GMT --- indra/newview/llnotificationlistitem.cpp | 42 +++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 9 deletions(-) (limited to 'indra/newview/llnotificationlistitem.cpp') diff --git a/indra/newview/llnotificationlistitem.cpp b/indra/newview/llnotificationlistitem.cpp index 23a2399ed3..ddbc5f3916 100644 --- a/indra/newview/llnotificationlistitem.cpp +++ b/indra/newview/llnotificationlistitem.cpp @@ -99,14 +99,35 @@ LLNotificationListItem::~LLNotificationListItem() } //static -std::string LLNotificationListItem::buildNotificationDate(const LLDate& time_stamp) +std::string LLNotificationListItem::buildNotificationDate(const LLDate& time_stamp, ETimeType time_type) { - std::string timeStr = "[" + LLTrans::getString("LTimeMthNum") + "]/[" - +LLTrans::getString("LTimeDay")+"]/[" - +LLTrans::getString("LTimeYear")+"] [" - +LLTrans::getString("LTimeHour")+"]:[" - +LLTrans::getString("LTimeMin")+"]"; - + std::string timeStr; + switch(time_type) + { + case Local: + timeStr = "[" + LLTrans::getString("LTimeMthNum") + "]/[" + +LLTrans::getString("LTimeDay")+"]/[" + +LLTrans::getString("LTimeYear")+"] [" + +LLTrans::getString("LTimeHour")+"]:[" + +LLTrans::getString("LTimeMin")+ "]"; + break; + case UTC: + timeStr = "[" + LLTrans::getString("UTCTimeMth") + "]/[" + +LLTrans::getString("UTCTimeDay")+"]/[" + +LLTrans::getString("UTCTimeYr")+"] [" + +LLTrans::getString("UTCTimeHr")+"]:[" + +LLTrans::getString("UTCTimeMin")+"] [" + +LLTrans::getString("UTCTimeTimezone")+"]"; + break; + case SLT: + default: + timeStr = "[" + LLTrans::getString("TimeMonth") + "]/[" + +LLTrans::getString("TimeDay")+"]/[" + +LLTrans::getString("TimeYear")+"] [" + +LLTrans::getString("TimeHour")+"]:[" + +LLTrans::getString("TimeMin")+"]"; + break; + } LLSD substitution; substitution["datetime"] = time_stamp; LLStringUtil::format(timeStr, substitution); @@ -330,11 +351,14 @@ BOOL LLGroupNoticeNotificationListItem::postBuild() mTitleBox->setValue(mParams.subject); mTitleBoxExp->setValue(mParams.subject); mNoticeTextExp->setValue(mParams.message); + + mTimeBox->setValue(buildNotificationDate(mParams.time_stamp, UTC)); + mTimeBoxExp->setValue(buildNotificationDate(mParams.time_stamp, UTC)); //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)); + mTimeBox->setValue(buildNotificationDate(mParams.received_time, UTC)); + mTimeBoxExp->setValue(buildNotificationDate(mParams.received_time, UTC)); } setSender(mParams.sender); -- cgit v1.2.3 From da0f280ec3989789db4d502f4b34797c03dea9fa Mon Sep 17 00:00:00 2001 From: Mnikolenko ProductEngine Date: Mon, 20 Jul 2015 16:38:57 +0300 Subject: MAINT-5414 FIXED Viewer crashes after opening Group info panel --- indra/newview/llnotificationlistitem.cpp | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) (limited to 'indra/newview/llnotificationlistitem.cpp') diff --git a/indra/newview/llnotificationlistitem.cpp b/indra/newview/llnotificationlistitem.cpp index ddbc5f3916..67f3d0720f 100644 --- a/indra/newview/llnotificationlistitem.cpp +++ b/indra/newview/llnotificationlistitem.cpp @@ -337,6 +337,11 @@ LLGroupNoticeNotificationListItem::LLGroupNoticeNotificationListItem(const Param buildFromFile("panel_notification_list_item.xml"); } +LLGroupNoticeNotificationListItem::~LLGroupNoticeNotificationListItem() +{ + LLGroupMgr::getInstance()->removeObserver(this); +} + BOOL LLGroupNoticeNotificationListItem::postBuild() { BOOL rv = LLGroupNotificationListItem::postBuild(); @@ -413,7 +418,8 @@ void LLGroupNotificationListItem::changed(LLGroupChange gc) { if (GC_PROPERTIES == gc) { - updateFromCache(); + updateFromCache(); + LLGroupMgr::getInstance()->removeObserver(this); } } @@ -427,19 +433,20 @@ bool LLGroupNotificationListItem::updateFromCache() void LLGroupNotificationListItem::setGroupId(const LLUUID& value) { - LLGroupMgr* gm = LLGroupMgr::getInstance(); - if (mGroupId.notNull()) + LLGroupMgr* gm = LLGroupMgr::getInstance(); + if (mGroupId.notNull()) { gm->removeObserver(this); - } - mID = mGroupId; - // Check if cache already contains image_id for that group - if (!updateFromCache()) - { - gm->addObserver(this); - gm->sendGroupPropertiesRequest(mGroupId); + mID = mGroupId; + + // Check if cache already contains image_id for that group + if (!updateFromCache()) + { + gm->addObserver(this); + gm->sendGroupPropertiesRequest(mGroupId); + } } } @@ -488,6 +495,7 @@ void LLGroupNoticeNotificationListItem::close() mInventoryOffer->forceResponse(IOR_DECLINE); mInventoryOffer = NULL; } + LLGroupMgr::getInstance()->removeObserver(this); } void LLGroupNoticeNotificationListItem::onClickAttachment() -- cgit v1.2.3 From 0905e4cc55764500b1a980f65ad1c710c7bd0e59 Mon Sep 17 00:00:00 2001 From: Mnikolenko ProductEngine Date: Tue, 21 Jul 2015 14:53:10 +0300 Subject: MAINT-5425 FIXED No icon is shown for certain transaction notifications. --- indra/newview/llnotificationlistitem.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/newview/llnotificationlistitem.cpp') diff --git a/indra/newview/llnotificationlistitem.cpp b/indra/newview/llnotificationlistitem.cpp index 67f3d0720f..a22da59a5d 100644 --- a/indra/newview/llnotificationlistitem.cpp +++ b/indra/newview/llnotificationlistitem.cpp @@ -546,6 +546,9 @@ BOOL LLTransactionNotificationListItem::postBuild() BOOL rv = LLNotificationListItem::postBuild(); mAvatarIcon = getChild("avatar_icon"); mAvatarIconExp = getChild("avatar_icon_exp"); + mAvatarIcon->setValue("System_Notification"); + mAvatarIconExp->setValue("System_Notification"); + if (mParams.notification_name == "PaymentReceived") { mAvatarIcon->setValue(mParams.paid_from_id); -- cgit v1.2.3 From 5665c5320c50180e69e3616613b7796da919a721 Mon Sep 17 00:00:00 2001 From: pavelkproductengine Date: Fri, 31 Jul 2015 17:49:45 +0300 Subject: MAINT-5394 [Project Notice] The PERMISSION_DEBIT notification is not distinct enough on the Project Notice viewer. --- indra/newview/llnotificationlistitem.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'indra/newview/llnotificationlistitem.cpp') diff --git a/indra/newview/llnotificationlistitem.cpp b/indra/newview/llnotificationlistitem.cpp index a22da59a5d..2b10457e99 100644 --- a/indra/newview/llnotificationlistitem.cpp +++ b/indra/newview/llnotificationlistitem.cpp @@ -566,9 +566,19 @@ BOOL LLTransactionNotificationListItem::postBuild() LLSystemNotificationListItem::LLSystemNotificationListItem(const Params& p) : LLNotificationListItem(p), - mSystemNotificationIcon(NULL) + mSystemNotificationIcon(NULL), + mIsCaution(false) { buildFromFile("panel_notification_list_item.xml"); + mIsCaution = p.notification_priority >= NOTIFICATION_PRIORITY_HIGH; + if (mIsCaution) + { + mTitleBox->setColor(LLUIColorTable::instance().getColor("NotifyCautionBoxColor")); + mTitleBoxExp->setColor(LLUIColorTable::instance().getColor("NotifyCautionBoxColor")); + mNoticeTextExp->setReadOnlyColor(LLUIColorTable::instance().getColor("NotifyCautionBoxColor")); + mTimeBox->setColor(LLUIColorTable::instance().getColor("NotifyCautionBoxColor")); + mTimeBoxExp->setColor(LLUIColorTable::instance().getColor("NotifyCautionBoxColor")); + } } BOOL LLSystemNotificationListItem::postBuild() -- cgit v1.2.3 From 374a5b7dbe248eb62ab0fd919c13dd4fe41de3a2 Mon Sep 17 00:00:00 2001 From: Mnikolenko ProductEngine Date: Tue, 4 Aug 2015 16:46:50 +0300 Subject: MAINT-5427 FIXED Highlight notifications when hovering mouse. --- indra/newview/llnotificationlistitem.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'indra/newview/llnotificationlistitem.cpp') diff --git a/indra/newview/llnotificationlistitem.cpp b/indra/newview/llnotificationlistitem.cpp index 2b10457e99..6e2cc39a06 100644 --- a/indra/newview/llnotificationlistitem.cpp +++ b/indra/newview/llnotificationlistitem.cpp @@ -91,6 +91,7 @@ BOOL LLNotificationListItem::postBuild() mCondensedHeight = (S32)atoi(condensed_height_str.c_str()); setExpanded(FALSE); + return rv; } @@ -147,6 +148,18 @@ BOOL LLNotificationListItem::handleMouseUp(S32 x, S32 y, MASK mask) return res; } +void LLNotificationListItem::onMouseEnter(S32 x, S32 y, MASK mask) +{ + mCondensedViewPanel->setTransparentColor(LLUIColorTable::instance().getColor( "ScrollHoveredColor" )); + mExpandedViewPanel->setTransparentColor(LLUIColorTable::instance().getColor( "ScrollHoveredColor" )); +} + +void LLNotificationListItem::onMouseLeave(S32 x, S32 y, MASK mask) +{ + mCondensedViewPanel->setTransparentColor(LLUIColorTable::instance().getColor( "SysWellItemUnselected" )); + mExpandedViewPanel->setTransparentColor(LLUIColorTable::instance().getColor( "SysWellItemUnselected" )); +} + //static LLNotificationListItem* LLNotificationListItem::create(const Params& p) { -- cgit v1.2.3 From 1dd2a17f6876fdb2f8856a2f2fb2b69d2bb4b265 Mon Sep 17 00:00:00 2001 From: Mnikolenko ProductEngine Date: Fri, 18 Sep 2015 15:59:53 +0300 Subject: MAINT-5427 Expand notifications according to message length --- indra/newview/llnotificationlistitem.cpp | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) (limited to 'indra/newview/llnotificationlistitem.cpp') diff --git a/indra/newview/llnotificationlistitem.cpp b/indra/newview/llnotificationlistitem.cpp index 6e2cc39a06..62b3ee3093 100644 --- a/indra/newview/llnotificationlistitem.cpp +++ b/indra/newview/llnotificationlistitem.cpp @@ -38,6 +38,7 @@ #include "lluicolortable.h" #include "message.h" #include "llnotificationsutil.h" + LLNotificationListItem::LLNotificationListItem(const Params& p) : LLPanel(p), mParams(p), mTitleBox(NULL), @@ -48,7 +49,8 @@ LLNotificationListItem::LLNotificationListItem(const Params& p) : LLPanel(p), mExpandedViewPanel(NULL), mCondensedHeight(0), mExpandedHeight(0), - mExpandedHeightResize(0) + mExpandedHeightResize(0), + mExpanded(false) { mNotificationName = p.notification_name; } @@ -58,7 +60,7 @@ BOOL LLNotificationListItem::postBuild() BOOL rv = LLPanel::postBuild(); mTitleBox = getChild("notification_title"); mTitleBoxExp = getChild("notification_title_exp"); - mNoticeTextExp = getChild("notification_text_exp"); + mNoticeTextExp = getChild("notification_text_exp"); mTimeBox = getChild("notification_time"); mTimeBoxExp = getChild("notification_time_exp"); @@ -70,6 +72,8 @@ BOOL LLNotificationListItem::postBuild() mTitleBox->setValue(mParams.title); mTitleBoxExp->setValue(mParams.title); mNoticeTextExp->setValue(mParams.title); + mNoticeTextExp->setEnabled(FALSE); + mNoticeTextExp->setTextExpandedCallback(boost::bind(&LLNotificationListItem::reshapeNotification, this)); mTimeBox->setValue(buildNotificationDate(mParams.time_stamp)); mTimeBoxExp->setValue(buildNotificationDate(mParams.time_stamp)); @@ -206,19 +210,31 @@ void LLNotificationListItem::onClickCondenseBtn() setExpanded(FALSE); } +void LLNotificationListItem::reshapeNotification() +{ + if(mExpanded) + { + S32 width = this->getRect().getWidth(); + this->reshape(width, mNoticeTextExp->getRect().getHeight() + mExpandedHeight, FALSE); + } +} + void LLNotificationListItem::setExpanded(BOOL value) { mCondensedViewPanel->setVisible(!value); mExpandedViewPanel->setVisible(value); S32 width = this->getRect().getWidth(); + if (value) { - this->reshape(width, mExpandedHeight + mExpandedHeightResize, FALSE); + this->reshape(width, mNoticeTextExp->getRect().getHeight() + mExpandedHeight, FALSE); } else { this->reshape(width, mCondensedHeight, FALSE); } + mExpanded = value; + } std::set LLGroupInviteNotificationListItem::getTypes() -- cgit v1.2.3 From c84fe50f18d39adf1bb712927a71628d343781d0 Mon Sep 17 00:00:00 2001 From: Mnikolenko ProductEngine Date: Mon, 21 Sep 2015 14:32:36 +0300 Subject: MAINT-5425 FIXED No icon is shown for certain transaction notifications. --- indra/newview/llnotificationlistitem.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'indra/newview/llnotificationlistitem.cpp') diff --git a/indra/newview/llnotificationlistitem.cpp b/indra/newview/llnotificationlistitem.cpp index 62b3ee3093..8005fa6239 100644 --- a/indra/newview/llnotificationlistitem.cpp +++ b/indra/newview/llnotificationlistitem.cpp @@ -578,6 +578,14 @@ BOOL LLTransactionNotificationListItem::postBuild() mAvatarIcon->setValue("System_Notification"); mAvatarIconExp->setValue("System_Notification"); + mAvatarIcon->setVisible(TRUE); + mAvatarIconExp->setVisible(TRUE); + if((GOVERNOR_LINDEN_ID == mParams.paid_to_id) || + (GOVERNOR_LINDEN_ID == mParams.paid_from_id)) + { + return rv; + } + if (mParams.notification_name == "PaymentReceived") { mAvatarIcon->setValue(mParams.paid_from_id); @@ -588,8 +596,7 @@ BOOL LLTransactionNotificationListItem::postBuild() mAvatarIcon->setValue(mParams.paid_to_id); mAvatarIconExp->setValue(mParams.paid_to_id); } - mAvatarIcon->setVisible(TRUE); - mAvatarIconExp->setVisible(TRUE); + return rv; } -- cgit v1.2.3