Skip to content
Snippets Groups Projects
Commit 0bf77e22 authored by Mike Antipov's avatar Mike Antipov
Browse files

Work on low task EXT-3682 (Dedicated icon is required for AvaLine callers in the VCP)

-- refactored processing of voice participants in the "Voice control panel".
  Now list is filled only when voice channel is in CONNECTED state and is cleared otherwise.

--HG--
branch : product-engine
parent 1474f3ae
No related branches found
No related tags found
No related merge requests found
...@@ -165,6 +165,7 @@ void LLAvatarList::clear() ...@@ -165,6 +165,7 @@ void LLAvatarList::clear()
{ {
getIDs().clear(); getIDs().clear();
setDirty(true); setDirty(true);
LLFlatListView::clear();
} }
void LLAvatarList::setNameFilter(const std::string& filter) void LLAvatarList::setNameFilter(const std::string& filter)
......
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
#include "llparticipantlist.h" #include "llparticipantlist.h"
#include "llspeakers.h" #include "llspeakers.h"
#include "lltransientfloatermgr.h" #include "lltransientfloatermgr.h"
#include "llvoicechannel.h"
static void get_voice_participants_uuids(std::vector<LLUUID>& speakers_uuids); static void get_voice_participants_uuids(std::vector<LLUUID>& speakers_uuids);
...@@ -99,6 +100,8 @@ BOOL LLCallFloater::LLAvatarListItemRemoveTimer::tick() ...@@ -99,6 +100,8 @@ BOOL LLCallFloater::LLAvatarListItemRemoveTimer::tick()
return TRUE; return TRUE;
} }
LLVoiceChannel* LLCallFloater::sCurrentVoiceCanel = NULL;
LLCallFloater::LLCallFloater(const LLSD& key) LLCallFloater::LLCallFloater(const LLSD& key)
: LLDockableFloater(NULL, false, key) : LLDockableFloater(NULL, false, key)
, mSpeakerManager(NULL) , mSpeakerManager(NULL)
...@@ -128,6 +131,7 @@ LLCallFloater::~LLCallFloater() ...@@ -128,6 +131,7 @@ LLCallFloater::~LLCallFloater()
mParticipants = NULL; mParticipants = NULL;
mAvatarListRefreshConnection.disconnect(); mAvatarListRefreshConnection.disconnect();
mVoiceChannelStateChangeConnection.disconnect();
// Don't use LLVoiceClient::getInstance() here // Don't use LLVoiceClient::getInstance() here
// singleton MAY have already been destroyed. // singleton MAY have already been destroyed.
...@@ -148,6 +152,7 @@ BOOL LLCallFloater::postBuild() ...@@ -148,6 +152,7 @@ BOOL LLCallFloater::postBuild()
childSetAction("leave_call_btn", boost::bind(&LLCallFloater::leaveCall, this)); childSetAction("leave_call_btn", boost::bind(&LLCallFloater::leaveCall, this));
mNonAvatarCaller = getChild<LLNonAvatarCaller>("non_avatar_caller"); mNonAvatarCaller = getChild<LLNonAvatarCaller>("non_avatar_caller");
mNonAvatarCaller->setVisible(FALSE);
LLView *anchor_panel = LLBottomTray::getInstance()->getChild<LLView>("speak_panel"); LLView *anchor_panel = LLBottomTray::getInstance()->getChild<LLView>("speak_panel");
...@@ -157,8 +162,8 @@ BOOL LLCallFloater::postBuild() ...@@ -157,8 +162,8 @@ BOOL LLCallFloater::postBuild()
initAgentData(); initAgentData();
// update list for current session
updateSession(); connectToChannel(LLVoiceChannel::getCurrentVoiceChannel());
return TRUE; return TRUE;
} }
...@@ -306,17 +311,6 @@ void LLCallFloater::updateSession() ...@@ -306,17 +311,6 @@ void LLCallFloater::updateSession()
void LLCallFloater::refreshParticipantList() void LLCallFloater::refreshParticipantList()
{ {
// lets forget states from the previous session
// for timers...
resetVoiceRemoveTimers();
// ...and for speaker state
mSpeakerStateMap.clear();
delete mParticipants;
mParticipants = NULL;
mAvatarList->clear();
bool non_avatar_caller = false; bool non_avatar_caller = false;
if (VC_PEER_TO_PEER == mVoiceType) if (VC_PEER_TO_PEER == mVoiceType)
{ {
...@@ -361,21 +355,19 @@ void LLCallFloater::onAvatarListRefreshed() ...@@ -361,21 +355,19 @@ void LLCallFloater::onAvatarListRefreshed()
} }
} }
// static
void LLCallFloater::sOnCurrentChannelChanged(const LLUUID& /*session_id*/) void LLCallFloater::sOnCurrentChannelChanged(const LLUUID& /*session_id*/)
{ {
// Don't update participant list if no channel info is available. LLVoiceChannel* channel = LLVoiceChannel::getCurrentVoiceChannel();
// Fix for ticket EXT-3427
// @see LLParticipantList::~LLParticipantList() // *NOTE: if signal was sent for voice channel with LLVoiceChannel::STATE_NO_CHANNEL_INFO
if(LLVoiceChannel::getCurrentVoiceChannel() && // it sill be sent for the same channel again (when state is changed).
LLVoiceChannel::STATE_NO_CHANNEL_INFO == LLVoiceChannel::getCurrentVoiceChannel()->getState()) // So, lets ignore this call.
{ if (channel == sCurrentVoiceCanel) return;
return;
}
LLCallFloater* call_floater = LLFloaterReg::getTypedInstance<LLCallFloater>("voice_controls"); LLCallFloater* call_floater = LLFloaterReg::getTypedInstance<LLCallFloater>("voice_controls");
// Forget speaker manager from the previous session to avoid using it after session was destroyed. call_floater->connectToChannel(channel);
call_floater->mSpeakerManager = NULL;
call_floater->updateSession();
} }
void LLCallFloater::updateTitle() void LLCallFloater::updateTitle()
...@@ -721,4 +713,49 @@ bool LLCallFloater::validateSpeaker(const LLUUID& speaker_id) ...@@ -721,4 +713,49 @@ bool LLCallFloater::validateSpeaker(const LLUUID& speaker_id)
return std::find(speakers.begin(), speakers.end(), speaker_id) != speakers.end(); return std::find(speakers.begin(), speakers.end(), speaker_id) != speakers.end();
} }
void LLCallFloater::connectToChannel(LLVoiceChannel* channel)
{
mVoiceChannelStateChangeConnection.disconnect();
sCurrentVoiceCanel = channel;
mVoiceChannelStateChangeConnection = sCurrentVoiceCanel->setStateChangedCallback(boost::bind(&LLCallFloater::onVoiceChannelStateChanged, this, _1, _2));
updateState(channel->getState());
}
void LLCallFloater::onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state)
{
updateState(new_state);
}
void LLCallFloater::updateState(const LLVoiceChannel::EState& new_state)
{
LL_DEBUGS("Voice") << "Updating state: " << new_state << ", session name: " << sCurrentVoiceCanel->getSessionName() << LL_ENDL;
if (LLVoiceChannel::STATE_CONNECTED == new_state)
{
updateSession();
}
else
{
reset();
}
}
void LLCallFloater::reset()
{
// lets forget states from the previous session
// for timers...
resetVoiceRemoveTimers();
// ...and for speaker state
mSpeakerStateMap.clear();
delete mParticipants;
mParticipants = NULL;
mAvatarList->clear();
mSpeakerManager = NULL;
}
//EOF //EOF
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#define LL_LLCALLFLOATER_H #define LL_LLCALLFLOATER_H
#include "lldockablefloater.h" #include "lldockablefloater.h"
#include "llvoicechannel.h"
#include "llvoiceclient.h" #include "llvoiceclient.h"
class LLAvatarList; class LLAvatarList;
...@@ -192,6 +193,28 @@ class LLCallFloater : public LLDockableFloater, LLVoiceClientParticipantObserver ...@@ -192,6 +193,28 @@ class LLCallFloater : public LLDockableFloater, LLVoiceClientParticipantObserver
*/ */
bool validateSpeaker(const LLUUID& speaker_id); bool validateSpeaker(const LLUUID& speaker_id);
/**
* Connects to passed channel to be updated according to channel's voice states.
*/
void connectToChannel(LLVoiceChannel* channel);
/**
* Callback to process changing of voice channel's states.
*/
void onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state);
/**
* Updates floater according to passed channel's voice state.
*/
void updateState(const LLVoiceChannel::EState& new_state);
/**
* Resets floater to be ready to show voice participants.
*
* Clears all data from the latest voice session.
*/
void reset();
private: private:
speaker_state_map_t mSpeakerStateMap; speaker_state_map_t mSpeakerStateMap;
LLSpeakerMgr* mSpeakerManager; LLSpeakerMgr* mSpeakerManager;
...@@ -242,6 +265,16 @@ class LLCallFloater : public LLDockableFloater, LLVoiceClientParticipantObserver ...@@ -242,6 +265,16 @@ class LLCallFloater : public LLDockableFloater, LLVoiceClientParticipantObserver
timers_map mVoiceLeftTimersMap; timers_map mVoiceLeftTimersMap;
S32 mVoiceLeftRemoveDelay; S32 mVoiceLeftRemoveDelay;
/**
* Stores reference to current voice channel.
*
* Is used to ignore voice channel changed callback for the same channel.
*
* @see sOnCurrentChannelChanged()
*/
static LLVoiceChannel* sCurrentVoiceCanel;
boost::signals2::connection mVoiceChannelStateChangeConnection;
}; };
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment