diff options
| -rw-r--r-- | indra/newview/llimview.cpp | 47 | ||||
| -rw-r--r-- | indra/newview/llimview.h | 10 | ||||
| -rw-r--r-- | indra/newview/llvoiceclient.cpp | 15 | ||||
| -rw-r--r-- | indra/newview/llvoiceclient.h | 2 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/floater_incoming_call.xml | 12 | 
5 files changed, 75 insertions, 11 deletions
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index 6c4af0522f..b710c41650 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -154,7 +154,6 @@ LLIMModel::LLIMSession::LLIMSession(const LLUUID& session_id, const std::string&  	mInitialTargetIDs(ids),  	mVoiceChannel(NULL),  	mSpeakers(NULL), -	mCallDialogManager(NULL),  	mSessionInitialized(false),  	mCallBackEnabled(true),  	mTextIMPossible(true), @@ -287,9 +286,6 @@ void LLIMModel::LLIMSession::onVoiceChannelStateChanged(const LLVoiceChannel::ES  LLIMModel::LLIMSession::~LLIMSession()  { -	delete mCallDialogManager; -	mCallDialogManager = NULL; -  	delete mSpeakers;  	mSpeakers = NULL; @@ -1268,6 +1264,7 @@ void LLCallDialogManager::onVoiceChannelStateChanged(const LLVoiceChannel::EStat  {  	LLSD mCallDialogPayload;  	LLOutgoingCallDialog* ocd; +	bool is_incoming;  	mCallDialogPayload["session_id"] = sSession->mSessionID;  	mCallDialogPayload["session_name"] = sSession->mName; @@ -1277,8 +1274,10 @@ void LLCallDialogManager::onVoiceChannelStateChanged(const LLVoiceChannel::EStat  	switch(new_state)  	{			  	case LLVoiceChannel::STATE_CALL_STARTED : -		// do not show "Calling to..." if it is incoming P2P call -		if(sSession->mSessionType == LLIMModel::LLIMSession::P2P_SESSION && static_cast<LLVoiceChannelP2P*>(sSession->mVoiceChannel)->isIncomingCall()) +		// do not show "Calling to..." if it is incoming call +		is_incoming = LLVoiceClient::getInstance()->isSessionIncoming(sSession->mSessionID); +		// *TODO: implement for AdHoc and Group voice chats +		if(is_incoming)  		{  			return;  		} @@ -1290,6 +1289,7 @@ void LLCallDialogManager::onVoiceChannelStateChanged(const LLVoiceChannel::EStat  			ocd->getChild<LLTextBox>("leaving")->setVisible(true);  			ocd->getChild<LLTextBox>("connecting")->setVisible(false);  			ocd->getChild<LLTextBox>("noanswer")->setVisible(false); +			ocd->getChild<LLButton>("Cancel")->setVisible(true);  		}  		return; @@ -1301,10 +1301,12 @@ void LLCallDialogManager::onVoiceChannelStateChanged(const LLVoiceChannel::EStat  			ocd->getChild<LLTextBox>("leaving")->setVisible(true);  			ocd->getChild<LLTextBox>("connecting")->setVisible(true);  			ocd->getChild<LLTextBox>("noanswer")->setVisible(false); +			ocd->getChild<LLButton>("Cancel")->setVisible(true);  		}  		return;  	case LLVoiceChannel::STATE_ERROR : +		mCallDialogPayload["start_timer"] = true;  		ocd = dynamic_cast<LLOutgoingCallDialog*>(LLFloaterReg::showInstance("outgoing_call", mCallDialogPayload, TRUE));  		if (ocd)  		{ @@ -1312,6 +1314,7 @@ void LLCallDialogManager::onVoiceChannelStateChanged(const LLVoiceChannel::EStat  			ocd->getChild<LLTextBox>("leaving")->setVisible(false);  			ocd->getChild<LLTextBox>("connecting")->setVisible(false);  			ocd->getChild<LLTextBox>("noanswer")->setVisible(true); +			ocd->getChild<LLButton>("Cancel")->setVisible(false);  		}  		return; @@ -1363,6 +1366,33 @@ LLCallDialog(payload)  		instance->onCancel(instance);  	}	  } +void LLOutgoingCallDialog::draw() +{ +	if (lifetimeHasExpired()) +	{ +		onLifetimeExpired(); +	} +	LLDockableFloater::draw(); +} + +bool LLOutgoingCallDialog::lifetimeHasExpired() +{ +	if (mLifetimeTimer.getStarted()) +	{ +		F32 elapsed_time = mLifetimeTimer.getElapsedTimeF32(); +		if (elapsed_time > LIFETIME)  +		{ +			return true; +		} +	} +	return false; +} + +void LLOutgoingCallDialog::onLifetimeExpired() +{ +	mLifetimeTimer.stop(); +	closeFloater(); +}  void LLOutgoingCallDialog::onOpen(const LLSD& key)  { @@ -1391,6 +1421,11 @@ void LLOutgoingCallDialog::onOpen(const LLSD& key)  	childSetTextArg("connecting", "[CALLEE_NAME]", callee_name);  	LLAvatarIconCtrl* icon = getChild<LLAvatarIconCtrl>("avatar_icon");  	icon->setValue(callee_id); + +	if(mPayload.has("start_timer")) +	{ +		mLifetimeTimer.reset(); +	}  } diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index c002434a18..d85a4cda82 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -81,7 +81,6 @@ public:  		SType mSessionType;  		LLUUID mOtherParticipantID;  		std::vector<LLUUID> mInitialTargetIDs; -		LLCallDialogManager* mCallDialogManager;  		// connection to voice channel state change signal  		boost::signals2::connection mVoiceChannelStateChangeConnection; @@ -493,7 +492,16 @@ public:  	static void onCancel(void* user_data); +	// check timer state +	/*virtual*/ void draw(); +  private: +	// lifetime timer for NO_ANSWER notification +	LLTimer	mLifetimeTimer; +	// lifetime duration for NO_ANSWER notification +	static const S32 LIFETIME = 5; +	bool lifetimeHasExpired(); +	void onLifetimeExpired();  };  // Globals diff --git a/indra/newview/llvoiceclient.cpp b/indra/newview/llvoiceclient.cpp index 7e1e7c940f..63acba50e7 100644 --- a/indra/newview/llvoiceclient.cpp +++ b/indra/newview/llvoiceclient.cpp @@ -4279,6 +4279,7 @@ void LLVoiceClient::mediaStreamUpdatedEvent(  				{  					// Send the voice chat invite to the GUI layer  					// *TODO: Question: Should we correlate with the mute list here? +					session->mIncoming = true;  					session->mIMSessionID = LLIMMgr::computeSessionID(IM_SESSION_P2P_INVITE, session->mCallerID);  					session->mVoiceInvitePending = true;  					if(session->mName.empty()) @@ -6353,6 +6354,20 @@ LLVoiceClient::sessionState *LLVoiceClient::findSession(const LLUUID &participan  	return result;  } +bool LLVoiceClient::isSessionIncoming(const LLUUID &session_id) +{ +	for(sessionIterator iter = sessionsBegin(); iter != sessionsEnd(); iter++) +	{ +		sessionState *session = *iter; +		if(session->mIMSessionID == session_id) +		{ +			return session->mIncoming; +			break; +		} +	} +	return false; +} +  LLVoiceClient::sessionState *LLVoiceClient::addSession(const std::string &uri, const std::string &handle)  {  	sessionState *result = NULL; diff --git a/indra/newview/llvoiceclient.h b/indra/newview/llvoiceclient.h index 347fae6156..edfe0173f8 100644 --- a/indra/newview/llvoiceclient.h +++ b/indra/newview/llvoiceclient.h @@ -527,6 +527,8 @@ static	void updatePosition(void);  		// Currently this will be false only for PSTN P2P calls.  		// NOTE: this will return true if the session can't be found.   		bool isSessionTextIMPossible(const LLUUID &session_id); + +		bool isSessionIncoming(const LLUUID &session_id);  	private: diff --git a/indra/newview/skins/default/xui/en/floater_incoming_call.xml b/indra/newview/skins/default/xui/en/floater_incoming_call.xml index 526fda90d1..acd59b6f09 100644 --- a/indra/newview/skins/default/xui/en/floater_incoming_call.xml +++ b/indra/newview/skins/default/xui/en/floater_incoming_call.xml @@ -36,21 +36,25 @@       top="35"       width="36" />      <text +     clip_partial="true"       font="SansSerifLarge" -     height="20" +     height="37"       layout="topleft"       left="77"       name="caller name" -     top="27" +     top="20" +     use_ellipses="true"       width="315"       word_wrap="true" />      <text +     clip_partial="true"       font="SansSerif" -     height="50" +     height="30"       layout="topleft"       left="77"       name="question" -     top="52" +     top_pad="5" +     use_ellipses="true"       width="315"       word_wrap="true">       Do you want to leave [CURRENT_CHAT] and join this voice chat?  | 
