summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2013-06-23 12:15:21 -0700
committerMerov Linden <merov@lindenlab.com>2013-06-23 12:15:21 -0700
commit27bd181a6d07b191d674870039b2801713c554f1 (patch)
treef024cfc25afe2edf6ea13c1242e8cd8252fb8862 /indra/newview
parentb403f0f849150d781c700539eff6ed1039673f25 (diff)
ACME-497 : Working implementation of Checkin though couple of bugs to fix and no visible map in the UI
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/llfloatersocial.cpp65
-rw-r--r--indra/newview/llfloatersocial.h10
-rw-r--r--indra/newview/skins/default/xui/en/floater_social.xml5
3 files changed, 77 insertions, 3 deletions
diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp
index f6fc55927e..cca966bb9a 100644
--- a/indra/newview/llfloatersocial.cpp
+++ b/indra/newview/llfloatersocial.cpp
@@ -29,11 +29,25 @@
#include "llfloatersocial.h"
+#include "llagent.h"
#include "llagentui.h"
+#include "llfacebookconnect.h"
#include "llfloaterreg.h"
#include "llslurl.h"
+#include "llviewerregion.h"
+#include "llviewercontrol.h"
-static LLRegisterPanelClassWrapper<LLSocialPhotoPanel> panel_class("llsocialphotopanel");
+static LLRegisterPanelClassWrapper<LLSocialPhotoPanel> t_panel_photo("llsocialphotopanel");
+static LLRegisterPanelClassWrapper<LLSocialCheckinPanel> t_panel_checkin("llsocialcheckinpanel");
+
+std::string get_map_url()
+{
+ LLVector3d center_agent = gAgent.getRegion()->getCenterGlobal();
+ int x_pos = center_agent[0] / 256.0;
+ int y_pos = center_agent[1] / 256.0;
+ std::string map_url = gSavedSettings.getString("CurrentMapServerURL") + llformat("map-1-%d-%d-objects.jpg", x_pos, y_pos);
+ return map_url;
+}
LLSocialPhotoPanel::LLSocialPhotoPanel()
{
@@ -60,6 +74,55 @@ void LLSocialPhotoPanel::onSend()
}
+LLSocialCheckinPanel::LLSocialCheckinPanel() :
+ mMapUrl("")
+{
+ mCommitCallbackRegistrar.add("SocialSharing.SendCheckin", boost::bind(&LLSocialCheckinPanel::onSend, this));
+}
+
+/*virtual*/
+void LLSocialCheckinPanel::setVisible(BOOL visible)
+{
+ if (visible)
+ {
+ mMapUrl = get_map_url();
+ }
+ LLPanel::setVisible(visible);
+}
+
+void LLSocialCheckinPanel::onSend()
+{
+ // Get the location SLURL
+ LLSLURL slurl;
+ LLAgentUI::buildSLURL(slurl);
+ std::string slurl_string = slurl.getSLURLString();
+
+ // Get the region name
+ std::string region_name = gAgent.getRegion()->getName();
+
+ // Get the region description
+ std::string description;
+ LLAgentUI::buildLocationString(description, LLAgentUI::LOCATION_FORMAT_NORMAL_COORDS, gAgent.getPositionAgent());
+
+
+ // Optionally add the region map view
+ bool add_map_view = getChild<LLUICtrl>("add_place_view_cb")->getValue().asBoolean();
+ std::string map_url = (add_map_view ? mMapUrl : "");
+
+ // Get the caption
+ std::string caption = getChild<LLUICtrl>("place_caption")->getValue().asString();
+
+ // Post all that to Facebook
+ LLFacebookConnect::instance().postCheckin(slurl_string, region_name, description, map_url, caption);
+
+ // Close the floater once "Post" has been pushed
+ LLFloater* floater = getParentByType<LLFloater>();
+ if (floater)
+ {
+ floater->closeFloater();
+ }
+}
+
LLFloaterSocial::LLFloaterSocial(const LLSD& key) : LLFloater(key)
{
diff --git a/indra/newview/llfloatersocial.h b/indra/newview/llfloatersocial.h
index a8c83fb364..aee7f2f060 100644
--- a/indra/newview/llfloatersocial.h
+++ b/indra/newview/llfloatersocial.h
@@ -36,6 +36,16 @@ class LLSocialPhotoPanel : public LLPanel
void onSend();
};
+class LLSocialCheckinPanel : public LLPanel
+{
+public:
+ LLSocialCheckinPanel();
+ void onSend();
+ /*virtual*/ void setVisible(BOOL visible);
+private:
+ std::string mMapUrl;
+};
+
class LLFloaterSocial : public LLFloater
{
public:
diff --git a/indra/newview/skins/default/xui/en/floater_social.xml b/indra/newview/skins/default/xui/en/floater_social.xml
index d57bc157cd..f99044b233 100644
--- a/indra/newview/skins/default/xui/en/floater_social.xml
+++ b/indra/newview/skins/default/xui/en/floater_social.xml
@@ -71,7 +71,7 @@
top_delta="0"
width="100">
<button.commit_callback
- function="PostToFacebook.Cancel" />
+ function="SocialSharing.Cancel" />
</button>
</panel>
<panel
@@ -334,6 +334,7 @@
</layout_stack>
</panel>
<panel
+ class="llsocialcheckinpanel"
follows="all"
height="430"
background_visible="true"
@@ -431,7 +432,7 @@
name="post_place_btn"
width="100">
<button.commit_callback
- function="Facebook.Checkin" />
+ function="SocialSharing.SendCheckin" />
</button>
<button
follows="left|top"