diff options
author | Dmitry Oleshko <doleshko@productengine.com> | 2009-12-17 13:53:59 +0200 |
---|---|---|
committer | Dmitry Oleshko <doleshko@productengine.com> | 2009-12-17 13:53:59 +0200 |
commit | 05b840d6b7576a30165f26f0b9c4c44136120e2d (patch) | |
tree | 514afc4b5aa934f853805940b808ad934a3c9367 /indra/newview | |
parent | b4bb8428b9072081855a289df95b600a800d4f82 (diff) |
fixed normal bug (EXT-3435) All voice notifications should look similar and according to the Voice UI Spec
- added new voice notification that replaced notification toasts
- now LLOutgoingCallDialog manages visibility of its controls on its own
--HG--
branch : product-engine
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llimview.cpp | 117 | ||||
-rw-r--r-- | indra/newview/llimview.h | 7 | ||||
-rw-r--r-- | indra/newview/llvoicechannel.cpp | 5 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_outgoing_call.xml | 26 |
4 files changed, 104 insertions, 51 deletions
diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index ad30b844a9..28d9f2170d 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -93,7 +93,8 @@ const static std::string ADHOC_NAME_SUFFIX(" Conference"); std::string LLCallDialogManager::sPreviousSessionlName = ""; std::string LLCallDialogManager::sCurrentSessionlName = ""; LLIMModel::LLIMSession* LLCallDialogManager::sSession = NULL; - +LLVoiceChannel::EState LLCallDialogManager::sOldState = LLVoiceChannel::STATE_READY; +const LLUUID LLOutgoingCallDialog::OCD_KEY = LLUUID("7CF78E11-0CFE-498D-ADB9-1417BF03DDB4"); // // Globals // @@ -1280,12 +1281,22 @@ void LLCallDialogManager::onVoiceChannelChanged(const LLUUID &session_id) void LLCallDialogManager::onVoiceChannelStateChanged(const LLVoiceChannel::EState& old_state, const LLVoiceChannel::EState& new_state, const LLVoiceChannel::EDirection& direction) { LLSD mCallDialogPayload; - LLOutgoingCallDialog* ocd; + LLOutgoingCallDialog* ocd = NULL; + + if(sOldState == new_state) + { + return; + } + + sOldState = new_state; mCallDialogPayload["session_id"] = sSession->mSessionID; mCallDialogPayload["session_name"] = sSession->mName; mCallDialogPayload["other_user_id"] = sSession->mOtherParticipantID; mCallDialogPayload["old_channel_name"] = sPreviousSessionlName; + mCallDialogPayload["state"] = new_state; + mCallDialogPayload["disconnected_channel_name"] = sSession->mName; + mCallDialogPayload["session_type"] = sSession->mSessionType; switch(new_state) { @@ -1295,46 +1306,10 @@ void LLCallDialogManager::onVoiceChannelStateChanged(const LLVoiceChannel::EStat { return; } - - ocd = dynamic_cast<LLOutgoingCallDialog*>(LLFloaterReg::showInstance("outgoing_call", mCallDialogPayload, TRUE)); - if (ocd) - { - ocd->getChild<LLTextBox>("calling")->setVisible(true); - 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; - - case LLVoiceChannel::STATE_RINGING : - ocd = dynamic_cast<LLOutgoingCallDialog*>(LLFloaterReg::showInstance("outgoing_call", mCallDialogPayload, TRUE)); - if (ocd) - { - ocd->getChild<LLTextBox>("calling")->setVisible(false); - 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) - { - ocd->getChild<LLTextBox>("calling")->setVisible(false); - 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; + break; case LLVoiceChannel::STATE_CONNECTED : - case LLVoiceChannel::STATE_HUNG_UP : - ocd = dynamic_cast<LLOutgoingCallDialog*>(LLFloaterReg::showInstance("outgoing_call", mCallDialogPayload, TRUE)); + ocd = LLFloaterReg::findTypedInstance<LLOutgoingCallDialog>("outgoing_call", LLOutgoingCallDialog::OCD_KEY); if (ocd) { ocd->closeFloater(); @@ -1345,6 +1320,11 @@ void LLCallDialogManager::onVoiceChannelStateChanged(const LLVoiceChannel::EStat break; } + ocd = LLFloaterReg::getTypedInstance<LLOutgoingCallDialog>("outgoing_call", LLOutgoingCallDialog::OCD_KEY); + if(ocd) + { + ocd->show(mCallDialogPayload); + } } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -1374,12 +1354,13 @@ void LLCallDialog::onOpen(const LLSD& key) LLOutgoingCallDialog::LLOutgoingCallDialog(const LLSD& payload) : LLCallDialog(payload) { - LLOutgoingCallDialog* instance = LLFloaterReg::findTypedInstance<LLOutgoingCallDialog>("outgoing_call", payload); + LLOutgoingCallDialog* instance = LLFloaterReg::findTypedInstance<LLOutgoingCallDialog>("outgoing_call", LLOutgoingCallDialog::OCD_KEY); if(instance && instance->getVisible()) { instance->onCancel(instance); } } + void LLOutgoingCallDialog::draw() { if (lifetimeHasExpired()) @@ -1408,10 +1389,14 @@ void LLOutgoingCallDialog::onLifetimeExpired() closeFloater(); } -void LLOutgoingCallDialog::onOpen(const LLSD& key) +void LLOutgoingCallDialog::show(const LLSD& key) { - LLCallDialog::onOpen(key); + mPayload = key; + + // hide all text at first + hideAllText(); + // customize text strings // tell the user which voice channel they are leaving if (!mPayload["old_channel_name"].asString().empty()) { @@ -1422,6 +1407,12 @@ void LLOutgoingCallDialog::onOpen(const LLSD& key) childSetTextArg("leaving", "[CURRENT_CHAT]", getString("localchat")); } + if (!mPayload["disconnected_channel_name"].asString().empty()) + { + childSetTextArg("nearby", "[VOICE_CHANNEL_NAME]", mPayload["disconnected_channel_name"].asString()); + childSetTextArg("nearby_P2P", "[VOICE_CHANNEL_NAME]", mPayload["disconnected_channel_name"].asString()); + } + std::string callee_name = mPayload["session_name"].asString(); if (callee_name == "anonymous") { @@ -1438,12 +1429,48 @@ void LLOutgoingCallDialog::onOpen(const LLSD& key) // stop timer by default mLifetimeTimer.stop(); - if(mPayload.has("start_timer")) + + // show only necessary strings and controls + switch(mPayload["state"].asInteger()) { - mLifetimeTimer.reset(); + case LLVoiceChannel::STATE_CALL_STARTED : + getChild<LLTextBox>("calling")->setVisible(true); + getChild<LLTextBox>("leaving")->setVisible(true); + break; + case LLVoiceChannel::STATE_RINGING : + getChild<LLTextBox>("leaving")->setVisible(true); + getChild<LLTextBox>("connecting")->setVisible(true); + break; + case LLVoiceChannel::STATE_ERROR : + getChild<LLTextBox>("noanswer")->setVisible(true); + getChild<LLButton>("Cancel")->setVisible(false); + mLifetimeTimer.start(); + break; + case LLVoiceChannel::STATE_HUNG_UP : + if (mPayload["session_type"].asInteger() == LLIMModel::LLIMSession::P2P_SESSION) + { + getChild<LLTextBox>("nearby_P2P")->setVisible(true); + } + else + { + getChild<LLTextBox>("nearby")->setVisible(true); + } + getChild<LLButton>("Cancel")->setVisible(false); + mLifetimeTimer.start(); } + + openFloater(LLOutgoingCallDialog::OCD_KEY); } +void LLOutgoingCallDialog::hideAllText() +{ + getChild<LLTextBox>("calling")->setVisible(false); + getChild<LLTextBox>("leaving")->setVisible(false); + getChild<LLTextBox>("connecting")->setVisible(false); + getChild<LLTextBox>("nearby_P2P")->setVisible(false); + getChild<LLTextBox>("nearby")->setVisible(false); + getChild<LLTextBox>("noanswer")->setVisible(false); +} //static void LLOutgoingCallDialog::onCancel(void* user_data) diff --git a/indra/newview/llimview.h b/indra/newview/llimview.h index 6eb3f3d07f..09f0c9df71 100644 --- a/indra/newview/llimview.h +++ b/indra/newview/llimview.h @@ -467,6 +467,7 @@ protected: static std::string sPreviousSessionlName; static std::string sCurrentSessionlName; static LLIMModel::LLIMSession* sSession; + static LLVoiceChannel::EState sOldState; }; class LLCallDialog : public LLDockableFloater @@ -504,14 +505,18 @@ public: LLOutgoingCallDialog(const LLSD& payload); /*virtual*/ BOOL postBuild(); - /*virtual*/ void onOpen(const LLSD& key); + void show(const LLSD& key); static void onCancel(void* user_data); + static const LLUUID OCD_KEY; // check timer state /*virtual*/ void draw(); private: + + // hide all text boxes + void hideAllText(); // lifetime timer for NO_ANSWER notification LLTimer mLifetimeTimer; // lifetime duration for NO_ANSWER notification diff --git a/indra/newview/llvoicechannel.cpp b/indra/newview/llvoicechannel.cpp index fd4e7bb91f..60a2c3b638 100644 --- a/indra/newview/llvoicechannel.cpp +++ b/indra/newview/llvoicechannel.cpp @@ -229,7 +229,6 @@ void LLVoiceChannel::handleStatusChange(EStatusType type) { // if forceably removed from channel // update the UI and revert to default channel - LLNotificationsUtil::add("VoiceChannelDisconnected", mNotifyArgs); deactivate(); } mIgnoreNextSessionLeave = FALSE; @@ -741,6 +740,7 @@ void LLVoiceChannelP2P::handleStatusChange(EStatusType type) case STATUS_LEFT_CHANNEL: if (callStarted() && !mIgnoreNextSessionLeave && !sSuspended) { + // *TODO: use it to show DECLINE voice notification if (mState == STATE_RINGING) { // other user declined call @@ -748,8 +748,7 @@ void LLVoiceChannelP2P::handleStatusChange(EStatusType type) } else { - // other user hung up - LLNotificationsUtil::add("VoiceChannelDisconnectedP2P", mNotifyArgs); + // other user hung up } deactivate(); } diff --git a/indra/newview/skins/default/xui/en/floater_outgoing_call.xml b/indra/newview/skins/default/xui/en/floater_outgoing_call.xml index ae4d5042ef..c6bc093c6c 100644 --- a/indra/newview/skins/default/xui/en/floater_outgoing_call.xml +++ b/indra/newview/skins/default/xui/en/floater_outgoing_call.xml @@ -69,7 +69,29 @@ Calling [CALLEE_NAME] word_wrap="true"> No Answer. Please try again later. </text> - <text + <text + font="SansSerifLarge" + height="40" + layout="topleft" + left="77" + name="nearby" + top="27" + width="315" + word_wrap="true"> + You have been disconnected from [VOICE_CHANNEL_NAME]. You will now be reconnected to Nearby Voice Chat. + </text> + <text + font="SansSerifLarge" + height="40" + layout="topleft" + left="77" + name="nearby_P2P" + top="27" + width="315" + word_wrap="true"> + [VOICE_CHANNEL_NAME] has ended the call. You will now be reconnected to Nearby Voice Chat. + </text> + <text font="SansSerif" height="50" layout="topleft" @@ -80,7 +102,7 @@ No Answer. Please try again later. word_wrap="true"> Leaving [CURRENT_CHAT]. </text> - <button + <button height="24" label="Cancel" label_selected="Cancel" |