From 3fdcb8751a1f36dbce9d7a3fd1d785160d356d3a Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Fri, 13 Apr 2012 23:31:01 +0300 Subject: CHUI-91 FIXED Moved block list to a separate People floater tab. --- indra/newview/llchathistory.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llchathistory.cpp') diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index f530d10ddc..5bdfb5adbc 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -143,7 +143,8 @@ public: { LLMuteList::getInstance()->add(LLMute(getAvatarId(), mFrom, LLMute::OBJECT)); - LLFloaterSidePanelContainer::showPanel("people", "panel_block_list_sidetray", LLSD().with("blocked_to_select", getAvatarId())); + LLFloaterSidePanelContainer::showPanel("people", "panel_people", + LLSD().with("people_panel_tab_name", "blocked_panel").with("blocked_to_select", getAvatarId())); } } -- cgit v1.3 From f948ba82a985c2fec5ed1e65a55bd68f6e811197 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Fri, 4 May 2012 22:08:13 +0300 Subject: CHUI-103 WIP Added support for showing/hiding timestamp and names, replacing own name with (You) --- indra/newview/llchathistory.cpp | 30 ++++++++++++++++++-------- indra/newview/skins/default/xui/en/strings.xml | 1 + 2 files changed, 22 insertions(+), 9 deletions(-) (limited to 'indra/newview/llchathistory.cpp') diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 5bdfb5adbc..143d4ff4fe 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -778,15 +778,19 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL if (use_plain_text_chat_history) { LLStyle::Params timestamp_style(style_params); - if (!message_from_log) + + if (args["show_time"].asBoolean()) { - LLColor4 timestamp_color = LLUIColorTable::instance().getColor("ChatTimestampColor"); - timestamp_style.color(timestamp_color); - timestamp_style.readonly_color(timestamp_color); + if (!message_from_log) + { + LLColor4 timestamp_color = LLUIColorTable::instance().getColor("ChatTimestampColor"); + timestamp_style.color(timestamp_color); + timestamp_style.readonly_color(timestamp_color); + } + mEditor->appendText("[" + chat.mTimeStr + "] ", mEditor->getText().size() != 0, timestamp_style); } - mEditor->appendText("[" + chat.mTimeStr + "] ", mEditor->getText().size() != 0, timestamp_style); - if (utf8str_trim(chat.mFromName).size() != 0) + if (args["show_names_in_p2p_chat"].asBoolean() && utf8str_trim(chat.mFromName).size() != 0) { // Don't hotlink any messages from the system (e.g. "Second Life:"), so just add those in plain text. if ( chat.mSourceType == CHAT_SOURCE_OBJECT && chat.mFromID.notNull()) @@ -806,13 +810,21 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL mEditor->appendText(chat.mFromName + delimiter, false, link_params); } - else if ( chat.mFromName != SYSTEM_FROM && chat.mFromID.notNull() && !message_from_log) + else if (chat.mFromName != SYSTEM_FROM && chat.mFromID.notNull() && !message_from_log) { LLStyle::Params link_params(style_params); link_params.overwriteFrom(LLStyleMap::instance().lookupAgent(chat.mFromID)); - // Add link to avatar's inspector and delimiter to message. - mEditor->appendText(std::string(link_params.link_href) + delimiter, false, link_params); + if (gAgentID == chat.mFromID) + { std::string localized_name; + bool is_localized = LLTrans::findString(localized_name, "AgentNameSubst"); + mEditor->appendText((is_localized? localized_name:"(You)") + delimiter, false, link_params); + } + else + { + // Add link to avatar's inspector and delimiter to message. + mEditor->appendText(std::string(link_params.link_href) + delimiter, false, link_params); + } } else { diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 9752652679..0beb8ed0ab 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -405,6 +405,7 @@ Please try logging in again in a minute. Track your camera Control your camera Not Connected + (You) General -- cgit v1.3 From 79928c65329146920558d9bc286f643ccf8dca7f Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Mon, 7 May 2012 20:05:07 +0300 Subject: CHUI-103 Repair drawing messages with prepend new line --- indra/newview/llchathistory.cpp | 21 ++++++++++++++------- indra/newview/llchathistory.h | 4 ++++ 2 files changed, 18 insertions(+), 7 deletions(-) (limited to 'indra/newview/llchathistory.cpp') diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 143d4ff4fe..30b2839547 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -775,10 +775,13 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL style_params.readonly_color(LLColor4::grey); } + mPrependNewLineState = (mEditor->getText().size() != 0)? 1 : 0; + if (use_plain_text_chat_history) { LLStyle::Params timestamp_style(style_params); + // timestams showing if (args["show_time"].asBoolean()) { if (!message_from_log) @@ -787,9 +790,10 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL timestamp_style.color(timestamp_color); timestamp_style.readonly_color(timestamp_color); } - mEditor->appendText("[" + chat.mTimeStr + "] ", mEditor->getText().size() != 0, timestamp_style); + mEditor->appendText("[" + chat.mTimeStr + "] ", isNeedPrependNewline(), timestamp_style); } + // names showing if (args["show_names_in_p2p_chat"].asBoolean() && utf8str_trim(chat.mFromName).size() != 0) { // Don't hotlink any messages from the system (e.g. "Second Life:"), so just add those in plain text. @@ -807,8 +811,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL link_params.is_link = true; link_params.link_href = url; - mEditor->appendText(chat.mFromName + delimiter, - false, link_params); + mEditor->appendText(chat.mFromName + delimiter, isNeedPrependNewline(), link_params); } else if (chat.mFromName != SYSTEM_FROM && chat.mFromID.notNull() && !message_from_log) { @@ -818,22 +821,26 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL if (gAgentID == chat.mFromID) { std::string localized_name; bool is_localized = LLTrans::findString(localized_name, "AgentNameSubst"); - mEditor->appendText((is_localized? localized_name:"(You)") + delimiter, false, link_params); + mEditor->appendText((is_localized? localized_name:"(You)") + delimiter, + isNeedPrependNewline(), link_params); } else { // Add link to avatar's inspector and delimiter to message. - mEditor->appendText(std::string(link_params.link_href) + delimiter, false, link_params); + mEditor->appendText(std::string(link_params.link_href) + delimiter, + isNeedPrependNewline(), link_params); } } else { - mEditor->appendText("" + chat.mFromName + "" + delimiter, false, style_params); + mEditor->appendText("" + chat.mFromName + "" + delimiter, + isNeedPrependNewline(), style_params); } } } else { + mPrependNewLineState = 0; LLView* view = NULL; LLInlineViewSegment::Params p; p.force_newline = true; @@ -956,7 +963,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL message = chat.mFromName + message; } - mEditor->appendText(message, FALSE, style_params); + mEditor->appendText(message, isNeedPrependNewline(), style_params); } mEditor->blockUndo(); diff --git a/indra/newview/llchathistory.h b/indra/newview/llchathistory.h index 28344e6a10..4cd9c75e1c 100644 --- a/indra/newview/llchathistory.h +++ b/indra/newview/llchathistory.h @@ -138,6 +138,10 @@ class LLChatHistory : public LLUICtrl S32 mTopHeaderPad; S32 mBottomHeaderPad; + S32 mPrependNewLineState; + + bool isNeedPrependNewline() {return (mPrependNewLineState-- > 0);} + class LLLayoutPanel* mMoreChatPanel; LLTextBox* mMoreChatText; LLTextEditor* mEditor; -- cgit v1.3 From 7b8251fd2f169136fc45e4c17104da676f75727b Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Mon, 7 May 2012 21:54:09 +0300 Subject: CHUI-103 WIP Added settings for switching text view mode --- indra/newview/app_settings/settings.xml | 23 +++++++++++++++++++++++ indra/newview/llchathistory.cpp | 24 +++++++++++++++--------- indra/newview/llchathistory.h | 4 ---- indra/newview/llimfloater.cpp | 3 +++ 4 files changed, 41 insertions(+), 13 deletions(-) (limited to 'indra/newview/llchathistory.cpp') diff --git a/indra/newview/app_settings/settings.xml b/indra/newview/app_settings/settings.xml index ee8c15752b..e6d0ed7dfa 100644 --- a/indra/newview/app_settings/settings.xml +++ b/indra/newview/app_settings/settings.xml @@ -2,6 +2,29 @@ + IMShowTime + + Comment + Enable(disable) timestamp showing in the chat. + Persist + 1 + Type + Boolean + Value + 1 + + IMShowNamesForP2PConv + + Comment + Enable(disable) showing of a names in the chat. + Persist + 1 + Type + Boolean + Value + 1 + + CrashHostUrl Comment diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index 30b2839547..b70e98f22b 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -775,7 +775,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL style_params.readonly_color(LLColor4::grey); } - mPrependNewLineState = (mEditor->getText().size() != 0)? 1 : 0; + bool prependNewLineState = mEditor->getText().size() != 0; if (use_plain_text_chat_history) { @@ -790,11 +790,12 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL timestamp_style.color(timestamp_color); timestamp_style.readonly_color(timestamp_color); } - mEditor->appendText("[" + chat.mTimeStr + "] ", isNeedPrependNewline(), timestamp_style); + mEditor->appendText("[" + chat.mTimeStr + "] ", prependNewLineState, timestamp_style); + prependNewLineState = false; } // names showing - if (args["show_names_in_p2p_chat"].asBoolean() && utf8str_trim(chat.mFromName).size() != 0) + if (args["show_names_for_p2p_conv"].asBoolean() && utf8str_trim(chat.mFromName).size() != 0) { // Don't hotlink any messages from the system (e.g. "Second Life:"), so just add those in plain text. if ( chat.mSourceType == CHAT_SOURCE_OBJECT && chat.mFromID.notNull()) @@ -811,7 +812,8 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL link_params.is_link = true; link_params.link_href = url; - mEditor->appendText(chat.mFromName + delimiter, isNeedPrependNewline(), link_params); + mEditor->appendText(chat.mFromName + delimiter, prependNewLineState, link_params); + prependNewLineState = false; } else if (chat.mFromName != SYSTEM_FROM && chat.mFromID.notNull() && !message_from_log) { @@ -822,25 +824,28 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL { std::string localized_name; bool is_localized = LLTrans::findString(localized_name, "AgentNameSubst"); mEditor->appendText((is_localized? localized_name:"(You)") + delimiter, - isNeedPrependNewline(), link_params); + prependNewLineState, link_params); + prependNewLineState = false; } else { // Add link to avatar's inspector and delimiter to message. mEditor->appendText(std::string(link_params.link_href) + delimiter, - isNeedPrependNewline(), link_params); + prependNewLineState, link_params); + prependNewLineState = false; } } else { mEditor->appendText("" + chat.mFromName + "" + delimiter, - isNeedPrependNewline(), style_params); + prependNewLineState, style_params); + prependNewLineState = false; } } } else { - mPrependNewLineState = 0; + prependNewLineState = 0; LLView* view = NULL; LLInlineViewSegment::Params p; p.force_newline = true; @@ -963,7 +968,8 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL message = chat.mFromName + message; } - mEditor->appendText(message, isNeedPrependNewline(), style_params); + mEditor->appendText(message, prependNewLineState, style_params); + prependNewLineState = false; } mEditor->blockUndo(); diff --git a/indra/newview/llchathistory.h b/indra/newview/llchathistory.h index 4cd9c75e1c..28344e6a10 100644 --- a/indra/newview/llchathistory.h +++ b/indra/newview/llchathistory.h @@ -138,10 +138,6 @@ class LLChatHistory : public LLUICtrl S32 mTopHeaderPad; S32 mBottomHeaderPad; - S32 mPrependNewLineState; - - bool isNeedPrependNewline() {return (mPrependNewLineState-- > 0);} - class LLLayoutPanel* mMoreChatPanel; LLTextBox* mMoreChatText; LLTextEditor* mEditor; diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index f67464078b..f743b5e2bf 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -630,6 +630,9 @@ void LLIMFloater::updateMessages() { LLSD chat_args; chat_args["use_plain_text_chat_history"] = use_plain_text_chat_history; + chat_args["show_time"] = gSavedSettings.getBOOL("IMShowTime"); + chat_args["show_names_for_p2p_conv"] = + gSavedSettings.getBOOL("IMShowNamesForP2PConv"); std::ostringstream message; std::list::const_reverse_iterator iter = messages.rbegin(); -- cgit v1.3 From df58153514f6b361c65efc5dd6d31d39f68603c0 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Mon, 14 May 2012 15:44:57 +0300 Subject: CHUI-113 WIP all voice controls is moved from a IM-control panel to the IM floater; IMControlPanel is removed; simplified voice button's listener behavior --- indra/newview/llchathistory.cpp | 14 +- indra/newview/llimfloater.cpp | 192 +++++++++++++----- indra/newview/llimfloater.h | 30 ++- indra/newview/llpanelimcontrolpanel.cpp | 221 +-------------------- indra/newview/llpanelimcontrolpanel.h | 31 +-- .../skins/default/xui/en/floater_im_session.xml | 16 +- 6 files changed, 202 insertions(+), 302 deletions(-) (limited to 'indra/newview/llchathistory.cpp') diff --git a/indra/newview/llchathistory.cpp b/indra/newview/llchathistory.cpp index b70e98f22b..3214c95600 100644 --- a/indra/newview/llchathistory.cpp +++ b/indra/newview/llchathistory.cpp @@ -700,9 +700,10 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL return; } + bool from_me = chat.mFromID == gAgent.getID(); mEditor->setPlainText(use_plain_text_chat_history); - if (!mEditor->scrolledToEnd() && chat.mFromID != gAgent.getID() && !chat.mFromName.empty()) + if (!mEditor->scrolledToEnd() && !from_me && !chat.mFromName.empty()) { mUnreadChatSources.insert(chat.mFromName); mMoreChatPanel->setVisible(TRUE); @@ -777,6 +778,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL bool prependNewLineState = mEditor->getText().size() != 0; + // show timestamps and names in the compact mode if (use_plain_text_chat_history) { LLStyle::Params timestamp_style(style_params); @@ -820,7 +822,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL LLStyle::Params link_params(style_params); link_params.overwriteFrom(LLStyleMap::instance().lookupAgent(chat.mFromID)); - if (gAgentID == chat.mFromID) + if (from_me) { std::string localized_name; bool is_localized = LLTrans::findString(localized_name, "AgentNameSubst"); mEditor->appendText((is_localized? localized_name:"(You)") + delimiter, @@ -843,9 +845,9 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL } } } - else + else // showing timestamp and name in the expanded mode { - prependNewLineState = 0; + prependNewLineState = false; LLView* view = NULL; LLInlineViewSegment::Params p; p.force_newline = true; @@ -953,7 +955,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL //MESSAGE TEXT PROCESSING //*HACK getting rid of redundant sender names in system notifications sent using sender name (see EXT-5010) - if (use_plain_text_chat_history && gAgentID != chat.mFromID && chat.mFromID.notNull()) + if (use_plain_text_chat_history && !from_me && chat.mFromID.notNull()) { std::string slurl_about = SLURL_APP_AGENT + chat.mFromID.asString() + SLURL_ABOUT; if (message.length() > slurl_about.length() && @@ -975,7 +977,7 @@ void LLChatHistory::appendMessage(const LLChat& chat, const LLSD &args, const LL mEditor->blockUndo(); // automatically scroll to end when receiving chat from myself - if (chat.mFromID == gAgentID) + if (from_me) { mEditor->setCursorAndScrollToEnd(); } diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index b2a5c4a64d..248e50eefa 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -51,14 +51,12 @@ #include "llchathistory.h" #include "llnotifications.h" #include "llviewerwindow.h" -#include "llvoicechannel.h" #include "lltransientfloatermgr.h" #include "llinventorymodel.h" #include "llrootview.h" #include "llspeakers.h" #include "llviewerchat.h" - LLIMFloater::LLIMFloater(const LLUUID& session_id) : LLTransientDockableFloater(NULL, true, session_id), mControlPanel(NULL), @@ -85,11 +83,8 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id) mSessionInitialized = im_session->mSessionInitialized; mDialog = im_session->mType; - switch(mDialog){ - case IM_NOTHING_SPECIAL: - case IM_SESSION_P2P_INVITE: - mFactoryMap["panel_im_control_panel"] = LLCallbackMap(createPanelIMControl, this); - break; + switch (mDialog) + { case IM_SESSION_CONFERENCE_START: mFactoryMap["panel_im_control_panel"] = LLCallbackMap(createPanelAdHocControl, this); break; @@ -106,6 +101,8 @@ LLIMFloater::LLIMFloater(const LLUUID& session_id) mFactoryMap["panel_im_control_panel"] = LLCallbackMap(createPanelAdHocControl, this); } break; + case IM_NOTHING_SPECIAL: + case IM_SESSION_P2P_INVITE: default: break; } @@ -143,7 +140,8 @@ bool LLIMFloater::onIMShowModesMenuItemEnable(const LLSD& userdata) std::string item = userdata.asString(); bool plain_text = gSavedSettings.getBOOL("PlainTextChatHistory"); bool is_not_names = (item != "IMShowNamesForP2PConv"); - bool is_p2p_chat = (mDialog == IM_SESSION_P2P_INVITE || mDialog == IM_NOTHING_SPECIAL); + LLIMModel::LLIMSession* im_session = LLIMModel::instance().findIMSession(mSessionID); + bool is_p2p_chat = im_session && im_session->isP2PSessionType(); return (plain_text && (is_not_names || is_p2p_chat)); } @@ -289,6 +287,12 @@ void LLIMFloater::sendMsg() LLIMFloater::~LLIMFloater() { + mVoiceChannelStateChangeConnection.disconnect(); + if(LLVoiceClient::instanceExists()) + { + LLVoiceClient::getInstance()->removeObserver(this); + } + LLTransientFloaterMgr::getInstance()->removeControlView(LLTransientFloaterMgr::IM, this); } @@ -301,15 +305,27 @@ BOOL LLIMFloater::postBuild() mOtherParticipantUUID = other_party_id; } - mControlPanel->setSessionId(mSessionID); - mControlPanel->getParent()->setVisible(gSavedSettings.getBOOL("IMShowControlPanel")); + boundVoiceChannel(); getChild("close_btn")->setCommitCallback(boost::bind(&LLFloater::onClickClose, this)); mExpandCollapseBtn = getChild("expand_collapse_btn"); - mExpandCollapseBtn->setImageOverlay(getString(mControlPanel->getParent()->getVisible() ? "collapse_icon" : "expand_icon")); mExpandCollapseBtn->setClickedCallback(boost::bind(&LLIMFloater::onSlide, this)); + if (mControlPanel) + { + mControlPanel->setSessionId(mSessionID); + mControlPanel->getParent()->setVisible(gSavedSettings.getBOOL("IMShowControlPanel")); + + mExpandCollapseBtn->setImageOverlay( + getString(mControlPanel->getParent()->getVisible() ? "collapse_icon" : "expand_icon")); + } + else + { + mExpandCollapseBtn->setEnabled(false); + getChild("im_control_panel_holder")->setVisible(false); + } + mTearOffBtn = getChild("tear_off_btn"); mTearOffBtn->setCommitCallback(boost::bind(&LLFloater::onClickTearOff, this)); @@ -358,6 +374,10 @@ BOOL LLIMFloater::postBuild() std::string session_name(LLIMModel::instance().getName(mSessionID)); updateSessionName(session_name, session_name); } + + childSetAction("voice_call_btn", boost::bind(&LLIMFloater::onCallButtonClicked, this)); + + LLVoiceClient::getInstance()->addObserver(this); //*TODO if session is not initialized yet, add some sort of a warning message like "starting session...blablabla" //see LLFloaterIMPanel for how it is done (IB) @@ -372,6 +392,89 @@ BOOL LLIMFloater::postBuild() } } +void LLIMFloater::boundVoiceChannel() +{ + LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); + if(voice_channel) + { + mVoiceChannelStateChangeConnection = voice_channel->setStateChangedCallback( + boost::bind(&LLIMFloater::onVoiceChannelStateChanged, this, _1, _2)); + + //call (either p2p, group or ad-hoc) can be already in started state + updateCallState(voice_channel->getState()); + } +} + +void LLIMFloater::updateCallState(LLVoiceChannel::EState state) +{ + bool is_call_started = state >= LLVoiceChannel::STATE_CALL_STARTED; + getChild("voice_call_btn")->setImageOverlay( + is_call_started? getString("call_btn_stop") : getString("call_btn_start")); + enableDisableCallBtn(); + +} + +void LLIMFloater::enableDisableCallBtn() +{ + bool voice_enabled = LLVoiceClient::getInstance()->voiceEnabled() + && LLVoiceClient::getInstance()->isVoiceWorking(); + + LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(mSessionID); + + if (!session) + { + getChildView("voice_call_btn")->setEnabled(false); + return; + } + + bool session_initialized = session->mSessionInitialized; + bool callback_enabled = session->mCallBackEnabled; + + BOOL enable_connect = session_initialized + && voice_enabled + && callback_enabled; + getChildView("voice_call_btn")->setEnabled(enable_connect); +} + + +void LLIMFloater::onCallButtonClicked() +{ + LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); + if (voice_channel) + { + bool is_call_active = voice_channel->getState() >= LLVoiceChannel::STATE_CALL_STARTED; + if (is_call_active) + { + gIMMgr->endCall(mSessionID); + } + else + { + gIMMgr->startCall(mSessionID); + } + } +} + +/*void LLIMFloater::onOpenVoiceControlsClicked() +{ + LLFloaterReg::showInstance("voice_controls"); +}*/ + +void LLIMFloater::onChange(EStatusType status, const std::string &channelURI, bool proximal) +{ + if(status == STATUS_JOINING || status == STATUS_LEFT_CHANNEL) + { + return; + } + + enableDisableCallBtn(); +} + +void LLIMFloater::onVoiceChannelStateChanged( + const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state) +{ + updateCallState(new_state); +} + void LLIMFloater::updateSessionName(const std::string& ui_title, const std::string& ui_label) { @@ -404,17 +507,6 @@ void LLIMFloater::draw() LLTransientDockableFloater::draw(); } - -// static -void* LLIMFloater::createPanelIMControl(void* userdata) -{ - LLIMFloater *self = (LLIMFloater*)userdata; - self->mControlPanel = new LLPanelIMControlPanel(); - self->mControlPanel->setXMLFilename("panel_im_control_panel.xml"); - return self->mControlPanel; -} - - // static void* LLIMFloater::createPanelGroupControl(void* userdata) { @@ -443,14 +535,17 @@ void LLIMFloater::onSlide() } else ///< floater is torn off { - bool expand = !mControlPanel->getParent()->getVisible(); + if (mControlPanel) + { + bool expand = !mControlPanel->getParent()->getVisible(); - // Expand/collapse the IM control panel - mControlPanel->getParent()->setVisible(expand); + // Expand/collapse the IM control panel + mControlPanel->getParent()->setVisible(expand); - gSavedSettings.setBOOL("IMShowControlPanel", expand); + gSavedSettings.setBOOL("IMShowControlPanel", expand); - mExpandCollapseBtn->setImageOverlay(getString(expand ? "collapse_icon" : "expand_icon")); + mExpandCollapseBtn->setImageOverlay(getString(expand ? "collapse_icon" : "expand_icon")); + } } } @@ -659,15 +754,13 @@ void LLIMFloater::sessionInitReplyReceived(const LLUUID& im_session_id) { mSessionID = im_session_id; setKey(im_session_id); - mControlPanel->setSessionId(im_session_id); + if (mControlPanel) + { + mControlPanel->setSessionId(im_session_id); + } + boundVoiceChannel(); } - // updating "Call" button from group control panel here to enable it without placing into draw() (EXT-4796) - if(gAgent.isInGroup(im_session_id)) - { - mControlPanel->updateCallButton(); - } - //*TODO here we should remove "starting session..." warning message if we added it in postBuild() (IB) @@ -910,13 +1003,6 @@ void LLIMFloater::processAgentListUpdates(const LLSD& body) } } -void LLIMFloater::updateChatHistoryStyle() -{ - mChatHistory->clear(); - mLastMessageIndex = -1; - updateMessages(); -} - void LLIMFloater::processChatHistoryStyleUpdate(const LLSD& newvalue) { LLFontGL* font = LLViewerChat::getChatFont(); @@ -927,11 +1013,10 @@ void LLIMFloater::processChatHistoryStyleUpdate(const LLSD& newvalue) LLIMFloater* floater = dynamic_cast(*iter); if (floater) { - floater->updateChatHistoryStyle(); + floater->reloadMessages(); floater->mInputEditor->setFont(font); } } - } void LLIMFloater::processSessionUpdate(const LLSD& session_update) @@ -1152,7 +1237,6 @@ void LLIMFloater::removeTypingIndicator(const LLIMInfo* im_info) speaker_mgr->setSpeakerTyping(im_info->mFromID, FALSE); } } - } } @@ -1274,7 +1358,7 @@ void LLIMFloater::updateTitleButtons() { // This gets called before LLIMFloater::postBuild() while some LLIMFloater members are NULL if ( !mDragHandle - || !mControlPanel + //|| !mControlPanel || !mExpandCollapseBtn || !mTearOffBtn) { @@ -1301,8 +1385,22 @@ void LLIMFloater::updateTitleButtons() { LLFloater::updateTitleButtons(); - bool is_expanded = mControlPanel->getParent()->getVisible(); - mExpandCollapseBtn->setImageOverlay(getString(is_expanded ? "collapse_icon" : "expand_icon")); + if (mControlPanel) + { + bool is_expanded = mControlPanel->getParent()->getVisible(); + mExpandCollapseBtn->setImageOverlay(getString(is_expanded ? "collapse_icon" : "expand_icon")); + } + } + + LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(mSessionID); + if (session) + { + mExpandCollapseBtn->setEnabled(is_hosted || !session->isP2PSessionType()); + } + else + { + llwarns << "Empty session." << llendl; + return; } // toggle floater's drag handle and title visibility diff --git a/indra/newview/llimfloater.h b/indra/newview/llimfloater.h index 4f161449f7..40b3fff8f4 100644 --- a/indra/newview/llimfloater.h +++ b/indra/newview/llimfloater.h @@ -31,6 +31,8 @@ #include "lllogchat.h" #include "lltooldraganddrop.h" #include "lltransientdockablefloater.h" +#include "llvoicechannel.h" +#include "llvoiceclient.h" class LLAvatarName; class LLButton; @@ -44,14 +46,16 @@ class LLInventoryCategory; * Individual IM window that appears at the bottom of the screen, * optionally "docked" to the bottom tray. */ -class LLIMFloater : public LLTransientDockableFloater +class LLIMFloater + : public LLTransientDockableFloater + , public LLVoiceClientStatusObserver { LOG_CLASS(LLIMFloater); public: LLIMFloater(const LLUUID& session_id); virtual ~LLIMFloater(); - + // LLView overrides /*virtual*/ BOOL postBuild(); /*virtual*/ void setVisible(BOOL visible); @@ -90,11 +94,20 @@ public: // called when docked floater's position has been set by chiclet void setPositioned(bool b) { mPositioned = b; }; void onVisibilityChange(const LLSD& new_visibility); + + // Implements LLVoiceClientStatusObserver::onChange() to enable the call + // button when voice is available + void onChange(EStatusType status, const std::string &channelURI, + bool proximal); + + virtual void onVoiceChannelStateChanged( + const LLVoiceChannel::EState& old_state, + const LLVoiceChannel::EState& new_state); + void processIMTyping(const LLIMInfo* im_info, BOOL typing); void processAgentListUpdates(const LLSD& body); void processSessionUpdate(const LLSD& session_update); - void updateChatHistoryStyle(); static void processChatHistoryStyleUpdate(const LLSD& newvalue); BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, @@ -153,6 +166,13 @@ private: bool onIMShowModesMenuItemCheck(const LLSD& userdata); bool onIMShowModesMenuItemEnable(const LLSD& userdata); void onIMSessionMenuItemClicked(const LLSD& userdata); + void onCallButtonClicked(); + + void boundVoiceChannel(); + void enableDisableCallBtn(); + + // refresh a visual state of the Call button + void updateCallState(LLVoiceChannel::EState state); // Add the "User is typing..." indicator. void addTypingIndicator(const LLIMInfo* im_info); @@ -185,9 +205,11 @@ private: bool mSessionInitialized; LLSD mQueuedMsgsForInit; + // connection to voice channel state change signal + boost::signals2::connection mVoiceChannelStateChangeConnection; + LLButton* mExpandCollapseBtn; LLButton* mTearOffBtn; }; - #endif // LL_IMFLOATER_H diff --git a/indra/newview/llpanelimcontrolpanel.cpp b/indra/newview/llpanelimcontrolpanel.cpp index eda0749cdb..f0fc15b4d8 100644 --- a/indra/newview/llpanelimcontrolpanel.cpp +++ b/indra/newview/llpanelimcontrolpanel.cpp @@ -1,31 +1,30 @@ -/** +/** * @file llpanelavatar.cpp * @brief LLPanelAvatar and related class implementations * * $LicenseInfo:firstyear=2004&license=viewerlgpl$ * Second Life Viewer Source Code * Copyright (C) 2010, Linden Research, Inc. - * + * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; * version 2.1 of the License only. - * + * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. - * + * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * + * * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ #include "llviewerprecompiledheaders.h" - #include "llfloaterreg.h" #include "llpanelimcontrolpanel.h" @@ -39,92 +38,15 @@ #include "llavatarlist.h" #include "llparticipantlist.h" #include "llimview.h" -#include "llvoicechannel.h" #include "llspeakers.h" #include "lltrans.h" -void LLPanelChatControlPanel::onCallButtonClicked() -{ - gIMMgr->startCall(mSessionId); -} - -void LLPanelChatControlPanel::onEndCallButtonClicked() -{ - gIMMgr->endCall(mSessionId); -} - -void LLPanelChatControlPanel::onOpenVoiceControlsClicked() -{ - LLFloaterReg::showInstance("voice_controls"); -} - -void LLPanelChatControlPanel::onChange(EStatusType status, const std::string &channelURI, bool proximal) -{ - if(status == STATUS_JOINING || status == STATUS_LEFT_CHANNEL) - { - return; - } - - updateCallButton(); -} - -void LLPanelChatControlPanel::onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state) -{ - updateButtons(new_state); -} - -void LLPanelChatControlPanel::updateCallButton() -{ - // hide/show call button - bool voice_enabled = LLVoiceClient::getInstance()->voiceEnabled() && LLVoiceClient::getInstance()->isVoiceWorking(); - - LLIMModel::LLIMSession* session = LLIMModel::getInstance()->findIMSession(mSessionId); - - if (!session) - { - getChildView("call_btn")->setEnabled(false); - return; - } - - bool session_initialized = session->mSessionInitialized; - bool callback_enabled = session->mCallBackEnabled; - - BOOL enable_connect = session_initialized - && voice_enabled - && callback_enabled; - getChildView("call_btn")->setEnabled(enable_connect); -} - -void LLPanelChatControlPanel::updateButtons(LLVoiceChannel::EState state) -{ - bool is_call_started = state >= LLVoiceChannel::STATE_CALL_STARTED; - getChildView("end_call_btn_panel")->setVisible( is_call_started); - getChildView("voice_ctrls_btn_panel")->setVisible( is_call_started && findChild("voice_ctrls_btn_panel")); - getChildView("call_btn_panel")->setVisible( ! is_call_started); - - getChildView("volume_ctrl_panel")->setVisible(state == LLVoiceChannel::STATE_CONNECTED); - - updateCallButton(); - -} - LLPanelChatControlPanel::~LLPanelChatControlPanel() { - mVoiceChannelStateChangeConnection.disconnect(); - if(LLVoiceClient::instanceExists()) - { - LLVoiceClient::getInstance()->removeObserver(this); - } } BOOL LLPanelChatControlPanel::postBuild() { - childSetAction("call_btn", boost::bind(&LLPanelChatControlPanel::onCallButtonClicked, this)); - childSetAction("end_call_btn", boost::bind(&LLPanelChatControlPanel::onEndCallButtonClicked, this)); - childSetAction("voice_ctrls_btn", boost::bind(&LLPanelChatControlPanel::onOpenVoiceControlsClicked, this)); - - LLVoiceClient::getInstance()->addObserver(this); - return TRUE; } @@ -132,14 +54,6 @@ void LLPanelChatControlPanel::setSessionId(const LLUUID& session_id) { //Method is called twice for AdHoc and Group chat. Second time when server init reply received mSessionId = session_id; - LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionId); - if(voice_channel) - { - mVoiceChannelStateChangeConnection = voice_channel->setStateChangedCallback(boost::bind(&LLPanelChatControlPanel::onVoiceChannelStateChanged, this, _1, _2)); - - //call (either p2p, group or ad-hoc) can be already in started state - updateButtons(voice_channel->getState()); - } } LLPanelIMControlPanel::LLPanelIMControlPanel() @@ -148,29 +62,27 @@ LLPanelIMControlPanel::LLPanelIMControlPanel() LLPanelIMControlPanel::~LLPanelIMControlPanel() { - LLAvatarTracker::instance().removeParticularFriendObserver(mAvatarID, this); +// LLAvatarTracker::instance().removeParticularFriendObserver(mAvatarID, this); } BOOL LLPanelIMControlPanel::postBuild() { - childSetAction("view_profile_btn", boost::bind(&LLPanelIMControlPanel::onViewProfileButtonClicked, this)); +/* childSetAction("view_profile_btn", boost::bind(&LLPanelIMControlPanel::onViewProfileButtonClicked, this)); childSetAction("add_friend_btn", boost::bind(&LLPanelIMControlPanel::onAddFriendButtonClicked, this)); childSetAction("share_btn", boost::bind(&LLPanelIMControlPanel::onShareButtonClicked, this)); childSetAction("teleport_btn", boost::bind(&LLPanelIMControlPanel::onTeleportButtonClicked, this)); childSetAction("pay_btn", boost::bind(&LLPanelIMControlPanel::onPayButtonClicked, this)); - childSetAction("mute_btn", boost::bind(&LLPanelIMControlPanel::onClickMuteVolume, this)); childSetAction("block_btn", boost::bind(&LLPanelIMControlPanel::onClickBlock, this)); childSetAction("unblock_btn", boost::bind(&LLPanelIMControlPanel::onClickUnblock, this)); - - getChild("volume_slider")->setCommitCallback(boost::bind(&LLPanelIMControlPanel::onVolumeChange, this, _2)); getChildView("add_friend_btn")->setEnabled(!LLAvatarActions::isFriend(getChild("avatar_icon")->getAvatarId())); setFocusReceivedCallback(boost::bind(&LLPanelIMControlPanel::onFocusReceived, this)); - +*/ return LLPanelChatControlPanel::postBuild(); + } void LLPanelIMControlPanel::draw() @@ -180,56 +92,14 @@ void LLPanelIMControlPanel::draw() getChild("block_btn_panel")->setVisible(!is_muted); getChild("unblock_btn_panel")->setVisible(is_muted); - if (getChildView("volume_ctrl_panel")->getVisible()) - { - - bool is_muted_voice = LLMuteList::getInstance()->isMuted(mAvatarID, LLMute::flagVoiceChat); - - LLUICtrl* mute_btn = getChild("mute_btn"); - mute_btn->setValue( is_muted_voice ); - - LLUICtrl* volume_slider = getChild("volume_slider"); - volume_slider->setEnabled( !is_muted_voice ); - - F32 volume; - - if (is_muted_voice) - { - // it's clearer to display their volume as zero - volume = 0.f; - } - else - { - // actual volume - volume = LLVoiceClient::getInstance()->getUserVolume(mAvatarID); - } - volume_slider->setValue( (F64)volume ); - } LLPanelChatControlPanel::draw(); } -void LLPanelIMControlPanel::onClickMuteVolume() -{ - // By convention, we only display and toggle voice mutes, not all mutes - LLMuteList* mute_list = LLMuteList::getInstance(); - bool is_muted = mute_list->isMuted(mAvatarID, LLMute::flagVoiceChat); - - LLMute mute(mAvatarID, getChild("avatar_name")->getText(), LLMute::AGENT); - if (!is_muted) - { - mute_list->add(mute, LLMute::flagVoiceChat); - } - else - { - mute_list->remove(mute, LLMute::flagVoiceChat); - } -} - void LLPanelIMControlPanel::onClickBlock() { LLMute mute(mAvatarID, getChild("avatar_name")->getText(), LLMute::AGENT); - + LLMuteList::getInstance()->add(mute); } @@ -240,12 +110,6 @@ void LLPanelIMControlPanel::onClickUnblock() LLMuteList::getInstance()->remove(mute); } -void LLPanelIMControlPanel::onVolumeChange(const LLSD& data) -{ - F32 volume = (F32)data.asReal(); - LLVoiceClient::getInstance()->setUserVolume(mAvatarID, volume); -} - void LLPanelIMControlPanel::onTeleportButtonClicked() { LLAvatarActions::offerTeleport(mAvatarID); @@ -281,62 +145,6 @@ void LLPanelIMControlPanel::onFocusReceived() } } -void LLPanelIMControlPanel::setSessionId(const LLUUID& session_id) -{ - LLPanelChatControlPanel::setSessionId(session_id); - - LLIMModel& im_model = LLIMModel::instance(); - - LLAvatarTracker::instance().removeParticularFriendObserver(mAvatarID, this); - mAvatarID = im_model.getOtherParticipantID(session_id); - LLAvatarTracker::instance().addParticularFriendObserver(mAvatarID, this); - - // Disable "Add friend" button for friends. - getChildView("add_friend_btn")->setEnabled(!LLAvatarActions::isFriend(mAvatarID)); - - // Disable "Teleport" button if friend is offline - if(LLAvatarActions::isFriend(mAvatarID)) - { - getChildView("teleport_btn")->setEnabled(LLAvatarTracker::instance().isBuddyOnline(mAvatarID)); - } - - getChild("avatar_icon")->setValue(mAvatarID); - - // Disable most profile buttons if the participant is - // not really an SL avatar (e.g., an Avaline caller). - LLIMModel::LLIMSession* im_session = - im_model.findIMSession(session_id); - if( im_session && !im_session->mOtherParticipantIsAvatar ) - { - getChildView("view_profile_btn")->setEnabled(FALSE); - getChildView("add_friend_btn")->setEnabled(FALSE); - - getChildView("share_btn")->setEnabled(FALSE); - getChildView("teleport_btn")->setEnabled(FALSE); - getChildView("pay_btn")->setEnabled(FALSE); - - getChild("avatar_name")->setValue(im_session->mName); - getChild("avatar_name")->setToolTip(im_session->mName); - } - else - { - // If the participant is an avatar, fetch the currect name - gCacheName->get(mAvatarID, false, - boost::bind(&LLPanelIMControlPanel::onNameCache, this, _1, _2, _3)); - } -} - -//virtual -void LLPanelIMControlPanel::changed(U32 mask) -{ - getChildView("add_friend_btn")->setEnabled(!LLAvatarActions::isFriend(mAvatarID)); - - // Disable "Teleport" button if friend is offline - if(LLAvatarActions::isFriend(mAvatarID)) - { - getChildView("teleport_btn")->setEnabled(LLAvatarTracker::instance().isBuddyOnline(mAvatarID)); - } -} void LLPanelIMControlPanel::onNameCache(const LLUUID& id, const std::string& full_name, bool is_group) { @@ -398,19 +206,13 @@ void LLPanelGroupControlPanel::onSortMenuItemClicked(const LLSD& userdata) } -void LLPanelGroupControlPanel::onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state) -{ - LLPanelChatControlPanel::onVoiceChannelStateChanged(old_state, new_state); - mParticipantList->setSpeakingIndicatorsVisible(new_state >= LLVoiceChannel::STATE_CALL_STARTED); -} - void LLPanelGroupControlPanel::setSessionId(const LLUUID& session_id) { LLPanelChatControlPanel::setSessionId(session_id); mGroupID = session_id; - // for group and Ad-hoc chat we need to include agent into list + // for group and Ad-hoc chat we need to include agent into list if(!mParticipantList) { LLSpeakerMgr* speaker_manager = LLIMModel::getInstance()->getSpeakerManager(session_id); @@ -428,4 +230,3 @@ BOOL LLPanelAdHocControlPanel::postBuild() //We don't need LLPanelGroupControlPanel::postBuild() to be executed as there is no group_info_btn at AdHoc chat return LLPanelChatControlPanel::postBuild(); } - diff --git a/indra/newview/llpanelimcontrolpanel.h b/indra/newview/llpanelimcontrolpanel.h index bba847b5d4..3466da33a1 100644 --- a/indra/newview/llpanelimcontrolpanel.h +++ b/indra/newview/llpanelimcontrolpanel.h @@ -28,14 +28,12 @@ #define LL_LLPANELIMCONTROLPANEL_H #include "llpanel.h" -#include "llvoicechannel.h" #include "llcallingcard.h" class LLParticipantList; -class LLPanelChatControlPanel +class LLPanelChatControlPanel : public LLPanel - , public LLVoiceClientStatusObserver { public: LLPanelChatControlPanel() : @@ -44,21 +42,6 @@ public: virtual BOOL postBuild(); - void onCallButtonClicked(); - void onEndCallButtonClicked(); - void onOpenVoiceControlsClicked(); - - // Implements LLVoiceClientStatusObserver::onChange() to enable the call - // button when voice is available - /*virtual*/ void onChange(EStatusType status, const std::string &channelURI, bool proximal); - - virtual void onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state); - - void updateButtons(LLVoiceChannel::EState state); - - // Enables/disables call button depending on voice availability - void updateCallButton(); - virtual void setSessionId(const LLUUID& session_id); const LLUUID& getSessionId() { return mSessionId; } @@ -70,7 +53,7 @@ private: }; -class LLPanelIMControlPanel : public LLPanelChatControlPanel, LLFriendObserver +class LLPanelIMControlPanel : public LLPanelChatControlPanel { public: LLPanelIMControlPanel(); @@ -78,10 +61,7 @@ public: BOOL postBuild(); - void setSessionId(const LLUUID& session_id); - - // LLFriendObserver trigger - virtual void changed(U32 mask); + //void setSessionId(const LLUUID& session_id); protected: void onNameCache(const LLUUID& id, const std::string& full_name, bool is_group); @@ -93,13 +73,9 @@ private: void onTeleportButtonClicked(); void onPayButtonClicked(); void onFocusReceived(); - - void onClickMuteVolume(); void onClickBlock(); void onClickUnblock(); /*virtual*/ void draw(); - void onVolumeChange(const LLSD& data); - LLUUID mAvatarID; }; @@ -123,7 +99,6 @@ protected: private: void onGroupInfoButtonClicked(); void onSortMenuItemClicked(const LLSD& userdata); - /*virtual*/ void onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state); }; class LLPanelAdHocControlPanel : public LLPanelGroupControlPanel diff --git a/indra/newview/skins/default/xui/en/floater_im_session.xml b/indra/newview/skins/default/xui/en/floater_im_session.xml index 954f646bae..a332bb5b12 100644 --- a/indra/newview/skins/default/xui/en/floater_im_session.xml +++ b/indra/newview/skins/default/xui/en/floater_im_session.xml @@ -15,6 +15,8 @@ can_tear_off="false" min_width="250" min_height="190"> + VoicePTT_Off + VoicePTT_On @@ -47,10 +49,10 @@ menu_filename="menu_im_session_showmodes.xml" follows="top|left" height="25" - image_hover_unselected="Toolbar_Middle_Over" + image_hover_unselected="Toolbar_Left_Over" image_overlay="OptionsMenu_Off" - image_selected="Toolbar_Middle_Selected" - image_unselected="Toolbar_Middle_Off" + image_selected="Toolbar_Left_Selected" + image_unselected="Toolbar_Left_Off" layout="topleft" left="5" name="view_options_btn" @@ -74,14 +76,14 @@