Work on EXT-3147 (Implement new states for message indicators)

-- added possibility to show "99+" when unread messages count exceeds 99

--HG--
branch : product-engine
meow-7.2.2
Mike Antipov 2009-12-08 11:14:00 +02:00
parent d6e22a7579
commit d4cfcfc7ce
3 changed files with 19 additions and 2 deletions

View File

@ -81,17 +81,18 @@ boost::signals2::signal<LLChiclet* (const LLUUID&),
LLSysWellChiclet::Params::Params()
: button("button")
, unread_notifications("unread_notifications")
, max_displayed_count("max_displayed_count", 9)
{
button.name("button");
button.tab_stop(FALSE);
button.label(LLStringUtil::null);
}
LLSysWellChiclet::LLSysWellChiclet(const Params& p)
: LLChiclet(p)
, mButton(NULL)
, mCounter(0)
, mMaxDisplayedCount(p.max_displayed_count)
{
LLButton::Params button_params = p.button;
mButton = LLUICtrlFactory::create<LLButton>(button_params);
@ -108,7 +109,12 @@ void LLSysWellChiclet::setCounter(S32 counter)
std::string s_count;
if(counter != 0)
{
s_count = llformat("%d", counter);
static std::string more_messages_exist("+");
std::string more_messages(counter > mMaxDisplayedCount ? more_messages_exist : "");
s_count = llformat("%d%s"
, llmin(counter, mMaxDisplayedCount)
, more_messages.c_str()
);
}
mButton->setLabel(s_count);

View File

@ -757,6 +757,14 @@ public:
Optional<LLChicletNotificationCounterCtrl::Params> unread_notifications;
/**
* Contains maximum displayed count of unread messages. Default value is 9.
*
* If count is less than "max_unread_count" will be displayed as is.
* Otherwise 9+ will be shown (for default value).
*/
Optional<S32> max_displayed_count;
Params();
};
@ -781,6 +789,7 @@ protected:
protected:
LLButton* mButton;
S32 mCounter;
S32 mMaxDisplayedCount;
};
/**

View File

@ -343,6 +343,7 @@ as for parent layout_panel (chiclet_list_panel) to resize bottom tray properly.
image_pressed_selected="PushButton_Selected_Press"
image_selected="PushButton_Selected_Press"
left="0"
max_displayed_count="99"
name="Unread IM messages"
pad_left="0"
pad_right="0"
@ -369,6 +370,7 @@ as for parent layout_panel (chiclet_list_panel) to resize bottom tray properly.
height="23"
layout="topleft"
left="0"
max_displayed_count="99"
name="notification_well"
top="4"
width="34">