diff options
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llpanelpeople.cpp | 16 | ||||
-rw-r--r-- | indra/newview/llpersonfolderview.cpp | 19 | ||||
-rw-r--r-- | indra/newview/llpersonfolderview.h | 16 | ||||
-rw-r--r-- | indra/newview/llpersonmodelcommon.cpp | 5 | ||||
-rw-r--r-- | indra/newview/llpersonmodelcommon.h | 10 | ||||
-rw-r--r-- | indra/newview/llpersontabview.cpp | 20 | ||||
-rw-r--r-- | indra/newview/llpersontabview.h | 8 |
7 files changed, 57 insertions, 37 deletions
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp index b9afe10d84..f7492a51e1 100644 --- a/indra/newview/llpanelpeople.cpp +++ b/indra/newview/llpanelpeople.cpp @@ -1641,7 +1641,7 @@ void LLPanelPeople::openFacebookWeb(std::string url) void LLPanelPeople::showFacebookFriends(const LLSD& friends) { mFacebookFriends->clear(); - S32 model_index; + LLPersonTabModel::tab_type tab_type; LLAvatarTracker& avatar_tracker = LLAvatarTracker::instance(); for (LLSD::map_const_iterator i = friends.beginMap(); i != friends.endMap(); ++i) @@ -1655,16 +1655,16 @@ void LLPanelPeople::showFacebookFriends(const LLSD& friends) //FB+SL but not SL friend if(agent_id.notNull() && !avatar_tracker.isBuddy(agent_id)) { - model_index = 0; + tab_type = LLPersonTabModel::FB_SL_NON_SL_FRIEND; } //FB only friend else { - model_index = 1; + tab_type = LLPersonTabModel::FB_ONLY_FRIEND; } //Add to person tab model - LLPersonTabModel * person_tab_model = dynamic_cast<LLPersonTabModel *>(mPersonFolderView->getPersonTabModelByIndex(model_index)); + LLPersonTabModel * person_tab_model = dynamic_cast<LLPersonTabModel *>(mPersonFolderView->getPersonTabModelByIndex(tab_type)); if(person_tab_model) { addParticipantToModel(person_tab_model, agent_id, name); @@ -1679,24 +1679,24 @@ void LLPanelPeople::addTestParticipant() LLPersonTabModel * person_tab_model; LLUUID agentID; std::string name; - S32 model_index; + LLPersonTabModel::tab_type tab_type; for(int i = 0; i < 300; ++i) { //Adds FB+SL people that aren't yet SL friends if(i < 10) { - model_index = 0; + tab_type = LLPersonTabModel::FB_SL_NON_SL_FRIEND; agentID = gAgent.getID(); } //Adds FB only friends else { - model_index = 1; + tab_type = LLPersonTabModel::FB_ONLY_FRIEND; agentID = LLUUID(NULL); } - person_tab_model = dynamic_cast<LLPersonTabModel *>(mPersonFolderView->getPersonTabModelByIndex(model_index)); + person_tab_model = dynamic_cast<LLPersonTabModel *>(mPersonFolderView->getPersonTabModelByIndex(tab_type)); name = prefix + " " + suffix; addParticipantToModel(person_tab_model, agentID, name); // Next suffix : Aa, Ab, Ac ... Az, Ba, Bb, Bc ... Bz, Ca, Cb ... diff --git a/indra/newview/llpersonfolderview.cpp b/indra/newview/llpersonfolderview.cpp index 191c7d5bcd..c22e4f3e58 100644 --- a/indra/newview/llpersonfolderview.cpp +++ b/indra/newview/llpersonfolderview.cpp @@ -30,7 +30,6 @@ #include "llpersonfolderview.h" #include "llpersontabview.h" -#include "llpersonmodelcommon.h" LLPersonFolderView::LLPersonFolderView(const Params &p) : @@ -76,14 +75,14 @@ BOOL LLPersonFolderView::handleMouseDown( S32 x, S32 y, MASK mask ) void LLPersonFolderView::createPersonTabs() { - createPersonTab("SL residents you may want to friend"); - createPersonTab("Invite people you know to SL"); + createPersonTab(LLPersonTabModel::FB_SL_NON_SL_FRIEND, "SL residents you may want to friend"); + createPersonTab(LLPersonTabModel::FB_ONLY_FRIEND, "Invite people you know to SL"); } -void LLPersonFolderView::createPersonTab(const std::string& tab_name) +void LLPersonFolderView::createPersonTab(LLPersonTabModel::tab_type tab_type, const std::string& tab_name) { //Create a person tab - LLPersonTabModel* item = new LLPersonTabModel(tab_name, *mViewModel); + LLPersonTabModel* item = new LLPersonTabModel(tab_type, tab_name, *mViewModel); LLPersonTabView::Params params; params.name = item->getDisplayName(); params.root = this; @@ -92,7 +91,7 @@ void LLPersonFolderView::createPersonTab(const std::string& tab_name) LLPersonTabView * widget = LLUICtrlFactory::create<LLPersonTabView>(params); widget->addToFolder(this); - mIndexToFolderVec.push_back(item->getID()); + mIndexToFolderMap[tab_type] = item->getID(); mPersonFolderModelMap[item->getID()] = item; mPersonFolderViewMap[item->getID()] = widget; } @@ -138,12 +137,12 @@ LLPersonView * LLPersonFolderView::createConversationViewParticipant(LLPersonMod return LLUICtrlFactory::create<LLPersonView>(params); } -LLPersonTabModel * LLPersonFolderView::getPersonTabModelByIndex(const S32 index) +LLPersonTabModel * LLPersonFolderView::getPersonTabModelByIndex(LLPersonTabModel::tab_type tab_type) { - return mPersonFolderModelMap[mIndexToFolderVec[index]]; + return mPersonFolderModelMap[mIndexToFolderMap[tab_type]]; } -LLPersonTabView * LLPersonFolderView::getPersonTabViewByIndex(const S32 index) +LLPersonTabView * LLPersonFolderView::getPersonTabViewByIndex(LLPersonTabModel::tab_type tab_type) { - return mPersonFolderViewMap[mIndexToFolderVec[index]]; + return mPersonFolderViewMap[mIndexToFolderMap[tab_type]]; } diff --git a/indra/newview/llpersonfolderview.h b/indra/newview/llpersonfolderview.h index 3a15f59164..85dec6515d 100644 --- a/indra/newview/llpersonfolderview.h +++ b/indra/newview/llpersonfolderview.h @@ -27,7 +27,10 @@ #ifndef LL_LLPERSONFOLDERVIEW_H #define LL_LLPERSONFOLDERVIEW_H -class LLPersonTabModel; +#include "llevents.h" +#include "llfolderview.h" +#include "llpersonmodelcommon.h" + class LLPersonTabView; class LLPersonView; class LLPersonModel; @@ -35,9 +38,6 @@ 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: @@ -53,16 +53,16 @@ public: BOOL handleMouseDown( S32 x, S32 y, MASK mask ); void createPersonTabs(); - void createPersonTab(const std::string& tab_name); + void createPersonTab(LLPersonTabModel::tab_type tab_type, const std::string& tab_name); bool onConversationModelEvent(const LLSD &event); LLPersonView * createConversationViewParticipant(LLPersonModel * item); - LLPersonTabModel * getPersonTabModelByIndex(const S32 index); - LLPersonTabView * getPersonTabViewByIndex(const S32 index); + LLPersonTabModel * getPersonTabModelByIndex(LLPersonTabModel::tab_type tab_type); + LLPersonTabView * getPersonTabViewByIndex(LLPersonTabModel::tab_type tab_type); person_folder_model_map mPersonFolderModelMap; person_folder_view_map mPersonFolderViewMap; - std::vector<LLUUID> mIndexToFolderVec; + std::map<LLPersonTabModel::tab_type, LLUUID> mIndexToFolderMap; LLEventStream mConversationsEventStream; }; diff --git a/indra/newview/llpersonmodelcommon.cpp b/indra/newview/llpersonmodelcommon.cpp index 6b4c71faa2..70a24ac77a 100644 --- a/indra/newview/llpersonmodelcommon.cpp +++ b/indra/newview/llpersonmodelcommon.cpp @@ -132,8 +132,9 @@ bool LLPersonModelCommon::filter( LLFolderViewFilter& filter) // LLPersonTabModel // -LLPersonTabModel::LLPersonTabModel(std::string display_name, LLFolderViewModelInterface& root_view_model) : -LLPersonModelCommon(display_name,root_view_model) +LLPersonTabModel::LLPersonTabModel(tab_type tab_type, std::string display_name, LLFolderViewModelInterface& root_view_model) : +LLPersonModelCommon(display_name,root_view_model), +mTabType(tab_type) { } diff --git a/indra/newview/llpersonmodelcommon.h b/indra/newview/llpersonmodelcommon.h index f44f619d18..7be3387564 100644 --- a/indra/newview/llpersonmodelcommon.h +++ b/indra/newview/llpersonmodelcommon.h @@ -108,7 +108,13 @@ protected: class LLPersonTabModel : public LLPersonModelCommon { public: - LLPersonTabModel(std::string display_name, LLFolderViewModelInterface& root_view_model); + enum tab_type + { + FB_SL_NON_SL_FRIEND, + FB_ONLY_FRIEND, + }; + + LLPersonTabModel(tab_type tab_type, std::string display_name, LLFolderViewModelInterface& root_view_model); LLPersonTabModel(LLFolderViewModelInterface& root_view_model); LLPointer<LLUIImage> getIcon() const { return NULL; } @@ -118,6 +124,8 @@ public: void clearParticipants(); LLPersonModel* findParticipant(const LLUUID& person_id); + tab_type mTabType; + private: }; diff --git a/indra/newview/llpersontabview.cpp b/indra/newview/llpersontabview.cpp index fdc024beb8..0dfd53705b 100644 --- a/indra/newview/llpersontabview.cpp +++ b/indra/newview/llpersontabview.cpp @@ -160,8 +160,10 @@ S32 LLPersonView::getLabelXPos() void LLPersonView::addToFolder(LLFolderViewFolder * person_folder_view) { LLFolderViewItem::addToFolder(person_folder_view); - //Added item to folder, could change folder's mHasVisibleChildren flag so call arrange + //Added item to folder could change folder's mHasVisibleChildren flag so call arrange person_folder_view->requestArrange(); + + mPersonTabModel = static_cast<LLPersonTabModel *>(getParentFolder()->getViewModelItem()); } LLPersonView::~LLPersonView() @@ -191,16 +193,24 @@ BOOL LLPersonView::postBuild() void LLPersonView::onMouseEnter(S32 x, S32 y, MASK mask) { - mInfoBtn->setVisible(TRUE); - mProfileBtn->setVisible(TRUE); + if(mPersonTabModel->mTabType == LLPersonTabModel::FB_SL_NON_SL_FRIEND) + { + mInfoBtn->setVisible(TRUE); + mProfileBtn->setVisible(TRUE); + } + updateChildren(); LLFolderViewItem::onMouseEnter(x, y, mask); } void LLPersonView::onMouseLeave(S32 x, S32 y, MASK mask) { - mInfoBtn->setVisible(FALSE); - mProfileBtn->setVisible(FALSE); + if(mPersonTabModel->mTabType == LLPersonTabModel::FB_SL_NON_SL_FRIEND) + { + mInfoBtn->setVisible(FALSE); + mProfileBtn->setVisible(FALSE); + } + updateChildren(); LLFolderViewItem::onMouseLeave(x, y, mask); } diff --git a/indra/newview/llpersontabview.h b/indra/newview/llpersontabview.h index 9cce615167..9e5fdc3057 100644 --- a/indra/newview/llpersontabview.h +++ b/indra/newview/llpersontabview.h @@ -33,6 +33,8 @@ #include "lloutputmonitorctrl.h" #include "lltextbox.h" +class LLPersonTabModel; + class LLPersonTabView : public LLFolderViewFolder { @@ -104,9 +106,11 @@ protected: private: + //Short-cut to tab model + LLPersonTabModel * mPersonTabModel; + LLPointer<LLUIImage> mImageOver; LLPointer<LLUIImage> mImageSelected; - LLAvatarIconCtrl* mAvatarIcon; LLTextBox * mLastInteractionTimeTextbox; LLIconCtrl * mPermissionEditTheirsIcon; @@ -117,8 +121,6 @@ private: LLButton * mProfileBtn; LLOutputMonitorCtrl * mOutputMonitorCtrl; - - typedef enum e_avatar_item_child { ALIC_SPEAKER_INDICATOR, ALIC_PROFILE_BUTTON, |