From d4cfcfc7ce1a9ab2488942077df2a6bfc9bf11bf Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Tue, 8 Dec 2009 11:14:00 +0200 Subject: 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 --- indra/newview/llchiclet.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'indra/newview/llchiclet.cpp') diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index 4b3b7a99d8..6d37eaed3d 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -81,17 +81,18 @@ boost::signals2::signal(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); -- cgit v1.2.3 From 7348fbb69af095f073da5ec9bd25c690c80b93f5 Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Tue, 8 Dec 2009 13:24:37 +0200 Subject: Completed normal task EXT-3147 (Implement new states for message indicators) -- Implemented 4 states of button by its background images via force Pressed state. They are: --- xml attribute Description --- image_unselected "Unlit" - there are no new messages --- image_selected "Unlit" + "Selected" - there are no new messages and the Well is open --- image_pressed "Lit" - there are new messages --- image_pressed_selected "Lit" + "Selected" - there are new messages and the Well is open --HG-- branch : product-engine --- indra/newview/llchiclet.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'indra/newview/llchiclet.cpp') diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index 6d37eaed3d..bd8effd93d 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -120,6 +120,16 @@ 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 + image_unselected "Unlit" - there are no new messages + image_selected "Unlit" + "Selected" - there are no new messages and the Well is open + image_pressed "Lit" - there are new messages + image_pressed_selected "Lit" + "Selected" - there are new messages and the Well is open + */ + mButton->setForcePressedState(counter > 0); } boost::signals2::connection LLSysWellChiclet::setClickCallback( -- cgit v1.2.3 From 8bfdaebc8072b89ce1268345b0c1a471a4194edf Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Tue, 8 Dec 2009 16:18:21 +0200 Subject: Completed normal task EXT-3147 (Implement new states for message indicators) -- Implemented flashing to 'Lit' [N] times. Also added configurable period of flashing. --HG-- branch : product-engine --- indra/newview/llchiclet.cpp | 61 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 58 insertions(+), 3 deletions(-) (limited to 'indra/newview/llchiclet.cpp') 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 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(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 */ -- cgit v1.2.3 From 00212e98d6b568cb505a99a06fadc54595f242ac Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Tue, 8 Dec 2009 17:38:07 +0200 Subject: Fixed Linux Build --HG-- branch : product-engine --- indra/newview/llchiclet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llchiclet.cpp') diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index d7c9575a7b..b11d8d45c8 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -87,7 +87,7 @@ class LLSysWellChiclet::FlashToLitTimer : public LLEventTimer { public: typedef boost::function callback_t; - LLSysWellChiclet::FlashToLitTimer(S32 count, F32 period, callback_t cb) + FlashToLitTimer(S32 count, F32 period, callback_t cb) : LLEventTimer(period) , mCallback(cb) , mFlashCount(2 * count) -- cgit v1.2.3 From ff87f87fa6a33daf72eae963b2aa33c9d5890509 Mon Sep 17 00:00:00 2001 From: Mike Antipov Date: Wed, 9 Dec 2009 09:58:32 +0200 Subject: Fixed line endings to Unix format --HG-- branch : product-engine --- indra/newview/llchiclet.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview/llchiclet.cpp') diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index b11d8d45c8..d90901612a 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -165,9 +165,9 @@ void LLSysWellChiclet::setCounter(S32 counter) /* Emulate 4 states of button by background images, see detains in EXT-3147 xml attribute Description - image_unselected "Unlit" - there are no new messages - image_selected "Unlit" + "Selected" - there are no new messages and the Well is open - image_pressed "Lit" - there are new messages + image_unselected "Unlit" - there are no new messages + image_selected "Unlit" + "Selected" - there are no new messages and the Well is open + image_pressed "Lit" - there are new messages image_pressed_selected "Lit" + "Selected" - there are new messages and the Well is open */ mButton->setForcePressedState(counter > 0); -- cgit v1.2.3 From b24cbb3633594ed7a7ebde1701175cbe33608dea Mon Sep 17 00:00:00 2001 From: Dmitry Zaporozhan Date: Wed, 9 Dec 2009 17:48:18 +0200 Subject: Implemented normal task EXT-3194 - Object chiclets should be accessible in the IM well. --HG-- branch : product-engine --- indra/newview/llchiclet.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'indra/newview/llchiclet.cpp') diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index d90901612a..30967677e8 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -61,6 +61,7 @@ static LLDefaultChildRegistry::Register t3("chiclet_im_p2p"); static LLDefaultChildRegistry::Register t4("chiclet_im_group"); static LLDefaultChildRegistry::Register t5("chiclet_im_adhoc"); static LLDefaultChildRegistry::Register t6("chiclet_script"); +static LLDefaultChildRegistry::Register t7("chiclet_offer"); static const LLRect CHICLET_RECT(0, 25, 25, 0); static const LLRect CHICLET_ICON_RECT(0, 22, 22, 0); @@ -1010,12 +1011,34 @@ void im_chiclet_callback(LLChicletPanel* panel, const LLSD& data){ } } +void object_chiclet_callback(const LLSD& data) +{ + LLUUID object_id = data["object_id"]; + bool new_message = data["new_message"]; + + std::list chiclets = LLIMChiclet::sFindChicletsSignal(object_id); + std::list::iterator iter; + for (iter = chiclets.begin(); iter != chiclets.end(); iter++) + { + LLIMChiclet* chiclet = dynamic_cast(*iter); + if (chiclet != NULL) + { + if(data.has("unread")) + { + chiclet->setCounter(data["unread"]); + } + chiclet->setShowNewMessagesIcon(new_message); + } + } +} BOOL LLChicletPanel::postBuild() { LLPanel::postBuild(); LLIMModel::instance().addNewMsgCallback(boost::bind(im_chiclet_callback, this, _1)); LLIMModel::instance().addNoUnreadMsgsCallback(boost::bind(im_chiclet_callback, this, _1)); + LLScriptFloaterManager::getInstance()->addNewObjectCallback(boost::bind(object_chiclet_callback, _1)); + LLScriptFloaterManager::getInstance()->addToggleObjectFloaterCallback(boost::bind(object_chiclet_callback, _1)); LLIMChiclet::sFindChicletsSignal.connect(boost::bind(&LLChicletPanel::findChiclet, this, _1)); LLVoiceChannel::setCurrentVoiceChannelChangedCallback(boost::bind(&LLChicletPanel::onCurrentVoiceChannelChanged, this, _1)); @@ -1616,6 +1639,11 @@ void LLScriptChiclet::setSessionId(const LLUUID& session_id) } } +void LLScriptChiclet::setCounter(S32 counter) +{ + setShowNewMessagesIcon( counter > 0 ); +} + void LLScriptChiclet::onMouseDown() { LLScriptFloaterManager::getInstance()->toggleScriptFloater(getSessionId()); @@ -1672,6 +1700,11 @@ void LLInvOfferChiclet::setSessionId(const LLUUID& session_id) } } +void LLInvOfferChiclet::setCounter(S32 counter) +{ + setShowNewMessagesIcon( counter > 0 ); +} + void LLInvOfferChiclet::onMouseDown() { LLScriptFloaterManager::instance().toggleScriptFloater(getSessionId()); -- cgit v1.2.3