diff options
author | Gilbert Gonzales <gilbert@lindenlab.com> | 2013-04-23 18:38:54 -0700 |
---|---|---|
committer | Gilbert Gonzales <gilbert@lindenlab.com> | 2013-04-23 18:38:54 -0700 |
commit | 955cc72f90413d5c28023d7d6a0a4ac58d04e74a (patch) | |
tree | 21a8fc13c3c7c1282e617175061ffbb66ab12bff /indra | |
parent | b9d9a40273dc574c95b3a83587c526eb140c9922 (diff) |
ACME-251 Create AvatarFolderItemView: Re-adding llpersonfolderview.h/cpp and to use a class called LLPersonFolderView to manage the creation of subwidgits and selection of tabs.
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/CMakeLists.txt | 2 | ||||
-rw-r--r-- | indra/newview/llpanelpeople.cpp | 58 | ||||
-rw-r--r-- | indra/newview/llpanelpeople.h | 19 | ||||
-rw-r--r-- | indra/newview/llpersonfolderview.cpp | 88 | ||||
-rw-r--r-- | indra/newview/llpersonfolderview.h | 63 |
5 files changed, 161 insertions, 69 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 145affeb60..52ce82560b 100644 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -452,6 +452,7 @@ set(viewer_SOURCE_FILES llpathfindingobjectlist.cpp llpathfindingpathtool.cpp llpersistentnotificationstorage.cpp + llpersonfolderview.cpp llpersonmodelcommon.cpp llpersontabview.cpp llphysicsmotion.cpp @@ -1031,6 +1032,7 @@ set(viewer_HEADER_FILES llpathfindingobjectlist.h llpathfindingpathtool.h llpersistentnotificationstorage.h + llpersonfolderview.h llpersonmodelcommon.h llpersontabview.h llphysicsmotion.h diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 02a286b880..c4ce56cb4f 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -63,6 +63,7 @@ #include "llnetmap.h" #include "llpanelpeoplemenus.h" #include "llparticipantlist.h" +#include "llpersonfolderview.h" #include "llpersonmodelcommon.h" #include "llpersontabview.h" #include "llsidetraypanelcontainer.h" @@ -549,7 +550,6 @@ LLPanelPeople::LLPanelPeople() : LLPanel(), mConnectedToFbc(false), mConversationsRoot(NULL), - mConversationsEventStream("ConversationsEventsTwo"), mTryToConnectToFbc(true), mTabContainer(NULL), mOnlineFriendList(NULL), @@ -605,8 +605,6 @@ LLPanelPeople::~LLPanelPeople() } if (mFbcTestBrowserHandle.get()) mFbcTestBrowserHandle.get()->die(); - - mConversationsEventStream.stopListening("ConversationsRefresh"); } void LLPanelPeople::onFriendsAccordionExpandedCollapsed(LLUICtrl* ctrl, const LLSD& param, LLAvatarList* avatar_list) @@ -697,7 +695,7 @@ BOOL LLPanelPeople::postBuild() //Create folder view LLPersonModelCommon* base_item = new LLPersonModelCommon(mPersonFolderViewModel); - LLFolderView::Params folder_view_params(LLUICtrlFactory::getDefaultParams<LLFolderView>()); + LLPersonFolderView::Params folder_view_params(LLUICtrlFactory::getDefaultParams<LLPersonFolderView>()); folder_view_params.parent_panel = friends_tab; folder_view_params.listener = base_item; folder_view_params.view_model = &mPersonFolderViewModel; @@ -705,8 +703,7 @@ BOOL LLPanelPeople::postBuild() folder_view_params.use_ellipses = false; folder_view_params.options_menu = "menu_conversation.xml"; folder_view_params.name = "fbcfolderview"; - mConversationsRoot = LLUICtrlFactory::create<LLFolderView>(folder_view_params); - mConversationsEventStream.listen("ConversationsRefresh", boost::bind(&LLPanelPeople::onConversationModelEvent, this, _1)); + mConversationsRoot = LLUICtrlFactory::create<LLPersonFolderView>(folder_view_params); //Create scroller LLRect scroller_view_rect = socialtwo_tab->getRect(); @@ -734,8 +731,8 @@ BOOL LLPanelPeople::postBuild() LLPersonTabView * widget = LLUICtrlFactory::create<LLPersonTabView>(params); widget->addToFolder(mConversationsRoot); - mPersonFolderModelMap[item->getID()] = item; - mPersonFolderViewMap[item->getID()] = widget; + mConversationsRoot->mPersonFolderModelMap[item->getID()] = item; + mConversationsRoot->mPersonFolderViewMap[item->getID()] = widget; gIdleCallbacks.addFunction(idle, this); @@ -1653,49 +1650,6 @@ bool LLPanelPeople::isAccordionCollapsedByUser(const std::string& name) return isAccordionCollapsedByUser(getChild<LLUICtrl>(name)); } -bool LLPanelPeople::onConversationModelEvent(const LLSD& event) -{ - std::string type = event.get("type").asString(); - LLUUID folder_id = event.get("folder_id").asUUID(); - LLUUID person_id = event.get("person_id").asUUID(); - - if(type == "add_participant") - { - LLPersonTabModel * person_folder_model = dynamic_cast<LLPersonTabModel *>(mPersonFolderModelMap[folder_id]); - LLPersonTabView * person_folder_view = dynamic_cast<LLPersonTabView *>(mPersonFolderViewMap[person_id]); - - if(person_folder_model) - { - LLPersonModel * person_model = person_folder_model->findParticipant(person_id); - - if(person_model) - { - LLPersonView * participant_view = createConversationViewParticipant(person_model); - participant_view->addToFolder(person_folder_view); - } - } - } - - return false; -} - -LLPersonView * LLPanelPeople::createConversationViewParticipant(LLPersonModel * item) -{ - LLPersonView::Params params; - LLRect panel_rect = getChild<LLPanel>(FBCTESTTWO_TAB_NAME)->getRect(); - - params.name = item->getDisplayName(); - params.root = mConversationsRoot; - params.listener = item; - - //24 is the the current hight of an item (itemHeight) loaded from conversation_view_participant.xml. - params.rect = LLRect (0, 24, panel_rect.getWidth(), 0); - params.tool_tip = params.name; - params.folder_indentation = 2; - - return LLUICtrlFactory::create<LLPersonView>(params); -} - void LLPanelPeople::openFacebookWeb(LLFloaterWebContent::Params& p) { LLFloater* browser = LLFloaterReg::showInstance("web_content", p); @@ -1733,7 +1687,7 @@ void LLPanelPeople::addTestParticipant() { for(int i = 0; i < 300; ++i) { - LLPersonTabModel * person_folder_model = dynamic_cast<LLPersonTabModel *>(mPersonFolderModelMap.begin()->second); + LLPersonTabModel * person_folder_model = dynamic_cast<LLPersonTabModel *>(mConversationsRoot->mPersonFolderModelMap.begin()->second); addParticipantToModel(person_folder_model, LLUUID().generateNewID(), "EastBayGuy"); } } diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h index f1fa7ec981..a448b7935e 100644 --- a/indra/newview/llpanelpeople.h +++ b/indra/newview/llpanelpeople.h @@ -31,7 +31,6 @@ #include "llcallingcard.h" // for avatar tracker #include "llpersonmodelcommon.h" -#include "llevents.h" #include "llfloaterwebcontent.h" #include "llvoiceclient.h" @@ -40,18 +39,10 @@ class LLAvatarListSocial; class LLAvatarName; class LLFilterEditor; class LLGroupList; +class LLPersonFolderView; class LLSocialList; class LLMenuButton; class LLTabContainer; -class LLFolderView; - -class LLPersonTabModel; -class LLPersonTabView; -class LLPersonView; -class LLPersonModel; - -typedef std::map<LLUUID, LLPersonTabModel *> person_folder_model_map; -typedef std::map<LLUUID, LLPersonTabView *> person_folder_view_map; class LLPanelPeople : public LLPanel @@ -164,9 +155,6 @@ private: bool isAccordionCollapsedByUser(LLUICtrl* acc_tab); bool isAccordionCollapsedByUser(const std::string& name); - bool onConversationModelEvent(const LLSD& event); - LLPersonView * createConversationViewParticipant(LLPersonModel * item); - LLTabContainer* mTabContainer; LLAvatarList* mOnlineFriendList; LLAvatarList* mAllFriendList; @@ -189,11 +177,8 @@ private: LLMenuButton* mFBCGearButton; LLHandle< LLFloater > mPicker; - person_folder_model_map mPersonFolderModelMap; - person_folder_view_map mPersonFolderViewMap; LLPersonFolderViewModel mPersonFolderViewModel; - LLFolderView* mConversationsRoot; - LLEventStream mConversationsEventStream; + LLPersonFolderView* mConversationsRoot; }; #endif //LL_LLPANELPEOPLE_H diff --git a/indra/newview/llpersonfolderview.cpp b/indra/newview/llpersonfolderview.cpp new file mode 100644 index 0000000000..d94c8cf32f --- /dev/null +++ b/indra/newview/llpersonfolderview.cpp @@ -0,0 +1,88 @@ +/** +* @file llpersonfolderview.cpp +* @brief Implementation of llpersonfolderview +* @author Gilbert@lindenlab.com +* +* $LicenseInfo:firstyear=2013&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2013, 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 "llpersonfolderview.h" + +#include "llpersontabview.h" +#include "llpersonmodelcommon.h" + + +LLPersonFolderView::LLPersonFolderView(const Params &p) : +LLFolderView(p), + mConversationsEventStream("ConversationsEventsTwo") +{ + mConversationsEventStream.listen("ConversationsRefresh", boost::bind(&LLPersonFolderView::onConversationModelEvent, this, _1)); +} + +LLPersonFolderView::~LLPersonFolderView() +{ + mConversationsEventStream.stopListening("ConversationsRefresh"); +} + +bool LLPersonFolderView::onConversationModelEvent(const LLSD &event) +{ + std::string type = event.get("type").asString(); + LLUUID folder_id = event.get("folder_id").asUUID(); + LLUUID person_id = event.get("person_id").asUUID(); + + if(type == "add_participant") + { + LLPersonTabModel * person_folder_model = dynamic_cast<LLPersonTabModel *>(mPersonFolderModelMap[folder_id]); + LLPersonTabView * person_folder_view = dynamic_cast<LLPersonTabView *>(mPersonFolderViewMap[person_id]); + + if(person_folder_model) + { + LLPersonModel * person_model = person_folder_model->findParticipant(person_id); + + if(person_model) + { + LLPersonView * participant_view = createConversationViewParticipant(person_model); + participant_view->addToFolder(person_folder_view); + } + } + } + + return false; +} + +LLPersonView * LLPersonFolderView::createConversationViewParticipant(LLPersonModel * item) +{ + LLPersonView::Params params; + + params.name = item->getDisplayName(); + params.root = this; + params.listener = item; + + //24 should be loaded from .xml somehow + params.rect = LLRect (0, 24, getRect().getWidth(), 0); + params.tool_tip = params.name; + params.folder_indentation = 2; + + return LLUICtrlFactory::create<LLPersonView>(params); +} diff --git a/indra/newview/llpersonfolderview.h b/indra/newview/llpersonfolderview.h new file mode 100644 index 0000000000..60260dc5ea --- /dev/null +++ b/indra/newview/llpersonfolderview.h @@ -0,0 +1,63 @@ +/** +* @file llpersonfolderview.h +* @brief Header file for llpersonfolderview +* @author Gilbert@lindenlab.com +* +* $LicenseInfo:firstyear=2013&license=viewerlgpl$ +* Second Life Viewer Source Code +* Copyright (C) 2013, 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_LLPERSONFOLDERVIEW_H +#define LL_LLPERSONFOLDERVIEW_H + +class LLPersonTabModel; +class LLPersonTabView; +class LLPersonView; +class LLPersonModel; + +typedef std::map<LLUUID, LLPersonTabModel *> person_folder_model_map; +typedef std::map<LLUUID, LLPersonTabView *> person_folder_view_map; + +#include "llevents.h" +#include "llfolderview.h" + +class LLPersonFolderView : public LLFolderView +{ +public: + struct Params : public LLInitParam::Block<Params, LLFolderView::Params> + { + Params() + {} + }; + + LLPersonFolderView(const Params &p); + ~LLPersonFolderView(); + + bool onConversationModelEvent(const LLSD &event); + + LLPersonView * createConversationViewParticipant(LLPersonModel * item); + + person_folder_model_map mPersonFolderModelMap; + person_folder_view_map mPersonFolderViewMap; + LLEventStream mConversationsEventStream; +}; + +#endif // LL_LLPERSONFOLDERVIEW_H + |