diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 73bc2c0460..c2f9fbf977 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -23149,6 +23149,28 @@ Change of this parameter will affect the layout of buttons in notification toast Value 0 + FSNotifyUnreadChatMessages + + Comment + Notify about new unread chat messages in history if scrolled back + Persist + 1 + Type + Boolean + Value + 1 + + FSNotifyUnreadIMMessages + + Comment + Notify about new unread IM messages in history if scrolled back + Persist + 1 + Type + Boolean + Value + 1 + diff --git a/indra/newview/fschathistory.cpp b/indra/newview/fschathistory.cpp index 22a87cf648..5185dfea33 100644 --- a/indra/newview/fschathistory.cpp +++ b/indra/newview/fschathistory.cpp @@ -820,7 +820,8 @@ FSChatHistory::FSChatHistory(const FSChatHistory::Params& p) mChatInputLine(NULL), // FIRE-8602: Typing in chat history focuses chat input line mIsLastMessageFromLog(false), mNotifyAboutUnreadMsg(p.notify_unread_msg), - mScrollToBottom(false) + mScrollToBottom(false), + mUnreadChatSources(0) { mLineSpacingPixels=llclamp(gSavedSettings.getS32("FSFontChatLineSpacingPixels"),0,36); } @@ -935,6 +936,15 @@ void FSChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL bool from_me = chat.mFromID == gAgent.getID(); setPlainText(use_plain_text_chat_history); + if (!scrolledToEnd() && !from_me && !chat.mFromName.empty()) + { + mUnreadChatSources++; + if (!mUnreadMessagesUpdateSignal.empty()) + { + mUnreadMessagesUpdateSignal(mUnreadChatSources); + } + } + LLColor4 txt_color = LLUIColorTable::instance().getColor("White"); LLColor4 name_color = LLUIColorTable::instance().getColor("ChatNameColor"); LLViewerChat::getChatColor(chat, txt_color, is_local); @@ -1369,5 +1379,14 @@ void FSChatHistory::draw() mScroller->goToBottom(); mScrollToBottom = false; } + + if (scrolledToEnd() && mUnreadChatSources != 0) + { + mUnreadChatSources = 0; + if (!mUnreadMessagesUpdateSignal.empty()) + { + mUnreadMessagesUpdateSignal(mUnreadChatSources); + } + } } // diff --git a/indra/newview/fschathistory.h b/indra/newview/fschathistory.h index 16a31b942f..3c5c554b3b 100644 --- a/indra/newview/fschathistory.h +++ b/indra/newview/fschathistory.h @@ -120,6 +120,12 @@ class FSChatHistory : public LLTextEditor // FIRE-8600: TAB out of chat /*virtual*/ void clear(); /*virtual*/ void draw(); + typedef boost::signals2::signal unread_messages_update_callback_t; + boost::signals2::connection setUnreadMessagesUpdateCallback(const unread_messages_update_callback_t::slot_type& cb) + { + return mUnreadMessagesUpdateSignal.connect(cb); + } + private: std::string mLastFromName; LLUUID mLastFromID; @@ -146,6 +152,9 @@ class FSChatHistory : public LLTextEditor // FIRE-8600: TAB out of chat std::string mDisplayName; std::string mDisplayName_Username; + S32 mUnreadChatSources; + unread_messages_update_callback_t mUnreadMessagesUpdateSignal; + // FIRE-8602: Typing in chat history focuses chat input line public: virtual BOOL handleUnicodeCharHere(llwchar uni_char); diff --git a/indra/newview/fsfloaterim.cpp b/indra/newview/fsfloaterim.cpp index 7d46479420..e68450262a 100644 --- a/indra/newview/fsfloaterim.cpp +++ b/indra/newview/fsfloaterim.cpp @@ -78,6 +78,7 @@ #include "fscommon.h" #include "fsfloaternearbychat.h" #include "llviewerregion.h" +#include "lltextbox.h" const F32 ME_TYPING_TIMEOUT = 4.0f; const F32 OTHER_TYPING_TIMEOUT = 9.0f; @@ -107,7 +108,9 @@ FSFloaterIM::FSFloaterIM(const LLUUID& session_id) mAvatarNameCacheConnection(), mVoiceChannel(NULL), mMeTypingTimer(), - mOtherTypingTimer() + mOtherTypingTimer(), + mUnreadMessagesNotificationPanel(NULL), + mUnreadMessagesNotificationTextBox(NULL) { LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(mSessionID); if (im_session) @@ -747,7 +750,11 @@ BOOL FSFloaterIM::postBuild() mInputPanels = getChild("input_panels"); mChatLayoutPanelHeight = mChatLayoutPanel->getRect().getHeight(); mInputEditorPad = mChatLayoutPanelHeight - mInputEditor->getRect().getHeight(); - + + mUnreadMessagesNotificationPanel = getChild("unread_messages_holder"); + mUnreadMessagesNotificationTextBox = getChild("unread_messages_text"); + mChatHistory->setUnreadMessagesUpdateCallback(boost::bind(&FSFloaterIM::updateUnreadMessageNotification, this, _1)); + mInputEditor->setAutoreplaceCallback(boost::bind(&LLAutoReplace::autoreplaceCallback, LLAutoReplace::getInstance(), _1, _2, _3, _4, _5)); mInputEditor->setFocusReceivedCallback(boost::bind(&FSFloaterIM::onInputEditorFocusReceived, this)); mInputEditor->setFocusLostCallback(boost::bind(&FSFloaterIM::onInputEditorFocusLost, this)); @@ -1919,3 +1926,16 @@ boost::signals2::connection FSFloaterIM::setIMFloaterShowedCallback(const floate { return FSFloaterIM::sIMFloaterShowedSignal.connect(cb); } + +void FSFloaterIM::updateUnreadMessageNotification(S32 unread_messages) +{ + if (unread_messages == 0 || !gSavedSettings.getBOOL("FSNotifyUnreadIMMessages")) + { + mUnreadMessagesNotificationPanel->setVisible(FALSE); + } + else + { + mUnreadMessagesNotificationTextBox->setTextArg("[NUM]", llformat("%d", unread_messages)); + mUnreadMessagesNotificationPanel->setVisible(TRUE); + } +} diff --git a/indra/newview/fsfloaterim.h b/indra/newview/fsfloaterim.h index 9c8923fbd3..d2af698838 100644 --- a/indra/newview/fsfloaterim.h +++ b/indra/newview/fsfloaterim.h @@ -39,6 +39,7 @@ class LLAvatarName; class LLButton; // support sysinfo button -Zi class LLChatEntry; +class LLTextBox; class LLTextEditor; class FSPanelChatControlPanel; class FSChatHistory; @@ -148,6 +149,8 @@ public: LLVoiceChannel* getVoiceChannel() { return mVoiceChannel; } + void updateUnreadMessageNotification(S32 unread_messages); + protected: /* virtual */ void onClickCloseBtn(bool app_quitting = false); @@ -221,6 +224,8 @@ private: LLChatEntry* mInputEditor; LLLayoutPanel* mChatLayoutPanel; LLLayoutStack* mInputPanels; + LLLayoutPanel* mUnreadMessagesNotificationPanel; + LLTextBox* mUnreadMessagesNotificationTextBox; // bool mPositioned; // dead code -Zi std::string mSavedTitle; diff --git a/indra/newview/fsfloaternearbychat.cpp b/indra/newview/fsfloaternearbychat.cpp index 3e3df56dad..7bd9f7fa42 100644 --- a/indra/newview/fsfloaternearbychat.cpp +++ b/indra/newview/fsfloaternearbychat.cpp @@ -63,6 +63,7 @@ #include "llrootview.h" #include "llspinctrl.h" #include "llstylemap.h" +#include "lltextbox.h" #include "lltrans.h" #include "lltranslate.h" #include "llviewercontrol.h" @@ -99,6 +100,8 @@ FSFloaterNearbyChat::FSFloaterNearbyChat(const LLSD& key) ,mChatLayoutPanel(NULL) ,mInputPanels(NULL) ,mChatLayoutPanelHeight(0) + ,mUnreadMessagesNotificationPanel(NULL) + ,mUnreadMessagesNotificationTextBox(NULL) { } @@ -174,6 +177,11 @@ BOOL FSFloaterNearbyChat::postBuild() // Optional muted chat history mChatHistoryMuted = getChild("chat_history_muted"); + + mUnreadMessagesNotificationPanel = getChild("unread_messages_holder"); + mUnreadMessagesNotificationTextBox = getChild("unread_messages_text"); + mChatHistory->setUnreadMessagesUpdateCallback(boost::bind(&FSFloaterNearbyChat::updateUnreadMessageNotification, this, _1)); + mChatHistoryMuted->setUnreadMessagesUpdateCallback(boost::bind(&FSFloaterNearbyChat::updateUnreadMessageNotification, this, _1)); FSUseNearbyChatConsole = gSavedSettings.getBOOL("FSUseNearbyChatConsole"); gSavedSettings.getControl("FSUseNearbyChatConsole")->getSignal()->connect(boost::bind(&FSFloaterNearbyChat::updateFSUseNearbyChatConsole, this, _2)); @@ -1331,3 +1339,16 @@ void really_send_chat_from_nearby_floater(std::string utf8_out_text, EChatType t gAgent.sendReliableMessage(); } // FIRE-787 + +void FSFloaterNearbyChat::updateUnreadMessageNotification(S32 unread_messages) +{ + if (unread_messages == 0 || !gSavedSettings.getBOOL("FSNotifyUnreadChatMessages")) + { + mUnreadMessagesNotificationPanel->setVisible(FALSE); + } + else + { + mUnreadMessagesNotificationTextBox->setTextArg("[NUM]", llformat("%d", unread_messages)); + mUnreadMessagesNotificationPanel->setVisible(TRUE); + } +} diff --git a/indra/newview/fsfloaternearbychat.h b/indra/newview/fsfloaternearbychat.h index 3174f2eb62..5b3a64f794 100644 --- a/indra/newview/fsfloaternearbychat.h +++ b/indra/newview/fsfloaternearbychat.h @@ -37,6 +37,7 @@ class LLResizeBar; class LLComboBox; class FSChatHistory; +class LLTextBox; #include "llchatentry.h" #include "lllayoutstack.h" @@ -95,7 +96,9 @@ public: static void sendChatFromViewer(const std::string &utf8text, EChatType type, BOOL animate); static void sendChatFromViewer(const LLWString &wtext, EChatType type, BOOL animate); - + + void updateUnreadMessageNotification(S32 unread_messages); + protected: static BOOL matchChatTypeTrigger(const std::string& in_str, std::string* out_str); void onChatBoxKeystroke(); @@ -128,7 +131,10 @@ private: LLLayoutPanel* mChatLayoutPanel; LLLayoutStack* mInputPanels; - + + LLLayoutPanel* mUnreadMessagesNotificationPanel; + LLTextBox* mUnreadMessagesNotificationTextBox; + S32 mInputEditorPad; S32 mChatLayoutPanelHeight; S32 mFloaterHeight; diff --git a/indra/newview/skins/default/xui/de/floater_fs_im_session.xml b/indra/newview/skins/default/xui/de/floater_fs_im_session.xml index 0c2a24c4dc..059df3b4c6 100644 --- a/indra/newview/skins/default/xui/de/floater_fs_im_session.xml +++ b/indra/newview/skins/default/xui/de/floater_fs_im_session.xml @@ -41,4 +41,15 @@ + + + + + + Ungelesene Nachrichten: [NUM] + + + + + diff --git a/indra/newview/skins/default/xui/de/floater_fs_nearby_chat.xml b/indra/newview/skins/default/xui/de/floater_fs_nearby_chat.xml index 9527d9cf6b..aedb27644f 100644 --- a/indra/newview/skins/default/xui/de/floater_fs_nearby_chat.xml +++ b/indra/newview/skins/default/xui/de/floater_fs_nearby_chat.xml @@ -17,6 +17,11 @@ + + + Ungelesene Nachrichten: [NUM] + + diff --git a/indra/newview/skins/default/xui/en/floater_fs_im_session.xml b/indra/newview/skins/default/xui/en/floater_fs_im_session.xml index 41bfe30312..548e7fa239 100644 --- a/indra/newview/skins/default/xui/en/floater_fs_im_session.xml +++ b/indra/newview/skins/default/xui/en/floater_fs_im_session.xml @@ -426,7 +426,7 @@ width="394" layout="topleft" orientation="horizontal" - name="im_panels" + name="chat_stack" top="40" left="0"> + + + + Unread Messages: [NUM] + + + + + + Unread Messages: [NUM] + + + + + + Unread Messages: [NUM] + + + + + + Unread Messages: [NUM] + +