From ba5bfa3f83443c1c4a65f4b7cd072312ea5ceab8 Mon Sep 17 00:00:00 2001 From: Ansariel Date: Mon, 3 Feb 2014 21:47:50 +0100 Subject: [PATCH] FIRE-4849: Add voice status icon to chat tabs in conversations floater --- indra/llui/lltabcontainer.cpp | 12 +++ indra/llui/lltabcontainer.h | 3 + indra/newview/fsfloaterim.cpp | 16 ++-- indra/newview/fsfloaterim.h | 4 + indra/newview/fsfloaterimcontainer.cpp | 73 ++++++++++++++++++- indra/newview/fsfloaterimcontainer.h | 8 +- indra/newview/skins/ansastorm/colors.xml | 9 +++ .../ansastorm/themes/classic_brown/colors.xml | 9 +++ indra/newview/skins/default/colors.xml | 9 +++ .../skins/default/textures/textures.xml | 2 + 10 files changed, 133 insertions(+), 12 deletions(-) diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 162aff6b02..fda3d03b6b 100755 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -1745,6 +1745,18 @@ void LLTabContainer::setTabImage(LLPanel* child, std::string image_name, const L } } +// Custom tab image overlay button alignment +void LLTabContainer::setTabImage(LLPanel* child, std::string image_name, LLFontGL::HAlign alignment, const LLColor4& color) +{ + LLTabTuple* tuple = getTabByPanel(child); + if( tuple ) + { + tuple->mButton->setImageOverlay(image_name, alignment, color); + reshapeTuple(tuple); + } +} +// + void LLTabContainer::setTabImage(LLPanel* child, const LLUUID& image_id, const LLColor4& color) { LLTabTuple* tuple = getTabByPanel(child); diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h index e49314e6ef..52eac73a52 100755 --- a/indra/llui/lltabcontainer.h +++ b/indra/llui/lltabcontainer.h @@ -219,6 +219,9 @@ public: void setTabImage(LLPanel* child, std::string img_name, const LLColor4& color = LLColor4::white); void setTabImage(LLPanel* child, const LLUUID& img_id, const LLColor4& color = LLColor4::white); void setTabImage(LLPanel* child, LLIconCtrl* icon); + // Custom tab image overlay button alignment + void setTabImage(LLPanel* child, std::string image_name, LLFontGL::HAlign alignment, const LLColor4& color = LLColor4::white); + // void setTitle( const std::string& title ); const std::string getPanelTitle(S32 index); diff --git a/indra/newview/fsfloaterim.cpp b/indra/newview/fsfloaterim.cpp index 7f07511d9b..1e9b04eaf9 100644 --- a/indra/newview/fsfloaterim.cpp +++ b/indra/newview/fsfloaterim.cpp @@ -68,7 +68,6 @@ //AO: For moving callbacks from control panel into this class #include "llavataractions.h" #include "llgroupactions.h" -#include "llvoicechannel.h" //TL: for support group chat prefix #include "fsdata.h" #include "llversioninfo.h" @@ -100,7 +99,8 @@ FSFloaterIM::FSFloaterIM(const LLUUID& session_id) mChatLayoutPanel(NULL), mInputPanels(NULL), mChatLayoutPanelHeight(0), - mAvatarNameCacheConnection() + mAvatarNameCacheConnection(), + mVoiceChannel(NULL) { LLIMModel::LLIMSession* im_session = LLIMModel::getInstance()->findIMSession(mSessionID); if (im_session) @@ -705,15 +705,15 @@ BOOL FSFloaterIM::postBuild() break; } } - LLVoiceChannel* voice_channel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); - if(voice_channel) + mVoiceChannel = LLIMModel::getInstance()->getVoiceChannel(mSessionID); + if(mVoiceChannel) { - LL_DEBUGS("FSFloaterIM") << "voice_channel start" << LL_ENDL; - mVoiceChannelStateChangeConnection = voice_channel->setStateChangedCallback(boost::bind(&FSFloaterIM::onVoiceChannelStateChanged, this, _1, _2)); + LL_DEBUGS("FSFloaterIM") << "voice_channel start" << LL_ENDL; + mVoiceChannelStateChangeConnection = mVoiceChannel->setStateChangedCallback(boost::bind(&FSFloaterIM::onVoiceChannelStateChanged, this, _1, _2)); //call (either p2p, group or ad-hoc) can be already in started state - updateButtons(voice_channel->getState() >= LLVoiceChannel::STATE_CALL_STARTED); - LL_DEBUGS("FSFloaterIM") << "voice_channel end" << LL_ENDL; + updateButtons(mVoiceChannel->getState() >= LLVoiceChannel::STATE_CALL_STARTED); + LL_DEBUGS("FSFloaterIM") << "voice_channel end" << LL_ENDL; } LLVoiceClient::getInstance()->addObserver((LLVoiceClientStatusObserver*)this); diff --git a/indra/newview/fsfloaterim.h b/indra/newview/fsfloaterim.h index 20f9ca00ad..520277763c 100644 --- a/indra/newview/fsfloaterim.h +++ b/indra/newview/fsfloaterim.h @@ -145,6 +145,8 @@ public: S32 getLastChatMessageIndex() {return mLastMessageIndex;} + LLVoiceChannel* getVoiceChannel() { return mVoiceChannel; } + protected: /* virtual */ void onClickCloseBtn(bool app_quitting = false); @@ -229,6 +231,8 @@ private: bool mSessionInitialized; LLSD mQueuedMsgsForInit; + + LLVoiceChannel* mVoiceChannel; S32 mInputEditorPad; S32 mChatLayoutPanelHeight; diff --git a/indra/newview/fsfloaterimcontainer.cpp b/indra/newview/fsfloaterimcontainer.cpp index c3ee67b919..81282f54bc 100644 --- a/indra/newview/fsfloaterimcontainer.cpp +++ b/indra/newview/fsfloaterimcontainer.cpp @@ -41,12 +41,14 @@ #include "llfloater.h" #include "llviewercontrol.h" #include "fsfloaterim.h" +#include "llvoiceclient.h" // // FSFloaterIMContainer // FSFloaterIMContainer::FSFloaterIMContainer(const LLSD& seed) -: LLMultiFloater(seed) +: LLMultiFloater(seed), + mActiveVoiceFloater(NULL) { mAutoResize = FALSE; LLTransientFloaterMgr::getInstance()->addControlView(LLTransientFloaterMgr::IM, this); @@ -346,4 +348,73 @@ void FSFloaterIMContainer::reloadEmptyFloaters() } } +// virtual +void FSFloaterIMContainer::draw() +{ + LLFloater* current_voice_floater = getCurrentVoiceFloater(); + if (mActiveVoiceFloater != current_voice_floater) + { + if (mActiveVoiceFloater) + { + mTabContainer->setTabImage(mActiveVoiceFloater, ""); + } + } + + if (current_voice_floater) + { + static LLUIColor voice_connected_color = LLUIColorTable::instance().getColor("VoiceConnectedColor", LLColor4::green); + static LLUIColor voice_error_color = LLUIColorTable::instance().getColor("VoiceErrorColor", LLColor4::red); + static LLUIColor voice_not_connected_color = LLUIColorTable::instance().getColor("VoiceNotConnectedColor", LLColor4::yellow); + + LLColor4 icon_color = LLColor4::white; + LLVoiceChannel* voice_channel = LLVoiceChannel::getCurrentVoiceChannel(); + if (voice_channel) + { + if (voice_channel->isActive()) + { + icon_color = voice_connected_color.get(); + } + else if (voice_channel->getState() == LLVoiceChannel::STATE_ERROR) + { + icon_color = voice_error_color.get(); + } + else + { + icon_color = voice_not_connected_color.get(); + } + } + mTabContainer->setTabImage(current_voice_floater, "Active_Voice_Tab", LLFontGL::RIGHT, icon_color); + } + mActiveVoiceFloater = current_voice_floater; + + LLMultiFloater::draw(); +} + +LLFloater* FSFloaterIMContainer::getCurrentVoiceFloater() +{ + if (!LLVoiceClient::instance().voiceEnabled()) + { + return NULL; + } + + if (LLVoiceChannelProximal::getInstance() == LLVoiceChannel::getCurrentVoiceChannel()) + { + return FSFloaterNearbyChat::getInstance(); + } + + for (S32 i = 0; i < mTabContainer->getTabCount(); ++i) + { + LLPanel* panel = mTabContainer->getPanelByIndex(i); + if (panel->getName() == "panel_im") + { + FSFloaterIM* im_floater = dynamic_cast(panel); + if (im_floater && im_floater->getVoiceChannel() == LLVoiceChannel::getCurrentVoiceChannel()) + { + return im_floater; + } + } + } + return NULL; +} + // EOF diff --git a/indra/newview/fsfloaterimcontainer.h b/indra/newview/fsfloaterimcontainer.h index fe4fb02aff..a582702992 100644 --- a/indra/newview/fsfloaterimcontainer.h +++ b/indra/newview/fsfloaterimcontainer.h @@ -50,6 +50,7 @@ public: /*virtual*/ BOOL postBuild(); /*virtual*/ void onOpen(const LLSD& key); void onCloseFloater(LLUUID& id); + /*virtual*/ void draw(); /*virtual*/ void addFloater(LLFloater* floaterp, BOOL select_added_floater, @@ -58,10 +59,7 @@ public: /*virtual*/ void removeFloater(LLFloater* floaterp); // [/SL:KB] - static LLFloater* getCurrentVoiceFloater(); - static FSFloaterIMContainer* findInstance(); - static FSFloaterIMContainer* getInstance(); virtual void setMinimized(BOOL b); @@ -77,6 +75,10 @@ public: static void reloadEmptyFloaters(); private: + LLFloater* getCurrentVoiceFloater(); + + LLFloater* mActiveVoiceFloater; + typedef std::map avatarID_panel_map_t; avatarID_panel_map_t mSessions; boost::signals2::connection mNewMessageConnection; diff --git a/indra/newview/skins/ansastorm/colors.xml b/indra/newview/skins/ansastorm/colors.xml index 17cb0a23a8..13a1f117b1 100644 --- a/indra/newview/skins/ansastorm/colors.xml +++ b/indra/newview/skins/ansastorm/colors.xml @@ -1285,4 +1285,13 @@ + + + diff --git a/indra/newview/skins/ansastorm/themes/classic_brown/colors.xml b/indra/newview/skins/ansastorm/themes/classic_brown/colors.xml index 27ebf93f3f..29ea96dd6f 100644 --- a/indra/newview/skins/ansastorm/themes/classic_brown/colors.xml +++ b/indra/newview/skins/ansastorm/themes/classic_brown/colors.xml @@ -1285,4 +1285,13 @@ + + + diff --git a/indra/newview/skins/default/colors.xml b/indra/newview/skins/default/colors.xml index cbcddd23c9..c4f2bd6c34 100755 --- a/indra/newview/skins/default/colors.xml +++ b/indra/newview/skins/default/colors.xml @@ -1240,4 +1240,13 @@ + + + diff --git a/indra/newview/skins/default/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 5996654741..1d0b6f8ba8 100755 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -980,4 +980,6 @@ with the same filename but different name + +