From 83c66c978b64e0bc7149332ef65f252f2dc69736 Mon Sep 17 00:00:00 2001 From: Inusaito Sayori Date: Thu, 29 Aug 2013 13:35:35 -0400 Subject: [PATCH] Option to ding on each new IM for given private IM sessions Ding noises configurable via LiruNewMessageSound* debug settings --- indra/newview/app_settings/settings.xml | 26 +++++++++++++++ indra/newview/llimpanel.cpp | 33 ++++++++++++++++--- indra/newview/llimpanel.h | 4 ++- .../xui/en-us/floater_instant_message.xml | 2 ++ ...floater_instant_message_concisebuttons.xml | 2 ++ 5 files changed, 62 insertions(+), 5 deletions(-) diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index 6a95142e7..a943565fb 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -762,6 +762,32 @@ Value 20000 + LiruNewMessageSound + + Comment + Sound ID to play when ding is on for an IM session and an IM comes in. + Persist + 1 + Type + String + Value + 67cc2844-00f3-2b3c-b991-6418d01e1bb7 + IsCOA + 1 + + LiruNewMessageSoundForSystemMessages + + Comment + Sound ID to play when ding is on for an IM session and a system message comes through, like when the correspondent starts typing or logs off. (Defaults to off) + Persist + 1 + Type + String + Value + + IsCOA + 1 + LiruNoTransactionClutter Comment diff --git a/indra/newview/llimpanel.cpp b/indra/newview/llimpanel.cpp index 7e74326e0..4e9f37702 100644 --- a/indra/newview/llimpanel.cpp +++ b/indra/newview/llimpanel.cpp @@ -46,6 +46,7 @@ #include "llagent.h" #include "llavataractions.h" #include "llbutton.h" +#include "llcombobox.h" #include "llcallingcard.h" #include "llchat.h" #include "llconsole.h" @@ -549,6 +550,7 @@ BOOL LLFloaterIMPanel::postBuild() if (checkRequirements()) { + mDing = false; mRPMode = false; mInputEditor = getChild("chat_editor"); @@ -561,9 +563,10 @@ BOOL LLFloaterIMPanel::postBuild() mInputEditor->setReplaceNewlinesWithSpaces( FALSE ); mInputEditor->setPassDelete( TRUE ); - if (LLUICtrl* ctrl = findChild("instant_message_flyout")) + if (LLComboBox* flyout = findChild("instant_message_flyout")) { - ctrl->setCommitCallback(boost::bind(&LLFloaterIMPanel::onFlyoutCommit, this, _2)); + flyout->setCommitCallback(boost::bind(&LLFloaterIMPanel::onFlyoutCommit, this, flyout, _2)); + flyout->add(getString("ding off"), 6); } if (LLButton* btn = findChild("group_info_btn")) btn->setCommitCallback(boost::bind(LLGroupActions::show, mSessionUUID)); @@ -797,6 +800,13 @@ void LLFloaterIMPanel::addHistoryLine(const std::string &utf8msg, LLColor4 incol incolor = mKeywordsColor; } } + + if (mDing && (!hasFocus() || !gFocusMgr.getAppHasFocus())) + { + static const LLCachedControl ding("LiruNewMessageSound"); + static const LLCachedControl dong("LiruNewMessageSoundForSystemMessages"); + LLUI::sAudioCallback(LLUUID(source.notNull() ? ding : dong)); + } } const LLColor4& color = incolor; @@ -1053,13 +1063,12 @@ void LLFloaterIMPanel::onTabClick(void* userdata) self->setInputFocus(TRUE); } - void LLFloaterIMPanel::onRPMode(const LLSD& value) { mRPMode = value.asBoolean(); } -void LLFloaterIMPanel::onFlyoutCommit(const LLSD& value) +void LLFloaterIMPanel::onFlyoutCommit(LLComboBox* flyout, const LLSD& value) { if (value.isUndefined()) { @@ -1073,6 +1082,22 @@ void LLFloaterIMPanel::onFlyoutCommit(const LLSD& value) else if (option == 3) LLAvatarActions::teleportRequest(mOtherParticipantUUID); else if (option == 4) LLAvatarActions::pay(mOtherParticipantUUID); else if (option == 5) LLAvatarActions::inviteToGroup(mOtherParticipantUUID); + else if (option >= 6) // Options that change labels need to stay in order at the end + { + std::string ding_label(mDing ? getString("ding on") : getString("ding off")); + // First remove them all + flyout->remove(ding_label); + + // Toggle as requested, adjust the strings + if (option == 6) + { + mDing = !mDing; + ding_label = mDing ? getString("ding on") : getString("ding off"); + } + + // Last add them back + flyout->add(ding_label, 6); + } } void LLFloaterIMPanel::onClickHistory() diff --git a/indra/newview/llimpanel.h b/indra/newview/llimpanel.h index 9e56ad0e7..175ad4648 100644 --- a/indra/newview/llimpanel.h +++ b/indra/newview/llimpanel.h @@ -115,7 +115,7 @@ public: void onClickHistory(); void onRPMode(const LLSD& value); - void onFlyoutCommit(const LLSD& value); + void onFlyoutCommit(class LLComboBox* flyout, const LLSD& value); static void onClickStartCall( void* userdata ); static void onClickEndCall( void* userdata ); void onClickToggleActiveSpeakers(const LLSD& value); @@ -240,6 +240,8 @@ private: BOOL mProfileButtonEnabled; BOOL mCallBackEnabled; + bool mDing; // Whether or not to play a ding on new messages + LLIMSpeakerMgr* mSpeakers; LLParticipantList* mSpeakerPanel; diff --git a/indra/newview/skins/default/xui/en-us/floater_instant_message.xml b/indra/newview/skins/default/xui/en-us/floater_instant_message.xml index d72e92a0c..59846ecf2 100644 --- a/indra/newview/skins/default/xui/en-us/floater_instant_message.xml +++ b/indra/newview/skins/default/xui/en-us/floater_instant_message.xml @@ -18,6 +18,8 @@ + + RP Mode