Added option to flash the chat toolbar button if new nearby chat or (group) IMs arrived:

* The corresponding floater must be docked to the conversations floater and the conversations floater must be closed for the button to flash
* The option to flash when new (group) IMs arrived is only available if IMs are shown in tabs and not as separate windows
master
Ansariel 2014-02-05 13:59:24 +01:00
parent 1f46c7387c
commit c69406e4f7
7 changed files with 99 additions and 11 deletions

View File

@ -21801,6 +21801,28 @@ Change of this parameter will affect the layout of buttons in notification toast
<key>Value</key>
<integer>1</integer>
</map>
<key>FSNotifyNearbyChatFlash</key>
<map>
<key>Comment</key>
<string>Flash FUI button if new nearby chat arrived and conversations floater is closed (nearby chat floater must be docked to conversations floater)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
<key>FSNotifyIMFlash</key>
<map>
<key>Comment</key>
<string>Flash FUI button if new (group) IMs arrived and conversations floater is closed (IM floater must be docked to conversations floater and IMs must be shown in tabs)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>Boolean</string>
<key>Value</key>
<integer>1</integer>
</map>
</map>
</llsd>

View File

@ -269,6 +269,18 @@ void FSFloaterIMContainer::removeFloater(LLFloater* floaterp)
}
// [/SL:KB]
bool FSFloaterIMContainer::hasFloater(LLFloater* floaterp)
{
for (S32 i = 0; i < mTabContainer->getTabCount(); ++i)
{
if (dynamic_cast<LLFloater*>(mTabContainer->getPanelByIndex(i)) == floaterp)
{
return true;
}
}
return false;
}
void FSFloaterIMContainer::onCloseFloater(LLUUID& id)
{
mSessions.erase(id);

View File

@ -58,6 +58,7 @@ public:
// [SL:KB] - Patch: Chat-NearbyChatBar | Checked: 2011-12-11 (Catznip-3.2.0d) | Added: Catznip-3.2.0d
/*virtual*/ void removeFloater(LLFloater* floaterp);
// [/SL:KB]
bool hasFloater(LLFloater* floaterp);
static FSFloaterIMContainer* findInstance();
static FSFloaterIMContainer* getInstance();

View File

@ -2450,6 +2450,14 @@ BOOL LLPanelPreference::postBuild()
}
}
// <FS:Ansariel> Flash chat toolbar button notification
if (hasChild("FSNotifyIMFlash", TRUE))
{
gSavedSettings.getControl("FSChatWindow")->getSignal()->connect(boost::bind(&LLPanelPreference::onChatWindowChanged, this));
onChatWindowChanged();
}
// </FS:Ansariel>
////////////////////// PanelVoice ///////////////////
if (hasChild("voice_unavailable", TRUE))
{
@ -2655,6 +2663,13 @@ void LLPanelPreference::onEnableGrowlChanged()
}
// </FS:Ansariel>
// <FS:Ansariel> Flash chat toolbar button notification
void LLPanelPreference::onChatWindowChanged()
{
getChild<LLCheckBoxCtrl>("FSNotifyIMFlash")->setEnabled(gSavedSettings.getS32("FSChatWindow") == 1);
}
// </FS:Ansariel>
void LLPanelPreference::cancel()
{
for (control_values_map_t::iterator iter = mSavedValues.begin();

View File

@ -277,6 +277,8 @@ private:
// <FS:Ansariel> Only enable Growl checkboxes if Growl is usable
void onEnableGrowlChanged();
// <FS:Ansariel> Flash chat toolbar button notification
void onChatWindowChanged();
typedef std::map<std::string, LLColor4> string_color_map_t;
string_color_map_t mSavedColors;

View File

@ -82,6 +82,7 @@
#include "exogroupmutelist.h"
#include "fsconsoleutils.h"
#include "fscommon.h"
#include "fsfloaternearbychat.h"
#ifdef OPENSIM
#include "llviewernetwork.h"
#endif // OPENSIM
@ -409,15 +410,21 @@ void notify_of_message(const LLSD& msg, bool is_dnd_msg)
LLUUID participant_id = msg["from_id"].asUUID();
LLUUID session_id = msg["session_id"].asUUID();
// Ansa: CHUI routes nearby chat through here with session id = null uuid!
if (session_id.isNull())
// do not show toast in busy mode or it goes from agent
if (gAgent.isDoNotDisturb() || gAgent.getID() == participant_id)
{
return;
}
// do not show toast in busy mode or it goes from agent
if (gAgent.isDoNotDisturb() || gAgent.getID() == participant_id)
// Ansa: CHUI routes nearby chat through here with session id = null uuid!
if (session_id.isNull())
{
FSFloaterIMContainer* im_container = FSFloaterIMContainer::getInstance();
if (!im_container->getVisible() && im_container->hasFloater(FSFloaterNearbyChat::getInstance())
&& gSavedSettings.getBOOL("FSNotifyNearbyChatFlash"))
{
gToolBarView->flashCommand(LLCommandId("chat"), true, FSFloaterIMContainer::getInstance()->isMinimized());
}
return;
}
@ -428,7 +435,20 @@ void notify_of_message(const LLSD& msg, bool is_dnd_msg)
}
// </FS:Ansariel> Don't toast if the message is an announcement
// <FS:Ansariel> (Group-)IMs in chat console
// Skip toasting for system messages
if (participant_id.isNull())
{
return;
}
FSFloaterIMContainer* im_container = FSFloaterIMContainer::getInstance();
if (!im_container->getVisible() && im_container->hasFloater(FSFloaterIM::getInstance(session_id))
&& gSavedSettings.getBOOL("FSNotifyIMFlash"))
{
gToolBarView->flashCommand(LLCommandId("chat"), true, FSFloaterIMContainer::getInstance()->isMinimized());
}
// <FS:Ansariel> (Group-)IMs in chat console
if (FSConsoleUtils::ProcessInstantMessage(session_id, participant_id, msg["message"].asString()))
{
return;
@ -442,12 +462,6 @@ void notify_of_message(const LLSD& msg, bool is_dnd_msg)
return;
}
// Skip toasting for system messages
if (participant_id.isNull())
{
return;
}
// *NOTE Skip toasting if the user disable it in preferences/debug settings ~Alexandrea
LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(session_id);
if (!gSavedSettings.getBOOL("EnableGroupChatPopups") && session->isGroupSessionType())

View File

@ -632,6 +632,28 @@
control_name="FSIMChatFlashOnFriendStatusChange"
label="Flash IM tabs when friends come online or go offline"/>
<check_box
layout="topleft"
follows="left|top"
top_pad="1"
width="400"
height="18"
name="FSNotifyNearbyChatFlash"
control_name="FSNotifyNearbyChatFlash"
label="Flash chat toolbar button if new nearby chat arrives"
tool_tip="Flashes the chat toolbar button if a new nearby chat arrives. The nearby chat window must be docked to the conversations window and the conversations window must be closed for the button to flash."/>
<check_box
layout="topleft"
follows="left|top"
top_pad="1"
width="400"
height="18"
name="FSNotifyIMFlash"
control_name="FSNotifyIMFlash"
label="Flash chat toolbar button if new a IM arrives"
tool_tip="Flashes the chat toolbar button if a new (group) IM arrives. The IM window must be docked to the conversations window and the conversations window must be closed for the button to flash. This option is only available if IMs will be shown in tabs instead of separate windows (see &quot;General&quot; tab)."/>
<check_box
layout="topleft"
follows="left|top"