diff options
author | Gilbert Gonzales <gilbert@lindenlab.com> | 2013-04-23 17:14:13 -0700 |
---|---|---|
committer | Gilbert Gonzales <gilbert@lindenlab.com> | 2013-04-23 17:14:13 -0700 |
commit | 1a5ef465ef4059e05a21aae0aa2c6de610f7485f (patch) | |
tree | b68fa232454fc12e17cb2c8cfd4499f89b37cc88 /indra | |
parent | 2ca3612dae3258b489df8e47879f8339e24947ba (diff) |
ACME-251 Create AvatarFolderItemView: Now the facebook friends tab is using LLPersonFolderViewModel instead of mConversationViewModel
Diffstat (limited to 'indra')
-rw-r--r-- | indra/newview/llpanelpeople.cpp | 8 | ||||
-rw-r--r-- | indra/newview/llpanelpeople.h | 4 | ||||
-rw-r--r-- | indra/newview/llpersonfolderview.cpp | 32 | ||||
-rw-r--r-- | indra/newview/llpersonfolderview.h | 37 | ||||
-rw-r--r-- | indra/newview/llpersonmodelcommon.h | 73 |
5 files changed, 79 insertions, 75 deletions
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index 91f7c61088..02a286b880 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -695,12 +695,12 @@ BOOL LLPanelPeople::postBuild() LLPanel * socialtwo_tab = getChild<LLPanel>(FBCTESTTWO_TAB_NAME); //Create folder view - LLPersonModelCommon* base_item = new LLPersonModelCommon(mConversationViewModel); + LLPersonModelCommon* base_item = new LLPersonModelCommon(mPersonFolderViewModel); LLFolderView::Params folder_view_params(LLUICtrlFactory::getDefaultParams<LLFolderView>()); folder_view_params.parent_panel = friends_tab; folder_view_params.listener = base_item; - folder_view_params.view_model = &mConversationViewModel; + folder_view_params.view_model = &mPersonFolderViewModel; folder_view_params.root = NULL; folder_view_params.use_ellipses = false; folder_view_params.options_menu = "menu_conversation.xml"; @@ -725,7 +725,7 @@ BOOL LLPanelPeople::postBuild() //Create a session //LLSpeakerMgr* speaker_manager = (LLSpeakerMgr*)LLLocalSpeakerMgr::getInstance(); - LLPersonTabModel* item = new LLPersonTabModel("Facebook Friends", mConversationViewModel); + LLPersonTabModel* item = new LLPersonTabModel("Facebook Friends", mPersonFolderViewModel); LLPersonTabView::Params params; params.name = item->getDisplayName(); params.root = mConversationsRoot; @@ -1742,7 +1742,7 @@ void LLPanelPeople::addParticipantToModel(LLPersonTabModel * person_folder_model { LLPersonModel* person_model = NULL; - person_model = new LLPersonModel(name, mConversationViewModel); + person_model = new LLPersonModel(name, mPersonFolderViewModel); person_folder_model->addParticipant(person_model); } diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h index d112ac2ec7..f1fa7ec981 100644 --- a/indra/newview/llpanelpeople.h +++ b/indra/newview/llpanelpeople.h @@ -30,7 +30,7 @@ #include <llpanel.h> #include "llcallingcard.h" // for avatar tracker -#include "llconversationmodel.h" +#include "llpersonmodelcommon.h" #include "llevents.h" #include "llfloaterwebcontent.h" #include "llvoiceclient.h" @@ -191,7 +191,7 @@ private: person_folder_model_map mPersonFolderModelMap; person_folder_view_map mPersonFolderViewMap; - LLConversationViewModel mConversationViewModel; + LLPersonFolderViewModel mPersonFolderViewModel; LLFolderView* mConversationsRoot; LLEventStream mConversationsEventStream; }; diff --git a/indra/newview/llpersonfolderview.cpp b/indra/newview/llpersonfolderview.cpp deleted file mode 100644 index e04eda2658..0000000000 --- a/indra/newview/llpersonfolderview.cpp +++ /dev/null @@ -1,32 +0,0 @@ -/** -* @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" - - diff --git a/indra/newview/llpersonfolderview.h b/indra/newview/llpersonfolderview.h deleted file mode 100644 index f96e45abc6..0000000000 --- a/indra/newview/llpersonfolderview.h +++ /dev/null @@ -1,37 +0,0 @@ -/** -* @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 - -#include "llfolderview.h" - -#endif // LL_LLPERSONFOLDERVIEW_H - -class LLPersonFolderView : public LLFolderView -{ - -}; diff --git a/indra/newview/llpersonmodelcommon.h b/indra/newview/llpersonmodelcommon.h index 866d863581..f3454df53f 100644 --- a/indra/newview/llpersonmodelcommon.h +++ b/indra/newview/llpersonmodelcommon.h @@ -127,6 +127,79 @@ private: }; +//Below code is just copied and adjusted from llconversationmodel.h, will need to investigate further + +class LLPersonViewFilter : public LLFolderViewFilter +{ +public: + + enum ESortOrderType + { + SO_NAME = 0, // Sort by name + SO_DATE = 0x1, // Sort by date (most recent) + SO_SESSION_TYPE = 0x2, // Sort by type (valid only for sessions) + SO_DISTANCE = 0x3, // Sort by distance (valid only for participants in nearby chat) + }; + // Default sort order is by type for sessions and by date for participants + static const U32 SO_DEFAULT = (SO_SESSION_TYPE << 16) | (SO_DATE); + + LLPersonViewFilter() { mEmpty = ""; } + ~LLPersonViewFilter() {} + + bool check(const LLFolderViewModelItem* item) { return true; } + bool checkFolder(const LLFolderViewModelItem* folder) const { return true; } + void setEmptyLookupMessage(const std::string& message) { } + std::string getEmptyLookupMessage() const { return mEmpty; } + bool showAllResults() const { return true; } + std::string::size_type getStringMatchOffset(LLFolderViewModelItem* item) const { return std::string::npos; } + std::string::size_type getFilterStringSize() const { return 0; } + + bool isActive() const { return false; } + bool isModified() const { return false; } + void clearModified() { } + const std::string& getName() const { return mEmpty; } + const std::string& getFilterText() { return mEmpty; } + void setModified(EFilterModified behavior = FILTER_RESTART) { } + + void setFilterCount(S32 count) { } + S32 getFilterCount() const { return 0; } + void decrementFilterCount() { } + + bool isDefault() const { return true; } + bool isNotDefault() const { return false; } + void markDefault() { } + void resetDefault() { } + + S32 getCurrentGeneration() const { return 0; } + S32 getFirstSuccessGeneration() const { return 0; } + S32 getFirstRequiredGeneration() const { return 0; } +private: + std::string mEmpty; +}; + +class LLPersonViewSort +{ +public: + LLPersonViewSort(U32 order = LLPersonViewFilter::SO_DEFAULT) : mSortOrder(order) { } + + bool operator()(const LLPersonModelCommon* const& a, const LLPersonModelCommon* const& b) const {return false;} + operator U32() const { return mSortOrder; } +private: + // Note: we're treating this value as a sort order bitmask as done in other places in the code (e.g. inventory) + U32 mSortOrder; +}; + + +class LLPersonFolderViewModel + : public LLFolderViewModel<LLPersonViewSort, LLPersonModelCommon, LLPersonModelCommon, LLPersonViewFilter> +{ +public: + typedef LLFolderViewModel<LLPersonViewSort, LLPersonModelCommon, LLPersonModelCommon, LLPersonViewFilter> base_t; + + void sort(LLFolderViewFolder* folder) { base_t::sort(folder);} + bool startDrag(std::vector<LLFolderViewModelItem*>& items) { return false; } // We do not allow drag of conversation items +}; + #endif // LL_LLPERSONMODELCOMMON_H |