aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/newview
diff options
context:
space:
mode:
authorMcCabe Maxsted2009-04-24 15:40:59 -0700
committerMcCabe Maxsted2009-04-24 15:40:59 -0700
commit6ba527aba9a09cde627309a4acd73b161b65e185 (patch)
treecacef790c5bbea1a035ae1f22ac0f863e5539b25 /linden/indra/newview
parentStarted 1.2.0 branch (diff)
downloadmeta-impy-6ba527aba9a09cde627309a4acd73b161b65e185.zip
meta-impy-6ba527aba9a09cde627309a4acd73b161b65e185.tar.gz
meta-impy-6ba527aba9a09cde627309a4acd73b161b65e185.tar.bz2
meta-impy-6ba527aba9a09cde627309a4acd73b161b65e185.tar.xz
Communicate window now shows the number of unread IMs
Diffstat (limited to '')
-rw-r--r--linden/indra/newview/llfloaterchatterbox.cpp54
-rw-r--r--linden/indra/newview/llfloaterchatterbox.h2
-rw-r--r--linden/indra/newview/llimpanel.cpp36
-rw-r--r--linden/indra/newview/skins/default/xui/en-us/floater_chatterbox.xml6
4 files changed, 90 insertions, 8 deletions
diff --git a/linden/indra/newview/llfloaterchatterbox.cpp b/linden/indra/newview/llfloaterchatterbox.cpp
index 1114635..e7de62c 100644
--- a/linden/indra/newview/llfloaterchatterbox.cpp
+++ b/linden/indra/newview/llfloaterchatterbox.cpp
@@ -88,6 +88,10 @@ void* LLFloaterMyFriends::createGroupsPanel(void* data)
88// 88//
89// LLFloaterChatterBox 89// LLFloaterChatterBox
90// 90//
91
92static std::string sTitle = "Communicate";
93static int sUnreadCount = 0;
94
91LLFloaterChatterBox::LLFloaterChatterBox(const LLSD& seed) : 95LLFloaterChatterBox::LLFloaterChatterBox(const LLSD& seed) :
92 mActiveVoiceFloater(NULL) 96 mActiveVoiceFloater(NULL)
93{ 97{
@@ -122,6 +126,9 @@ LLFloaterChatterBox::LLFloaterChatterBox(const LLSD& seed) :
122 addFloater(LLFloaterChat::getInstance(LLSD()), FALSE); 126 addFloater(LLFloaterChat::getInstance(LLSD()), FALSE);
123 } 127 }
124 mTabContainer->lockTabs(); 128 mTabContainer->lockTabs();
129
130 sUnreadCount = 0;
131 sTitle = getTitle();
125} 132}
126 133
127LLFloaterChatterBox::~LLFloaterChatterBox() 134LLFloaterChatterBox::~LLFloaterChatterBox()
@@ -217,6 +224,53 @@ void LLFloaterChatterBox::setMinimized(BOOL minimized)
217 LLFloaterChat::getInstance()->updateConsoleVisibility(); 224 LLFloaterChat::getInstance()->updateConsoleVisibility();
218} 225}
219 226
227void LLFloaterChatterBox::markAsUnread(bool unread)
228{
229 LLFloaterChatterBox* floater = LLFloaterChatterBox::getInstance();
230
231 // Update IM unread count
232 if (unread)
233 {
234 sUnreadCount++;
235 }
236 else if (!unread)
237 {
238 sUnreadCount--;
239 }
240
241 if (floater)
242 {
243 // Update the title message with the number of unread IMs.
244 // Remove the message when we hit 0.
245 if (sUnreadCount > 0)
246 {
247 // Check for plurals
248 std::string unread_string;
249 if (sUnreadCount == 1)
250 {
251 unread_string = floater->getString("unread_count_string_singular");
252 }
253 else
254 {
255 unread_string = floater->getString("unread_count_string_plural");
256 }
257
258 std::ostringstream unread_count_message;
259 unread_count_message << sTitle << " (" << sUnreadCount << " " << unread_string << ")";
260
261 // Update the floater title
262 floater->setTitle(unread_count_message.str());
263 }
264 else
265 {
266 sUnreadCount = 0;
267
268 // Update the floater title
269 floater->setTitle(sTitle);
270 }
271 }
272}
273
220void LLFloaterChatterBox::removeFloater(LLFloater* floaterp) 274void LLFloaterChatterBox::removeFloater(LLFloater* floaterp)
221{ 275{
222 if (floaterp->getName() == "chat floater") 276 if (floaterp->getName() == "chat floater")
diff --git a/linden/indra/newview/llfloaterchatterbox.h b/linden/indra/newview/llfloaterchatterbox.h
index ac494d1..197c735 100644
--- a/linden/indra/newview/llfloaterchatterbox.h
+++ b/linden/indra/newview/llfloaterchatterbox.h
@@ -90,6 +90,8 @@ public:
90 VisibilityPolicy<LLFloater>::hide(instance, key); 90 VisibilityPolicy<LLFloater>::hide(instance, key);
91 } 91 }
92 92
93 static void markAsUnread(bool unread);
94
93private: 95private:
94 LLFloater* getFloater(const LLSD& key) 96 LLFloater* getFloater(const LLSD& key)
95 { 97 {
diff --git a/linden/indra/newview/llimpanel.cpp b/linden/indra/newview/llimpanel.cpp
index dede746..5a563a4 100644
--- a/linden/indra/newview/llimpanel.cpp
+++ b/linden/indra/newview/llimpanel.cpp
@@ -49,6 +49,7 @@
49#include "llconsole.h" 49#include "llconsole.h"
50#include "llfloater.h" 50#include "llfloater.h"
51#include "llfloatergroupinfo.h" 51#include "llfloatergroupinfo.h"
52#include "llfloaterchatterbox.h"
52#include "llimview.h" 53#include "llimview.h"
53#include "llinventory.h" 54#include "llinventory.h"
54#include "llinventorymodel.h" 55#include "llinventorymodel.h"
@@ -1160,6 +1161,7 @@ void LLFloaterIMPanel::init(const std::string& session_label)
1160 FALSE); 1161 FALSE);
1161 1162
1162 setTitle(mSessionLabel); 1163 setTitle(mSessionLabel);
1164
1163 mInputEditor->setMaxTextLength(1023); 1165 mInputEditor->setMaxTextLength(1023);
1164 // enable line history support for instant message bar 1166 // enable line history support for instant message bar
1165 mInputEditor->setEnableLineHistory(TRUE); 1167 mInputEditor->setEnableLineHistory(TRUE);
@@ -1472,7 +1474,21 @@ void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, const LLColor4
1472 && hostp 1474 && hostp
1473 && source != gAgent.getID()) 1475 && source != gAgent.getID())
1474 { 1476 {
1475 hostp->setFloaterFlashing(this, TRUE); 1477 // Only start flashing on first update so we can
1478 // get the proper unread number of unread tabs here
1479 if (!hostp->isFloaterFlashing(this))
1480 {
1481 hostp->setFloaterFlashing(this, TRUE);
1482 LLFloaterChatterBox::markAsUnread(true);
1483 }
1484
1485 //// Only increment the number of unread IMs if they're from individuals
1486 //// We increment the first received for the rest during new IM creation.
1487 //if (mDialog == IM_SESSION_P2P_INVITE ||
1488 // mDialog == IM_NOTHING_SPECIAL)
1489 //{
1490 // LLFloaterChatterBox::markAsUnread(true);
1491 //}
1476 } 1492 }
1477 } 1493 }
1478 1494
@@ -1540,13 +1556,17 @@ void LLFloaterIMPanel::setVisible(BOOL b)
1540 LLMultiFloater* hostp = getHost(); 1556 LLMultiFloater* hostp = getHost();
1541 if( b && hostp ) 1557 if( b && hostp )
1542 { 1558 {
1543 hostp->setFloaterFlashing(this, FALSE); 1559 if (hostp->isFloaterFlashing(this))
1544 1560 {
1545 /* Don't change containing floater title - leave it "Instant Message" JC 1561 hostp->setFloaterFlashing(this, FALSE);
1546 LLUIString title = sTitleString; 1562 LLFloaterChatterBox::markAsUnread(false);
1547 title.setArg("[NAME]", mSessionLabel); 1563
1548 hostp->setTitle( title ); 1564 /* Don't change containing floater title - leave it "Instant Message" JC
1549 */ 1565 LLUIString title = sTitleString;
1566 title.setArg("[NAME]", mSessionLabel);
1567 hostp->setTitle( title );
1568 */
1569 }
1550 } 1570 }
1551} 1571}
1552 1572
diff --git a/linden/indra/newview/skins/default/xui/en-us/floater_chatterbox.xml b/linden/indra/newview/skins/default/xui/en-us/floater_chatterbox.xml
index 69f8286..96904d7 100644
--- a/linden/indra/newview/skins/default/xui/en-us/floater_chatterbox.xml
+++ b/linden/indra/newview/skins/default/xui/en-us/floater_chatterbox.xml
@@ -8,5 +8,11 @@
8 mouse_opaque="false" name="chatterbox_tab_container" width="391"></icon> 8 mouse_opaque="false" name="chatterbox_tab_container" width="391"></icon>
9 <tab_container bottom="2" follows="left|right|top|bottom" height="370" left="0" 9 <tab_container bottom="2" follows="left|right|top|bottom" height="370" left="0"
10 name="chatterbox_tabs" tab_position="bottom" tab_width="80" width="395" /> 10 name="chatterbox_tabs" tab_position="bottom" tab_width="80" width="395" />
11 <string name="unread_count_string_singular">
12 unread IM
13 </string>
14 <string name="unread_count_string_plural">
15 unread IMs
16 </string>
11</multi_floater> 17</multi_floater>
12 18