diff options
author | Mike Antipov <mantipov@productengine.com> | 2009-12-02 18:38:44 +0200 |
---|---|---|
committer | Mike Antipov <mantipov@productengine.com> | 2009-12-02 18:38:44 +0200 |
commit | b2891b732f145ee0d170afd8b116b834a0879973 (patch) | |
tree | f4dcd345af5877668bd89c5a33a8828e145c7b4f /indra/newview | |
parent | 34b624f873ce931c6089487d5381d76f99494feb (diff) |
Implemented major task EXT-2985 (Implement Avaline calls processing in Voice Control Panel)
-- improved Voice Control Panel to show avaline caller number as its name.
Separate instance of derived from LLAvatarListItem class was provided
--HG--
branch : product-engine
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llavatarlistitem.cpp | 23 | ||||
-rw-r--r-- | indra/newview/llavatarlistitem.h | 23 | ||||
-rw-r--r-- | indra/newview/llcallfloater.cpp | 75 | ||||
-rw-r--r-- | indra/newview/llcallfloater.h | 2 |
4 files changed, 103 insertions, 20 deletions
diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp index 3bee5c353f..59ed391c06 100644 --- a/indra/newview/llavatarlistitem.cpp +++ b/indra/newview/llavatarlistitem.cpp @@ -42,7 +42,7 @@ #include "llavatariconctrl.h" #include "llbutton.h" -LLAvatarListItem::LLAvatarListItem() +LLAvatarListItem::LLAvatarListItem(bool not_from_ui_factory/* = true*/) : LLPanel(), mAvatarIcon(NULL), mAvatarName(NULL), @@ -55,14 +55,12 @@ LLAvatarListItem::LLAvatarListItem() mShowInfoBtn(true), mShowProfileBtn(true) { - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_avatar_list_item.xml"); - // Remember avatar icon width including its padding from the name text box, - // so that we can hide and show the icon again later. - - mIconWidth = mAvatarName->getRect().mLeft - mAvatarIcon->getRect().mLeft; - mInfoBtnWidth = mInfoBtn->getRect().mRight - mSpeakingIndicator->getRect().mRight; - mProfileBtnWidth = mProfileBtn->getRect().mRight - mInfoBtn->getRect().mRight; - mSpeakingIndicatorWidth = mSpeakingIndicator->getRect().mRight - mAvatarName->getRect().mRight; + if (not_from_ui_factory) + { + LLUICtrlFactory::getInstance()->buildPanel(this, "panel_avatar_list_item.xml"); + } + // *NOTE: mantipov: do not use any member here. They can be uninitialized here in case instance + // is created from the UICtrlFactory } LLAvatarListItem::~LLAvatarListItem() @@ -87,6 +85,13 @@ BOOL LLAvatarListItem::postBuild() mProfileBtn->setVisible(false); mProfileBtn->setClickedCallback(boost::bind(&LLAvatarListItem::onProfileBtnClick, this)); + // Remember avatar icon width including its padding from the name text box, + // so that we can hide and show the icon again later. + mIconWidth = mAvatarName->getRect().mLeft - mAvatarIcon->getRect().mLeft; + mInfoBtnWidth = mInfoBtn->getRect().mRight - mSpeakingIndicator->getRect().mRight; + mProfileBtnWidth = mProfileBtn->getRect().mRight - mInfoBtn->getRect().mRight; + mSpeakingIndicatorWidth = mSpeakingIndicator->getRect().mRight - mAvatarName->getRect().mRight; + /* if(!p.buttons.profile) { diff --git a/indra/newview/llavatarlistitem.h b/indra/newview/llavatarlistitem.h index 341f5a6bcf..a7b080098d 100644 --- a/indra/newview/llavatarlistitem.h +++ b/indra/newview/llavatarlistitem.h @@ -51,7 +51,16 @@ public: virtual void show(LLView* spawning_view, const std::vector<LLUUID>& selected_uuids, S32 x, S32 y) = 0; }; - LLAvatarListItem(); + /** + * Creates an instance of LLAvatarListItem. + * + * It is not registered with LLDefaultChildRegistry. It is built via LLUICtrlFactory::buildPanel + * or via registered LLCallbackMap depend on passed parameter. + * + * @param not_from_ui_factory if true instance will be build with LLUICtrlFactory::buildPanel + * otherwise it should be registered via LLCallbackMap before creating. + */ + LLAvatarListItem(bool not_from_ui_factory = true); virtual ~LLAvatarListItem(); virtual BOOL postBuild(); @@ -82,8 +91,19 @@ public: void setContextMenu(ContextMenu* menu) { mContextMenu = menu; } + /** + * This method was added to fix EXT-2364 (Items in group/ad-hoc IM participant list (avatar names) should be reshaped when adding/removing the "(Moderator)" label) + * But this is a *HACK. The real reason of it was in incorrect logic while hiding profile/info/speaker buttons + * *TODO: new reshape method should be provided in lieu of this one to be called when visibility if those buttons is changed + */ void reshapeAvatarName(); +protected: + /** + * Contains indicator to show voice activity. + */ + LLOutputMonitorCtrl* mSpeakingIndicator; + private: typedef enum e_online_status { @@ -100,7 +120,6 @@ private: LLTextBox* mAvatarName; LLTextBox* mLastInteractionTime; - LLOutputMonitorCtrl* mSpeakingIndicator; LLButton* mInfoBtn; LLButton* mProfileBtn; ContextMenu* mContextMenu; diff --git a/indra/newview/llcallfloater.cpp b/indra/newview/llcallfloater.cpp index d82c088997..ad59c780f3 100644 --- a/indra/newview/llcallfloater.cpp +++ b/indra/newview/llcallfloater.cpp @@ -42,14 +42,45 @@ #include "llspeakers.h" +class LLNonAvatarCaller : public LLAvatarListItem +{ +public: + LLNonAvatarCaller() : LLAvatarListItem(false) + { + + } + BOOL postBuild() + { + BOOL rv = LLAvatarListItem::postBuild(); + + if (rv) + { + setOnline(true); + showLastInteractionTime(false); + setShowProfileBtn(false); + setShowInfoBtn(false); + } + return rv; + } + + void setSpeakerId(const LLUUID& id) { mSpeakingIndicator->setSpeakerId(id); } +}; + + +static void* create_non_avatar_caller(void*) +{ + return new LLNonAvatarCaller; +} + LLCallFloater::LLCallFloater(const LLSD& key) : LLDockableFloater(NULL, key) , mSpeakerManager(NULL) , mPaticipants(NULL) , mAvatarList(NULL) +, mNonAvatarCaller(NULL) , mVoiceType(VC_LOCAL_CHAT) { - + mFactoryMap["non_avatar_caller"] = LLCallbackMap(create_non_avatar_caller, NULL); } LLCallFloater::~LLCallFloater() @@ -66,6 +97,7 @@ BOOL LLCallFloater::postBuild() mAvatarList = getChild<LLAvatarList>("speakers_list"); childSetAction("leave_call_btn", boost::bind(&LLCallFloater::leaveCall, this)); + mNonAvatarCaller = getChild<LLNonAvatarCaller>("non_avatar_caller"); LLView *anchor_panel = LLBottomTray::getInstance()->getChild<LLView>("speak_panel"); @@ -161,14 +193,33 @@ void LLCallFloater::updateSession() void LLCallFloater::refreshPartisipantList() { delete mPaticipants; + mPaticipants = NULL; mAvatarList->clear(); - bool do_not_use_context_menu_in_local_chat = LLLocalSpeakerMgr::getInstance() != mSpeakerManager; - mPaticipants = new LLParticipantList(mSpeakerManager, mAvatarList, do_not_use_context_menu_in_local_chat); + bool non_avatar_caller = false; + if (VC_PEER_TO_PEER == mVoiceType) + { + LLIMModel::LLIMSession* session = LLIMModel::instance().findIMSession(mSpeakerManager->getSessionID()); + non_avatar_caller = !session->mOtherParticipantIsAvatar; + if (non_avatar_caller) + { + mNonAvatarCaller->setSpeakerId(session->mOtherParticipantID); + mNonAvatarCaller->setName(session->mName); + } + } + + mNonAvatarCaller->setVisible(non_avatar_caller); + mAvatarList->setVisible(!non_avatar_caller); - if (!do_not_use_context_menu_in_local_chat) + if (!non_avatar_caller) { - mAvatarList->setNoItemsCommentText(getString("no_one_near")); + bool do_not_use_context_menu_in_local_chat = LLLocalSpeakerMgr::getInstance() != mSpeakerManager; + mPaticipants = new LLParticipantList(mSpeakerManager, mAvatarList, do_not_use_context_menu_in_local_chat); + + if (!do_not_use_context_menu_in_local_chat) + { + mAvatarList->setNoItemsCommentText(getString("no_one_near")); + } } } @@ -189,15 +240,21 @@ void LLCallFloater::updateTitle() title = getString("title_nearby"); break; case VC_PEER_TO_PEER: - title = voice_channel->getSessionName(); + { + LLStringUtil::format_map_t args; + args["[NAME]"] = voice_channel->getSessionName(); + title = getString("title_peer_2_peer", args); + } break; case VC_AD_HOC_CHAT: title = getString("title_adhoc"); break; case VC_GROUP_CHAT: - LLStringUtil::format_map_t args; - args["[GROUP]"] = voice_channel->getSessionName(); - title = getString("title_group", args); + { + LLStringUtil::format_map_t args; + args["[GROUP]"] = voice_channel->getSessionName(); + title = getString("title_group", args); + } break; } diff --git a/indra/newview/llcallfloater.h b/indra/newview/llcallfloater.h index d0a2ca5303..b615f57d5b 100644 --- a/indra/newview/llcallfloater.h +++ b/indra/newview/llcallfloater.h @@ -37,6 +37,7 @@ #include "lldockablefloater.h" class LLAvatarList; +class LLNonAvatarCaller; class LLParticipantList; class LLSpeakerMgr; @@ -91,6 +92,7 @@ private: LLSpeakerMgr* mSpeakerManager; LLParticipantList* mPaticipants; LLAvatarList* mAvatarList; + LLNonAvatarCaller* mNonAvatarCaller; EVoiceControls mVoiceType; boost::signals2::connection mChannelChangedConnection; |