summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorCho <cho@lindenlab.com>2014-02-21 02:06:03 +0000
committerCho <cho@lindenlab.com>2014-02-21 02:06:03 +0000
commitac9cf045ecc14f8c650773f3fff7bc338fa468d0 (patch)
tree41d0fedcb325bf2fda21ea4ad3c1ff033cc0fff4 /indra/newview
parent63e7c0c131859dd38f98e5ebbfabc2932a7b1bff (diff)
Added Friends tab to Facebook floater for ACME-1325
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llfloaterfacebook.cpp99
-rw-r--r--indra/newview/llfloaterfacebook.h16
-rwxr-xr-xindra/newview/llpanelpeople.cpp6
-rwxr-xr-xindra/newview/llpanelpeople.h2
-rw-r--r--indra/newview/skins/default/xui/en/floater_facebook.xml10
-rw-r--r--indra/newview/skins/default/xui/en/panel_facebook_friends.xml35
6 files changed, 161 insertions, 7 deletions
diff --git a/indra/newview/llfloaterfacebook.cpp b/indra/newview/llfloaterfacebook.cpp
index 3e58b40c75..de849b6b3f 100644
--- a/indra/newview/llfloaterfacebook.cpp
+++ b/indra/newview/llfloaterfacebook.cpp
@@ -48,10 +48,13 @@
#include "llviewercontrol.h"
#include "llviewermedia.h"
#include "lltabcontainer.h"
+#include "llavatarlist.h"
+#include "llpanelpeoplemenus.h"
static LLRegisterPanelClassWrapper<LLFacebookStatusPanel> t_panel_status("llfacebookstatuspanel");
static LLRegisterPanelClassWrapper<LLFacebookPhotoPanel> t_panel_photo("llfacebookphotopanel");
static LLRegisterPanelClassWrapper<LLFacebookCheckinPanel> t_panel_checkin("llfacebookcheckinpanel");
+static LLRegisterPanelClassWrapper<LLFacebookFriendsPanel> t_panel_friends("llfacebookfriendspanel");
static LLRegisterPanelClassWrapper<LLFacebookAccountPanel> t_panel_account("llfacebookaccountpanel");
const S32 MAX_POSTCARD_DATASIZE = 1024 * 1024; // one megabyte
@@ -693,6 +696,102 @@ void LLFacebookCheckinPanel::clearAndClose()
}
///////////////////////////
+//LLFacebookFriendsPanel//////
+///////////////////////////
+
+LLFacebookFriendsPanel::LLFacebookFriendsPanel() :
+mSuggestedFriends(NULL)
+{
+}
+
+BOOL LLFacebookFriendsPanel::postBuild()
+{
+ mSuggestedFriends = getChild<LLAvatarList>("suggested_friends");
+ mSuggestedFriends->setContextMenu(&LLPanelPeopleMenus::gSuggestedFriendsContextMenu);
+
+ setVisibleCallback(boost::bind(&LLFacebookFriendsPanel::updateFacebookList, this, _2));
+
+ return LLPanel::postBuild();
+}
+
+bool LLFacebookFriendsPanel::updateSuggestedFriendList()
+{
+ const LLAvatarTracker& av_tracker = LLAvatarTracker::instance();
+ uuid_vec_t& suggested_friends = mSuggestedFriends->getIDs();
+ suggested_friends.clear();
+
+ //Add suggested friends
+ LLSD friends = LLFacebookConnect::instance().getContent();
+ for (LLSD::array_const_iterator i = friends.beginArray(); i != friends.endArray(); ++i)
+ {
+ LLUUID agent_id = (*i).asUUID();
+ bool second_life_buddy = agent_id.notNull() ? av_tracker.isBuddy(agent_id) : false;
+
+ if(!second_life_buddy)
+ {
+ //FB+SL but not SL friend
+ if (agent_id.notNull())
+ {
+ suggested_friends.push_back(agent_id);
+ }
+ }
+ }
+
+ //Force a refresh when there aren't any filter matches (prevent displaying content that shouldn't display)
+ mSuggestedFriends->setDirty(true, !mSuggestedFriends->filterHasMatches());
+ //showFriendsAccordionsIfNeeded();
+
+ return false;
+}
+
+void LLFacebookFriendsPanel::updateFacebookList(bool visible)
+{
+ if (visible)
+ {
+ LLEventPumps::instance().obtain("FacebookConnectContent").stopListening("LLPanelPeople"); // just in case it is already listening
+ LLEventPumps::instance().obtain("FacebookConnectContent").listen("LLPanelPeople", boost::bind(&LLFacebookFriendsPanel::updateSuggestedFriendList, this));
+
+ LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLPanelPeople"); // just in case it is already listening
+ LLEventPumps::instance().obtain("FacebookConnectState").listen("LLPanelPeople", boost::bind(&LLFacebookFriendsPanel::onConnectedToFacebook, this, _1));
+
+ //Connected
+ if (LLFacebookConnect::instance().isConnected())
+ {
+ LLFacebookConnect::instance().loadFacebookFriends();
+ }
+ //Check if connected
+ if ((LLFacebookConnect::instance().getConnectionState() == LLFacebookConnect::FB_NOT_CONNECTED) ||
+ (LLFacebookConnect::instance().getConnectionState() == LLFacebookConnect::FB_CONNECTION_FAILED))
+ {
+ LLFacebookConnect::instance().checkConnectionToFacebook();
+ }
+
+ updateSuggestedFriendList();
+ }
+ else
+ {
+ LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLPanelPeople");
+ LLEventPumps::instance().obtain("FacebookConnectContent").stopListening("LLPanelPeople");
+ }
+}
+
+bool LLFacebookFriendsPanel::onConnectedToFacebook(const LLSD& data)
+{
+ LLSD::Integer connection_state = data.get("enum").asInteger();
+
+ if (connection_state == LLFacebookConnect::FB_CONNECTED)
+ {
+ LLFacebookConnect::instance().loadFacebookFriends();
+ }
+ else if(connection_state == LLFacebookConnect::FB_NOT_CONNECTED)
+ {
+ updateSuggestedFriendList();
+ };
+
+ return false;
+}
+
+///////////////////////////
//LLFacebookAccountPanel//////
///////////////////////////
diff --git a/indra/newview/llfloaterfacebook.h b/indra/newview/llfloaterfacebook.h
index 4361dfa628..20c401d0c1 100644
--- a/indra/newview/llfloaterfacebook.h
+++ b/indra/newview/llfloaterfacebook.h
@@ -34,6 +34,7 @@
class LLIconCtrl;
class LLCheckBoxCtrl;
class LLSnapshotLivePreview;
+class LLAvatarList;
class LLFacebookStatusPanel : public LLPanel
{
@@ -119,6 +120,20 @@ private:
bool mReloadingMapTexture;
};
+class LLFacebookFriendsPanel : public LLPanel
+{
+public:
+ LLFacebookFriendsPanel();
+ BOOL postBuild();
+
+private:
+ bool updateSuggestedFriendList();
+ void updateFacebookList(bool visible);
+ bool onConnectedToFacebook(const LLSD& data);
+
+ LLAvatarList* mSuggestedFriends;
+};
+
class LLFacebookAccountPanel : public LLPanel
{
public:
@@ -146,7 +161,6 @@ private:
LLUICtrl * mDisconnectButton;
};
-
class LLFloaterFacebook : public LLFloater
{
public:
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index f551fc96ee..b2e733e1ae 100755
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -505,7 +505,7 @@ public:
LLPanelPeople::LLPanelPeople()
: LLPanel(),
- mTryToConnectToFbc(true),
+ mTryToConnectToFacebook(true),
mTabContainer(NULL),
mOnlineFriendList(NULL),
mAllFriendList(NULL),
@@ -865,10 +865,10 @@ void LLPanelPeople::updateFacebookList(bool visible)
{
LLFacebookConnect::instance().loadFacebookFriends();
}
- else if(mTryToConnectToFbc)
+ else if(mTryToConnectToFacebook)
{
LLFacebookConnect::instance().checkConnectionToFacebook();
- mTryToConnectToFbc = false;
+ mTryToConnectToFacebook = false;
}
updateSuggestedFriendList();
diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h
index c7141f36ee..67e190dafd 100755
--- a/indra/newview/llpanelpeople.h
+++ b/indra/newview/llpanelpeople.h
@@ -56,7 +56,7 @@ public:
// when voice is available
/*virtual*/ void onChange(EStatusType status, const std::string &channelURI, bool proximal);
- bool mTryToConnectToFbc;
+ bool mTryToConnectToFacebook;
// internals
class Updater;
diff --git a/indra/newview/skins/default/xui/en/floater_facebook.xml b/indra/newview/skins/default/xui/en/floater_facebook.xml
index c1ff8571e9..544c443c76 100644
--- a/indra/newview/skins/default/xui/en/floater_facebook.xml
+++ b/indra/newview/skins/default/xui/en/floater_facebook.xml
@@ -49,12 +49,18 @@
label="CHECK IN"
name="panel_facebook_place"/>
<panel
+ filename="panel_facebook_friends.xml"
+ class="llfacebookfriendspanel"
+ follows="all"
+ label="FRIENDS"
+ name="panel_facebook_friends"/>
+ <panel
filename="panel_facebook_account.xml"
class="llfacebookaccountpanel"
follows="all"
label="ACCOUNT"
- name="panel_facebook_account"/>
- </tab_container>
+ name="panel_facebook_account"/>
+ </tab_container>
<panel
name="connection_status_panel"
follows="left|bottom|right"
diff --git a/indra/newview/skins/default/xui/en/panel_facebook_friends.xml b/indra/newview/skins/default/xui/en/panel_facebook_friends.xml
new file mode 100644
index 0000000000..d772dde0c5
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/panel_facebook_friends.xml
@@ -0,0 +1,35 @@
+<panel
+ height="400"
+ width="304"
+ layout="topleft"
+ name="panel_facebook_friends">
+ <accordion
+ background_visible="true"
+ bg_alpha_color="DkGray2"
+ bg_opaque_color="DkGray2"
+ follows="all"
+ height="408"
+ layout="topleft"
+ left="3"
+ name="friends_accordion"
+ right="-2"
+ top_pad="2">
+ <accordion_tab
+ layout="topleft"
+ height="173"
+ name="tab_suggested_friends"
+ title="People you may want to friend">
+ <avatar_list
+ ignore_online_status="true"
+ allow_select="true"
+ follows="all"
+ height="173"
+ layout="topleft"
+ left="0"
+ name="suggested_friends"
+ show_permissions_granted="true"
+ top="0"
+ width="307" />
+ </accordion_tab>
+ </accordion>
+</panel>