FIRE-4849: Add voice status icon to chat tabs in conversations floater

master
Ansariel 2014-02-03 21:47:50 +01:00
parent 22cf771ce4
commit ba5bfa3f83
10 changed files with 133 additions and 12 deletions

View File

@ -1745,6 +1745,18 @@ void LLTabContainer::setTabImage(LLPanel* child, std::string image_name, const L
}
}
// <FS:Ansariel> 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);
}
}
// </FS:Ansariel>
void LLTabContainer::setTabImage(LLPanel* child, const LLUUID& image_id, const LLColor4& color)
{
LLTabTuple* tuple = getTabByPanel(child);

View File

@ -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);
// <FS:Ansariel> Custom tab image overlay button alignment
void setTabImage(LLPanel* child, std::string image_name, LLFontGL::HAlign alignment, const LLColor4& color = LLColor4::white);
// </FS:Ansariel>
void setTitle( const std::string& title );
const std::string getPanelTitle(S32 index);

View File

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

View File

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

View File

@ -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<FSFloaterIM*>(panel);
if (im_floater && im_floater->getVoiceChannel() == LLVoiceChannel::getCurrentVoiceChannel())
{
return im_floater;
}
}
}
return NULL;
}
// EOF

View File

@ -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<LLUUID,LLFloater*> avatarID_panel_map_t;
avatarID_panel_map_t mSessions;
boost::signals2::connection mNewMessageConnection;

View File

@ -1285,4 +1285,13 @@
<color
name="XUITooltipFileName"
value="0.7 0.7 1 1" />
<color
name="VoiceConnectedColor"
reference="Green" />
<color
name="VoiceErrorColor"
reference="Red" />
<color
name="VoiceNotConnectedColor"
reference="Yellow" />
</colors>

View File

@ -1285,4 +1285,13 @@
<color
name="XUITooltipFileName"
value="0.7 0.7 1 1" />
<color
name="VoiceConnectedColor"
reference="Green" />
<color
name="VoiceErrorColor"
reference="Red" />
<color
name="VoiceNotConnectedColor"
reference="Yellow" />
</colors>

View File

@ -1240,4 +1240,13 @@
<color
name="XUITooltipFileName"
value="0.7 0.7 1 1" />
<color
name="VoiceConnectedColor"
reference="Green" />
<color
name="VoiceErrorColor"
reference="Red" />
<color
name="VoiceNotConnectedColor"
reference="Yellow" />
</colors>

View File

@ -980,4 +980,6 @@ with the same filename but different name
<texture name="AddItem_Menu" file_name="icons/AddItem_Menu.png" preload="false" />
<texture name="TrashItem_Menu" file_name="icons/TrashItem_Menu.png" preload="false" />
<texture name="Active_Voice_Tab" file_name="legacy/active_voice_tab.tga" preload="false" />
</textures>