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 +++++++++++++++++++--- indra/newview/llnotificationlistitem.h | 6 ++++-- .../xui/en/floater_notifications_tabbed.xml | 3 ++- .../xui/en/panel_notification_list_item.xml | 18 +++++++----------- 4 files changed, 32 insertions(+), 17 deletions(-) (limited to 'indra') 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() diff --git a/indra/newview/llnotificationlistitem.h b/indra/newview/llnotificationlistitem.h index 950b75c39a..9a4ce2be4b 100644 --- a/indra/newview/llnotificationlistitem.h +++ b/indra/newview/llnotificationlistitem.h @@ -34,7 +34,7 @@ #include "llbutton.h" #include "llgroupiconctrl.h" #include "llavatariconctrl.h" - +#include "llchatentry.h" #include "llgroupmgr.h" #include "llviewermessage.h" @@ -93,6 +93,7 @@ public: virtual bool showPopup() { return true; } void setExpanded(BOOL value); virtual BOOL postBuild(); + void reshapeNotification(); typedef enum e_time_type { @@ -114,7 +115,7 @@ protected: Params mParams; LLTextBox* mTitleBox; LLTextBox* mTitleBoxExp; - LLViewerTextEditor* mNoticeTextExp; + LLChatEntry* mNoticeTextExp; LLTextBox* mTimeBox; LLTextBox* mTimeBoxExp; LLButton* mExpandBtn; @@ -128,6 +129,7 @@ protected: S32 mCondensedHeight; S32 mExpandedHeight; S32 mExpandedHeightResize; + bool mExpanded; }; class LLGroupNotificationListItem 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 b18c6b1e82..afc609de52 100644 --- a/indra/newview/skins/default/xui/en/floater_notifications_tabbed.xml +++ b/indra/newview/skins/default/xui/en/floater_notifications_tabbed.xml @@ -8,8 +8,9 @@ save_rect="true" title="NOTIFICATIONS" width="350" - min_width="320" + min_width="435" height="550" + min_height="150" can_minimize="false" can_tear_off="false" can_resize="true" 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 73f90f73aa..0c173261a3 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 @@ -33,7 +33,7 @@ - 175 + 87 @@ -91,9 +91,7 @@ - - - + Notice Title Notice Title N o t i c e T i t l e N o t i c e T i t l e @@ -103,7 +101,7 @@ Group Name Group Name Group Na m e e - + Sender: "Resident R e s i d e n t R e s i d e n t" @@ -111,11 +109,11 @@ - - + Notice text goes here b l a b l a b l a b l a b l a b l a b l a b l a b l a b l a b l a b l a b l a b l a b l a b l a b l a b l a b l a b l a b l a b l a b l a b l a b l a b l a b l a b l a b l a b l a b l a bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla. bla bla bla bla bla bla bla bla bla bla bla bla bla . - + - +