diff options
author | AlexanderP ProductEngine <apaschenko@productengine.com> | 2012-05-14 15:44:57 +0300 |
---|---|---|
committer | AlexanderP ProductEngine <apaschenko@productengine.com> | 2012-05-14 15:44:57 +0300 |
commit | df58153514f6b361c65efc5dd6d31d39f68603c0 (patch) | |
tree | 83ab45717a7219e18d9ac433a2673a570afa49e8 | |
parent | 7eaeb88bc37a747ff82fd37df84592f54c88cdbf (diff) |
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
-rw-r--r-- | indra/newview/llchathistory.cpp | 14 | ||||
-rw-r--r-- | indra/newview/llimfloater.cpp | 192 | ||||
-rw-r--r-- | indra/newview/llimfloater.h | 30 | ||||
-rw-r--r-- | indra/newview/llpanelimcontrolpanel.cpp | 221 | ||||
-rw-r--r-- | indra/newview/llpanelimcontrolpanel.h | 31 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_im_session.xml | 16 |
6 files changed, 202 insertions, 302 deletions
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<LLButton>("close_btn")->setCommitCallback(boost::bind(&LLFloater::onClickClose, this)); mExpandCollapseBtn = getChild<LLButton>("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<LLLayoutPanel>("im_control_panel_holder")->setVisible(false); + } + mTearOffBtn = getChild<LLButton>("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<LLButton>("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<LLIMFloater*>(*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<LLView>("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<LLUICtrl>("volume_slider")->setCommitCallback(boost::bind(&LLPanelIMControlPanel::onVolumeChange, this, _2)); getChildView("add_friend_btn")->setEnabled(!LLAvatarActions::isFriend(getChild<LLAvatarIconCtrl>("avatar_icon")->getAvatarId())); setFocusReceivedCallback(boost::bind(&LLPanelIMControlPanel::onFocusReceived, this)); - +*/ return LLPanelChatControlPanel::postBuild(); + } void LLPanelIMControlPanel::draw() @@ -180,56 +92,14 @@ void LLPanelIMControlPanel::draw() getChild<LLUICtrl>("block_btn_panel")->setVisible(!is_muted); getChild<LLUICtrl>("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<LLUICtrl>("mute_btn"); - mute_btn->setValue( is_muted_voice ); - - LLUICtrl* volume_slider = getChild<LLUICtrl>("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<LLTextBox>("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<LLTextBox>("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<LLAvatarIconCtrl>("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<LLTextBox>("avatar_name")->setValue(im_session->mName); - getChild<LLTextBox>("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"> + <floater.string name="call_btn_start">VoicePTT_Off</floater.string> + <floater.string name="call_btn_stop">VoicePTT_On</floater.string> <floater.string name="collapse_icon" value="TabIcon_Open_Off"/> @@ -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 @@ <button follows="top|left" height="25" - image_hover_unselected="Toolbar_Middle_Over" + image_hover_unselected="Toolbar_Right_Over" image_overlay="VoicePTT_Off" - image_selected="Toolbar_Middle_Selected" - image_unselected="Toolbar_Middle_Off" + image_selected="Toolbar_Right_Selected" + image_unselected="Toolbar_Right_Off" layout="topleft" top="5" left_pad="4" - name="call" + name="voice_call_btn" width="31"> <commit_callback function="Chats.add" /> |