From 14708a3ace184b0654ca7923732be6e06962d583 Mon Sep 17 00:00:00 2001 From: AlexanderP ProductEngine Date: Wed, 22 Aug 2012 18:27:29 +0300 Subject: CHUI_310 make NearbyChat a singletone --- indra/newview/llagent.cpp | 4 +- indra/newview/llchatitemscontainerctrl.cpp | 4 +- indra/newview/llfirstuse.cpp | 2 +- indra/newview/llfloatertranslationsettings.cpp | 2 +- indra/newview/llgesturemgr.cpp | 2 +- indra/newview/llimconversation.cpp | 32 +++++++++-- indra/newview/llimfloatercontainer.cpp | 6 +-- indra/newview/llimview.cpp | 7 +-- indra/newview/llnearbychat.cpp | 41 ++++++-------- indra/newview/llnearbychat.h | 8 +-- indra/newview/llnearbychathandler.cpp | 6 +-- indra/newview/llnotificationhandlerutil.cpp | 5 +- indra/newview/llnotificationtiphandler.cpp | 3 +- indra/newview/llstartup.cpp | 1 + indra/newview/llviewerfloaterreg.cpp | 2 +- indra/newview/llviewergesture.cpp | 2 +- indra/newview/llviewerkeyboard.cpp | 2 +- indra/newview/llviewermessage.cpp | 9 ++-- indra/newview/llviewerwindow.cpp | 62 +++++++++++----------- .../skins/default/xui/da/panel_nearby_chat_bar.xml | 2 +- .../skins/default/xui/de/floater_chat_bar.xml | 2 +- .../skins/default/xui/de/panel_nearby_chat_bar.xml | 2 +- indra/newview/skins/default/xui/en/menu_viewer.xml | 4 +- .../skins/default/xui/en/panel_bottomtray_lite.xml | 2 +- .../skins/default/xui/en/panel_nearby_chat_bar.xml | 2 +- .../skins/default/xui/es/floater_chat_bar.xml | 2 +- .../skins/default/xui/es/panel_nearby_chat_bar.xml | 2 +- .../skins/default/xui/fr/floater_chat_bar.xml | 2 +- .../skins/default/xui/fr/panel_nearby_chat_bar.xml | 2 +- .../skins/default/xui/it/floater_chat_bar.xml | 2 +- .../skins/default/xui/it/panel_nearby_chat_bar.xml | 2 +- .../skins/default/xui/ja/floater_chat_bar.xml | 2 +- .../skins/default/xui/ja/panel_nearby_chat_bar.xml | 2 +- .../skins/default/xui/pl/panel_nearby_chat_bar.xml | 2 +- .../skins/default/xui/pt/floater_chat_bar.xml | 2 +- .../skins/default/xui/pt/panel_nearby_chat_bar.xml | 2 +- .../skins/default/xui/ru/floater_chat_bar.xml | 2 +- .../skins/default/xui/ru/panel_nearby_chat_bar.xml | 2 +- .../skins/default/xui/tr/floater_chat_bar.xml | 2 +- .../skins/default/xui/tr/panel_nearby_chat_bar.xml | 2 +- .../skins/default/xui/zh/panel_nearby_chat_bar.xml | 2 +- 41 files changed, 125 insertions(+), 121 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llagent.cpp b/indra/newview/llagent.cpp index f187318c0f..be6901c36a 100755 --- a/indra/newview/llagent.cpp +++ b/indra/newview/llagent.cpp @@ -1911,7 +1911,7 @@ void LLAgent::startTyping() { sendAnimationRequest(ANIM_AGENT_TYPE, ANIM_REQUEST_START); } - LLNearbyChat::getInstance()->sendChatFromViewer("", CHAT_TYPE_START, FALSE); + (LLNearbyChat::instance()).sendChatFromViewer("", CHAT_TYPE_START, FALSE); } //----------------------------------------------------------------------------- @@ -1923,7 +1923,7 @@ void LLAgent::stopTyping() { clearRenderState(AGENT_STATE_TYPING); sendAnimationRequest(ANIM_AGENT_TYPE, ANIM_REQUEST_STOP); - LLNearbyChat::getInstance()->sendChatFromViewer("", CHAT_TYPE_STOP, FALSE); + (LLNearbyChat::instance()).sendChatFromViewer("", CHAT_TYPE_STOP, FALSE); } } diff --git a/indra/newview/llchatitemscontainerctrl.cpp b/indra/newview/llchatitemscontainerctrl.cpp index 61772b4bb7..e6340e0fa3 100644 --- a/indra/newview/llchatitemscontainerctrl.cpp +++ b/indra/newview/llchatitemscontainerctrl.cpp @@ -323,12 +323,12 @@ BOOL LLNearbyChatToastPanel::handleMouseUp (S32 x, S32 y, MASK mask) return TRUE; else { - LLNearbyChat::getInstance()->showHistory(); + LLNearbyChat::instance().showHistory(); return FALSE; } } - LLNearbyChat::getInstance()->showHistory(); + LLNearbyChat::instance().showHistory(); return LLPanel::handleMouseUp(x,y,mask); } diff --git a/indra/newview/llfirstuse.cpp b/indra/newview/llfirstuse.cpp index a9f52282a5..e2850f5181 100644 --- a/indra/newview/llfirstuse.cpp +++ b/indra/newview/llfirstuse.cpp @@ -74,7 +74,7 @@ void LLFirstUse::resetFirstUse() // static void LLFirstUse::otherAvatarChatFirst(bool enable) { - firstUseNotification("FirstOtherChatBeforeUser", enable, "HintChat", LLSD(), LLSD().with("target", "chat_bar").with("direction", "top_right").with("distance", 24)); + firstUseNotification("FirstOtherChatBeforeUser", enable, "HintChat", LLSD(), LLSD().with("target", "nearby_chat").with("direction", "top_right").with("distance", 24)); } // static diff --git a/indra/newview/llfloatertranslationsettings.cpp b/indra/newview/llfloatertranslationsettings.cpp index bb01ce5a7e..b5b86dadc2 100644 --- a/indra/newview/llfloatertranslationsettings.cpp +++ b/indra/newview/llfloatertranslationsettings.cpp @@ -293,6 +293,6 @@ void LLFloaterTranslationSettings::onBtnOK() gSavedSettings.setString("TranslationService", getSelectedService()); gSavedSettings.setString("BingTranslateAPIKey", getEnteredBingKey()); gSavedSettings.setString("GoogleTranslateAPIKey", getEnteredGoogleKey()); - LLNearbyChat::getInstance()->showTranslationCheckbox(LLTranslate::isTranslationConfigured()); + LLNearbyChat::instance().showTranslationCheckbox(LLTranslate::isTranslationConfigured()); closeFloater(false); } diff --git a/indra/newview/llgesturemgr.cpp b/indra/newview/llgesturemgr.cpp index 26b63bdacb..0377337af6 100644 --- a/indra/newview/llgesturemgr.cpp +++ b/indra/newview/llgesturemgr.cpp @@ -997,7 +997,7 @@ void LLGestureMgr::runStep(LLMultiGesture* gesture, LLGestureStep* step) const BOOL animate = FALSE; - LLNearbyChat::getInstance()->sendChatFromViewer(chat_text, CHAT_TYPE_NORMAL, animate); + LLNearbyChat::instance().sendChatFromViewer(chat_text, CHAT_TYPE_NORMAL, animate); gesture->mCurrentStep++; break; diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index ee7f58b01f..2212673d3a 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -81,13 +81,35 @@ LLIMConversation::~LLIMConversation() //static LLIMConversation* LLIMConversation::findConversation(const LLUUID& uuid) { - return LLFloaterReg::findTypedInstance(uuid.isNull()? "chat_bar" : "impanel", LLSD(uuid)); + LLIMConversation* conv; + + if (uuid.isNull()) + { + conv = LLFloaterReg::findTypedInstance("nearby_chat"); + } + else + { + conv = LLFloaterReg::findTypedInstance("impanel", LLSD(uuid)); + } + + return conv; }; //static LLIMConversation* LLIMConversation::getConversation(const LLUUID& uuid) { - return LLFloaterReg::getTypedInstance(uuid.isNull()? "chat_bar" : "impanel", LLSD(uuid)); + LLIMConversation* conv; + + if (uuid.isNull()) + { + conv = LLFloaterReg::getTypedInstance("nearby_chat"); + } + else + { + conv = LLFloaterReg::getTypedInstance("impanel", LLSD(uuid)); + } + + return conv; }; @@ -336,15 +358,15 @@ void LLIMConversation::processChatHistoryStyleUpdate() } } - LLNearbyChat* nearby_chat = LLNearbyChat::getInstance(); - if (nearby_chat) + if (LLNearbyChat::instanceExists()) { - nearby_chat->reloadMessages(); + LLNearbyChat::instance().reloadMessages(); } } void LLIMConversation::updateCallBtnState(bool callIsActive) { +llwarns<<(this->getName())<("voice_call_btn")->setImageOverlay( callIsActive? getString("call_btn_stop") : getString("call_btn_start")); enableDisableCallBtn(); diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 4d0bd623f8..a3f5e357c9 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -315,13 +315,13 @@ void LLIMFloaterContainer::setVisible(BOOL visible) if (visible) { // Make sure we have the Nearby Chat present when showing the conversation container - LLIMConversation* nearby_chat = LLIMConversation::findConversation(LLUUID::null); + LLIMConversation* nearby_chat = LLFloaterReg::findTypedInstance("nearby_chat"); if (nearby_chat == NULL) { // If not found, force the creation of the nearby chat conversation panel // *TODO: find a way to move this to XML as a default panel or something like that - LLSD name("chat_bar"); - LLFloaterReg::toggleInstanceOrBringToFront(name, LLSD(LLUUID::null)); + LLSD name("nearby_chat"); + LLFloaterReg::toggleInstanceOrBringToFront(name); } } diff --git a/indra/newview/llimview.cpp b/indra/newview/llimview.cpp index d88a558125..216db15c94 100644 --- a/indra/newview/llimview.cpp +++ b/indra/newview/llimview.cpp @@ -2486,12 +2486,9 @@ void LLIMMgr::addSystemMessage(const LLUUID& session_id, const std::string& mess LLChat chat(message); chat.mSourceType = CHAT_SOURCE_SYSTEM; - - LLNearbyChat* nearby_chat = LLNearbyChat::getInstance(); - - if(nearby_chat) + if (LLNearbyChat::instanceExists()) { - nearby_chat->addMessage(chat); + LLNearbyChat::instance().addMessage(chat); } } else // going to IM session diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index e1454fb5dc..a723748094 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -123,8 +123,8 @@ static LLChatTypeTrigger sChatTypeTriggers[] = { }; -LLNearbyChat::LLNearbyChat(const LLSD& key) -: LLIMConversation(key), +LLNearbyChat::LLNearbyChat(const LLSD& llsd) +: LLIMConversation(LLSD()), //mOutputMonitor(NULL), mSpeakerMgr(NULL), mExpandedHeight(COLLAPSED_HEIGHT + EXPANDED_HEIGHT) @@ -133,6 +133,7 @@ LLNearbyChat::LLNearbyChat(const LLSD& key) setIsChrome(TRUE); mKey = LLSD(); mSpeakerMgr = LLLocalSpeakerMgr::getInstance(); + setName("nearby_chat"); } //virtual @@ -379,11 +380,6 @@ void LLNearbyChat::onChatFontChange(LLFontGL* fontp) } } -//static -LLNearbyChat* LLNearbyChat::getInstance() -{ - return LLFloaterReg::getTypedInstance("chat_bar", LLSD(LLUUID::null)); -} void LLNearbyChat::show() { @@ -646,7 +642,10 @@ void LLNearbyChat::appendMessage(const LLChat& chat, const LLSD &args) chat_args["show_time"] = gSavedSettings.getBOOL("IMShowTime"); chat_args["show_names_for_p2p_conv"] = true; - mChatHistory->appendMessage(chat, chat_args); + if (mChatHistory) + { + mChatHistory->appendMessage(chat, chat_args); + } } } @@ -781,22 +780,20 @@ void LLNearbyChat::sendChatFromViewer(const LLWString &wtext, EChatType type, BO // static void LLNearbyChat::startChat(const char* line) { - LLNearbyChat* cb = LLNearbyChat::getInstance(); - - if (cb ) + if (LLNearbyChat::instanceExists()) { - cb->show(); - cb->setVisible(TRUE); - cb->setFocus(TRUE); - cb->mInputEditor->setFocus(TRUE); + (LLNearbyChat::instance()).show(); + (LLNearbyChat::instance()).setVisible(TRUE); + (LLNearbyChat::instance()).setFocus(TRUE); + (LLNearbyChat::instance().mInputEditor)->setFocus(TRUE); if (line) { std::string line_string(line); - cb->mInputEditor->setText(line_string); + (LLNearbyChat::instance().mInputEditor)->setText(line_string); } - cb->mInputEditor->endOfDoc(); + (LLNearbyChat::instance().mInputEditor)->endOfDoc(); } } @@ -804,14 +801,10 @@ void LLNearbyChat::startChat(const char* line) // static void LLNearbyChat::stopChat() { - LLNearbyChat* cb = LLNearbyChat::getInstance(); - - if (cb) + if (LLNearbyChat::instanceExists()) { - cb->mInputEditor->setFocus(FALSE); - - // stop typing animation - gAgent.stopTyping(); + (LLNearbyChat::instance().mInputEditor)->setFocus(FALSE); + gAgent.stopTyping(); } } diff --git a/indra/newview/llnearbychat.h b/indra/newview/llnearbychat.h index 7c58e3037e..379bfbee4b 100644 --- a/indra/newview/llnearbychat.h +++ b/indra/newview/llnearbychat.h @@ -35,17 +35,19 @@ #include "lloutputmonitorctrl.h" #include "llspeakers.h" #include "llscrollbar.h" +#include "llsingleton.h" #include "llviewerchat.h" #include "llpanel.h" class LLResizeBar; class LLNearbyChat - : public LLIMConversation + : public LLIMConversation, + public LLSingleton { public: // constructor for inline chat-bars (e.g. hosted in chat history window) - LLNearbyChat(const LLSD& key); + LLNearbyChat(const LLSD& key = LLSD()); ~LLNearbyChat() {} /*virtual*/ BOOL postBuild(); @@ -61,8 +63,6 @@ public: void reloadMessages(); void removeScreenChat(); - static LLNearbyChat* getInstance(); - void addToHost(); void show(); bool isChatVisible() const; diff --git a/indra/newview/llnearbychathandler.cpp b/indra/newview/llnearbychathandler.cpp index c97e3585e1..37f4cc4c19 100644 --- a/indra/newview/llnearbychathandler.cpp +++ b/indra/newview/llnearbychathandler.cpp @@ -487,8 +487,6 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, if(chat_msg.mText.empty()) return;//don't process empty messages - LLNearbyChat* nearby_chat = LLNearbyChat::getInstance(); - // Build notification data LLSD chat; chat["message"] = chat_msg.mText; @@ -539,7 +537,7 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, } } - nearby_chat->addMessage(chat_msg, true, args); + LLNearbyChat::instance().addMessage(chat_msg, true, args); if(chat_msg.mSourceType == CHAT_SOURCE_AGENT && chat_msg.mFromID.notNull() @@ -555,7 +553,7 @@ void LLNearbyChatHandler::processChat(const LLChat& chat_msg, // Send event on to LLEventStream sChatWatcher->post(chat); - if( nearby_chat->isInVisibleChain() + if( LLNearbyChat::instance().isInVisibleChain() || ( chat_msg.mSourceType == CHAT_SOURCE_AGENT && gSavedSettings.getBOOL("UseChatBubbles") ) || mChannel.isDead() diff --git a/indra/newview/llnotificationhandlerutil.cpp b/indra/newview/llnotificationhandlerutil.cpp index cba22b233b..db8e917435 100644 --- a/indra/newview/llnotificationhandlerutil.cpp +++ b/indra/newview/llnotificationhandlerutil.cpp @@ -181,14 +181,13 @@ void LLHandlerUtil::logGroupNoticeToIMGroup( // static void LLHandlerUtil::logToNearbyChat(const LLNotificationPtr& notification, EChatSourceType type) { - LLNearbyChat* nearby_chat = LLNearbyChat::getInstance(); - if(nearby_chat) + if (LLNearbyChat::instanceExists()) { LLChat chat_msg(notification->getMessage()); chat_msg.mSourceType = type; chat_msg.mFromName = SYSTEM_FROM; chat_msg.mFromID = LLUUID::null; - nearby_chat->addMessage(chat_msg); + LLNearbyChat::instance().addMessage(chat_msg); } } diff --git a/indra/newview/llnotificationtiphandler.cpp b/indra/newview/llnotificationtiphandler.cpp index a420c0d2ed..67fc9b27dc 100644 --- a/indra/newview/llnotificationtiphandler.cpp +++ b/indra/newview/llnotificationtiphandler.cpp @@ -85,8 +85,7 @@ bool LLTipHandler::processNotification(const LLNotificationPtr& notification) LLHandlerUtil::logToNearbyChat(notification, CHAT_SOURCE_SYSTEM); // don't show toast if Nearby Chat is opened - LLNearbyChat* nearby_chat = LLNearbyChat::getInstance(); - if (nearby_chat->isChatVisible()) + if (LLNearbyChat::instance().isChatVisible()) { return false; } diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index ab72b4e512..c827b39d0e 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -64,6 +64,7 @@ #include "llmessageconfig.h" #include "llmoveview.h" #include "llimfloatercontainer.h" +#include "llnearbychat.h" #include "llnotifications.h" #include "llnotificationsutil.h" #include "llteleporthistory.h" diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp index 50735d10bd..927ee8f380 100644 --- a/indra/newview/llviewerfloaterreg.cpp +++ b/indra/newview/llviewerfloaterreg.cpp @@ -192,7 +192,7 @@ void LLViewerFloaterReg::registerFloaters() LLFloaterReg::add("bumps", "floater_bumps.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("camera", "floater_camera.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); - LLFloaterReg::add("chat_bar", "floater_im_session.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); + LLFloaterReg::add("nearby_chat", "floater_im_session.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("compile_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); LLFloaterReg::add("conversation", "floater_conversation_log.xml", (LLFloaterBuildFunc)&LLFloaterReg::build); diff --git a/indra/newview/llviewergesture.cpp b/indra/newview/llviewergesture.cpp index c7d37e102e..a2dea31d9b 100644 --- a/indra/newview/llviewergesture.cpp +++ b/indra/newview/llviewergesture.cpp @@ -130,7 +130,7 @@ void LLViewerGesture::doTrigger( BOOL send_chat ) { // Don't play nodding animation, since that might not blend // with the gesture animation. - LLNearbyChat::getInstance()->sendChatFromViewer(mOutputString, CHAT_TYPE_NORMAL, FALSE); + LLNearbyChat::instance().sendChatFromViewer(mOutputString, CHAT_TYPE_NORMAL, FALSE); } } diff --git a/indra/newview/llviewerkeyboard.cpp b/indra/newview/llviewerkeyboard.cpp index 385d3cd29a..7105720eb4 100644 --- a/indra/newview/llviewerkeyboard.cpp +++ b/indra/newview/llviewerkeyboard.cpp @@ -543,7 +543,7 @@ void start_gesture( EKeystate s ) if (KEYSTATE_UP == s && ! (focus_ctrlp && focus_ctrlp->acceptsTextInput())) { - if (LLNearbyChat::getInstance()->getCurrentChat().empty()) + if (LLNearbyChat::instance().getCurrentChat().empty()) { // No existing chat in chat editor, insert '/' LLNearbyChat::startChat("/"); diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index b20b86a582..9abd269f0f 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -2297,12 +2297,10 @@ void god_message_name_cb(const LLAvatarName& av_name, LLChat chat, std::string m // Treat like a system message and put in chat history. chat.mText = av_name.getCompleteName() + ": " + message; - LLNearbyChat* nearby_chat = LLNearbyChat::getInstance(); - if(nearby_chat) + if (LLNearbyChat::instanceExists()) { - nearby_chat->addMessage(chat); + LLNearbyChat::instance().addMessage(chat); } - } void process_improved_im(LLMessageSystem *msg, void **user_data) @@ -2897,8 +2895,7 @@ void process_improved_im(LLMessageSystem *msg, void **user_data) // Note: lie to Nearby Chat, pretending that this is NOT an IM, because // IMs from obejcts don't open IM sessions. - LLNearbyChat* nearby_chat = LLNearbyChat::getInstance(); - if(!chat_from_system && nearby_chat) + if(!chat_from_system && LLNearbyChat::instanceExists()) { chat.mOwnerID = from_id; LLSD args; diff --git a/indra/newview/llviewerwindow.cpp b/indra/newview/llviewerwindow.cpp index 1bcf15913f..23d2b1633d 100755 --- a/indra/newview/llviewerwindow.cpp +++ b/indra/newview/llviewerwindow.cpp @@ -198,7 +198,6 @@ #include "llfloaternotificationsconsole.h" -#include "llnearbychat.h" #include "llwindowlistener.h" #include "llviewerwindowlistener.h" #include "llpaneltopinfobar.h" @@ -2497,43 +2496,42 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) // Traverses up the hierarchy if( keyboard_focus ) { - LLNearbyChat* nearby_chat = LLFloaterReg::findTypedInstance("chat_bar"); - - if (nearby_chat) + if (LLNearbyChat::instanceExists()) { - LLChatEntry* chat_editor = nearby_chat->getChatBox(); - - // arrow keys move avatar while chatting hack - if (chat_editor && chat_editor->hasFocus()) - { - // If text field is empty, there's no point in trying to move - // cursor with arrow keys, so allow movement - if (chat_editor->getText().empty() - || gSavedSettings.getBOOL("ArrowKeysAlwaysMove")) + LLChatEntry* chat_editor = LLNearbyChat::instance().getChatBox(); + + // arrow keys move avatar while chatting hack + if (chat_editor && chat_editor->hasFocus()) { - // let Control-Up and Control-Down through for chat line history, - if (!(key == KEY_UP && mask == MASK_CONTROL) - && !(key == KEY_DOWN && mask == MASK_CONTROL)) + // If text field is empty, there's no point in trying to move + // cursor with arrow keys, so allow movement + if (chat_editor->getText().empty() + || gSavedSettings.getBOOL("ArrowKeysAlwaysMove")) { - switch(key) + // let Control-Up and Control-Down through for chat line history, + if (!(key == KEY_UP && mask == MASK_CONTROL) + && !(key == KEY_DOWN && mask == MASK_CONTROL)) { - case KEY_LEFT: - case KEY_RIGHT: - case KEY_UP: - case KEY_DOWN: - case KEY_PAGE_UP: - case KEY_PAGE_DOWN: - case KEY_HOME: - // when chatbar is empty or ArrowKeysAlwaysMove set, - // pass arrow keys on to avatar... - return FALSE; - default: - break; + switch(key) + { + case KEY_LEFT: + case KEY_RIGHT: + case KEY_UP: + case KEY_DOWN: + case KEY_PAGE_UP: + case KEY_PAGE_DOWN: + case KEY_HOME: + // when chatbar is empty or ArrowKeysAlwaysMove set, + // pass arrow keys on to avatar... + return FALSE; + default: + break; + } } } } } - } + if (keyboard_focus->handleKey(key, mask, FALSE)) { return TRUE; @@ -2564,11 +2562,11 @@ BOOL LLViewerWindow::handleKey(KEY key, MASK mask) if ( gSavedSettings.getS32("LetterKeysFocusChatBar") && !gAgentCamera.cameraMouselook() && !keyboard_focus && key < 0x80 && (mask == MASK_NONE || mask == MASK_SHIFT) ) { - LLChatEntry* chat_editor = LLNearbyChat::getInstance()->getChatBox(); + LLChatEntry* chat_editor = LLNearbyChat::instance().getChatBox(); if (chat_editor) { // passing NULL here, character will be added later when it is handled by character handler. - LLNearbyChat::getInstance()->startChat(NULL); + LLNearbyChat::instance().startChat(NULL); return TRUE; } } diff --git a/indra/newview/skins/default/xui/da/panel_nearby_chat_bar.xml b/indra/newview/skins/default/xui/da/panel_nearby_chat_bar.xml index 949cbcbd7b..eb104201f8 100644 --- a/indra/newview/skins/default/xui/da/panel_nearby_chat_bar.xml +++ b/indra/newview/skins/default/xui/da/panel_nearby_chat_bar.xml @@ -1,5 +1,5 @@ - + -- cgit v1.2.3 From 11e9f66e6217c22373f5d47518f6d1f9885f1793 Mon Sep 17 00:00:00 2001 From: William Todd Stinson Date: Tue, 28 Aug 2012 12:41:57 -0700 Subject: BUILDFIX: Correcting a linux build error. --- indra/newview/llfloaterconversationpreview.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llfloaterconversationpreview.cpp b/indra/newview/llfloaterconversationpreview.cpp index 2c34029c5c..ae6f1441eb 100644 --- a/indra/newview/llfloaterconversationpreview.cpp +++ b/indra/newview/llfloaterconversationpreview.cpp @@ -88,8 +88,13 @@ void LLFloaterConversationPreview::showHistory() int delta = 0; if (mCurrentPage) { - double num_of_pages = (double)mMessages.size() / mPageSize; - delta = (ceil(num_of_pages) - num_of_pages) * mPageSize; + // stinson 08/28/2012 : This operation could be simplified using integer math with the mod (%) operator. + // e.g. The following code should give the same output. + // int remainder = mMessages.size() % mPageSize; + // delta = (remainder == 0) ? 0 : (mPageSize - remainder); + // Though without examining further, the remainder might be a more appropriate value. + double num_of_pages = static_cast(mMessages.size()) / static_cast(mPageSize); + delta = static_cast((ceil(num_of_pages) - num_of_pages) * static_cast(mPageSize)); } std::advance(iter, (mCurrentPage * mPageSize) - delta); -- cgit v1.2.3 From 051bc99573d7c571cea0e2e1df332c1e5e97ff19 Mon Sep 17 00:00:00 2001 From: Seth ProductEngine Date: Tue, 28 Aug 2012 20:08:17 +0300 Subject: CHUI-287 FIX IM toast panel is closed upon mouse up and doesn't pass the mouse click that activates "click to walk". --- indra/newview/lltoastimpanel.cpp | 4 ++-- indra/newview/lltoastimpanel.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/lltoastimpanel.cpp b/indra/newview/lltoastimpanel.cpp index e0cb200ef5..75e6e3d13a 100644 --- a/indra/newview/lltoastimpanel.cpp +++ b/indra/newview/lltoastimpanel.cpp @@ -104,9 +104,9 @@ LLToastIMPanel::~LLToastIMPanel() } //virtual -BOOL LLToastIMPanel::handleMouseDown(S32 x, S32 y, MASK mask) +BOOL LLToastIMPanel::handleMouseUp(S32 x, S32 y, MASK mask) { - if (LLPanel::handleMouseDown(x,y,mask) == FALSE) + if (LLPanel::handleMouseUp(x,y,mask) == FALSE) { mNotification->respond(mNotification->getResponseTemplate()); } diff --git a/indra/newview/lltoastimpanel.h b/indra/newview/lltoastimpanel.h index 279dd69bc7..3eb11fb3bc 100644 --- a/indra/newview/lltoastimpanel.h +++ b/indra/newview/lltoastimpanel.h @@ -52,7 +52,7 @@ public: LLToastIMPanel(LLToastIMPanel::Params &p); virtual ~LLToastIMPanel(); - /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask); + /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask); /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask); private: void showInspector(); -- cgit v1.2.3 From c4638d1dca7f3292d7ce48ddb2f5598f86282c88 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 28 Aug 2012 19:09:57 -0700 Subject: CHUI-280 : WIP : Implement update of LLConversationModel in LLParticipantList --- indra/newview/llconversationmodel.cpp | 47 ++++++++++++- indra/newview/llconversationmodel.h | 31 ++++++++- indra/newview/llparticipantlist.cpp | 125 ++++++++++++++++++++++------------ 3 files changed, 154 insertions(+), 49 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index a5c0244bd4..9b353809db 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -88,7 +88,8 @@ bool LLConversationSort::operator()(const LLConversationItem* const& a, const LL // LLConversationItemSession::LLConversationItemSession(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : - LLConversationItem(display_name,uuid,root_view_model) + LLConversationItem(display_name,uuid,root_view_model), + mIsLoaded(false) { } @@ -97,12 +98,54 @@ LLConversationItemSession::LLConversationItemSession(const LLUUID& uuid, LLFolde { } +void LLConversationItemSession::addParticipant(LLConversationItemParticipant* item) +{ + addChild(item); + mIsLoaded = true; +} + +void LLConversationItemSession::removeParticipant(LLConversationItemParticipant* item) +{ + removeChild(item); +} + +void LLConversationItemSession::clearParticipants() +{ + clearChildren(); + mIsLoaded = false; +} + +LLConversationItemParticipant* LLConversationItemSession::findParticipant(const LLUUID& participant_id) +{ + // This is *not* a general tree parsing algorithm. It assumes that a session contains only + // items (LLConversationItemParticipant) that have themselve no children. + LLConversationItemParticipant* participant = NULL; + child_list_t::iterator iter; + for (iter = mChildren.begin(); iter != mChildren.end(); iter++) + { + participant = dynamic_cast(*iter); + if (participant->hasSameValue(participant_id)) + { + break; + } + } + return (iter == mChildren.end() ? NULL : participant); +} + +void LLConversationItemSession::setParticipantIsMuted(const LLUUID& participant_id, bool is_muted) +{ + LLConversationItemParticipant* participant = findParticipant(participant_id); + participant->setIsMuted(is_muted); +} + // // LLConversationItemParticipant // LLConversationItemParticipant::LLConversationItemParticipant(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : - LLConversationItem(display_name,uuid,root_view_model) + LLConversationItem(display_name,uuid,root_view_model), + mIsMuted(false), + mIsModerator(false) { } diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h index 1a63230e41..484c0feb36 100644 --- a/indra/newview/llconversationmodel.h +++ b/indra/newview/llconversationmodel.h @@ -33,6 +33,8 @@ // Implementation of conversations list class LLConversationItem; +class LLConversationItemSession; +class LLConversationItemParticipant; typedef std::map conversations_items_map; typedef std::map conversations_widgets_map; @@ -100,9 +102,10 @@ public: // bool hasSameValues(std::string name, const LLUUID& uuid) { return ((name == mName) && (uuid == mUUID)); } bool hasSameValue(const LLUUID& uuid) { return (uuid == mUUID); } -private: - std::string mName; - const LLUUID mUUID; + +protected: + std::string mName; // Name of the session or the participant + LLUUID mUUID; // UUID of the session or the participant }; class LLConversationItemSession : public LLConversationItem @@ -111,6 +114,19 @@ public: LLConversationItemSession(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model); LLConversationItemSession(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model); virtual ~LLConversationItemSession() {} + + void setSessionID(const LLUUID& session_id) { mUUID = session_id; } + void addParticipant(LLConversationItemParticipant* item); + void removeParticipant(LLConversationItemParticipant* item); + void clearParticipants(); + LLConversationItemParticipant* findParticipant(const LLUUID& participant_id); + + void setParticipantIsMuted(const LLUUID& participant_id, bool is_muted); + + bool isLoaded() { return mIsLoaded; } + +private: + bool mIsLoaded; // true if at least one participant has been added to the session, false otherwise }; class LLConversationItemParticipant : public LLConversationItem @@ -119,6 +135,15 @@ public: LLConversationItemParticipant(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model); LLConversationItemParticipant(const LLUUID& uuid, LLFolderViewModelInterface& root_view_model); virtual ~LLConversationItemParticipant() {} + + bool isMuted() { return mIsMuted; } + bool isModerator() {return mIsModerator; } + void setIsMuted(bool is_muted) { mIsMuted = is_muted; } + void setIsModerator(bool is_moderator) { mIsModerator = is_moderator; } + +private: + bool mIsMuted; // default is false + bool mIsModerator; // default is false }; // We don't want to ever filter conversations but we need to declare that class to create a conversation view model. diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp index 552ae196dd..6511b0a1a6 100644 --- a/indra/newview/llparticipantlist.cpp +++ b/indra/newview/llparticipantlist.cpp @@ -29,6 +29,8 @@ // common includes #include "lltrans.h" #include "llavataractions.h" +#include "llavatarnamecache.h" +#include "llavatarname.h" #include "llagent.h" #include "llimview.h" @@ -226,29 +228,34 @@ LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source, mSpeakerMgr->addListener(mSpeakerClearListener, "clear"); mSpeakerMgr->addListener(mSpeakerModeratorListener, "update_moderator"); - mAvatarList->setNoItemsCommentText(LLTrans::getString("LoadingData")); - LL_DEBUGS("SpeakingIndicator") << "Set session for speaking indicators: " << mSpeakerMgr->getSessionID() << LL_ENDL; - mAvatarList->setSessionID(mSpeakerMgr->getSessionID()); - mAvatarListDoubleClickConnection = mAvatarList->setItemDoubleClickCallback(boost::bind(&LLParticipantList::onAvatarListDoubleClicked, this, _1)); - mAvatarListRefreshConnection = mAvatarList->setRefreshCompleteCallback(boost::bind(&LLParticipantList::onAvatarListRefreshed, this, _1, _2)); - // Set onAvatarListDoubleClicked as default on_return action. - mAvatarListReturnConnection = mAvatarList->setReturnCallback(boost::bind(&LLParticipantList::onAvatarListDoubleClicked, this, mAvatarList)); - - if (use_context_menu) - { - //mParticipantListMenu = new LLParticipantListMenu(*this); - //mAvatarList->setContextMenu(mParticipantListMenu); - mAvatarList->setContextMenu(&LLPanelPeopleMenus::gNearbyMenu); - } - else + setSessionID(mSpeakerMgr->getSessionID()); + + if (mAvatarList) { - mAvatarList->setContextMenu(NULL); - } + mAvatarList->setNoItemsCommentText(LLTrans::getString("LoadingData")); + LL_DEBUGS("SpeakingIndicator") << "Set session for speaking indicators: " << mSpeakerMgr->getSessionID() << LL_ENDL; + mAvatarList->setSessionID(mSpeakerMgr->getSessionID()); + mAvatarListDoubleClickConnection = mAvatarList->setItemDoubleClickCallback(boost::bind(&LLParticipantList::onAvatarListDoubleClicked, this, _1)); + mAvatarListRefreshConnection = mAvatarList->setRefreshCompleteCallback(boost::bind(&LLParticipantList::onAvatarListRefreshed, this, _1, _2)); + // Set onAvatarListDoubleClicked as default on_return action. + mAvatarListReturnConnection = mAvatarList->setReturnCallback(boost::bind(&LLParticipantList::onAvatarListDoubleClicked, this, mAvatarList)); + + if (use_context_menu) + { + //mParticipantListMenu = new LLParticipantListMenu(*this); + //mAvatarList->setContextMenu(mParticipantListMenu); + mAvatarList->setContextMenu(&LLPanelPeopleMenus::gNearbyMenu); + } + else + { + mAvatarList->setContextMenu(NULL); + } - if (use_context_menu && can_toggle_icons) - { - mAvatarList->setShowIcons("ParticipantListShowIcons"); - mAvatarListToggleIconsConnection = gSavedSettings.getControl("ParticipantListShowIcons")->getSignal()->connect(boost::bind(&LLAvatarList::toggleIcons, mAvatarList)); + if (use_context_menu && can_toggle_icons) + { + mAvatarList->setShowIcons("ParticipantListShowIcons"); + mAvatarListToggleIconsConnection = gSavedSettings.getControl("ParticipantListShowIcons")->getSignal()->connect(boost::bind(&LLAvatarList::toggleIcons, mAvatarList)); + } } //Lets fill avatarList with existing speakers @@ -396,6 +403,7 @@ void LLParticipantList::onAvatarListRefreshed(LLUICtrl* ctrl, const LLSD& param) if (speakerp->mStatus == LLSpeaker::STATUS_TEXT_ONLY) { + setParticipantIsMuted(speakerp->mID, speakerp->mModeratorMutedVoice); update_speaker_indicator(list, speakerp->mID, speakerp->mModeratorMutedVoice); } } @@ -415,30 +423,39 @@ void LLParticipantList::onAvatarListRefreshed(LLUICtrl* ctrl, const LLSD& param) */ void LLParticipantList::onAvalineCallerFound(const LLUUID& participant_id) { - LLPanel* item = mAvatarList->getItemByValue(participant_id); - - if (NULL == item) + if (mAvatarList) { - LL_WARNS("Avaline") << "Something wrong. Unable to find item for: " << participant_id << LL_ENDL; - return; - } + LLPanel* item = mAvatarList->getItemByValue(participant_id); - if (typeid(*item) == typeid(LLAvalineListItem)) - { - LL_DEBUGS("Avaline") << "Avaline caller has already correct class type for: " << participant_id << LL_ENDL; - // item representing an Avaline caller has a correct type already. - return; - } + if (NULL == item) + { + LL_WARNS("Avaline") << "Something wrong. Unable to find item for: " << participant_id << LL_ENDL; + return; + } - LL_DEBUGS("Avaline") << "remove item from the list and re-add it: " << participant_id << LL_ENDL; + if (typeid(*item) == typeid(LLAvalineListItem)) + { + LL_DEBUGS("Avaline") << "Avaline caller has already correct class type for: " << participant_id << LL_ENDL; + // item representing an Avaline caller has a correct type already. + return; + } - // remove UUID from LLAvatarList::mIDs to be able add it again. - uuid_vec_t& ids = mAvatarList->getIDs(); - uuid_vec_t::iterator pos = std::find(ids.begin(), ids.end(), participant_id); - ids.erase(pos); + LL_DEBUGS("Avaline") << "remove item from the list and re-add it: " << participant_id << LL_ENDL; - // remove item directly - mAvatarList->removeItem(item); + // remove UUID from LLAvatarList::mIDs to be able add it again. + uuid_vec_t& ids = mAvatarList->getIDs(); + uuid_vec_t::iterator pos = std::find(ids.begin(), ids.end(), participant_id); + ids.erase(pos); + + // remove item directly + mAvatarList->removeItem(item); + } + + LLConversationItemParticipant* participant = findParticipant(participant_id); + if (participant) + { + removeParticipant(participant); + } // re-add avaline caller with a correct class instance. addAvatarIDExceptAgent(participant_id); @@ -562,6 +579,7 @@ bool LLParticipantList::onSpeakerMuteEvent(LLPointer event // update UI on confirmation of moderator mutes if (event->getValue().asString() == "voice") { + setParticipantIsMuted(speakerp->mID, speakerp->mModeratorMutedVoice); update_speaker_indicator(mAvatarList, speakerp->mID, speakerp->mModeratorMutedVoice); } return true; @@ -601,21 +619,40 @@ void LLParticipantList::sort() void LLParticipantList::addAvatarIDExceptAgent(const LLUUID& avatar_id) { if (mExcludeAgent && gAgent.getID() == avatar_id) return; - if (mAvatarList->contains(avatar_id)) return; + if (mAvatarList && mAvatarList->contains(avatar_id)) return; bool is_avatar = LLVoiceClient::getInstance()->isParticipantAvatar(avatar_id); + LLConversationItemParticipant* participant = NULL; + if (is_avatar) { - mAvatarList->getIDs().push_back(avatar_id); - mAvatarList->setDirty(); + // Create a participant view model instance and add it to the linked list + LLAvatarName avatar_name; + bool has_name = LLAvatarNameCache::get(avatar_id, &avatar_name); + participant = new LLConversationItemParticipant(!has_name ? "Avatar" : avatar_name.mDisplayName , avatar_id, mRootViewModel); + if ( mAvatarList) + { + mAvatarList->getIDs().push_back(avatar_id); + mAvatarList->setDirty(); + } } else { std::string display_name = LLVoiceClient::getInstance()->getDisplayName(avatar_id); - mAvatarList->addAvalineItem(avatar_id, mSpeakerMgr->getSessionID(), display_name.empty() ? LLTrans::getString("AvatarNameWaiting") : display_name); + // Create a participant view model instance and add it to the linked list + participant = new LLConversationItemParticipant(display_name.empty() ? LLTrans::getString("AvatarNameWaiting") : display_name, avatar_id, mRootViewModel); + if ( mAvatarList) + { + mAvatarList->addAvalineItem(avatar_id, mSpeakerMgr->getSessionID(), display_name.empty() ? LLTrans::getString("AvatarNameWaiting") : display_name); + } mAvalineUpdater->watchAvalineCaller(avatar_id); } + + // *TODO : Merov : need to declare and bind a name update callback on that "participant" instance. See LLAvatarListItem::updateAvatarName() for pattern. + // For the moment, we'll get the correct name only if it's already in the name cache (see call to LLAvatarNameCache::get() here above) + addParticipant(participant); + adjustParticipant(avatar_id); } -- cgit v1.2.3 From ad070b9155e2fddfc746319003253248ceb0eba3 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 28 Aug 2012 23:13:10 -0700 Subject: CHUI-280 : Implement all LLConversationModel updates in LLParticipantList. Allow mAvatarList to be NULL. --- indra/newview/llconversationmodel.cpp | 31 +++++- indra/newview/llconversationmodel.h | 6 +- indra/newview/llparticipantlist.cpp | 193 +++++++++++++++++++--------------- 3 files changed, 137 insertions(+), 93 deletions(-) (limited to 'indra/newview') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 9b353809db..dbf5ac6e03 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -98,15 +98,24 @@ LLConversationItemSession::LLConversationItemSession(const LLUUID& uuid, LLFolde { } -void LLConversationItemSession::addParticipant(LLConversationItemParticipant* item) +void LLConversationItemSession::addParticipant(LLConversationItemParticipant* participant) { - addChild(item); + addChild(participant); mIsLoaded = true; } -void LLConversationItemSession::removeParticipant(LLConversationItemParticipant* item) +void LLConversationItemSession::removeParticipant(LLConversationItemParticipant* participant) { - removeChild(item); + removeChild(participant); +} + +void LLConversationItemSession::removeParticipant(const LLUUID& participant_id) +{ + LLConversationItemParticipant* participant = findParticipant(participant_id); + if (participant) + { + removeParticipant(participant); + } } void LLConversationItemSession::clearParticipants() @@ -135,7 +144,19 @@ LLConversationItemParticipant* LLConversationItemSession::findParticipant(const void LLConversationItemSession::setParticipantIsMuted(const LLUUID& participant_id, bool is_muted) { LLConversationItemParticipant* participant = findParticipant(participant_id); - participant->setIsMuted(is_muted); + if (participant) + { + participant->setIsMuted(is_muted); + } +} + +void LLConversationItemSession::setParticipantIsModerator(const LLUUID& participant_id, bool is_moderator) +{ + LLConversationItemParticipant* participant = findParticipant(participant_id); + if (participant) + { + participant->setIsModerator(is_moderator); + } } // diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h index 484c0feb36..aa79e5aeb0 100644 --- a/indra/newview/llconversationmodel.h +++ b/indra/newview/llconversationmodel.h @@ -116,12 +116,14 @@ public: virtual ~LLConversationItemSession() {} void setSessionID(const LLUUID& session_id) { mUUID = session_id; } - void addParticipant(LLConversationItemParticipant* item); - void removeParticipant(LLConversationItemParticipant* item); + void addParticipant(LLConversationItemParticipant* participant); + void removeParticipant(LLConversationItemParticipant* participant); + void removeParticipant(const LLUUID& participant_id); void clearParticipants(); LLConversationItemParticipant* findParticipant(const LLUUID& participant_id); void setParticipantIsMuted(const LLUUID& participant_id, bool is_muted); + void setParticipantIsModerator(const LLUUID& participant_id, bool is_moderator); bool isLoaded() { return mIsLoaded; } diff --git a/indra/newview/llparticipantlist.cpp b/indra/newview/llparticipantlist.cpp index 6511b0a1a6..35c1a34a26 100644 --- a/indra/newview/llparticipantlist.cpp +++ b/indra/newview/llparticipantlist.cpp @@ -52,11 +52,14 @@ static const LLAvatarItemAgentOnTopComparator AGENT_ON_TOP_NAME_COMPARATOR; // helper function to update AvatarList Item's indicator in the voice participant list static void update_speaker_indicator(const LLAvatarList* const avatar_list, const LLUUID& avatar_uuid, bool is_muted) { - LLAvatarListItem* item = dynamic_cast(avatar_list->getItemByValue(avatar_uuid)); - if (item) + if (avatar_list) { - LLOutputMonitorCtrl* indicator = item->getChild("speaking_indicator"); - indicator->setIsMuted(is_muted); + LLAvatarListItem* item = dynamic_cast(avatar_list->getItemByValue(avatar_uuid)); + if (item) + { + LLOutputMonitorCtrl* indicator = item->getChild("speaking_indicator"); + indicator->setIsMuted(is_muted); + } } } @@ -281,10 +284,13 @@ LLParticipantList::LLParticipantList(LLSpeakerMgr* data_source, LLParticipantList::~LLParticipantList() { - mAvatarListDoubleClickConnection.disconnect(); - mAvatarListRefreshConnection.disconnect(); - mAvatarListReturnConnection.disconnect(); - mAvatarListToggleIconsConnection.disconnect(); + if (mAvatarList) + { + mAvatarListDoubleClickConnection.disconnect(); + mAvatarListRefreshConnection.disconnect(); + mAvatarListReturnConnection.disconnect(); + mAvatarListToggleIconsConnection.disconnect(); + } // It is possible Participant List will be re-created from LLCallFloater::onCurrentChannelChanged() // See ticket EXT-3427 @@ -300,16 +306,22 @@ LLParticipantList::~LLParticipantList() mParticipantListMenu = NULL; } - mAvatarList->setContextMenu(NULL); - mAvatarList->setComparator(NULL); + if (mAvatarList) + { + mAvatarList->setContextMenu(NULL); + mAvatarList->setComparator(NULL); + } delete mAvalineUpdater; } void LLParticipantList::setSpeakingIndicatorsVisible(BOOL visible) { - mAvatarList->setSpeakingIndicatorsVisible(visible); -}; + if (mAvatarList) + { + mAvatarList->setSpeakingIndicatorsVisible(visible); + } +} void LLParticipantList::onAvatarListDoubleClicked(LLUICtrl* ctrl) { @@ -330,82 +342,81 @@ void LLParticipantList::onAvatarListDoubleClicked(LLUICtrl* ctrl) void LLParticipantList::onAvatarListRefreshed(LLUICtrl* ctrl, const LLSD& param) { LLAvatarList* list = dynamic_cast(ctrl); - if (list) + const std::string moderator_indicator(LLTrans::getString("IM_moderator_label")); + const std::size_t moderator_indicator_len = moderator_indicator.length(); + + // Firstly remove moderators indicator + std::set::const_iterator + moderator_list_it = mModeratorToRemoveList.begin(), + moderator_list_end = mModeratorToRemoveList.end(); + for (;moderator_list_it != moderator_list_end; ++moderator_list_it) { - const std::string moderator_indicator(LLTrans::getString("IM_moderator_label")); - const std::size_t moderator_indicator_len = moderator_indicator.length(); - - // Firstly remove moderators indicator - std::set::const_iterator - moderator_list_it = mModeratorToRemoveList.begin(), - moderator_list_end = mModeratorToRemoveList.end(); - for (;moderator_list_it != moderator_list_end; ++moderator_list_it) + LLAvatarListItem* item = (list ? dynamic_cast (list->getItemByValue(*moderator_list_it)) : NULL); + if ( item ) { - LLAvatarListItem* item = dynamic_cast (list->getItemByValue(*moderator_list_it)); - if ( item ) + std::string name = item->getAvatarName(); + std::string tooltip = item->getAvatarToolTip(); + size_t found = name.find(moderator_indicator); + if (found != std::string::npos) { - std::string name = item->getAvatarName(); - std::string tooltip = item->getAvatarToolTip(); - size_t found = name.find(moderator_indicator); - if (found != std::string::npos) - { - name.erase(found, moderator_indicator_len); - item->setAvatarName(name); - } - found = tooltip.find(moderator_indicator); - if (found != tooltip.npos) - { - tooltip.erase(found, moderator_indicator_len); - item->setAvatarToolTip(tooltip); - } + name.erase(found, moderator_indicator_len); + item->setAvatarName(name); + } + found = tooltip.find(moderator_indicator); + if (found != tooltip.npos) + { + tooltip.erase(found, moderator_indicator_len); + item->setAvatarToolTip(tooltip); } } + setParticipantIsModerator(*moderator_list_it,false); + } - mModeratorToRemoveList.clear(); + mModeratorToRemoveList.clear(); - // Add moderators indicator - moderator_list_it = mModeratorList.begin(); - moderator_list_end = mModeratorList.end(); - for (;moderator_list_it != moderator_list_end; ++moderator_list_it) + // Add moderators indicator + moderator_list_it = mModeratorList.begin(); + moderator_list_end = mModeratorList.end(); + for (;moderator_list_it != moderator_list_end; ++moderator_list_it) + { + LLAvatarListItem* item = (list ? dynamic_cast (list->getItemByValue(*moderator_list_it)) : NULL); + if ( item ) { - LLAvatarListItem* item = dynamic_cast (list->getItemByValue(*moderator_list_it)); - if ( item ) + std::string name = item->getAvatarName(); + std::string tooltip = item->getAvatarToolTip(); + size_t found = name.find(moderator_indicator); + if (found == std::string::npos) { - std::string name = item->getAvatarName(); - std::string tooltip = item->getAvatarToolTip(); - size_t found = name.find(moderator_indicator); - if (found == std::string::npos) - { - name += " "; - name += moderator_indicator; - item->setAvatarName(name); - } - found = tooltip.find(moderator_indicator); - if (found == std::string::npos) - { - tooltip += " "; - tooltip += moderator_indicator; - item->setAvatarToolTip(tooltip); - } + name += " "; + name += moderator_indicator; + item->setAvatarName(name); + } + found = tooltip.find(moderator_indicator); + if (found == std::string::npos) + { + tooltip += " "; + tooltip += moderator_indicator; + item->setAvatarToolTip(tooltip); } } + setParticipantIsModerator(*moderator_list_it,true); + } - // update voice mute state of all items. See EXT-7235 - LLSpeakerMgr::speaker_list_t speaker_list; + // update voice mute state of all items. See EXT-7235 + LLSpeakerMgr::speaker_list_t speaker_list; - // Use also participants which are not in voice session now (the second arg is TRUE). - // They can already have mModeratorMutedVoice set from the previous voice session - // and LLSpeakerVoiceModerationEvent will not be sent when speaker manager is updated next time. - mSpeakerMgr->getSpeakerList(&speaker_list, TRUE); - for(LLSpeakerMgr::speaker_list_t::iterator it = speaker_list.begin(); it != speaker_list.end(); it++) - { - const LLPointer& speakerp = *it; + // Use also participants which are not in voice session now (the second arg is TRUE). + // They can already have mModeratorMutedVoice set from the previous voice session + // and LLSpeakerVoiceModerationEvent will not be sent when speaker manager is updated next time. + mSpeakerMgr->getSpeakerList(&speaker_list, TRUE); + for(LLSpeakerMgr::speaker_list_t::iterator it = speaker_list.begin(); it != speaker_list.end(); it++) + { + const LLPointer& speakerp = *it; - if (speakerp->mStatus == LLSpeaker::STATUS_TEXT_ONLY) - { - setParticipantIsMuted(speakerp->mID, speakerp->mModeratorMutedVoice); - update_speaker_indicator(list, speakerp->mID, speakerp->mModeratorMutedVoice); - } + if (speakerp->mStatus == LLSpeaker::STATUS_TEXT_ONLY) + { + setParticipantIsMuted(speakerp->mID, speakerp->mModeratorMutedVoice); + update_speaker_indicator(list, speakerp->mID, speakerp->mModeratorMutedVoice); } } } @@ -506,7 +517,7 @@ bool LLParticipantList::isHovered() { S32 x, y; LLUI::getMousePositionScreen(&x, &y); - return mAvatarList->calcScreenRect().pointInRect(x, y); + return (mAvatarList ? mAvatarList->calcScreenRect().pointInRect(x, y) : false); } bool LLParticipantList::onAddItemEvent(LLPointer event, const LLSD& userdata) @@ -525,21 +536,30 @@ bool LLParticipantList::onAddItemEvent(LLPointer event, co bool LLParticipantList::onRemoveItemEvent(LLPointer event, const LLSD& userdata) { - uuid_vec_t& group_members = mAvatarList->getIDs(); - uuid_vec_t::iterator pos = std::find(group_members.begin(), group_members.end(), event->getValue().asUUID()); - if(pos != group_members.end()) + LLUUID avatar_id = event->getValue().asUUID(); + if (mAvatarList) { - group_members.erase(pos); - mAvatarList->setDirty(); + uuid_vec_t& group_members = mAvatarList->getIDs(); + uuid_vec_t::iterator pos = std::find(group_members.begin(), group_members.end(), avatar_id); + if(pos != group_members.end()) + { + group_members.erase(pos); + mAvatarList->setDirty(); + } } + removeParticipant(avatar_id); return true; } bool LLParticipantList::onClearListEvent(LLPointer event, const LLSD& userdata) { - uuid_vec_t& group_members = mAvatarList->getIDs(); - group_members.clear(); - mAvatarList->setDirty(); + if (mAvatarList) + { + uuid_vec_t& group_members = mAvatarList->getIDs(); + group_members.clear(); + mAvatarList->setDirty(); + } + clearParticipants(); return true; } @@ -587,6 +607,7 @@ bool LLParticipantList::onSpeakerMuteEvent(LLPointer event void LLParticipantList::sort() { + // *TODO : Merov : Need to plan for sort() for LLConversationModel if ( !mAvatarList ) return; @@ -631,7 +652,7 @@ void LLParticipantList::addAvatarIDExceptAgent(const LLUUID& avatar_id) LLAvatarName avatar_name; bool has_name = LLAvatarNameCache::get(avatar_id, &avatar_name); participant = new LLConversationItemParticipant(!has_name ? "Avatar" : avatar_name.mDisplayName , avatar_id, mRootViewModel); - if ( mAvatarList) + if (mAvatarList) { mAvatarList->getIDs().push_back(avatar_id); mAvatarList->setDirty(); @@ -642,7 +663,7 @@ void LLParticipantList::addAvatarIDExceptAgent(const LLUUID& avatar_id) std::string display_name = LLVoiceClient::getInstance()->getDisplayName(avatar_id); // Create a participant view model instance and add it to the linked list participant = new LLConversationItemParticipant(display_name.empty() ? LLTrans::getString("AvatarNameWaiting") : display_name, avatar_id, mRootViewModel); - if ( mAvatarList) + if (mAvatarList) { mAvatarList->addAvalineItem(avatar_id, mSpeakerMgr->getSessionID(), display_name.empty() ? LLTrans::getString("AvatarNameWaiting") : display_name); } @@ -808,7 +829,7 @@ void LLParticipantList::LLParticipantListMenu::toggleMute(const LLSD& userdata, LL_WARNS("Speakers") << "Speaker " << speaker_id << " not found" << llendl; return; } - LLAvatarListItem* item = dynamic_cast(mParent.mAvatarList->getItemByValue(speaker_id)); + LLAvatarListItem* item = (mParent.mAvatarList ? dynamic_cast(mParent.mAvatarList->getItemByValue(speaker_id)) : NULL); if (NULL == item) return; name = item->getAvatarName(); -- cgit v1.2.3 From ca7abc4c3be9310f4e5fec00b7d6ffadaba58ff0 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 29 Aug 2012 10:07:55 -0700 Subject: CHUI-280 : Add print out debug methods --- indra/newview/llconversationmodel.cpp | 16 ++++++++++++++++ indra/newview/llconversationmodel.h | 4 ++++ 2 files changed, 20 insertions(+) (limited to 'indra/newview') diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index dbf5ac6e03..d7f9093a4a 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -159,6 +159,18 @@ void LLConversationItemSession::setParticipantIsModerator(const LLUUID& particip } } +void LLConversationItemSession::dumpDebugData() +{ + llinfos << "Merov debug : session, uuid = " << mUUID << ", name = " << mName << ", is loaded = " << mIsLoaded << llendl; + LLConversationItemParticipant* participant = NULL; + child_list_t::iterator iter; + for (iter = mChildren.begin(); iter != mChildren.end(); iter++) + { + participant = dynamic_cast(*iter); + participant->dumpDebugData(); + } +} + // // LLConversationItemParticipant // @@ -175,4 +187,8 @@ LLConversationItemParticipant::LLConversationItemParticipant(const LLUUID& uuid, { } +void LLConversationItemParticipant::dumpDebugData() +{ + llinfos << "Merov debug : participant, uuid = " << mUUID << ", name = " << mName << ", muted = " << mIsMuted << ", moderator = " << mIsModerator << llendl; +} // EOF diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h index aa79e5aeb0..af3756c45d 100644 --- a/indra/newview/llconversationmodel.h +++ b/indra/newview/llconversationmodel.h @@ -127,6 +127,8 @@ public: bool isLoaded() { return mIsLoaded; } + void dumpDebugData(); + private: bool mIsLoaded; // true if at least one participant has been added to the session, false otherwise }; @@ -143,6 +145,8 @@ public: void setIsMuted(bool is_muted) { mIsMuted = is_muted; } void setIsModerator(bool is_moderator) { mIsModerator = is_moderator; } + void dumpDebugData(); + private: bool mIsMuted; // default is false bool mIsModerator; // default is false -- cgit v1.2.3