diff options
author | AlexanderP ProductEngine <apaschenko@productengine.com> | 2012-08-09 16:48:33 +0300 |
---|---|---|
committer | AlexanderP ProductEngine <apaschenko@productengine.com> | 2012-08-09 16:48:33 +0300 |
commit | 6cf49a4a715c9f498d4b063f8d74e295be1f418c (patch) | |
tree | 25031d63658434e1a70b29b6c06c0302831605bf /indra | |
parent | 268d5bd4bd4c9311053808b1f7aa74a85aa038a5 (diff) |
CHUI-171 WIP (Conversation not automatically readded to conversation window listing when open) - removal of the dependence between items of the conversations list and conversation's floaters.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llconversationmodel.cpp | 22 | ||||
-rw-r--r-- | indra/newview/llconversationmodel.h | 9 | ||||
-rw-r--r-- | indra/newview/llimconversation.cpp | 15 | ||||
-rw-r--r-- | indra/newview/llimconversation.h | 3 | ||||
-rw-r--r-- | indra/newview/llimfloater.cpp | 28 | ||||
-rw-r--r-- | indra/newview/llimfloatercontainer.cpp | 64 | ||||
-rw-r--r-- | indra/newview/llimfloatercontainer.h | 12 | ||||
-rw-r--r-- | indra/newview/llnearbychat.cpp | 9 | ||||
-rw-r--r-- | indra/newview/llsyswellwindow.h | 2 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/floater_im_session.xml | 3 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/strings.xml | 3 |
11 files changed, 88 insertions, 82 deletions
diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index bd314588a0..0c23e2654e 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -28,14 +28,14 @@ #include "llviewerprecompiledheaders.h" #include "llconversationmodel.h" +#include "llimconversation.h" #include "llimfloatercontainer.h" // Conversation items -LLConversationItem::LLConversationItem(std::string name, const LLUUID& uuid, LLFloater* floaterp, LLIMFloaterContainer* containerp) : +LLConversationItem::LLConversationItem(std::string display_name, const LLUUID& uuid, LLIMFloaterContainer* containerp) : LLFolderViewModelItemCommon(containerp->getRootViewModel()), - mName(name), + mName(display_name), mUUID(uuid), - mFloater(floaterp), mContainer(containerp) { } @@ -44,7 +44,6 @@ LLConversationItem::LLConversationItem(LLIMFloaterContainer* containerp) : LLFolderViewModelItemCommon(containerp->getRootViewModel()), mName(""), mUUID(), - mFloater(NULL), mContainer(NULL) { } @@ -53,25 +52,30 @@ LLConversationItem::LLConversationItem(LLIMFloaterContainer* containerp) : // Virtual action callbacks void LLConversationItem::selectItem(void) { - LLMultiFloater* host_floater = mFloater->getHost(); + LLFloater* session_floater = LLIMConversation::getConversation(mUUID); + LLMultiFloater* host_floater = session_floater->getHost(); + +// LLIMFloater::show(mUUID); if (host_floater == mContainer) { // Always expand the message pane if the panel is hosted by the container mContainer->collapseMessagesPane(false); // Switch to the conversation floater that is being selected - mContainer->selectFloater(mFloater); + mContainer->selectFloater(session_floater); } // Set the focus on the selected floater - mFloater->setFocus(TRUE); + session_floater->setFocus(TRUE); } void LLConversationItem::setVisibleIfDetached(BOOL visible) { // Do this only if the conversation floater has been torn off (i.e. no multi floater host) and is not minimized // Note: minimized dockable floaters are brought to front hence unminimized when made visible and we don't want that here - if (!mFloater->getHost() && !mFloater->isMinimized()) + LLFloater* session_floater = LLIMConversation::getConversation(mUUID); + + if (session_floater && !session_floater->getHost() && !session_floater->isMinimized()) { - mFloater->setVisible(visible); + session_floater->setVisible(visible); } } diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h index 85760eb1a8..56a5b73c15 100644 --- a/indra/newview/llconversationmodel.h +++ b/indra/newview/llconversationmodel.h @@ -44,15 +44,15 @@ class LLIMFloaterContainer; class LLConversationItem; -typedef std::map<LLFloater*, LLConversationItem*> conversations_items_map; -typedef std::map<LLFloater*, LLFolderViewItem*> conversations_widgets_map; +typedef std::map<LLUUID, LLConversationItem*> conversations_items_map; +typedef std::map<LLUUID, LLFolderViewItem*> conversations_widgets_map; // Conversation items: we hold a list of those and create an LLFolderViewItem widget for each // that we tuck into the mConversationsListPanel. class LLConversationItem : public LLFolderViewModelItemCommon { public: - LLConversationItem(std::string name, const LLUUID& uuid, LLFloater* floaterp, LLIMFloaterContainer* containerp); + LLConversationItem(std::string display_name, const LLUUID& uuid, LLIMFloaterContainer* containerp); LLConversationItem(LLIMFloaterContainer* containerp); virtual ~LLConversationItem() {} @@ -109,12 +109,11 @@ public: void* cargo_data, std::string& tooltip_msg) { return FALSE; } - bool hasSameValues(std::string name, const LLUUID& uuid) { return ((name == mName) && (uuid == mUUID)); } +// 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; - LLFloater* mFloater; LLIMFloaterContainer* mContainer; }; diff --git a/indra/newview/llimconversation.cpp b/indra/newview/llimconversation.cpp index b56f30312a..ec25583c8f 100644 --- a/indra/newview/llimconversation.cpp +++ b/indra/newview/llimconversation.cpp @@ -78,6 +78,19 @@ LLIMConversation::~LLIMConversation() delete mRefreshTimer; } +//static +LLIMConversation* LLIMConversation::findConversation(const LLUUID& uuid) +{ + return LLFloaterReg::findTypedInstance<LLIMConversation>(uuid.isNull()? "chat_bar" : "impanel", LLSD(uuid)); +}; + +//static +LLIMConversation* LLIMConversation::getConversation(const LLUUID& uuid) +{ + return LLFloaterReg::getTypedInstance<LLIMConversation>(uuid.isNull()? "chat_bar" : "impanel", LLSD(uuid)); +}; + + BOOL LLIMConversation::postBuild() { BOOL result; @@ -384,7 +397,7 @@ void LLIMConversation::onClose(bool app_quitting) LLIMFloaterContainer* im_box = LLIMFloaterContainer::findInstance(); if (im_box) { - im_box->removeConversationListItem(this); + im_box->removeConversationListItem(mKey); } } } diff --git a/indra/newview/llimconversation.h b/indra/newview/llimconversation.h index 649c200899..94a3a7781b 100644 --- a/indra/newview/llimconversation.h +++ b/indra/newview/llimconversation.h @@ -57,6 +57,9 @@ public: */ static bool isChatMultiTab(); + static LLIMConversation* findConversation(const LLUUID& uuid); + static LLIMConversation* getConversation(const LLUUID& uuid); + // show/hide the translation check box void showTranslationCheckbox(const BOOL visible = FALSE); diff --git a/indra/newview/llimfloater.cpp b/indra/newview/llimfloater.cpp index 3399a88c9e..6a1437f318 100644 --- a/indra/newview/llimfloater.cpp +++ b/indra/newview/llimfloater.cpp @@ -344,10 +344,6 @@ BOOL LLIMFloater::postBuild() initIMFloater(); - // Add a conversation list item in the left pane - LLIMFloaterContainer* im_box = LLIMFloaterContainer::getInstance(); - im_box->addConversationListItem(getTitle(), getKey(), this); - return result; } @@ -547,7 +543,7 @@ void LLIMFloater::onParticipantsListChanged(LLUICtrl* ctrl) if (!avatar_list) { return; - } + } bool all_names_resolved = true; std::vector<LLSD> participants_uuids; @@ -555,12 +551,12 @@ void LLIMFloater::onParticipantsListChanged(LLUICtrl* ctrl) avatar_list->getValues(participants_uuids); // Check whether we have all participants names in LLAvatarNameCache - for (std::vector<LLSD>::const_iterator it = participants_uuids.begin(); it != participants_uuids.end(); ++it) -{ + for (std::vector<LLSD>::const_iterator it = participants_uuids.begin(); it != participants_uuids.end(); ++it) + { const LLUUID& id = it->asUUID(); LLAvatarName av_name; - if (!LLAvatarNameCache::get(id, &av_name)) - { + if (!LLAvatarNameCache::get(id, &av_name)) + { all_names_resolved = false; // If a name is not found in cache, request it and continue the process recursively @@ -568,8 +564,8 @@ void LLIMFloater::onParticipantsListChanged(LLUICtrl* ctrl) LLAvatarNameCache::get(id, boost::bind(&LLIMFloater::onParticipantsListChanged, this, avatar_list)); break; - } -} + } + } if (all_names_resolved) { @@ -580,20 +576,20 @@ void LLIMFloater::onParticipantsListChanged(LLUICtrl* ctrl) const LLUUID& id = it->asUUID(); LLAvatarName av_name; if (LLAvatarNameCache::get(id, &av_name)) -{ + { avatar_names.push_back(av_name); - } -} + } + } // We should check whether the vector is not empty to pass the assertion // that avatar_names.size() > 0 in LLAvatarActions::buildResidentsString. if (!avatar_names.empty()) -{ + { std::string ui_title; LLAvatarActions::buildResidentsString(avatar_names, ui_title); updateSessionName(ui_title, ui_title); } -} + } } //static diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index c2c0ddddea..1896ed65f3 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -76,13 +76,20 @@ LLIMFloaterContainer::~LLIMFloaterContainer() void LLIMFloaterContainer::sessionVoiceOrIMStarted(const LLUUID& session_id) { LLIMFloater::show(session_id); + addConversationListItem(session_id); +} + +void LLIMFloaterContainer::sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id) +{ + removeConversationListItem(old_session_id); + addConversationListItem(new_session_id); } void LLIMFloaterContainer::sessionRemoved(const LLUUID& session_id) { LLIMFloater* floaterp = LLIMFloater::findInstance(session_id); LLFloater::onClickClose(floaterp); - removeConversationListItem(floaterp); + removeConversationListItem(session_id); } BOOL LLIMFloaterContainer::postBuild() @@ -112,6 +119,10 @@ BOOL LLIMFloaterContainer::postBuild() mConversationsRoot = LLUICtrlFactory::create<LLFolderView>(p); mConversationsListPanel->addChild(mConversationsRoot); + addConversationListItem(LLUUID()); // manually add nearby chat + + addConversationListItem(LLUUID()); // manually add nearby chat + mExpandCollapseBtn = getChild<LLButton>("expand_collapse_btn"); mExpandCollapseBtn->setClickedCallback(boost::bind(&LLIMFloaterContainer::onExpandCollapseButtonClicked, this)); @@ -301,13 +312,13 @@ void LLIMFloaterContainer::setVisible(BOOL visible) if (visible) { // Make sure we have the Nearby Chat present when showing the conversation container - LLFloater* nearby_chat = LLFloaterReg::findInstance("chat_bar"); + LLIMConversation* nearby_chat = LLIMConversation::getConversation(LLUUID::null); 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); + LLFloaterReg::toggleInstanceOrBringToFront(name, LLSD(LLUUID::null)); } } @@ -432,33 +443,29 @@ void LLIMFloaterContainer::repositioningWidgets() } // CHUI-137 : Temporary implementation of conversations list -void LLIMFloaterContainer::addConversationListItem(std::string name, const LLUUID& uuid, LLFloater* floaterp) +void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid) { + std::string display_name = uuid.isNull()? LLTrans::getString("NearbyChatTitle") : LLIMModel::instance().getName(uuid); + // Check if the item is not already in the list, exit if it is and has the same name and uuid (nothing to do) // Note: this happens often, when reattaching a torn off conversation for instance - conversations_items_map::iterator item_it = mConversationsItems.find(floaterp); + conversations_items_map::iterator item_it = mConversationsItems.find(uuid); if (item_it != mConversationsItems.end()) { - LLConversationItem* item = item_it->second; - // Check if the item has changed - if (item->hasSameValues(name,uuid)) - { - // If it hasn't changed, nothing to do -> exit - return; - } + return; } - + // Remove the conversation item that might exist already: it'll be recreated anew further down anyway // and nothing wrong will happen removing it if it doesn't exist - removeConversationListItem(floaterp,false); + removeConversationListItem(uuid,false); // Create a conversation item - LLConversationItem* item = new LLConversationItem(name, uuid, floaterp, this); - mConversationsItems[floaterp] = item; + LLConversationItem* item = new LLConversationItem(display_name, uuid, this); + mConversationsItems[uuid] = item; // Create a widget from it LLFolderViewItem* widget = createConversationItemWidget(item); - mConversationsWidgets[floaterp] = widget; + mConversationsWidgets[uuid] = widget; // Add a new conversation widget to the root folder of a folder view. widget->addToFolder(mConversationsRoot); @@ -473,12 +480,12 @@ void LLIMFloaterContainer::addConversationListItem(std::string name, const LLUUI return; } -void LLIMFloaterContainer::removeConversationListItem(LLFloater* floaterp, bool change_focus) +void LLIMFloaterContainer::removeConversationListItem(const LLUUID& uuid, bool change_focus) { // Delete the widget and the associated conversation item // Note : since the mConversationsItems is also the listener to the widget, deleting // the widget will also delete its listener - conversations_widgets_map::iterator widget_it = mConversationsWidgets.find(floaterp); + conversations_widgets_map::iterator widget_it = mConversationsWidgets.find(uuid); if (widget_it != mConversationsWidgets.end()) { LLFolderViewItem* widget = widget_it->second; @@ -486,8 +493,8 @@ void LLIMFloaterContainer::removeConversationListItem(LLFloater* floaterp, bool } // Suppress the conversation items and widgets from their respective maps - mConversationsItems.erase(floaterp); - mConversationsWidgets.erase(floaterp); + mConversationsItems.erase(uuid); + mConversationsWidgets.erase(uuid); repositioningWidgets(); @@ -505,21 +512,6 @@ void LLIMFloaterContainer::removeConversationListItem(LLFloater* floaterp, bool return; } -LLFloater* LLIMFloaterContainer::findConversationItem(LLUUID& uuid) -{ - LLFloater* floaterp = NULL; - for (conversations_items_map::iterator item_it = mConversationsItems.begin(); item_it != mConversationsItems.end(); ++item_it) - { - LLConversationItem* item = item_it->second; - if (item->hasSameValue(uuid)) - { - floaterp = item_it->first; - break; - } - } - return floaterp; -} - LLFolderViewItem* LLIMFloaterContainer::createConversationItemWidget(LLConversationItem* item) { LLFolderViewItem::Params params; diff --git a/indra/newview/llimfloatercontainer.h b/indra/newview/llimfloatercontainer.h index 161c6d9806..d6dda8ea2d 100644 --- a/indra/newview/llimfloatercontainer.h +++ b/indra/newview/llimfloatercontainer.h @@ -35,6 +35,7 @@ #include "llmultifloater.h" #include "llavatarpropertiesprocessor.h" #include "llgroupmgr.h" +#include "lltrans.h" #include "llconversationmodel.h" class LLButton; @@ -75,10 +76,11 @@ public: // LLIMSessionObserver observe triggers - /*virtual*/ void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id) {}; + /*virtual*/ void sessionAdded(const LLUUID& session_id, const std::string& name, const LLUUID& other_participant_id); /*virtual*/ void sessionVoiceOrIMStarted(const LLUUID& session_id); /*virtual*/ void sessionRemoved(const LLUUID& session_id); - /*virtual*/ void sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id) {}; + /*virtual*/ void sessionIDUpdated(const LLUUID& old_session_id, const LLUUID& new_session_id); + LLConversationViewModel& getRootViewModel() { return mConversationViewModel; } private: @@ -107,9 +109,9 @@ private: // Conversation list implementation public: - void removeConversationListItem(LLFloater* floaterp, bool change_focus = true); - void addConversationListItem(std::string name, const LLUUID& uuid, LLFloater* floaterp); - LLFloater* findConversationItem(LLUUID& uuid); + void removeConversationListItem(const LLUUID& uuid, bool change_focus = true); + void addConversationListItem(const LLUUID& uuid); + private: LLFolderViewItem* createConversationItemWidget(LLConversationItem* item); diff --git a/indra/newview/llnearbychat.cpp b/indra/newview/llnearbychat.cpp index 8f0e6b4c83..fa8e423056 100644 --- a/indra/newview/llnearbychat.cpp +++ b/indra/newview/llnearbychat.cpp @@ -152,7 +152,7 @@ BOOL LLNearbyChat::postBuild() // title must be defined BEFORE call addConversationListItem() because // it is used for show the item's name in the conversations list - setTitle(getString("NearbyChatTitle")); + setTitle(LLTrans::getString("NearbyChatTitle")); addToHost(); @@ -177,16 +177,13 @@ BOOL LLNearbyChat::postBuild() loadHistory(); } - // added row in the conversations list when nearby chat is tear-off - LLIMFloaterContainer* im_box = LLIMFloaterContainer::getInstance(); - im_box->addConversationListItem(getTitle(), LLSD(), this); - return result; } // virtual void LLNearbyChat::refresh() { + updateHeaderAndToolbar(); displaySpeakingIndicator(); updateCallBtnState(LLVoiceClient::getInstance()->getUserPTTState()); @@ -386,7 +383,7 @@ void LLNearbyChat::onChatFontChange(LLFontGL* fontp) //static LLNearbyChat* LLNearbyChat::getInstance() { - return LLFloaterReg::getTypedInstance<LLNearbyChat>("chat_bar"); + return LLFloaterReg::getTypedInstance<LLNearbyChat>("chat_bar", LLSD(LLUUID::null)); } void LLNearbyChat::show() diff --git a/indra/newview/llsyswellwindow.h b/indra/newview/llsyswellwindow.h index 8758c8c4e5..6be12711ac 100644 --- a/indra/newview/llsyswellwindow.h +++ b/indra/newview/llsyswellwindow.h @@ -49,6 +49,8 @@ class LLSysWellChiclet; class LLSysWellWindow : public LLTransientDockableFloater { public: + LOG_CLASS(LLSysWellWindow); + LLSysWellWindow(const LLSD& key); ~LLSysWellWindow(); BOOL postBuild(); diff --git a/indra/newview/skins/default/xui/en/floater_im_session.xml b/indra/newview/skins/default/xui/en/floater_im_session.xml index 4abe4d6941..37aa8bb787 100644 --- a/indra/newview/skins/default/xui/en/floater_im_session.xml +++ b/indra/newview/skins/default/xui/en/floater_im_session.xml @@ -17,9 +17,6 @@ min_width="250" min_height="190" positioning="relative"> - <floater.string - name="NearbyChatTitle" - value="Nearby Chat"/> <floater.string name="call_btn_start">Conv_toolbar_open_call</floater.string> <floater.string name="call_btn_stop">Conv_toolbar_hang_up</floater.string> <floater.string diff --git a/indra/newview/skins/default/xui/en/strings.xml b/indra/newview/skins/default/xui/en/strings.xml index 2806bcaa2e..696c282887 100644 --- a/indra/newview/skins/default/xui/en/strings.xml +++ b/indra/newview/skins/default/xui/en/strings.xml @@ -384,13 +384,14 @@ Please try logging in again in a minute.</string> <string name="ST_NO_JOINT">Can't find ROOT or JOINT.</string> <!-- Chat --> + <string name="NearbyChatTitle">Nearby chat</string> <string name="whisper">whispers:</string> <string name="shout">shouts:</string> <string name="ringing">Connecting to in-world Voice Chat...</string> <string name="connected">Connected</string> <string name="unavailable">Voice not available at your current location</string> <string name="hang_up">Disconnected from in-world Voice Chat</string> - <string name="reconnect_nearby">You will now be reconnected to Nearby Voice Chat</string> + <string name="reconnect_nearby">You will now be reconnected to Nearby Voice Chat</string> <string name="ScriptQuestionCautionChatGranted">'[OBJECTNAME]', an object owned by '[OWNERNAME]', located in [REGIONNAME] at [REGIONPOS], has been granted permission to: [PERMISSIONS].</string> <string name="ScriptQuestionCautionChatDenied">'[OBJECTNAME]', an object owned by '[OWNERNAME]', located in [REGIONNAME] at [REGIONPOS], has been denied permission to: [PERMISSIONS].</string> <string name="AdditionalPermissionsRequestHeader">If you allow access to your account, you will also be allowing the object to:</string> |