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

merge

--HG--
branch : product-engine
parents 2eb06583 4648de25
No related branches found
No related tags found
No related merge requests found
......@@ -93,22 +93,6 @@ static void* create_non_avatar_caller(void*)
return new LLNonAvatarCaller;
}
LLCallFloater::LLAvatarListItemRemoveTimer::LLAvatarListItemRemoveTimer(callback_t remove_cb, F32 period, const LLUUID& speaker_id)
: LLEventTimer(period)
, mRemoveCallback(remove_cb)
, mSpeakerId(speaker_id)
{
}
BOOL LLCallFloater::LLAvatarListItemRemoveTimer::tick()
{
if (mRemoveCallback)
{
mRemoveCallback(mSpeakerId);
}
return TRUE;
}
LLVoiceChannel* LLCallFloater::sCurrentVoiceCanel = NULL;
LLCallFloater::LLCallFloater(const LLSD& key)
......@@ -122,10 +106,9 @@ LLCallFloater::LLCallFloater(const LLSD& key)
, mSpeakingIndicator(NULL)
, mIsModeratorMutedVoice(false)
, mInitParticipantsVoiceState(false)
, mVoiceLeftRemoveDelay(10)
{
static LLUICachedControl<S32> voice_left_remove_delay ("VoiceParticipantLeftRemoveDelay", 10);
mVoiceLeftRemoveDelay = voice_left_remove_delay;
mSpeakerDelayRemover = new LLSpeakersDelayActionsStorage(boost::bind(&LLCallFloater::removeVoiceLeftParticipant, this, _1), voice_left_remove_delay);
mFactoryMap["non_avatar_caller"] = LLCallbackMap(create_non_avatar_caller, NULL);
LLVoiceClient::getInstance()->addObserver(this);
......@@ -135,6 +118,7 @@ LLCallFloater::LLCallFloater(const LLSD& key)
LLCallFloater::~LLCallFloater()
{
resetVoiceRemoveTimers();
delete mSpeakerDelayRemover;
delete mParticipants;
mParticipants = NULL;
......@@ -648,33 +632,11 @@ void LLCallFloater::setState(LLAvatarListItem* item, ESpeakerState state)
void LLCallFloater::setVoiceRemoveTimer(const LLUUID& voice_speaker_id)
{
// If there is already a started timer for the current panel don't do anything.
bool no_timer_for_current_panel = true;
if (mVoiceLeftTimersMap.size() > 0)
{
timers_map::iterator found_it = mVoiceLeftTimersMap.find(voice_speaker_id);
if (found_it != mVoiceLeftTimersMap.end())
{
no_timer_for_current_panel = false;
}
}
if (no_timer_for_current_panel)
{
// Starting a timer to remove an avatar row panel after timeout
mVoiceLeftTimersMap.insert(timer_pair(voice_speaker_id,
new LLAvatarListItemRemoveTimer(boost::bind(&LLCallFloater::removeVoiceLeftParticipant, this, _1), mVoiceLeftRemoveDelay, voice_speaker_id)));
}
mSpeakerDelayRemover->setActionTimer(voice_speaker_id);
}
void LLCallFloater::removeVoiceLeftParticipant(const LLUUID& voice_speaker_id)
bool LLCallFloater::removeVoiceLeftParticipant(const LLUUID& voice_speaker_id)
{
if (mVoiceLeftTimersMap.size() > 0)
{
mVoiceLeftTimersMap.erase(mVoiceLeftTimersMap.find(voice_speaker_id));
}
LLAvatarList::uuid_vector_t& speaker_uuids = mAvatarList->getIDs();
LLAvatarList::uuid_vector_t::iterator pos = std::find(speaker_uuids.begin(), speaker_uuids.end(), voice_speaker_id);
if(pos != speaker_uuids.end())
......@@ -682,34 +644,19 @@ void LLCallFloater::removeVoiceLeftParticipant(const LLUUID& voice_speaker_id)
speaker_uuids.erase(pos);
mAvatarList->setDirty();
}
return false;
}
void LLCallFloater::resetVoiceRemoveTimers()
{
if (mVoiceLeftTimersMap.size() > 0)
{
for (timers_map::iterator iter = mVoiceLeftTimersMap.begin();
iter != mVoiceLeftTimersMap.end(); ++iter)
{
delete iter->second;
}
}
mVoiceLeftTimersMap.clear();
mSpeakerDelayRemover->removeAllTimers();
}
void LLCallFloater::removeVoiceRemoveTimer(const LLUUID& voice_speaker_id)
{
// Remove the timer if it has been already started
if (mVoiceLeftTimersMap.size() > 0)
{
timers_map::iterator found_it = mVoiceLeftTimersMap.find(voice_speaker_id);
if (found_it != mVoiceLeftTimersMap.end())
{
delete found_it->second;
mVoiceLeftTimersMap.erase(found_it);
}
}
mSpeakerDelayRemover->unsetActionTimer(voice_speaker_id);
}
bool LLCallFloater::validateSpeaker(const LLUUID& speaker_id)
......
......@@ -44,6 +44,8 @@ class LLNonAvatarCaller;
class LLOutputMonitorCtrl;
class LLParticipantList;
class LLSpeakerMgr;
class LLSpeakersDelayActionsStorage;
/**
* The Voice Control Panel is an ambient window summoned by clicking the flyout chevron on the Speak button.
* It can be torn-off and freely positioned onscreen.
......@@ -169,7 +171,7 @@ class LLCallFloater : public LLTransientDockableFloater, LLVoiceClientParticipan
*
* @param voice_speaker_id LLUUID of Avatar List item to be removed from the list.
*/
void removeVoiceLeftParticipant(const LLUUID& voice_speaker_id);
bool removeVoiceLeftParticipant(const LLUUID& voice_speaker_id);
/**
* Deletes all timers from the list to prevent started timers from ticking after destruction
......@@ -240,32 +242,11 @@ class LLCallFloater : public LLTransientDockableFloater, LLVoiceClientParticipan
boost::signals2::connection mAvatarListRefreshConnection;
/**
* class LLAvatarListItemRemoveTimer
*
* Implements a timer that removes avatar list item of a participant
* who has left the call.
* time out speakers when they are not part of current session
*/
class LLAvatarListItemRemoveTimer : public LLEventTimer
{
public:
typedef boost::function<void(const LLUUID&)> callback_t;
LLAvatarListItemRemoveTimer(callback_t remove_cb, F32 period, const LLUUID& speaker_id);
virtual ~LLAvatarListItemRemoveTimer() {};
virtual BOOL tick();
private:
callback_t mRemoveCallback;
LLUUID mSpeakerId;
};
typedef std::pair<LLUUID, LLAvatarListItemRemoveTimer*> timer_pair;
typedef std::map<LLUUID, LLAvatarListItemRemoveTimer*> timers_map;
timers_map mVoiceLeftTimersMap;
S32 mVoiceLeftRemoveDelay;
LLSpeakersDelayActionsStorage* mSpeakerDelayRemover;
/**
* Stores reference to current voice channel.
......
......@@ -245,7 +245,6 @@ void LLPanelIMControlPanel::nameUpdatedCallback(const LLUUID& id, const std::str
LLPanelGroupControlPanel::LLPanelGroupControlPanel(const LLUUID& session_id):
mParticipantList(NULL)
{
mSpeakerManager = LLIMModel::getInstance()->getSpeakerManager(session_id);
}
BOOL LLPanelGroupControlPanel::postBuild()
......@@ -304,7 +303,10 @@ void LLPanelGroupControlPanel::setSessionId(const LLUUID& session_id)
// for group and Ad-hoc chat we need to include agent into list
if(!mParticipantList)
mParticipantList = new LLParticipantList(mSpeakerManager, getChild<LLAvatarList>("speakers_list"), true,false);
{
LLSpeakerMgr* speaker_manager = LLIMModel::getInstance()->getSpeakerManager(session_id);
mParticipantList = new LLParticipantList(speaker_manager, getChild<LLAvatarList>("speakers_list"), true,false);
}
}
......
......@@ -37,8 +37,6 @@
#include "llvoicechannel.h"
#include "llcallingcard.h"
class LLSpeakerMgr;
class LLAvatarList;
class LLParticipantList;
class LLPanelChatControlPanel : public LLPanel
......@@ -110,7 +108,6 @@ class LLPanelGroupControlPanel : public LLPanelChatControlPanel
protected:
LLUUID mGroupID;
LLSpeakerMgr* mSpeakerManager;
LLParticipantList* mParticipantList;
......
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