diff options
author | Merov Linden <merov@lindenlab.com> | 2012-08-22 19:29:22 -0700 |
---|---|---|
committer | Merov Linden <merov@lindenlab.com> | 2012-08-22 19:29:22 -0700 |
commit | 2cf5307c9211b813689f0e441b9f56bc21f63348 (patch) | |
tree | e4e521308d788c5de96bccc20d60a57ef1579dd7 /indra | |
parent | b93e2f7c84a8e14d7ca6c58c35183216a7fbf5bb (diff) |
CHUI-282 : WIP : Isolated llconversationview classes and suppressed the dependency of model to widgets
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/CMakeLists.txt | 2 | ||||
-rw-r--r-- | indra/newview/llconversationmodel.cpp | 31 | ||||
-rw-r--r-- | indra/newview/llconversationmodel.h | 7 | ||||
-rw-r--r-- | indra/newview/llconversationview.cpp | 64 | ||||
-rw-r--r-- | indra/newview/llconversationview.h | 63 | ||||
-rw-r--r-- | indra/newview/llimfloatercontainer.cpp | 10 |
6 files changed, 144 insertions, 33 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 9553476aaf..c49c625dbd 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -138,6 +138,7 @@ set(viewer_SOURCE_FILES llconversationloglist.cpp llconversationloglistitem.cpp llconversationmodel.cpp + llconversationview.cpp llcurrencyuimanager.cpp llcylinder.cpp lldateutil.cpp @@ -721,6 +722,7 @@ set(viewer_HEADER_FILES llconversationloglist.h llconversationloglistitem.h llconversationmodel.h + llconversationview.h llcurrencyuimanager.h llcylinder.h lldateutil.h diff --git a/indra/newview/llconversationmodel.cpp b/indra/newview/llconversationmodel.cpp index 0c23e2654e..923bc7a3a1 100644 --- a/indra/newview/llconversationmodel.cpp +++ b/indra/newview/llconversationmodel.cpp @@ -32,41 +32,22 @@ #include "llimfloatercontainer.h" // Conversation items -LLConversationItem::LLConversationItem(std::string display_name, const LLUUID& uuid, LLIMFloaterContainer* containerp) : - LLFolderViewModelItemCommon(containerp->getRootViewModel()), +LLConversationItem::LLConversationItem(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model) : + LLFolderViewModelItemCommon(root_view_model), mName(display_name), - mUUID(uuid), - mContainer(containerp) + mUUID(uuid) { } -LLConversationItem::LLConversationItem(LLIMFloaterContainer* containerp) : - LLFolderViewModelItemCommon(containerp->getRootViewModel()), +LLConversationItem::LLConversationItem(LLFolderViewModelInterface& root_view_model) : + LLFolderViewModelItemCommon(root_view_model), mName(""), - mUUID(), - mContainer(NULL) + mUUID() { } // Virtual action callbacks -void LLConversationItem::selectItem(void) -{ - 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(session_floater); - } - // Set the focus on the selected floater - 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 diff --git a/indra/newview/llconversationmodel.h b/indra/newview/llconversationmodel.h index 56a5b73c15..2f7124aec5 100644 --- a/indra/newview/llconversationmodel.h +++ b/indra/newview/llconversationmodel.h @@ -52,8 +52,8 @@ typedef std::map<LLUUID, LLFolderViewItem*> conversations_widgets_map; class LLConversationItem : public LLFolderViewModelItemCommon { public: - LLConversationItem(std::string display_name, const LLUUID& uuid, LLIMFloaterContainer* containerp); - LLConversationItem(LLIMFloaterContainer* containerp); + LLConversationItem(std::string display_name, const LLUUID& uuid, LLFolderViewModelInterface& root_view_model); + LLConversationItem(LLFolderViewModelInterface& root_view_model); virtual ~LLConversationItem() {} // Stub those things we won't really be using in this conversation context @@ -95,7 +95,7 @@ public: virtual void openItem( void ); virtual void closeItem( void ); virtual void previewItem( void ); - virtual void selectItem(void); + virtual void selectItem(void) { } virtual void showProperties(void); void setVisibleIfDetached(BOOL visible); @@ -114,7 +114,6 @@ public: private: std::string mName; const LLUUID mUUID; - LLIMFloaterContainer* mContainer; }; // 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/llconversationview.cpp b/indra/newview/llconversationview.cpp new file mode 100644 index 0000000000..7d90a154e5 --- /dev/null +++ b/indra/newview/llconversationview.cpp @@ -0,0 +1,64 @@ +/** + * @file llconversationview.cpp + * @brief Implementation of conversations list widgets and views + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + + +#include "llviewerprecompiledheaders.h" + +#include "llconversationview.h" +#include "llimconversation.h" +#include "llimfloatercontainer.h" + +LLConversationViewSession::Params::Params() : + container() +{} + +LLConversationViewSession::LLConversationViewSession( const LLConversationViewSession::Params& p ): + LLFolderViewFolder(p), + mContainer(p.container) +{ +} + +void LLConversationViewSession::selectItem() +{ + LLFolderViewItem::selectItem(); + + LLConversationItem* item = dynamic_cast<LLConversationItem*>(mViewModelItem); + LLFloater* session_floater = LLIMConversation::getConversation(item->getUUID()); + LLMultiFloater* host_floater = session_floater->getHost(); + + 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(session_floater); + } + + // Set the focus on the selected floater + session_floater->setFocus(TRUE); +} + +// EOF diff --git a/indra/newview/llconversationview.h b/indra/newview/llconversationview.h new file mode 100644 index 0000000000..08f2343aca --- /dev/null +++ b/indra/newview/llconversationview.h @@ -0,0 +1,63 @@ +/** + * @file llconversationview.h + * @brief Implementation of conversations list widgets and views + * + * $LicenseInfo:firstyear=2009&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLCONVERSATIONVIEW_H +#define LL_LLCONVERSATIONVIEW_H + +#include "llfolderviewitem.h" +#include "llfolderviewmodel.h" + +class LLButton; +class LLFloater; +class LLLayoutPanel; +class LLLayoutStack; +class LLTabContainer; +class LLIMFloaterContainer; + +// Implementation of conversations list widgets + +class LLConversationViewSession : public LLFolderViewFolder +{ +public: + struct Params : public LLInitParam::Block<Params, LLFolderViewItem::Params> + { + Optional<LLIMFloaterContainer*> container; + + Params(); + }; + +protected: + friend class LLUICtrlFactory; + LLConversationViewSession( const Params& p ); + + LLIMFloaterContainer* mContainer; + +public: + virtual ~LLConversationViewSession( void ) { } + virtual void selectItem(); +}; + +#endif // LL_LLCONVERSATIONVIEW_H diff --git a/indra/newview/llimfloatercontainer.cpp b/indra/newview/llimfloatercontainer.cpp index 1e136b721c..29878cfc9e 100644 --- a/indra/newview/llimfloatercontainer.cpp +++ b/indra/newview/llimfloatercontainer.cpp @@ -43,6 +43,7 @@ #include "llimview.h" #include "lltransientfloatermgr.h" #include "llviewercontrol.h" +#include "llconversationview.h" // // LLIMFloaterContainer @@ -111,7 +112,7 @@ BOOL LLIMFloaterContainer::postBuild() mConversationsListPanel = getChild<LLPanel>("conversations_list_panel"); // CHUI-98 : View Model for conversations - LLConversationItem* base_item = new LLConversationItem(this); + LLConversationItem* base_item = new LLConversationItem(getRootViewModel()); LLFolderView::Params p; p.view_model = &mConversationViewModel; p.parent_panel = mConversationsListPanel; @@ -470,7 +471,7 @@ void LLIMFloaterContainer::addConversationListItem(const LLUUID& uuid) removeConversationListItem(uuid,false); // Create a conversation item - LLConversationItem* item = new LLConversationItem(display_name, uuid, this); + LLConversationItem* item = new LLConversationItem(display_name, uuid, getRootViewModel()); mConversationsItems[uuid] = item; // Create a widget from it @@ -524,7 +525,7 @@ void LLIMFloaterContainer::removeConversationListItem(const LLUUID& uuid, bool c LLFolderViewItem* LLIMFloaterContainer::createConversationItemWidget(LLConversationItem* item) { - LLFolderViewItem::Params params; + LLConversationViewSession::Params params; params.name = item->getDisplayName(); //params.icon = bridge->getIcon(); @@ -534,8 +535,9 @@ LLFolderViewItem* LLIMFloaterContainer::createConversationItemWidget(LLConversat params.listener = item; params.rect = LLRect (0, 0, 0, 0); params.tool_tip = params.name; + params.container = this; - return LLUICtrlFactory::create<LLFolderViewItem>(params); + return LLUICtrlFactory::create<LLConversationViewSession>(params); } // EOF |