From c4f22cd6a6f96546a39702097accc8557130d34a Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Mon, 8 Jun 2009 23:23:07 -0700 Subject: 'IM Received' button to '__ New IMs' --- linden/indra/newview/llfloaterchatterbox.cpp | 21 ++++++++++---------- linden/indra/newview/llimview.cpp | 10 +++++++++- linden/indra/newview/llimview.h | 8 +++++--- linden/indra/newview/lloverlaybar.cpp | 23 ++++++++++++++++++++-- linden/indra/newview/lloverlaybar.h | 6 ++++-- .../skins/default/xui/en-us/panel_overlaybar.xml | 5 ++++- 6 files changed, 53 insertions(+), 20 deletions(-) (limited to 'linden/indra/newview') diff --git a/linden/indra/newview/llfloaterchatterbox.cpp b/linden/indra/newview/llfloaterchatterbox.cpp index 53a2cf5..5ef5a30 100644 --- a/linden/indra/newview/llfloaterchatterbox.cpp +++ b/linden/indra/newview/llfloaterchatterbox.cpp @@ -89,8 +89,8 @@ void* LLFloaterMyFriends::createGroupsPanel(void* data) // LLFloaterChatterBox // -static std::string sTitle = "Communicate"; -static int sUnreadCount = 0; +static std::string sTitle = ""; +static int sIMUnreadCount = 0; LLFloaterChatterBox::LLFloaterChatterBox(const LLSD& seed) : mActiveVoiceFloater(NULL) @@ -127,7 +127,6 @@ LLFloaterChatterBox::LLFloaterChatterBox(const LLSD& seed) : } mTabContainer->lockTabs(); - sUnreadCount = 0; sTitle = getTitle(); } @@ -228,25 +227,25 @@ void LLFloaterChatterBox::markAsUnread(bool unread) { LLFloaterChatterBox* floater = LLFloaterChatterBox::getInstance(); - // Update IM unread count + // Update IM unread count here as tabs are clicked if (unread) { - sUnreadCount++; + sIMUnreadCount++; } - else if (!unread) + else { - sUnreadCount--; + sIMUnreadCount--; } if (floater) { // Update the title message with the number of unread IMs. // Remove the message when we hit 0. - if (sUnreadCount > 0) + if (sIMUnreadCount > 0) { // Check for plurals std::string unread_string; - if (sUnreadCount == 1) + if (sIMUnreadCount == 1) { unread_string = floater->getString("unread_count_string_singular"); } @@ -256,14 +255,14 @@ void LLFloaterChatterBox::markAsUnread(bool unread) } std::ostringstream unread_count_message; - unread_count_message << sTitle << " (" << sUnreadCount << " " << unread_string << ")"; + unread_count_message << sTitle << " - " << sIMUnreadCount << " " << unread_string; // Update the floater title floater->setTitle(unread_count_message.str()); } else { - sUnreadCount = 0; + sIMUnreadCount = 0; // Update the floater title floater->setTitle(sTitle); diff --git a/linden/indra/newview/llimview.cpp b/linden/indra/newview/llimview.cpp index 10e8ff8..1072b21 100644 --- a/linden/indra/newview/llimview.cpp +++ b/linden/indra/newview/llimview.cpp @@ -366,7 +366,8 @@ void LLIMMgr::toggle(void*) LLIMMgr::LLIMMgr() : mFriendObserver(NULL), - mIMReceived(FALSE) + mIMReceived(FALSE), + mIMUnreadCount(0) { mFriendObserver = new LLIMViewFriendObserver(this); LLAvatarTracker::instance().addObserver(mFriendObserver); @@ -510,6 +511,7 @@ void LLIMMgr::addMessage( //notify of a new IM notifyNewIM(); + mIMUnreadCount++; } } @@ -553,6 +555,7 @@ void LLIMMgr::notifyNewIM() void LLIMMgr::clearNewIMNotification() { mIMReceived = FALSE; + mIMUnreadCount = 0; } BOOL LLIMMgr::getIMReceived() const @@ -560,6 +563,11 @@ BOOL LLIMMgr::getIMReceived() const return mIMReceived; } +int LLIMMgr::getIMUnreadCount() +{ + return mIMUnreadCount; +} + // This method returns TRUE if the local viewer has a session // currently open keyed to the uuid. BOOL LLIMMgr::isIMSessionOpen(const LLUUID& uuid) diff --git a/linden/indra/newview/llimview.h b/linden/indra/newview/llimview.h index 6b82c2e..cccd6b4 100644 --- a/linden/indra/newview/llimview.h +++ b/linden/indra/newview/llimview.h @@ -132,6 +132,7 @@ public: // IM received that you haven't seen yet BOOL getIMReceived() const; + int getIMUnreadCount(); void setFloaterOpen(BOOL open); /*Flawfinder: ignore*/ BOOL getFloaterOpen(); @@ -207,10 +208,11 @@ private: LLFriendObserver* mFriendObserver; // An IM has been received that you haven't seen yet. - BOOL mIMReceived; + BOOL mIMReceived; + int mIMUnreadCount; - LLSD mPendingInvitations; - LLSD mPendingAgentListUpdates; + LLSD mPendingInvitations; + LLSD mPendingAgentListUpdates; }; diff --git a/linden/indra/newview/lloverlaybar.cpp b/linden/indra/newview/lloverlaybar.cpp index 5dd5d39..91a7375 100644 --- a/linden/indra/newview/lloverlaybar.cpp +++ b/linden/indra/newview/lloverlaybar.cpp @@ -102,7 +102,8 @@ LLOverlayBar::LLOverlayBar() : LLPanel(), mMediaRemote(NULL), mVoiceRemote(NULL), - mMusicState(STOPPED) + mMusicState(STOPPED), + mOriginalIMLabel("") { setMouseOpaque(FALSE); setIsChrome(TRUE); @@ -129,6 +130,8 @@ BOOL LLOverlayBar::postBuild() setFocusRoot(TRUE); mBuilt = true; + mOriginalIMLabel = getChild("IM Received")->getLabelSelected(); + layoutButtons(); return TRUE; } @@ -192,9 +195,25 @@ void LLOverlayBar::refresh() BOOL buttons_changed = FALSE; BOOL im_received = gIMMgr->getIMReceived(); + int unread_count = gIMMgr->getIMUnreadCount(); LLButton* button = getChild("IM Received"); - if (button && button->getVisible() != im_received) + + if (button && button->getVisible() != im_received || + button && button->getVisible()) { + if (unread_count > 0) + { + if (unread_count > 1) + { + std::stringstream ss; + ss << unread_count << " " << getString("unread_count_string_plural"); + button->setLabel(ss.str()); + } + else + { + button->setLabel("1 " + mOriginalIMLabel); + } + } button->setVisible(im_received); sendChildToFront(button); moveChildToBackOfTabGroup(button); diff --git a/linden/indra/newview/lloverlaybar.h b/linden/indra/newview/lloverlaybar.h index 8b9b6bc..52a469a 100644 --- a/linden/indra/newview/lloverlaybar.h +++ b/linden/indra/newview/lloverlaybar.h @@ -95,9 +95,11 @@ protected: protected: LLMediaRemoteCtrl* mMediaRemote; LLVoiceRemoteCtrl* mVoiceRemote; - bool mBuilt; // dialog constructed yet? + bool mBuilt; // dialog constructed yet? + S32 mMusicState; + std::string mOriginalIMLabel; + enum { STOPPED=0, PLAYING=1, PAUSED=2 }; - S32 mMusicState; }; extern LLOverlayBar* gOverlayBar; diff --git a/linden/indra/newview/skins/default/xui/en-us/panel_overlaybar.xml b/linden/indra/newview/skins/default/xui/en-us/panel_overlaybar.xml index 997a5a6..e785909 100644 --- a/linden/indra/newview/skins/default/xui/en-us/panel_overlaybar.xml +++ b/linden/indra/newview/skins/default/xui/en-us/panel_overlaybar.xml @@ -17,7 +17,7 @@ name="state_buttons" use_bounding_rect="true" user_resize="false" width="420">