diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llchiclet.cpp | 61 | ||||
-rw-r--r-- | indra/newview/llchiclet.h | 28 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_bottomtray.xml | 2 |
3 files changed, 87 insertions, 4 deletions
diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index bd8effd93d..d7c9575a7b 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -78,10 +78,50 @@ boost::signals2::signal<LLChiclet* (const LLUUID&), ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// +/** + * Updates the Well's 'Lit' state to flash it when "new messages" are come. + * + * It gets callback which will be called 2*N times with passed period. See EXT-3147 + */ +class LLSysWellChiclet::FlashToLitTimer : public LLEventTimer +{ +public: + typedef boost::function<void()> callback_t; + LLSysWellChiclet::FlashToLitTimer(S32 count, F32 period, callback_t cb) + : LLEventTimer(period) + , mCallback(cb) + , mFlashCount(2 * count) + , mCurrentFlashCount(0) + { + mEventTimer.stop(); + } + + BOOL tick() + { + mCallback(); + + if (++mCurrentFlashCount == mFlashCount) mEventTimer.stop(); + return FALSE; + } + + void flash() + { + mCurrentFlashCount = 0; + mEventTimer.start(); + } + +private: + callback_t mCallback; + S32 mFlashCount; + S32 mCurrentFlashCount; +}; + LLSysWellChiclet::Params::Params() : button("button") , unread_notifications("unread_notifications") , max_displayed_count("max_displayed_count", 9) +, flash_to_lit_count("flash_to_lit_count", 3) +, flash_period("flash_period", 0.5F) { button.name("button"); button.tab_stop(FALSE); @@ -93,15 +133,18 @@ LLSysWellChiclet::LLSysWellChiclet(const Params& p) , mButton(NULL) , mCounter(0) , mMaxDisplayedCount(p.max_displayed_count) +, mFlashToLitTimer(NULL) { LLButton::Params button_params = p.button; mButton = LLUICtrlFactory::create<LLButton>(button_params); addChild(mButton); + + mFlashToLitTimer = new FlashToLitTimer(p.flash_to_lit_count, p.flash_period, boost::bind(&LLSysWellChiclet::changeLitState, this)); } LLSysWellChiclet::~LLSysWellChiclet() { - + delete mFlashToLitTimer; } void LLSysWellChiclet::setCounter(S32 counter) @@ -119,8 +162,6 @@ void LLSysWellChiclet::setCounter(S32 counter) mButton->setLabel(s_count); - mCounter = counter; - /* Emulate 4 states of button by background images, see detains in EXT-3147 xml attribute Description @@ -130,6 +171,12 @@ void LLSysWellChiclet::setCounter(S32 counter) image_pressed_selected "Lit" + "Selected" - there are new messages and the Well is open */ mButton->setForcePressedState(counter > 0); + + if (mCounter == 0 && counter > 0) + { + mFlashToLitTimer->flash(); + } + mCounter = counter; } boost::signals2::connection LLSysWellChiclet::setClickCallback( @@ -142,6 +189,14 @@ void LLSysWellChiclet::setToggleState(BOOL toggled) { mButton->setToggleState(toggled); } +void LLSysWellChiclet::changeLitState() +{ + static bool set_lit = false; + + mButton->setForcePressedState(set_lit); + + set_lit ^= true; +} /************************************************************************/ /* LLIMWellChiclet implementation */ diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h index 598773757e..06d25f081a 100644 --- a/indra/newview/llchiclet.h +++ b/indra/newview/llchiclet.h @@ -745,7 +745,7 @@ private: /** * Implements notification chiclet. Used to display total amount of unread messages - * across all IM sessions, total amount of system notifications. + * across all IM sessions, total amount of system notifications. See EXT-3147 for details */ class LLSysWellChiclet : public LLChiclet { @@ -765,6 +765,16 @@ public: */ Optional<S32> max_displayed_count; + /** + * How many time chiclet should flash before set "Lit" state. Default value is 3. + */ + Optional<S32> flash_to_lit_count; + + /** + * Period of flashing while setting "Lit" state, in seconds. Default value is 0.5. + */ + Optional<F32> flash_period; + Params(); }; @@ -786,10 +796,26 @@ protected: LLSysWellChiclet(const Params& p); friend class LLUICtrlFactory; + /** + * Change Well 'Lit' state from 'Lit' to 'Unlit' and vice-versa. + * + * There is an assumption that it will be called 2*N times to do not change its start state. + * @see FlashToLitTimer + */ + void changeLitState(); + protected: + class FlashToLitTimer; LLButton* mButton; S32 mCounter; S32 mMaxDisplayedCount; + + /** + * How many times Well will blink. + */ + S32 mFlashToLitCount; + FlashToLitTimer* mFlashToLitTimer; + }; /** diff --git a/indra/newview/skins/default/xui/en/panel_bottomtray.xml b/indra/newview/skins/default/xui/en/panel_bottomtray.xml index fc6f4966c4..e77960f200 100644 --- a/indra/newview/skins/default/xui/en/panel_bottomtray.xml +++ b/indra/newview/skins/default/xui/en/panel_bottomtray.xml @@ -324,6 +324,7 @@ as for parent layout_panel (chiclet_list_panel) to resize bottom tray properly. min_width="34" user_resize="false"> <chiclet_im_well + flash_period="0.3" follows="right" height="23" layout="topleft" @@ -374,6 +375,7 @@ image_pressed_selected "Lit" + "Selected" - there are new messages and the Well min_width="34" user_resize="false"> <chiclet_notification + flash_period="0.25" follows="right" height="23" layout="topleft" |