summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGilbert Gonzales <gilbert@lindenlab.com>2013-04-01 23:08:16 -0700
committerGilbert Gonzales <gilbert@lindenlab.com>2013-04-01 23:08:16 -0700
commit0a4ab0c64790b82edba369891a1983cd4b7f84f2 (patch)
treed78c329976442dd6bcefa821089a64a3cba67f9b
parentd6ec3cf584b4ecb904037a6f63fbd5a8c1ad2c05 (diff)
Some not so clean code to use to show facebook friends using the existing avatar list.
-rw-r--r--indra/newview/llavatarlist.cpp36
-rw-r--r--indra/newview/llavatarlist.h27
-rw-r--r--indra/newview/llpanelpeople.cpp37
-rw-r--r--indra/newview/llpanelpeople.h2
-rw-r--r--indra/newview/skins/default/xui/en/panel_people.xml36
5 files changed, 96 insertions, 42 deletions
diff --git a/indra/newview/llavatarlist.cpp b/indra/newview/llavatarlist.cpp
index 771419f60a..37de2d5793 100644
--- a/indra/newview/llavatarlist.cpp
+++ b/indra/newview/llavatarlist.cpp
@@ -624,3 +624,39 @@ void LLAvalineListItem::setName(const std::string& name)
LLAvatarListItem::setAvatarToolTip(formatted_phone);
}
}
+
+/************************************************************************/
+/* class LLAvatarListSocial */
+/************************************************************************/
+
+static LLDefaultChildRegistry::Register<LLAvatarListSocial> s("avatar_list_social");
+
+LLAvatarListSocial::LLAvatarListSocial(const Params& p) : LLAvatarList(p)
+{
+
+}
+
+void LLAvatarListSocial::addSocialItem(const LLUUID& id, const std::string& name, BOOL is_online, EAddPosition pos)
+{
+ LLAvatarListItem* item = new LLAvatarListItem();
+ // This sets the name as a side effect
+ item->setAvatarId(id, mSessionID, mIgnoreOnlineStatus, false);
+ item->setAvatarName(name);
+ item->setOnline(mIgnoreOnlineStatus ? true : is_online);
+ item->showLastInteractionTime(mShowLastInteractionTime);
+
+ item->setAvatarIconVisible(mShowIcons);
+ item->setShowInfoBtn(mShowInfoBtn);
+ item->setShowProfileBtn(mShowProfileBtn);
+ item->showSpeakingIndicator(mShowSpeakingIndicator);
+ item->setShowPermissions(mShowPermissions);
+
+ item->setDoubleClickCallback(boost::bind(&LLAvatarListSocial::onItemDoubleClicked, this, _1, _2, _3, _4));
+
+ addItem(item, id, pos);
+}
+
+void LLAvatarListSocial::refresh()
+{
+
+}
diff --git a/indra/newview/llavatarlist.h b/indra/newview/llavatarlist.h
index 4814a88a79..cbe5956493 100644
--- a/indra/newview/llavatarlist.h
+++ b/indra/newview/llavatarlist.h
@@ -97,10 +97,12 @@ public:
void addAvalineItem(const LLUUID& item_id, const LLUUID& session_id, const std::string& item_name);
void handleDisplayNamesOptionChanged();
-protected:
- void refresh();
+
- void addNewItem(const LLUUID& id, const std::string& name, BOOL is_online, EAddPosition pos = ADD_BOTTOM);
+protected:
+ virtual void refresh();
+ virtual void addNewItem(const LLUUID& id, const std::string& name, BOOL is_online, EAddPosition pos = ADD_BOTTOM);
+
void computeDifference(
const uuid_vec_t& vnew,
uuid_vec_t& vadded,
@@ -110,8 +112,6 @@ protected:
void onItemDoubleClicked(LLUICtrl* ctrl, S32 x, S32 y, MASK mask);
void updateAvatarNames();
-private:
-
bool isAvalineItemSelected();
bool mIgnoreOnlineStatus;
@@ -205,4 +205,21 @@ private:
bool mIsHideNumber;
};
+class LLAvatarListSocial : public LLAvatarList
+{
+ public:
+ struct Params : public LLInitParam::Block<Params, LLAvatarList::Params>
+ {
+
+ };
+
+ LLAvatarListSocial(const Params&);
+
+ void addSocialItem(const LLUUID& id, const std::string& name, BOOL is_online, EAddPosition pos = ADD_BOTTOM);
+
+ protected:
+ /*virtual*/ void refresh();
+};
+
+
#endif // LL_LLAVATARLIST_H
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index 01d68cb9a0..7a3e6abb7f 100644
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -647,7 +647,9 @@ BOOL LLPanelPeople::postBuild()
mAllFriendList->setContextMenu(&LLPanelPeopleMenus::gNearbyMenu);
mOnlineFriendList->setContextMenu(&LLPanelPeopleMenus::gNearbyMenu);
- mFbcTestText = getChild<LLPanel>(FBCTEST_TAB_NAME)->getChild<LLTextBox>("fbctest_label");
+ LLPanel * social_tab = getChild<LLPanel>(FBCTEST_TAB_NAME);
+ social_tab->setVisibleCallback(boost::bind(&Updater::setActive, mFbcTestListUpdater, _2));
+ mFacebookFriends = social_tab->getChild<LLAvatarListSocial>("facebook_friends");
setSortOrder(mRecentList, (ESortOrder)gSavedSettings.getU32("RecentPeopleSortOrder"), false);
setSortOrder(mAllFriendList, (ESortOrder)gSavedSettings.getU32("FriendsSortOrder"), false);
@@ -883,35 +885,10 @@ void LLPanelPeople::updateRecentList()
void LLPanelPeople::updateFbcTestList()
{
- if (!mFbcTestText)
- return;
-
- if (mFbcTestBrowserHandle.get())
- {
- // get the browser data (from the title bar, of course!)
- std::string title = mFbcTestBrowserHandle.get()->getTitle();
-
- // if the data is ready (if it says the magic word)
- if (title.length() >= 2 && title[0] == ':')
- {
- // success! :)
- if (title[1] == ')')
- {
- mFbcTestText->setText(std::string("okay, now we can get the list of friends!"));
- }
- // failure :(
- else if (title[1] == '(')
- {
- mFbcTestText->setText(std::string("hmm, the authentication failed somehow"));
- }
-
- // close the browser window
- mFbcTestBrowserHandle.get()->die();
-
- // stop updating
- mFbcTestListUpdater->setActive(false);
- }
- }
+ mFacebookFriends->addSocialItem(LLUUID(), "TEST", false);
+
+ // stop updating
+ mFbcTestListUpdater->setActive(false);
}
void LLPanelPeople::buttonSetVisible(std::string btn_name, BOOL visible)
diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h
index dadd273603..a00b5be516 100644
--- a/indra/newview/llpanelpeople.h
+++ b/indra/newview/llpanelpeople.h
@@ -34,6 +34,7 @@
#include "llvoiceclient.h"
class LLAvatarList;
+class LLAvatarListSocial;
class LLAvatarName;
class LLFilterEditor;
class LLGroupList;
@@ -149,6 +150,7 @@ private:
LLAvatarList* mNearbyList;
LLAvatarList* mRecentList;
LLGroupList* mGroupList;
+ LLAvatarListSocial* mFacebookFriends;
LLNetMap* mMiniMap;
LLTextBox* mFbcTestText;
diff --git a/indra/newview/skins/default/xui/en/panel_people.xml b/indra/newview/skins/default/xui/en/panel_people.xml
index cbb6aff4ea..f3334fd767 100644
--- a/indra/newview/skins/default/xui/en/panel_people.xml
+++ b/indra/newview/skins/default/xui/en/panel_people.xml
@@ -585,14 +585,36 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
name="fbctest_panel"
top="0"
width="313">
- <text
- follows="all"
- height="356"
+ <accordion
+ background_visible="true"
+ bg_alpha_color="DkGray2"
+ bg_opaque_color="DkGray2"
+ follows="all"
+ height="356"
+ layout="topleft"
+ left="3"
+ name="friends_accordion"
+ top="0"
+ width="307">
+ <accordion_tab
layout="topleft"
- left="3"
- name="fbctest_label"
- top="0"
- width="307"/>
+ height="172"
+ min_height="150"
+ name="tab_facebook"
+ title="Facebook Friends">
+ <avatar_list_social
+ allow_select="true"
+ follows="all"
+ height="172"
+ layout="topleft"
+ left="0"
+ multi_select="true"
+ name="facebook_friends"
+ show_permissions_granted="true"
+ top="0"
+ width="307" />
+ </accordion_tab>
+ </accordion>
<panel
background_visible="true"
follows="left|right|bottom"