FIRE-1205: Add optional "new message alert" to chat and IM history via FSNotifyUnreadChatMessages & FSNotifyUnreadIMMessages debug setting (needs to be wired up in preferences)

Ansariel 2015-02-26 22:42:06 +01:00
parent 1ee6b83b10
commit 92cc8c2322
13 changed files with 240 additions and 11 deletions

View File

@ -23149,6 +23149,28 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Value</key>
<integer>0</integer>
</map>
<key>FSNotifyUnreadChatMessages</key>
<map>
<key>Comment</key>
<string>Notify about new unread chat messages in history if scrolled back</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FSNotifyUnreadIMMessages</key>
<map>
<key>Comment</key>
<string>Notify about new unread IM messages in history if scrolled back</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
</map>
</llsd>

View File

@ -820,7 +820,8 @@ FSChatHistory::FSChatHistory(const FSChatHistory::Params& p)
mChatInputLine(NULL), // <FS_Zi> 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);
}
}
}
// </FS:Zi>

View File

@ -120,6 +120,12 @@ class FSChatHistory : public LLTextEditor // <FS:Zi> FIRE-8600: TAB out of chat
/*virtual*/ void clear();
/*virtual*/ void draw();
typedef boost::signals2::signal<void(S32 unread_messages)> 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 // <FS:Zi> FIRE-8600: TAB out of chat
std::string mDisplayName;
std::string mDisplayName_Username;
S32 mUnreadChatSources;
unread_messages_update_callback_t mUnreadMessagesUpdateSignal;
// <FS_Zi> FIRE-8602: Typing in chat history focuses chat input line
public:
virtual BOOL handleUnicodeCharHere(llwchar uni_char);

View File

@ -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<LLLayoutStack>("input_panels");
mChatLayoutPanelHeight = mChatLayoutPanel->getRect().getHeight();
mInputEditorPad = mChatLayoutPanelHeight - mInputEditor->getRect().getHeight();
mUnreadMessagesNotificationPanel = getChild<LLLayoutPanel>("unread_messages_holder");
mUnreadMessagesNotificationTextBox = getChild<LLTextBox>("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);
}
}

View File

@ -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;

View File

@ -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()
// <FS:Ansariel> Optional muted chat history
mChatHistoryMuted = getChild<FSChatHistory>("chat_history_muted");
mUnreadMessagesNotificationPanel = getChild<LLLayoutPanel>("unread_messages_holder");
mUnreadMessagesNotificationTextBox = getChild<LLTextBox>("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();
}
//</FS:TS> 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);
}
}

View File

@ -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;

View File

@ -41,4 +41,15 @@
<check_box label="Version senden" name="FSSupportGroupChatPrefix_toggle" tool_tip="Fügt die aktuelle Viewer-Version und Oberfläche am Anfang jeder Nachricht hinzu, die an diese Gruppe gesendet werden, um die Support-Mitarbeiter dabei zu unterstützen, ein mögliches Problem besser zu diagnostizieren und die Genauigkeit der Antworten auf deine Fragen zu verbessern."/>
</layout_panel>
</layout_stack>
<layout_stack name="chat_stack">
<layout_panel name="panel_im_control_lp">
<layout_stack name="im_panels">
<layout_panel name="unread_messages_holder">
<text name="unread_messages_text">
Ungelesene Nachrichten: [NUM]
</text>
</layout_panel>
</layout_stack>
</layout_panel>
</layout_stack>
</floater>

View File

@ -17,6 +17,11 @@
<layout_stack name="ls_chat">
<layout_panel name="panel_im_control_lp">
<layout_stack name="im_panels">
<layout_panel name="unread_messages_holder">
<text name="unread_messages_text">
Ungelesene Nachrichten: [NUM]
</text>
</layout_panel>
<layout_panel name="chat_layout_panel">
<layout_stack name="input_panels">
<layout_panel name="input_editor_layout_panel">

View File

@ -426,7 +426,7 @@
width="394"
layout="topleft"
orientation="horizontal"
name="im_panels"
name="chat_stack"
top="40"
left="0">
<layout_panel
@ -476,10 +476,37 @@
top="0"
bottom="-1" />
</layout_panel>
<layout_panel
height="20"
visible="false"
auto_resize="false"
user_resize="false"
name="unread_messages_holder">
<icon
follows="left|right"
image_name="Toolbar_Middle_Off"
left="3"
name="unread_messages_background"
top="0"
height="20"
right="-4"/>
<text
type="string"
length="1"
follows="left|top|right"
font="SansSerif"
layout="topleft"
name="unread_messages_text"
right="-4"
left="6"
height="14"
bottom="-3">
Unread Messages: [NUM]
</text>
</layout_panel>
<layout_panel
tab_group="3"
top_delta="0"
top="0"
height="26"
bottom="-1"
auto_resize="false"

View File

@ -180,10 +180,38 @@
top="0"
bottom="-1" />
</layout_panel>
<layout_panel
height="20"
visible="false"
auto_resize="false"
user_resize="false"
name="unread_messages_holder">
<icon
follows="left|right"
image_name="Toolbar_Middle_Off"
left="3"
name="unread_messages_background"
top="0"
height="20"
right="-4"/>
<text
type="string"
length="1"
follows="left|top|right"
font="SansSerif"
layout="topleft"
name="unread_messages_text"
right="-4"
left="6"
height="14"
bottom="-3">
Unread Messages: [NUM]
</text>
</layout_panel>
<layout_panel
visibility_control="FSNearbyChatbar"
tab_group="2"
top="0"
top_delta="0"
height="26"
bottom="-1"
auto_resize="false"

View File

@ -387,7 +387,7 @@
width="394"
layout="topleft"
orientation="horizontal"
name="im_panels"
name="chat_stack"
top="40"
left="0">
<layout_panel
@ -437,10 +437,38 @@
top="0"
bottom="-1" />
</layout_panel>
<layout_panel
height="20"
visible="false"
auto_resize="false"
user_resize="false"
name="unread_messages_holder">
<view_border
top="0"
left="3"
right="-4"
height="19"
layout="topleft"
follows="left|right"
name="unread_messages_background"
bevel_style="in" />
<text
type="string"
length="1"
follows="left|top|right"
font="SansSerif"
layout="topleft"
name="unread_messages_text"
right="-4"
left="6"
height="14"
bottom="-3">
Unread Messages: [NUM]
</text>
</layout_panel>
<layout_panel
tab_group="3"
top_delta="0"
top="0"
height="26"
bottom="-1"
auto_resize="false"

View File

@ -163,11 +163,39 @@
top="0"
bottom="-1" />
</layout_panel>
<layout_panel
height="20"
visible="false"
auto_resize="false"
user_resize="false"
name="unread_messages_holder">
<view_border
top="0"
left="3"
right="-4"
height="19"
layout="topleft"
follows="left|right"
name="unread_messages_background"
bevel_style="in" />
<text
type="string"
length="1"
follows="left|top|right"
font="SansSerif"
layout="topleft"
name="unread_messages_text"
right="-4"
left="6"
height="14"
bottom="-3">
Unread Messages: [NUM]
</text>
</layout_panel>
<layout_panel
visibility_control="FSNearbyChatbar"
tab_group="2"
top_delta="0"
top="0"
height="26"
bottom="-1"
auto_resize="false"