Option to ding on each new IM for given private IM sessions

Ding noises configurable via LiruNewMessageSound* debug settings
This commit is contained in:
Inusaito Sayori
2013-08-29 13:35:35 -04:00
parent 344909c0a3
commit 83c66c978b
5 changed files with 62 additions and 5 deletions

View File

@@ -762,6 +762,32 @@
<key>Value</key>
<integer>20000</integer>
</map>
<key>LiruNewMessageSound</key>
<map>
<key>Comment</key>
<string>Sound ID to play when ding is on for an IM session and an IM comes in.</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string>67cc2844-00f3-2b3c-b991-6418d01e1bb7</string>
<key>IsCOA</key>
<integer>1</integer>
</map>
<key>LiruNewMessageSoundForSystemMessages</key>
<map>
<key>Comment</key>
<string>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)</string>
<key>Persist</key>
<integer>1</integer>
<key>Type</key>
<string>String</string>
<key>Value</key>
<string/>
<key>IsCOA</key>
<integer>1</integer>
</map>
<key>LiruNoTransactionClutter</key>
<map>
<key>Comment</key>

View File

@@ -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<LLLineEditor>("chat_editor");
@@ -561,9 +563,10 @@ BOOL LLFloaterIMPanel::postBuild()
mInputEditor->setReplaceNewlinesWithSpaces( FALSE );
mInputEditor->setPassDelete( TRUE );
if (LLUICtrl* ctrl = findChild<LLUICtrl>("instant_message_flyout"))
if (LLComboBox* flyout = findChild<LLComboBox>("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<LLButton>("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<std::string> ding("LiruNewMessageSound");
static const LLCachedControl<std::string> 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()

View File

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

View File

@@ -18,6 +18,8 @@
<flyout_button_item label="Pay" name="profile_tele_btn" value="4"/>
<flyout_button_item label="Invite To Group" name="profile_tele_btn" value="5"/>
</flyout_button>
<string name="ding on" value="Ding on new messages (On)"/>
<string name="ding off" value="Ding on new messages (Off)"/>
<check_box bottom="-37" follows="top" height="20" left_delta="80" name="rp_mode">RP Mode</check_box>
<button bottom="-37" follows="left|top" height="20" image_overlay="icn_voice-call-start.tga" image_overlay_alignment="left" label="Call" left_delta="80" name="start_call_btn" width="80"/>
<button bottom="-37" follows="top" height="20" image_overlay="icn_voice-call-end.tga" image_overlay_alignment="left" label="End" name="end_call_btn" visible="false" width="80"/>

View File

@@ -18,6 +18,8 @@
<flyout_button_item label="Pay" name="profile_tele_btn" value="4"/>
<flyout_button_item label="Invite To Group" name="profile_tele_btn" value="5"/>
</flyout_button>
<string name="ding on" value="Ding on new messages (On)"/>
<string name="ding off" value="Ding on new messages (Off)"/>
<check_box bottom="-20" follows="right|top" height="20" left_delta="90" name="rp_mode">RP Mode</check_box>
<button bottom="-20" follows="right|top" height="20" image_overlay="icn_voice-call-start.tga" image_overlay_alignment="left" label="Call" left_delta="67" name="start_call_btn" width="60"/>
<button bottom="-20" follows="right|top" height="20" image_overlay="icn_voice-call-end.tga" image_overlay_alignment="left" scale_image="true" label="End" name="end_call_btn" width="24"/>