aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra
diff options
context:
space:
mode:
authorMcCabe Maxsted2009-06-08 23:23:07 -0700
committerMcCabe Maxsted2009-06-08 23:23:07 -0700
commitc4f22cd6a6f96546a39702097accc8557130d34a (patch)
tree8827b07170fea501cdfbfd7696461298dfb587dc /linden/indra
parentMerged in 1.2.0-communicatetitle (diff)
downloadmeta-impy-c4f22cd6a6f96546a39702097accc8557130d34a.zip
meta-impy-c4f22cd6a6f96546a39702097accc8557130d34a.tar.gz
meta-impy-c4f22cd6a6f96546a39702097accc8557130d34a.tar.bz2
meta-impy-c4f22cd6a6f96546a39702097accc8557130d34a.tar.xz
'IM Received' button to '__ New IMs'
Diffstat (limited to 'linden/indra')
-rw-r--r--linden/indra/newview/llfloaterchatterbox.cpp21
-rw-r--r--linden/indra/newview/llimview.cpp10
-rw-r--r--linden/indra/newview/llimview.h8
-rw-r--r--linden/indra/newview/lloverlaybar.cpp23
-rw-r--r--linden/indra/newview/lloverlaybar.h6
-rw-r--r--linden/indra/newview/skins/default/xui/en-us/panel_overlaybar.xml5
6 files changed, 53 insertions, 20 deletions
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)
89// LLFloaterChatterBox 89// LLFloaterChatterBox
90// 90//
91 91
92static std::string sTitle = "Communicate"; 92static std::string sTitle = "";
93static int sUnreadCount = 0; 93static int sIMUnreadCount = 0;
94 94
95LLFloaterChatterBox::LLFloaterChatterBox(const LLSD& seed) : 95LLFloaterChatterBox::LLFloaterChatterBox(const LLSD& seed) :
96 mActiveVoiceFloater(NULL) 96 mActiveVoiceFloater(NULL)
@@ -127,7 +127,6 @@ LLFloaterChatterBox::LLFloaterChatterBox(const LLSD& seed) :
127 } 127 }
128 mTabContainer->lockTabs(); 128 mTabContainer->lockTabs();
129 129
130 sUnreadCount = 0;
131 sTitle = getTitle(); 130 sTitle = getTitle();
132} 131}
133 132
@@ -228,25 +227,25 @@ void LLFloaterChatterBox::markAsUnread(bool unread)
228{ 227{
229 LLFloaterChatterBox* floater = LLFloaterChatterBox::getInstance(); 228 LLFloaterChatterBox* floater = LLFloaterChatterBox::getInstance();
230 229
231 // Update IM unread count 230 // Update IM unread count here as tabs are clicked
232 if (unread) 231 if (unread)
233 { 232 {
234 sUnreadCount++; 233 sIMUnreadCount++;
235 } 234 }
236 else if (!unread) 235 else
237 { 236 {
238 sUnreadCount--; 237 sIMUnreadCount--;
239 } 238 }
240 239
241 if (floater) 240 if (floater)
242 { 241 {
243 // Update the title message with the number of unread IMs. 242 // Update the title message with the number of unread IMs.
244 // Remove the message when we hit 0. 243 // Remove the message when we hit 0.
245 if (sUnreadCount > 0) 244 if (sIMUnreadCount > 0)
246 { 245 {
247 // Check for plurals 246 // Check for plurals
248 std::string unread_string; 247 std::string unread_string;
249 if (sUnreadCount == 1) 248 if (sIMUnreadCount == 1)
250 { 249 {
251 unread_string = floater->getString("unread_count_string_singular"); 250 unread_string = floater->getString("unread_count_string_singular");
252 } 251 }
@@ -256,14 +255,14 @@ void LLFloaterChatterBox::markAsUnread(bool unread)
256 } 255 }
257 256
258 std::ostringstream unread_count_message; 257 std::ostringstream unread_count_message;
259 unread_count_message << sTitle << " (" << sUnreadCount << " " << unread_string << ")"; 258 unread_count_message << sTitle << " - " << sIMUnreadCount << " " << unread_string;
260 259
261 // Update the floater title 260 // Update the floater title
262 floater->setTitle(unread_count_message.str()); 261 floater->setTitle(unread_count_message.str());
263 } 262 }
264 else 263 else
265 { 264 {
266 sUnreadCount = 0; 265 sIMUnreadCount = 0;
267 266
268 // Update the floater title 267 // Update the floater title
269 floater->setTitle(sTitle); 268 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*)
366 366
367LLIMMgr::LLIMMgr() : 367LLIMMgr::LLIMMgr() :
368 mFriendObserver(NULL), 368 mFriendObserver(NULL),
369 mIMReceived(FALSE) 369 mIMReceived(FALSE),
370 mIMUnreadCount(0)
370{ 371{
371 mFriendObserver = new LLIMViewFriendObserver(this); 372 mFriendObserver = new LLIMViewFriendObserver(this);
372 LLAvatarTracker::instance().addObserver(mFriendObserver); 373 LLAvatarTracker::instance().addObserver(mFriendObserver);
@@ -510,6 +511,7 @@ void LLIMMgr::addMessage(
510 511
511 //notify of a new IM 512 //notify of a new IM
512 notifyNewIM(); 513 notifyNewIM();
514 mIMUnreadCount++;
513 } 515 }
514} 516}
515 517
@@ -553,6 +555,7 @@ void LLIMMgr::notifyNewIM()
553void LLIMMgr::clearNewIMNotification() 555void LLIMMgr::clearNewIMNotification()
554{ 556{
555 mIMReceived = FALSE; 557 mIMReceived = FALSE;
558 mIMUnreadCount = 0;
556} 559}
557 560
558BOOL LLIMMgr::getIMReceived() const 561BOOL LLIMMgr::getIMReceived() const
@@ -560,6 +563,11 @@ BOOL LLIMMgr::getIMReceived() const
560 return mIMReceived; 563 return mIMReceived;
561} 564}
562 565
566int LLIMMgr::getIMUnreadCount()
567{
568 return mIMUnreadCount;
569}
570
563// This method returns TRUE if the local viewer has a session 571// This method returns TRUE if the local viewer has a session
564// currently open keyed to the uuid. 572// currently open keyed to the uuid.
565BOOL LLIMMgr::isIMSessionOpen(const LLUUID& uuid) 573BOOL 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:
132 132
133 // IM received that you haven't seen yet 133 // IM received that you haven't seen yet
134 BOOL getIMReceived() const; 134 BOOL getIMReceived() const;
135 int getIMUnreadCount();
135 136
136 void setFloaterOpen(BOOL open); /*Flawfinder: ignore*/ 137 void setFloaterOpen(BOOL open); /*Flawfinder: ignore*/
137 BOOL getFloaterOpen(); 138 BOOL getFloaterOpen();
@@ -207,10 +208,11 @@ private:
207 LLFriendObserver* mFriendObserver; 208 LLFriendObserver* mFriendObserver;
208 209
209 // An IM has been received that you haven't seen yet. 210 // An IM has been received that you haven't seen yet.
210 BOOL mIMReceived; 211 BOOL mIMReceived;
212 int mIMUnreadCount;
211 213
212 LLSD mPendingInvitations; 214 LLSD mPendingInvitations;
213 LLSD mPendingAgentListUpdates; 215 LLSD mPendingAgentListUpdates;
214}; 216};
215 217
216 218
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()
102 : LLPanel(), 102 : LLPanel(),
103 mMediaRemote(NULL), 103 mMediaRemote(NULL),
104 mVoiceRemote(NULL), 104 mVoiceRemote(NULL),
105 mMusicState(STOPPED) 105 mMusicState(STOPPED),
106 mOriginalIMLabel("")
106{ 107{
107 setMouseOpaque(FALSE); 108 setMouseOpaque(FALSE);
108 setIsChrome(TRUE); 109 setIsChrome(TRUE);
@@ -129,6 +130,8 @@ BOOL LLOverlayBar::postBuild()
129 setFocusRoot(TRUE); 130 setFocusRoot(TRUE);
130 mBuilt = true; 131 mBuilt = true;
131 132
133 mOriginalIMLabel = getChild<LLButton>("IM Received")->getLabelSelected();
134
132 layoutButtons(); 135 layoutButtons();
133 return TRUE; 136 return TRUE;
134} 137}
@@ -192,9 +195,25 @@ void LLOverlayBar::refresh()
192 BOOL buttons_changed = FALSE; 195 BOOL buttons_changed = FALSE;
193 196
194 BOOL im_received = gIMMgr->getIMReceived(); 197 BOOL im_received = gIMMgr->getIMReceived();
198 int unread_count = gIMMgr->getIMUnreadCount();
195 LLButton* button = getChild<LLButton>("IM Received"); 199 LLButton* button = getChild<LLButton>("IM Received");
196 if (button && button->getVisible() != im_received) 200
201 if (button && button->getVisible() != im_received ||
202 button && button->getVisible())
197 { 203 {
204 if (unread_count > 0)
205 {
206 if (unread_count > 1)
207 {
208 std::stringstream ss;
209 ss << unread_count << " " << getString("unread_count_string_plural");
210 button->setLabel(ss.str());
211 }
212 else
213 {
214 button->setLabel("1 " + mOriginalIMLabel);
215 }
216 }
198 button->setVisible(im_received); 217 button->setVisible(im_received);
199 sendChildToFront(button); 218 sendChildToFront(button);
200 moveChildToBackOfTabGroup(button); 219 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:
95protected: 95protected:
96 LLMediaRemoteCtrl* mMediaRemote; 96 LLMediaRemoteCtrl* mMediaRemote;
97 LLVoiceRemoteCtrl* mVoiceRemote; 97 LLVoiceRemoteCtrl* mVoiceRemote;
98 bool mBuilt; // dialog constructed yet? 98 bool mBuilt; // dialog constructed yet?
99 S32 mMusicState;
100 std::string mOriginalIMLabel;
101
99 enum { STOPPED=0, PLAYING=1, PAUSED=2 }; 102 enum { STOPPED=0, PLAYING=1, PAUSED=2 };
100 S32 mMusicState;
101}; 103};
102 104
103extern LLOverlayBar* gOverlayBar; 105extern 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 @@
17 name="state_buttons" use_bounding_rect="true" user_resize="false" 17 name="state_buttons" use_bounding_rect="true" user_resize="false"
18 width="420"> 18 width="420">
19 <button bottom="1" follows="left|bottom" font="SansSerif" halign="center" height="20" 19 <button bottom="1" follows="left|bottom" font="SansSerif" halign="center" height="20"
20 label="IM Received" label_selected="IM Received" left="0" 20 label="New IM" label_selected="New IM" left="0"
21 name="IM Received" scale_image="true" 21 name="IM Received" scale_image="true"
22 tool_tip="You have an instant message pending. Click to show IMs." 22 tool_tip="You have an instant message pending. Click to show IMs."
23 width="102" /> 23 width="102" />
@@ -56,4 +56,7 @@
56 <panel background_visible="false" border="false" bottom="0" name="voice_remote" /> 56 <panel background_visible="false" border="false" bottom="0" name="voice_remote" />
57 </layout_panel> 57 </layout_panel>
58 </layout_stack> 58 </layout_stack>
59 <string name="unread_count_string_plural">
60 New IMs
61 </string>
59</panel> 62</panel>