From 524e7cc347679bd331b21cb89298f5f4d27cebc0 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Tue, 20 Oct 2015 09:52:16 +0200 Subject: [PATCH] Make unread IM counter in application window title optional --- indra/newview/app_settings/settings.xml | 11 +++++++ indra/newview/llchiclet.cpp | 29 +++++++++---------- indra/newview/llchiclet.h | 2 ++ .../default/xui/de/panel_preferences_chat.xml | 1 + .../default/xui/en/panel_preferences_chat.xml | 13 ++++++++- 5 files changed, 40 insertions(+), 16 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 06d4801e1f..64fdebd383 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -23682,6 +23682,17 @@ Change of this parameter will affect the layout of buttons in notification toast Value 0 + FSShowMessageCountInWindowTitle + + Comment + Displays the number of unread IMs in the application window title. + Persist + 1 + Type + Boolean + Value + 0 + diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index 99b18833cd..f8e9a2fca1 100755 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -199,6 +199,8 @@ LLIMWellChiclet::LLIMWellChiclet(const Params& p) LLIMMgr::getInstance()->addSessionObserver(this); LLIMWellWindow::getInstance()->setSysWellChiclet(this); + + gSavedSettings.getControl("FSShowMessageCountInWindowTitle")->getSignal()->connect(boost::bind(&LLIMWellChiclet::updateApplicationWindowTitle, this)); } LLIMWellChiclet::~LLIMWellChiclet() @@ -281,25 +283,22 @@ void LLIMWellChiclet::messageCountChanged(const LLSD& session_data) mFlashToLitTimer->stopFlashing(); } - // Unread IMs counter in window title - std::string window_title; - if (counter > 99) + setCounter(counter); + + updateApplicationWindowTitle(); +} + +void LLIMWellChiclet::updateApplicationWindowTitle() +{ + std::string window_title = gWindowTitle; + + if (gSavedSettings.getBOOL("FSShowMessageCountInWindowTitle") && mCounter > 0) { - window_title = "(99+) " + gWindowTitle; - } - else if (counter > 0) - { - window_title = "(" + llformat("%d", counter) + ") " + gWindowTitle; - } - else - { - window_title = gWindowTitle; + window_title = "(" + mButton->getLabelUnselected() + ") " + gWindowTitle; } + LLStringUtil::truncate(window_title, 255); gViewerWindow->getWindow()->setTitle(window_title); - // - - setCounter(counter); } // [FS communication UI] diff --git a/indra/newview/llchiclet.h b/indra/newview/llchiclet.h index 49dd94994f..3ea58b3067 100755 --- a/indra/newview/llchiclet.h +++ b/indra/newview/llchiclet.h @@ -986,6 +986,8 @@ protected: * @see LLIMMgr::getNumberOfUnreadParticipantMessages() */ void messageCountChanged(const LLSD& session_data); + + void updateApplicationWindowTitle(); }; // [FS communication UI] diff --git a/indra/newview/skins/default/xui/de/panel_preferences_chat.xml b/indra/newview/skins/default/xui/de/panel_preferences_chat.xml index da385b4fb1..228c9fcee3 100755 --- a/indra/newview/skins/default/xui/de/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/de/panel_preferences_chat.xml @@ -180,6 +180,7 @@ IM-Text vor dem Hintergrund des Chatverlaufs ausblenden + diff --git a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml index f0552b6f3e..2314e7d20f 100755 --- a/indra/newview/skins/default/xui/en/panel_preferences_chat.xml +++ b/indra/newview/skins/default/xui/en/panel_preferences_chat.xml @@ -1133,9 +1133,20 @@ left="20" width="400" height="18" + name="FSShowMessageCountInWindowTitle" + control_name="FSShowMessageCountInWindowTitle" + label="Show number of unread IMs in Firestorm's window title"/> + + + label="Announce incoming IMs as soon as the sender starts typing"/>