From 1643c4dacadf6df1cf7d000987a2c570eb4325ac Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Mon, 17 Jun 2013 18:30:36 -0700 Subject: CHUI 560: When Me->Post to Facebook... is selected the Facebook floater opens. --- indra/newview/llfloatersocial.cpp | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 indra/newview/llfloatersocial.cpp (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp new file mode 100644 index 0000000000..fe9cfa592b --- /dev/null +++ b/indra/newview/llfloatersocial.cpp @@ -0,0 +1,35 @@ +/** +* @file llfloatersocial.cpp +* @brief Implementation of llfloatersocial +* @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 "llfloatersocial.h" + +LLFloaterSocial::LLFloaterSocial(const LLSD& key) : LLFloater(key) +{ + +} -- cgit v1.2.3 From ba8bced90b0a3e5126e3274ac4d8a9f611a9ded8 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Fri, 21 Jun 2013 12:45:20 -0700 Subject: ACME-588 Make 'Post' button post to facebook: Intial commit is just adding callback for clicking the post button --- indra/newview/llfloatersocial.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index fe9cfa592b..0f3a82878b 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -29,7 +29,44 @@ #include "llfloatersocial.h" +#include "llagentui.h" +#include "llfloaterreg.h" +#include "llslurl.h" + +static LLRegisterPanelClassWrapper panel_class("llsocialphotopanel"); + +LLSocialPhotoPanel::LLSocialPhotoPanel() +{ + mCommitCallbackRegistrar.add("PostToFacebook.Send", boost::bind(&LLSocialPhotoPanel::onSend, this)); +} + +void LLSocialPhotoPanel::onSend() +{ + std::string caption = getChild("caption")->getValue().asString(); + bool add_location = getChild("add_location_cb")->getValue().asBoolean(); + + if (add_location) + { + LLSLURL slurl; + LLAgentUI::buildSLURL(slurl); + if (caption.empty()) + caption = slurl.getSLURLString(); + else + caption = caption + " " + slurl.getSLURLString(); + } + //LLFacebookConnect::instance().sharePhoto(LLFloaterSnapshot::getImageData(), caption); + //LLWebProfile::uploadImage(LLFloaterSnapshot::getImageData(), caption, add_location, boost::bind(&LLPanelSnapshotFacebook::onImageUploaded, this, caption, _1)); + //LLFloaterSnapshot::postSave(); +} + + + LLFloaterSocial::LLFloaterSocial(const LLSD& key) : LLFloater(key) { } + +BOOL LLFloaterSocial::postBuild() +{ + return LLFloater::postBuild(); +} -- cgit v1.2.3 From 9debe1787f966efd6c25ffc43a3a77553aca107a Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Sat, 22 Jun 2013 11:49:36 -0700 Subject: ACME-497 : All xml work for the Checkin feature --- indra/newview/llfloatersocial.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index fe9cfa592b..4a3efe4a2d 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -31,5 +31,10 @@ LLFloaterSocial::LLFloaterSocial(const LLSD& key) : LLFloater(key) { + mCommitCallbackRegistrar.add("SocialSharing.Cancel", boost::bind(&LLFloaterSocial::onCancel, this)); +} +void LLFloaterSocial::onCancel() +{ + closeFloater(); } -- cgit v1.2.3 From 27bd181a6d07b191d674870039b2801713c554f1 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Sun, 23 Jun 2013 12:15:21 -0700 Subject: ACME-497 : Working implementation of Checkin though couple of bugs to fix and no visible map in the UI --- indra/newview/llfloatersocial.cpp | 65 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloatersocial.cpp') 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 panel_class("llsocialphotopanel"); +static LLRegisterPanelClassWrapper t_panel_photo("llsocialphotopanel"); +static LLRegisterPanelClassWrapper 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("add_place_view_cb")->getValue().asBoolean(); + std::string map_url = (add_map_view ? mMapUrl : ""); + + // Get the caption + std::string caption = getChild("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(); + if (floater) + { + floater->closeFloater(); + } +} + LLFloaterSocial::LLFloaterSocial(const LLSD& key) : LLFloater(key) { -- cgit v1.2.3 From 37fcb81c4ab8806a52ef747e6a3047fff2d6eccf Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 24 Jun 2013 13:32:13 -0700 Subject: ACME-497 : Clean up the xml code for checkin to use a proper icon widget and add a decent default image for it --- indra/newview/llfloatersocial.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index cca966bb9a..361d54f696 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -42,7 +42,11 @@ static LLRegisterPanelClassWrapper t_panel_checkin("llsoci std::string get_map_url() { - LLVector3d center_agent = gAgent.getRegion()->getCenterGlobal(); + LLVector3d center_agent; + if (gAgent.getRegion()) + { + 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); @@ -104,7 +108,6 @@ void LLSocialCheckinPanel::onSend() std::string description; LLAgentUI::buildLocationString(description, LLAgentUI::LOCATION_FORMAT_NORMAL_COORDS, gAgent.getPositionAgent()); - // Optionally add the region map view bool add_map_view = getChild("add_place_view_cb")->getValue().asBoolean(); std::string map_url = (add_map_view ? mMapUrl : ""); -- cgit v1.2.3 From 68fa34965daa5bd65aea5cb1f4dc4554e7d9f70f Mon Sep 17 00:00:00 2001 From: Cho Date: Tue, 25 Jun 2013 00:26:10 +0100 Subject: made status update actually post to Facebook, for ACME-569 and ACME-573 --- indra/newview/llfloatersocial.cpp | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 361d54f696..dd4f4f03d9 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -37,6 +37,7 @@ #include "llviewerregion.h" #include "llviewercontrol.h" +static LLRegisterPanelClassWrapper t_panel_status("llsocialstatuspanel"); static LLRegisterPanelClassWrapper t_panel_photo("llsocialphotopanel"); static LLRegisterPanelClassWrapper t_panel_checkin("llsocialcheckinpanel"); @@ -53,6 +54,23 @@ std::string get_map_url() return map_url; } +LLSocialStatusPanel::LLSocialStatusPanel() +{ + mCommitCallbackRegistrar.add("SocialSharing.SendStatus", boost::bind(&LLSocialStatusPanel::onSend, this)); +} + +void LLSocialStatusPanel::onSend() +{ + std::string message = getChild("message")->getValue().asString(); + LLFacebookConnect::instance().updateStatus(message); + + LLFloater* floater = getParentByType(); + if (floater) + { + floater->closeFloater(); + } +} + LLSocialPhotoPanel::LLSocialPhotoPanel() { mCommitCallbackRegistrar.add("PostToFacebook.Send", boost::bind(&LLSocialPhotoPanel::onSend, this)); -- cgit v1.2.3 From e2a7280918665222db3357a4d7566dbdc5d959f2 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 24 Jun 2013 17:01:10 -0700 Subject: ACME-582 : Checkin feature: Implement the loading and displaying of map tiles in the LLIconCtrl --- indra/newview/llfloatersocial.cpp | 51 ++++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 14 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 361d54f696..b14098eb77 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -33,6 +33,7 @@ #include "llagentui.h" #include "llfacebookconnect.h" #include "llfloaterreg.h" +#include "lliconctrl.h" #include "llslurl.h" #include "llviewerregion.h" #include "llviewercontrol.h" @@ -78,22 +79,11 @@ void LLSocialPhotoPanel::onSend() } -LLSocialCheckinPanel::LLSocialCheckinPanel() : - mMapUrl("") +LLSocialCheckinPanel::LLSocialCheckinPanel() { 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 @@ -110,7 +100,7 @@ void LLSocialCheckinPanel::onSend() // Optionally add the region map view bool add_map_view = getChild("add_place_view_cb")->getValue().asBoolean(); - std::string map_url = (add_map_view ? mMapUrl : ""); + std::string map_url = (add_map_view ? get_map_url() : ""); // Get the caption std::string caption = getChild("place_caption")->getValue().asString(); @@ -127,7 +117,9 @@ void LLSocialCheckinPanel::onSend() } -LLFloaterSocial::LLFloaterSocial(const LLSD& key) : LLFloater(key) +LLFloaterSocial::LLFloaterSocial(const LLSD& key) : LLFloater(key), + mMapUrl(""), + mReloadingMapTexture(false) { mCommitCallbackRegistrar.add("SocialSharing.Cancel", boost::bind(&LLFloaterSocial::onCancel, this)); } @@ -139,5 +131,36 @@ void LLFloaterSocial::onCancel() BOOL LLFloaterSocial::postBuild() { + // Keep a pointer to the map tile placeholder texture + mMapPlaceholder = getChild("map_placeholder")->getImage(); return LLFloater::postBuild(); } + +/*virtual*/ +void LLFloaterSocial::draw() +{ + std::string map_url = get_map_url(); + // Did we change location? + if (map_url != mMapUrl) + { + mMapUrl = map_url; + // Load the map tile + mMapTexture = LLViewerTextureManager::getFetchedTextureFromUrl(mMapUrl, FTT_MAP_TILE, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + mMapTexture->setBoostLevel(LLGLTexture::BOOST_MAP); + mReloadingMapTexture = true; + // In the meantime, put back the "loading" placeholder in the map widget + getChild("map_placeholder")->setImage(mMapPlaceholder); + } + // Are we done loading the map tile? + if (mReloadingMapTexture && mMapTexture->isFullyLoaded()) + { + // Don't do it again next time around + mReloadingMapTexture = false; + // Convert the map texture to the appropriate image object + LLPointer ui_image = new LLUIImage(mMapUrl, mMapTexture); + // Point map widget to correct map tile + getChild("map_placeholder")->setImage(ui_image); + } + LLFloater::draw(); +} + -- cgit v1.2.3 From 48cc41a0f8b7b2473e938b1cac8cd294b71d40f7 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Mon, 24 Jun 2013 17:33:10 -0700 Subject: ACME-593: Now the photo tab of the facebook panel displays a screenshot based upon when the facebook floater was opened. --- indra/newview/llfloatersocial.cpp | 138 +++++++++++++++++++++++++++++++++++++- 1 file changed, 136 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index cca966bb9a..9a63a7de78 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -49,11 +49,131 @@ std::string get_map_url() return map_url; } -LLSocialPhotoPanel::LLSocialPhotoPanel() +LLSocialPhotoPanel::LLSocialPhotoPanel() : +mRefreshBtn(NULL), +mRefreshLabel(NULL), +mSucceessLblPanel(NULL), +mFailureLblPanel(NULL), +mThumbnailPlaceholder(NULL) { mCommitCallbackRegistrar.add("PostToFacebook.Send", boost::bind(&LLSocialPhotoPanel::onSend, this)); } + + +LLSocialPhotoPanel::~LLSocialPhotoPanel() +{ + if(mPreviewHandle.get()) + { + mPreviewHandle.get()->die(); + } +} + +BOOL LLSocialPhotoPanel::postBuild() +{ + mRefreshBtn = getChild("new_snapshot_btn"); + childSetAction("new_snapshot_btn", boost::bind(&LLSocialPhotoPanel::onClickNewSnapshot, this)); + mRefreshLabel = getChild("refresh_lbl"); + mSucceessLblPanel = getChild("succeeded_panel"); + mFailureLblPanel = getChild("failed_panel"); + mThumbnailPlaceholder = getChild("thumbnail_placeholder"); + + LLRect full_screen_rect = getRootView()->getRect(); + LLSnapshotLivePreview::Params p; + p.rect(full_screen_rect); + LLSnapshotLivePreview* previewp = new LLSnapshotLivePreview(p); + mPreviewHandle = previewp->getHandle(); + + previewp->setThumbnailPlaceholderRect(getThumbnailPlaceholderRect()); + + return LLPanel::postBuild(); +} + +void LLSocialPhotoPanel::onClickNewSnapshot() +{ + LLSnapshotLivePreview* previewp = static_cast(mPreviewHandle.get()); + //LLFloaterSnapshot *view = (LLFloaterSnapshot *)data; + if (previewp /*&& view*/) + { + //view->impl.setStatus(Impl::STATUS_READY); + lldebugs << "updating snapshot" << llendl; + previewp->updateSnapshot(TRUE); + } +} + +void LLSocialPhotoPanel::draw() +{ + LLSnapshotLivePreview * previewp = static_cast(mPreviewHandle.get()); + + LLPanel::draw(); + + if(previewp && previewp->getThumbnailImage()) + { + bool working = false; //impl.getStatus() == Impl::STATUS_WORKING; + const LLRect& thumbnail_rect = getThumbnailPlaceholderRect(); + const S32 thumbnail_w = previewp->getThumbnailWidth(); + const S32 thumbnail_h = previewp->getThumbnailHeight(); + + // calc preview offset within the preview rect + const S32 local_offset_x = (thumbnail_rect.getWidth() - thumbnail_w) / 2 ; + const S32 local_offset_y = (thumbnail_rect.getHeight() - thumbnail_h) / 2 ; // preview y pos within the preview rect + + // calc preview offset within the floater rect + S32 offset_x = thumbnail_rect.mLeft + local_offset_x; + S32 offset_y = thumbnail_rect.mBottom + local_offset_y; + + LLUICtrl * snapshot_panel = getChild("snapshot_panel"); + snapshot_panel->localPointToOtherView(offset_x, offset_y, &offset_x, &offset_y, gFloaterView->getParentFloater(this)); + + gGL.matrixMode(LLRender::MM_MODELVIEW); + // Apply floater transparency to the texture unless the floater is focused. + F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency(); + LLColor4 color = working ? LLColor4::grey4 : LLColor4::white; + gl_draw_scaled_image(offset_x, offset_y, + thumbnail_w, thumbnail_h, + previewp->getThumbnailImage(), color % alpha); + + previewp->drawPreviewRect(offset_x, offset_y) ; + + // Draw some controls on top of the preview thumbnail. + static const S32 PADDING = 5; + static const S32 REFRESH_LBL_BG_HEIGHT = 32; + + // Reshape and position the posting result message panels at the top of the thumbnail. + // Do this regardless of current posting status (finished or not) to avoid flicker + // when the result message is displayed for the first time. + // if (impl.getStatus() == Impl::STATUS_FINISHED) + { + LLRect result_lbl_rect = mSucceessLblPanel->getRect(); + const S32 result_lbl_h = result_lbl_rect.getHeight(); + result_lbl_rect.setLeftTopAndSize(local_offset_x, local_offset_y + thumbnail_h, thumbnail_w - 1, result_lbl_h); + mSucceessLblPanel->reshape(result_lbl_rect.getWidth(), result_lbl_h); + mSucceessLblPanel->setRect(result_lbl_rect); + mFailureLblPanel->reshape(result_lbl_rect.getWidth(), result_lbl_h); + mFailureLblPanel->setRect(result_lbl_rect); + } + + // Position the refresh button in the bottom left corner of the thumbnail. + mRefreshBtn->setOrigin(local_offset_x + PADDING, local_offset_y + PADDING); + + if (/*impl.mNeedRefresh*/false) + { + // Place the refresh hint text to the right of the refresh button. + const LLRect& refresh_btn_rect = mRefreshBtn->getRect(); + mRefreshLabel->setOrigin(refresh_btn_rect.mLeft + refresh_btn_rect.getWidth() + PADDING, refresh_btn_rect.mBottom); + + // Draw the refresh hint background. + LLRect refresh_label_bg_rect(offset_x, offset_y + REFRESH_LBL_BG_HEIGHT, offset_x + thumbnail_w - 1, offset_y); + gl_rect_2d(refresh_label_bg_rect, LLColor4::white % 0.9f, TRUE); + } + + gGL.pushUIMatrix(); + LLUI::translate((F32) thumbnail_rect.mLeft, (F32) thumbnail_rect.mBottom); + mThumbnailPlaceholder->draw(); + gGL.popUIMatrix(); + } +} + void LLSocialPhotoPanel::onSend() { std::string caption = getChild("caption")->getValue().asString(); @@ -124,7 +244,9 @@ void LLSocialCheckinPanel::onSend() } -LLFloaterSocial::LLFloaterSocial(const LLSD& key) : LLFloater(key) +LLFloaterSocial::LLFloaterSocial(const LLSD& key) : +LLFloater(key), +mSocialPhotoPanel(NULL) { mCommitCallbackRegistrar.add("SocialSharing.Cancel", boost::bind(&LLFloaterSocial::onCancel, this)); } @@ -136,5 +258,17 @@ void LLFloaterSocial::onCancel() BOOL LLFloaterSocial::postBuild() { + mSocialPhotoPanel = static_cast(getChild("social_photo_tab")); + return LLFloater::postBuild(); } + +void LLFloaterSocial::onOpen(const LLSD& key) +{ + LLSnapshotLivePreview* preview = static_cast(mSocialPhotoPanel->mPreviewHandle.get()); + if(preview) + { + lldebugs << "opened, updating snapshot" << llendl; + preview->updateSnapshot(TRUE); + } +} -- cgit v1.2.3 From 4441edecdf27b9324b61d9e415c257e50e4909a6 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Tue, 25 Jun 2013 10:54:59 -0700 Subject: ACME-587 Add the 'refresh' button on top the image --- indra/newview/llfloatersocial.cpp | 181 +++++++++++++++++++++++++++++++++++++- 1 file changed, 179 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index fe5c324d0b..f2110e09c1 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -42,6 +42,8 @@ static LLRegisterPanelClassWrapper t_panel_status("llsocial static LLRegisterPanelClassWrapper t_panel_photo("llsocialphotopanel"); static LLRegisterPanelClassWrapper t_panel_checkin("llsocialcheckinpanel"); +const S32 MAX_POSTCARD_DATASIZE = 1024 * 1024; // one megabyte + std::string get_map_url() { LLVector3d center_agent; @@ -94,6 +96,8 @@ LLSocialPhotoPanel::~LLSocialPhotoPanel() BOOL LLSocialPhotoPanel::postBuild() { + mResolutionComboBox = getChild("resolution_combobox"); + mResolutionComboBox->setCommitCallback(boost::bind(&LLSocialPhotoPanel::onResolutionComboCommit, this)); mRefreshBtn = getChild("new_snapshot_btn"); childSetAction("new_snapshot_btn", boost::bind(&LLSocialPhotoPanel::onClickNewSnapshot, this)); mRefreshLabel = getChild("refresh_lbl"); @@ -112,6 +116,12 @@ BOOL LLSocialPhotoPanel::postBuild() return LLPanel::postBuild(); } +void LLSocialPhotoPanel::onResolutionComboCommit() +{ + LLFloaterSocial* instance = LLFloaterReg::findTypedInstance("social"); + updateResolution(mResolutionComboBox, instance); +} + void LLSocialPhotoPanel::onClickNewSnapshot() { LLSnapshotLivePreview* previewp = static_cast(mPreviewHandle.get()); @@ -124,6 +134,131 @@ void LLSocialPhotoPanel::onClickNewSnapshot() } } +void LLSocialPhotoPanel::updateResolution(LLUICtrl* ctrl, void* data, BOOL do_update) +{ + LLComboBox* combobox = (LLComboBox*)ctrl; + LLFloaterSnapshot *view = (LLFloaterSnapshot *)data; + + if (!view || !combobox) + { + llassert(view && combobox); + return; + } + + std::string sdstring = combobox->getSelectedValue(); + LLSD sdres; + std::stringstream sstream(sdstring); + LLSDSerialize::fromNotation(sdres, sstream, sdstring.size()); + + S32 width = sdres[0]; + S32 height = sdres[1]; + + LLSnapshotLivePreview * previewp = static_cast(mPreviewHandle.get()); + if (previewp && combobox->getCurrentIndex() >= 0) + { + S32 original_width = 0 , original_height = 0 ; + previewp->getSize(original_width, original_height) ; + + if (width == 0 || height == 0) + { + // take resolution from current window size + lldebugs << "Setting preview res from window: " << gViewerWindow->getWindowWidthRaw() << "x" << gViewerWindow->getWindowHeightRaw() << llendl; + previewp->setSize(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw()); + } + else + { + // use the resolution from the selected pre-canned drop-down choice + lldebugs << "Setting preview res selected from combo: " << width << "x" << height << llendl; + previewp->setSize(width, height); + } + + checkAspectRatio(view, width) ; + + previewp->getSize(width, height); + + if(original_width != width || original_height != height) + { + previewp->setSize(width, height); + + // hide old preview as the aspect ratio could be wrong + lldebugs << "updating thumbnail" << llendl; + + previewp->updateSnapshot(FALSE, TRUE); + if(do_update) + { + lldebugs << "Will update controls" << llendl; + updateControls(); + setNeedRefresh(true); + } + } + + } +} + +void LLSocialPhotoPanel::setNeedRefresh(bool need) +{ + mRefreshLabel->setVisible(need); + mNeedRefresh = need; +} + +void LLSocialPhotoPanel::checkAspectRatio(LLFloaterSnapshot *view, S32 index) +{ + LLSnapshotLivePreview *previewp = getPreviewView() ; + + BOOL keep_aspect = FALSE; + + if (0 == index) // current window size + { + keep_aspect = TRUE; + } + else // predefined resolution + { + keep_aspect = FALSE; + } + + if (previewp) + { + previewp->mKeepAspectRatio = keep_aspect; + } +} + +LLSnapshotLivePreview* LLSocialPhotoPanel::getPreviewView() +{ + LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)mPreviewHandle.get(); + return previewp; +} + + +void LLSocialPhotoPanel::updateControls() +{ + + + LLSnapshotLivePreview* previewp = getPreviewView(); + BOOL got_bytes = previewp && previewp->getDataSize() > 0; + BOOL got_snap = previewp && previewp->getSnapshotUpToDate(); + + // *TODO: Separate maximum size for Web images from postcards + lldebugs << "Is snapshot up-to-date? " << got_snap << llendl; + + LLLocale locale(LLLocale::USER_LOCALE); + std::string bytes_string; + if (got_snap) + { + LLResMgr::getInstance()->getIntegerString(bytes_string, (previewp->getDataSize()) >> 10 ); + } + + //getChild("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : getString("unknown")); + getChild("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : "unknown"); + getChild("file_size_label")->setColor( + true + && got_bytes + && previewp->getDataSize() > MAX_POSTCARD_DATASIZE ? LLUIColor(LLColor4::red) : LLUIColorTable::instance().getColor( "LabelTextColor" )); + + LLComboBox* combo = getChild("resolution_combobox"); + LLFloaterSocial* instance = LLFloaterReg::findTypedInstance("social"); + updateResolution(combo, instance, FALSE); +} + void LLSocialPhotoPanel::draw() { LLSnapshotLivePreview * previewp = static_cast(mPreviewHandle.get()); @@ -179,7 +314,7 @@ void LLSocialPhotoPanel::draw() // Position the refresh button in the bottom left corner of the thumbnail. mRefreshBtn->setOrigin(local_offset_x + PADDING, local_offset_y + PADDING); - if (/*impl.mNeedRefresh*/false) + if (mNeedRefresh) { // Place the refresh hint text to the right of the refresh button. const LLRect& refresh_btn_rect = mRefreshBtn->getRect(); @@ -191,7 +326,11 @@ void LLSocialPhotoPanel::draw() } gGL.pushUIMatrix(); - LLUI::translate((F32) thumbnail_rect.mLeft, (F32) thumbnail_rect.mBottom); + S32 x_pos; + S32 y_pos; + snapshot_panel->localPointToOtherView(thumbnail_rect.mLeft, thumbnail_rect.mBottom, &x_pos, &y_pos, gFloaterView->getParentFloater(this)); + + LLUI::translate((F32) x_pos, (F32) y_pos); mThumbnailPlaceholder->draw(); gGL.popUIMatrix(); } @@ -313,3 +452,41 @@ void LLFloaterSocial::onOpen(const LLSD& key) preview->updateSnapshot(TRUE); } } + +// static +void LLFloaterSocial::preUpdate() +{ + // FIXME: duplicated code + LLFloaterSocial* instance = LLFloaterReg::findTypedInstance("social"); + if (instance) + { + // Disable the send/post/save buttons until snapshot is ready. + instance->mSocialPhotoPanel->updateControls(); + + // Force hiding the "Refresh to save" hint because we know we've just started refresh. + instance->mSocialPhotoPanel->setNeedRefresh(false); + } +} + +// static +void LLFloaterSocial::postUpdate() +{ + // FIXME: duplicated code + LLFloaterSocial* instance = LLFloaterReg::findTypedInstance("social"); + if (instance) + { + // Enable the send/post/save buttons. + instance->mSocialPhotoPanel->updateControls(); + + // We've just done refresh. + instance->mSocialPhotoPanel->setNeedRefresh(false); + + // The refresh button is initially hidden. We show it after the first update, + // i.e. when preview appears. + if (!instance->mSocialPhotoPanel->mRefreshBtn->getVisible()) + { + instance->mSocialPhotoPanel->mRefreshBtn->setVisible(true); + } + + } +} -- cgit v1.2.3 From 4a8579462c464bd73d79256435d08ebc4112ccf7 Mon Sep 17 00:00:00 2001 From: Cho Date: Tue, 25 Jun 2013 19:49:13 +0100 Subject: made status update post button disabled for ACME-571 --- indra/newview/llfloatersocial.cpp | 45 ++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 10 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index f2110e09c1..92a291e51c 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -57,21 +57,48 @@ std::string get_map_url() return map_url; } -LLSocialStatusPanel::LLSocialStatusPanel() +LLSocialStatusPanel::LLSocialStatusPanel() : + mMessageTextEditor(NULL), + mPostStatusButton(NULL) { mCommitCallbackRegistrar.add("SocialSharing.SendStatus", boost::bind(&LLSocialStatusPanel::onSend, this)); } +BOOL LLSocialStatusPanel::postBuild() +{ + mMessageTextEditor = getChild("status_message"); + mPostStatusButton = getChild("post_status_btn"); + + return LLPanel::postBuild(); +} + +void LLSocialStatusPanel::draw() +{ + if (mMessageTextEditor && mPostStatusButton) + { + std::string message = mMessageTextEditor->getValue().asString(); + mPostStatusButton->setEnabled(!message.empty()); + } + + LLPanel::draw(); +} + void LLSocialStatusPanel::onSend() { - std::string message = getChild("message")->getValue().asString(); - LLFacebookConnect::instance().updateStatus(message); + if (mMessageTextEditor) + { + std::string message = mMessageTextEditor->getValue().asString(); + if (!message.empty()) + { + LLFacebookConnect::instance().updateStatus(message); - LLFloater* floater = getParentByType(); - if (floater) - { - floater->closeFloater(); - } + LLFloater* floater = getParentByType(); + if (floater) + { + floater->closeFloater(); + } + } + } } LLSocialPhotoPanel::LLSocialPhotoPanel() : @@ -84,8 +111,6 @@ mThumbnailPlaceholder(NULL) mCommitCallbackRegistrar.add("PostToFacebook.Send", boost::bind(&LLSocialPhotoPanel::onSend, this)); } - - LLSocialPhotoPanel::~LLSocialPhotoPanel() { if(mPreviewHandle.get()) -- cgit v1.2.3 From d63dd9d442a2c30b26163cdaf475ed31070aa92b Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Tue, 25 Jun 2013 13:44:21 -0700 Subject: ACME-588 Make 'Post' button post to facebook --- indra/newview/llfloatersocial.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index f2110e09c1..52a4e090f3 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -350,9 +350,11 @@ void LLSocialPhotoPanel::onSend() else caption = caption + " " + slurl.getSLURLString(); } - //LLFacebookConnect::instance().sharePhoto(LLFloaterSnapshot::getImageData(), caption); - //LLWebProfile::uploadImage(LLFloaterSnapshot::getImageData(), caption, add_location, boost::bind(&LLPanelSnapshotFacebook::onImageUploaded, this, caption, _1)); - //LLFloaterSnapshot::postSave(); + + LLSnapshotLivePreview* previewp = getPreviewView(); + + LLFacebookConnect::instance().sharePhoto(previewp->getFormattedImage(), caption); + updateControls(); } -- cgit v1.2.3 From e92e5a3d5337204c10a8417bb0ad480d591b4b90 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Tue, 25 Jun 2013 13:53:38 -0700 Subject: ACME-592 Clicking 'Post' should close the Facebook floater --- indra/newview/llfloatersocial.cpp | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 23e3d35c22..9b27024eed 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -380,6 +380,13 @@ void LLSocialPhotoPanel::onSend() LLFacebookConnect::instance().sharePhoto(previewp->getFormattedImage(), caption); updateControls(); + + // Close the floater once "Post" has been pushed + LLFloater* floater = getParentByType(); + if (floater) + { + floater->closeFloater(); + } } -- cgit v1.2.3 From b497b121ed2d8964160ee79003debb9f5ab62a49 Mon Sep 17 00:00:00 2001 From: Cho Date: Tue, 25 Jun 2013 23:19:53 +0100 Subject: used default SL logo for image-less checkins for ACME-613 --- indra/newview/llfloatersocial.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 9b27024eed..b3c0481968 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -43,6 +43,7 @@ static LLRegisterPanelClassWrapper t_panel_photo("llsocialph static LLRegisterPanelClassWrapper t_panel_checkin("llsocialcheckinpanel"); const S32 MAX_POSTCARD_DATASIZE = 1024 * 1024; // one megabyte +const std::string DEFAULT_CHECKIN_ICON_URL = "http://logok.org/wp-content/uploads/2010/07/podcastlogo1.jpg"; std::string get_map_url() { @@ -411,7 +412,7 @@ void LLSocialCheckinPanel::onSend() // Optionally add the region map view bool add_map_view = getChild("add_place_view_cb")->getValue().asBoolean(); - std::string map_url = (add_map_view ? get_map_url() : ""); + std::string map_url = (add_map_view ? get_map_url() : DEFAULT_CHECKIN_ICON_URL); // Get the caption std::string caption = getChild("place_caption")->getValue().asString(); -- cgit v1.2.3 From ec09ce526b477869aa76dddaa8e11eecca57989d Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 25 Jun 2013 15:49:39 -0700 Subject: ACME-612 : Implemented a loading indicator for the map tile when it's loading, also disable the checkbox during that time --- indra/newview/llfloatersocial.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 92a291e51c..e164ea8155 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -34,6 +34,7 @@ #include "llfacebookconnect.h" #include "llfloaterreg.h" #include "lliconctrl.h" +#include "llloadingindicator.h" #include "llslurl.h" #include "llviewerregion.h" #include "llviewercontrol.h" @@ -453,8 +454,12 @@ void LLFloaterSocial::draw() mMapTexture->setBoostLevel(LLGLTexture::BOOST_MAP); mReloadingMapTexture = true; // In the meantime, put back the "loading" placeholder in the map widget - getChild("map_placeholder")->setImage(mMapPlaceholder); - } + getChild("map_loading_indicator")->setVisible(true); + getChild("map_placeholder")->setVisible(false); + mMapCheckBoxValue = getChild("add_place_view_cb")->get(); + getChild("add_place_view_cb")->set(false); + getChild("add_place_view_cb")->setEnabled(false); + } // Are we done loading the map tile? if (mReloadingMapTexture && mMapTexture->isFullyLoaded()) { @@ -464,6 +469,11 @@ void LLFloaterSocial::draw() LLPointer ui_image = new LLUIImage(mMapUrl, mMapTexture); // Point map widget to correct map tile getChild("map_placeholder")->setImage(ui_image); + // Switch visibility + getChild("map_loading_indicator")->setVisible(false); + getChild("map_placeholder")->setVisible(true); + getChild("add_place_view_cb")->setEnabled(true); + getChild("add_place_view_cb")->set(mMapCheckBoxValue); } LLFloater::draw(); } -- cgit v1.2.3 From f081cca8dd79b4970082ecada831633ca6f9a501 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Tue, 25 Jun 2013 16:11:39 -0700 Subject: ACME-586: Fixing the file size appearing as red. Was using the postcard snap-shot type which is used for e-mailing pictures (red indicates going over 1mb). --- indra/newview/llfloatersocial.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 9b27024eed..7ca96dd228 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -136,6 +136,7 @@ BOOL LLSocialPhotoPanel::postBuild() LLSnapshotLivePreview* previewp = new LLSnapshotLivePreview(p); mPreviewHandle = previewp->getHandle(); + previewp->setSnapshotType(previewp->SNAPSHOT_WEB); previewp->setThumbnailPlaceholderRect(getThumbnailPlaceholderRect()); return LLPanel::postBuild(); @@ -261,6 +262,7 @@ void LLSocialPhotoPanel::updateControls() LLSnapshotLivePreview* previewp = getPreviewView(); BOOL got_bytes = previewp && previewp->getDataSize() > 0; BOOL got_snap = previewp && previewp->getSnapshotUpToDate(); + LLSnapshotLivePreview::ESnapshotType shot_type = previewp->getSnapshotType(); // *TODO: Separate maximum size for Web images from postcards lldebugs << "Is snapshot up-to-date? " << got_snap << llendl; @@ -275,7 +277,7 @@ void LLSocialPhotoPanel::updateControls() //getChild("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : getString("unknown")); getChild("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : "unknown"); getChild("file_size_label")->setColor( - true + shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD && got_bytes && previewp->getDataSize() > MAX_POSTCARD_DATASIZE ? LLUIColor(LLColor4::red) : LLUIColorTable::instance().getColor( "LabelTextColor" )); -- cgit v1.2.3 From e6e8bf172cb399fa94ddd6f45efcf58947eaf0e8 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 25 Jun 2013 16:49:15 -0700 Subject: ACME-497 : Refactor the LLSocialCheckinPanel code a bit to make it more maintainable --- indra/newview/llfloatersocial.cpp | 87 +++++++++++++++++++++++---------------- 1 file changed, 51 insertions(+), 36 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 2859b19b19..c9f7283640 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -392,11 +392,61 @@ void LLSocialPhotoPanel::onSend() } -LLSocialCheckinPanel::LLSocialCheckinPanel() +LLSocialCheckinPanel::LLSocialCheckinPanel() : + mMapUrl(""), + mReloadingMapTexture(false) { mCommitCallbackRegistrar.add("SocialSharing.SendCheckin", boost::bind(&LLSocialCheckinPanel::onSend, this)); } +BOOL LLSocialCheckinPanel::postBuild() +{ + // Keep pointers to widgets so we don't traverse the UI hierarchy too often + mMapLoadingIndicator = getChild("map_loading_indicator"); + mMapPlaceholder = getChild("map_placeholder"); + mMapCheckBox = getChild("add_place_view_cb"); + mMapCheckBoxValue = mMapCheckBox->get(); + + return LLPanel::postBuild(); +} + +void LLSocialCheckinPanel::draw() +{ + std::string map_url = get_map_url(); + // Did we change location? + if (map_url != mMapUrl) + { + mMapUrl = map_url; + // Load the map tile + mMapTexture = LLViewerTextureManager::getFetchedTextureFromUrl(mMapUrl, FTT_MAP_TILE, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); + mMapTexture->setBoostLevel(LLGLTexture::BOOST_MAP); + mReloadingMapTexture = true; + // In the meantime, put the "loading" indicator on, hide the tile map and disable the checkbox + mMapLoadingIndicator->setVisible(true); + mMapPlaceholder->setVisible(false); + mMapCheckBoxValue = mMapCheckBox->get(); + mMapCheckBox->set(false); + mMapCheckBox->setEnabled(false); + } + // Are we done loading the map tile? + if (mReloadingMapTexture && mMapTexture->isFullyLoaded()) + { + // Don't do it again next time around + mReloadingMapTexture = false; + // Convert the map texture to the appropriate image object + LLPointer ui_image = new LLUIImage(mMapUrl, mMapTexture); + // Load the map widget with the correct map tile image + mMapPlaceholder->setImage(ui_image); + // Now hide the loading indicator, bring the tile in view and reenable the checkbox with its previous value + mMapLoadingIndicator->setVisible(false); + mMapPlaceholder->setVisible(true); + mMapCheckBox->setEnabled(true); + mMapCheckBox->set(mMapCheckBoxValue); + } + + LLPanel::draw(); +} + void LLSocialCheckinPanel::onSend() { // Get the location SLURL @@ -431,8 +481,6 @@ void LLSocialCheckinPanel::onSend() LLFloaterSocial::LLFloaterSocial(const LLSD& key) : LLFloater(key), - mMapUrl(""), - mReloadingMapTexture(false), mSocialPhotoPanel(NULL) { mCommitCallbackRegistrar.add("SocialSharing.Cancel", boost::bind(&LLFloaterSocial::onCancel, this)); @@ -446,45 +494,12 @@ void LLFloaterSocial::onCancel() BOOL LLFloaterSocial::postBuild() { mSocialPhotoPanel = static_cast(getChild("social_photo_tab")); - // Keep a pointer to the map tile placeholder texture - mMapPlaceholder = getChild("map_placeholder")->getImage(); return LLFloater::postBuild(); } /*virtual*/ void LLFloaterSocial::draw() { - std::string map_url = get_map_url(); - // Did we change location? - if (map_url != mMapUrl) - { - mMapUrl = map_url; - // Load the map tile - mMapTexture = LLViewerTextureManager::getFetchedTextureFromUrl(mMapUrl, FTT_MAP_TILE, TRUE, LLGLTexture::BOOST_NONE, LLViewerTexture::LOD_TEXTURE); - mMapTexture->setBoostLevel(LLGLTexture::BOOST_MAP); - mReloadingMapTexture = true; - // In the meantime, put back the "loading" placeholder in the map widget - getChild("map_loading_indicator")->setVisible(true); - getChild("map_placeholder")->setVisible(false); - mMapCheckBoxValue = getChild("add_place_view_cb")->get(); - getChild("add_place_view_cb")->set(false); - getChild("add_place_view_cb")->setEnabled(false); - } - // Are we done loading the map tile? - if (mReloadingMapTexture && mMapTexture->isFullyLoaded()) - { - // Don't do it again next time around - mReloadingMapTexture = false; - // Convert the map texture to the appropriate image object - LLPointer ui_image = new LLUIImage(mMapUrl, mMapTexture); - // Point map widget to correct map tile - getChild("map_placeholder")->setImage(ui_image); - // Switch visibility - getChild("map_loading_indicator")->setVisible(false); - getChild("map_placeholder")->setVisible(true); - getChild("add_place_view_cb")->setEnabled(true); - getChild("add_place_view_cb")->set(mMapCheckBoxValue); - } LLFloater::draw(); } -- cgit v1.2.3 From bb59fff5a0e60b16e0726fb2da6cc6ee9cc3569c Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Wed, 26 Jun 2013 17:54:33 -0700 Subject: ACME-628 Removing unneeeded headers files from llsnapshotpreview, llsnapshot and llfloatersocial --- indra/newview/llfloatersocial.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 43819e65f4..f16c5601c8 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -31,9 +31,12 @@ #include "llagent.h" #include "llagentui.h" +#include "llcombobox.h" #include "llfacebookconnect.h" #include "llfloaterreg.h" #include "lliconctrl.h" +#include "llresmgr.h" // LLLocale +#include "llsdserialize.h" #include "llslurl.h" #include "llviewerregion.h" #include "llviewercontrol.h" -- cgit v1.2.3 From 7fc98de12c0a69bae6d847697da6d8a0e03f80be Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 26 Jun 2013 21:14:11 -0700 Subject: ACME-621 : Add autoconnect to FBC in the social floater, disable Post buttons when not connected. --- indra/newview/llfloatersocial.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 9e7b131abf..b717dc0f40 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -79,7 +79,7 @@ void LLSocialStatusPanel::draw() if (mMessageTextEditor && mPostStatusButton) { std::string message = mMessageTextEditor->getValue().asString(); - mPostStatusButton->setEnabled(!message.empty()); + mPostStatusButton->setEnabled(!message.empty() && LLFacebookConnect::instance().isConnected()); } LLPanel::draw(); @@ -123,6 +123,7 @@ LLSocialPhotoPanel::~LLSocialPhotoPanel() BOOL LLSocialPhotoPanel::postBuild() { + mPostButton = getChild("post_btn"); mResolutionComboBox = getChild("resolution_combobox"); mResolutionComboBox->setCommitCallback(boost::bind(&LLSocialPhotoPanel::onResolutionComboCommit, this)); mRefreshBtn = getChild("new_snapshot_btn"); @@ -256,11 +257,8 @@ LLSnapshotLivePreview* LLSocialPhotoPanel::getPreviewView() return previewp; } - void LLSocialPhotoPanel::updateControls() { - - LLSnapshotLivePreview* previewp = getPreviewView(); BOOL got_bytes = previewp && previewp->getDataSize() > 0; BOOL got_snap = previewp && previewp->getSnapshotUpToDate(); @@ -363,6 +361,8 @@ void LLSocialPhotoPanel::draw() mThumbnailPlaceholder->draw(); gGL.popUIMatrix(); } + + mPostButton->setEnabled(LLFacebookConnect::instance().isConnected()); } void LLSocialPhotoPanel::onSend() @@ -404,6 +404,7 @@ LLSocialCheckinPanel::LLSocialCheckinPanel() : BOOL LLSocialCheckinPanel::postBuild() { // Keep pointers to widgets so we don't traverse the UI hierarchy too often + mPostButton = getChild("post_place_btn"); mMapLoadingIndicator = getChild("map_loading_indicator"); mMapPlaceholder = getChild("map_placeholder"); mMapCheckBox = getChild("add_place_view_cb"); @@ -445,6 +446,7 @@ void LLSocialCheckinPanel::draw() mMapCheckBox->setEnabled(true); mMapCheckBox->set(mMapCheckBoxValue); } + mPostButton->setEnabled(LLFacebookConnect::instance().isConnected()); LLPanel::draw(); } @@ -495,6 +497,9 @@ void LLFloaterSocial::onCancel() BOOL LLFloaterSocial::postBuild() { + // Initiate a connection to Facebook (getConnectionToFacebook() handles the already connected state) + LLFacebookConnect::instance().getConnectionToFacebook(); + // Keep tab of the Photo Panel mSocialPhotoPanel = static_cast(getChild("social_photo_tab")); return LLFloater::postBuild(); } -- cgit v1.2.3 From 29477353f9ac936a5269302b76179ae0b1feec3a Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Thu, 27 Jun 2013 11:26:18 -0700 Subject: ACME-628 Removing unneeeded headers files and used forward declarations for llfloatersnapshot.h, llfloatersocial.h and llsnapshotlivepreview.h. --- indra/newview/llfloatersocial.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 80cdd3a0cb..ea69a60887 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -31,12 +31,16 @@ #include "llagent.h" #include "llagentui.h" +#include "llcheckboxctrl.h" #include "llcombobox.h" #include "llfacebookconnect.h" #include "llfloaterreg.h" #include "lliconctrl.h" +#include "llresmgr.h" // LLLocale +#include "llsdserialize.h" #include "llloadingindicator.h" #include "llslurl.h" +#include "llsnapshotlivepreview.h" #include "llviewerregion.h" #include "llviewercontrol.h" @@ -201,7 +205,7 @@ void LLSocialPhotoPanel::updateResolution(LLUICtrl* ctrl, void* data, BOOL do_up previewp->setSize(width, height); } - checkAspectRatio(view, width) ; + checkAspectRatio(width); previewp->getSize(width, height); @@ -230,7 +234,7 @@ void LLSocialPhotoPanel::setNeedRefresh(bool need) mNeedRefresh = need; } -void LLSocialPhotoPanel::checkAspectRatio(LLFloaterSnapshot *view, S32 index) +void LLSocialPhotoPanel::checkAspectRatio(S32 index) { LLSnapshotLivePreview *previewp = getPreviewView() ; -- cgit v1.2.3 From 26832818780ffe5052443db3c6bbfca15575a5b5 Mon Sep 17 00:00:00 2001 From: Cho Date: Thu, 27 Jun 2013 19:34:39 +0100 Subject: changed FBC photo sharing to use JPEG instead of PNG for ACME-636 --- indra/newview/llfloatersocial.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 7ef8f9f9e3..e305bfd10a 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -137,7 +137,7 @@ BOOL LLSocialPhotoPanel::postBuild() mSucceessLblPanel = getChild("succeeded_panel"); mFailureLblPanel = getChild("failed_panel"); mThumbnailPlaceholder = getChild("thumbnail_placeholder"); - + LLRect full_screen_rect = getRootView()->getRect(); LLSnapshotLivePreview::Params p; p.rect(full_screen_rect); @@ -145,8 +145,10 @@ BOOL LLSocialPhotoPanel::postBuild() mPreviewHandle = previewp->getHandle(); previewp->setSnapshotType(previewp->SNAPSHOT_WEB); + previewp->setSnapshotFormat(LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG); + //previewp->setSnapshotQuality(98); previewp->setThumbnailPlaceholderRect(getThumbnailPlaceholderRect()); - + return LLPanel::postBuild(); } -- cgit v1.2.3 From 1d54e25990b5e28a6fd7f352bfa26473aec53d6d Mon Sep 17 00:00:00 2001 From: Cho Date: Thu, 27 Jun 2013 22:50:41 +0100 Subject: Fixed delay in loading tabs on Facebook floater for ACME-649 --- indra/newview/llfloatersocial.cpp | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index e305bfd10a..9198d9a07b 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -128,6 +128,8 @@ LLSocialPhotoPanel::~LLSocialPhotoPanel() BOOL LLSocialPhotoPanel::postBuild() { + setVisibleCallback(boost::bind(&LLSocialPhotoPanel::onVisibilityChange, this, _2)); + mPostButton = getChild("post_btn"); mResolutionComboBox = getChild("resolution_combobox"); mResolutionComboBox->setCommitCallback(boost::bind(&LLSocialPhotoPanel::onResolutionComboCommit, this)); @@ -138,17 +140,6 @@ BOOL LLSocialPhotoPanel::postBuild() mFailureLblPanel = getChild("failed_panel"); mThumbnailPlaceholder = getChild("thumbnail_placeholder"); - LLRect full_screen_rect = getRootView()->getRect(); - LLSnapshotLivePreview::Params p; - p.rect(full_screen_rect); - LLSnapshotLivePreview* previewp = new LLSnapshotLivePreview(p); - mPreviewHandle = previewp->getHandle(); - - previewp->setSnapshotType(previewp->SNAPSHOT_WEB); - previewp->setSnapshotFormat(LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG); - //previewp->setSnapshotQuality(98); - previewp->setThumbnailPlaceholderRect(getThumbnailPlaceholderRect()); - return LLPanel::postBuild(); } @@ -293,6 +284,26 @@ void LLSocialPhotoPanel::updateControls() updateResolution(combo, instance, FALSE); } +void LLSocialPhotoPanel::onVisibilityChange(const LLSD& new_visibility) +{ + bool visible = new_visibility.asBoolean(); + if (visible && !mPreviewHandle.get()) + { + LLRect full_screen_rect = getRootView()->getRect(); + LLSnapshotLivePreview::Params p; + p.rect(full_screen_rect); + LLSnapshotLivePreview* previewp = new LLSnapshotLivePreview(p); + mPreviewHandle = previewp->getHandle(); + + previewp->setSnapshotType(previewp->SNAPSHOT_WEB); + previewp->setSnapshotFormat(LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG); + //previewp->setSnapshotQuality(98); + previewp->setThumbnailPlaceholderRect(getThumbnailPlaceholderRect()); + + updateControls(); + } +} + void LLSocialPhotoPanel::draw() { LLSnapshotLivePreview * previewp = static_cast(mPreviewHandle.get()); -- cgit v1.2.3 From 0b34d1c34cccd1ed95f17293ef941289b40e39f9 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Thu, 27 Jun 2013 16:47:00 -0700 Subject: ACME-630 Adjust floater_social.xml to load panels from files instead of in-lining --- indra/newview/llfloatersocial.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index e305bfd10a..594773c556 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -507,7 +507,7 @@ BOOL LLFloaterSocial::postBuild() // Initiate a connection to Facebook (getConnectionToFacebook() handles the already connected state) LLFacebookConnect::instance().getConnectionToFacebook(); // Keep tab of the Photo Panel - mSocialPhotoPanel = static_cast(getChild("social_photo_tab")); + mSocialPhotoPanel = static_cast(getChild("panel_social_photo")); return LLFloater::postBuild(); } -- cgit v1.2.3 From 0e50cbc2edacdecf32071c97c2ce5349db5ef5e9 Mon Sep 17 00:00:00 2001 From: Cho Date: Fri, 28 Jun 2013 01:21:14 +0100 Subject: made it optional to autoconnect in LLFacebookConnect::getConnectionToFacebook() for ACME-648 --- indra/newview/llfloatersocial.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 8d026471dc..35761d5cc8 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -516,7 +516,7 @@ void LLFloaterSocial::onCancel() BOOL LLFloaterSocial::postBuild() { // Initiate a connection to Facebook (getConnectionToFacebook() handles the already connected state) - LLFacebookConnect::instance().getConnectionToFacebook(); + LLFacebookConnect::instance().getConnectionToFacebook(true); // Keep tab of the Photo Panel mSocialPhotoPanel = static_cast(getChild("panel_social_photo")); return LLFloater::postBuild(); -- cgit v1.2.3 From 06f0e4161b3c735678f9ace02d659cc838afc1d8 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Thu, 27 Jun 2013 18:30:27 -0700 Subject: ACME-629 Clean up names of variables and functions used in the Facebook photo panel --- indra/newview/llfloatersocial.cpp | 385 +++++++++++++++++++------------------- 1 file changed, 194 insertions(+), 191 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 35761d5cc8..dfc9024d54 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -64,6 +64,10 @@ std::string get_map_url() return map_url; } +/////////////////////////// +//LLSocialStatusPanel////// +/////////////////////////// + LLSocialStatusPanel::LLSocialStatusPanel() : mMessageTextEditor(NULL), mPostStatusButton(NULL) @@ -108,12 +112,21 @@ void LLSocialStatusPanel::onSend() } } +/////////////////////////// +//LLSocialPhotoPanel/////// +/////////////////////////// + LLSocialPhotoPanel::LLSocialPhotoPanel() : +mSnapshotPanel(NULL), +mResolutionComboBox(NULL), mRefreshBtn(NULL), mRefreshLabel(NULL), mSucceessLblPanel(NULL), mFailureLblPanel(NULL), -mThumbnailPlaceholder(NULL) +mThumbnailPlaceholder(NULL), +mCaptionTextBox(NULL), +mLocationCheckbox(NULL), +mPostButton(NULL) { mCommitCallbackRegistrar.add("PostToFacebook.Send", boost::bind(&LLSocialPhotoPanel::onSend, this)); } @@ -129,179 +142,21 @@ LLSocialPhotoPanel::~LLSocialPhotoPanel() BOOL LLSocialPhotoPanel::postBuild() { setVisibleCallback(boost::bind(&LLSocialPhotoPanel::onVisibilityChange, this, _2)); - - mPostButton = getChild("post_btn"); + + mSnapshotPanel = getChild("snapshot_panel"); mResolutionComboBox = getChild("resolution_combobox"); - mResolutionComboBox->setCommitCallback(boost::bind(&LLSocialPhotoPanel::onResolutionComboCommit, this)); + mResolutionComboBox->setCommitCallback(boost::bind(&LLSocialPhotoPanel::updateResolution, this, TRUE)); mRefreshBtn = getChild("new_snapshot_btn"); childSetAction("new_snapshot_btn", boost::bind(&LLSocialPhotoPanel::onClickNewSnapshot, this)); mRefreshLabel = getChild("refresh_lbl"); mSucceessLblPanel = getChild("succeeded_panel"); mFailureLblPanel = getChild("failed_panel"); mThumbnailPlaceholder = getChild("thumbnail_placeholder"); - - return LLPanel::postBuild(); -} - -void LLSocialPhotoPanel::onResolutionComboCommit() -{ - LLFloaterSocial* instance = LLFloaterReg::findTypedInstance("social"); - updateResolution(mResolutionComboBox, instance); -} - -void LLSocialPhotoPanel::onClickNewSnapshot() -{ - LLSnapshotLivePreview* previewp = static_cast(mPreviewHandle.get()); - //LLFloaterSnapshot *view = (LLFloaterSnapshot *)data; - if (previewp /*&& view*/) - { - //view->impl.setStatus(Impl::STATUS_READY); - lldebugs << "updating snapshot" << llendl; - previewp->updateSnapshot(TRUE); - } -} - -void LLSocialPhotoPanel::updateResolution(LLUICtrl* ctrl, void* data, BOOL do_update) -{ - LLComboBox* combobox = (LLComboBox*)ctrl; - LLFloaterSnapshot *view = (LLFloaterSnapshot *)data; - - if (!view || !combobox) - { - llassert(view && combobox); - return; - } - - std::string sdstring = combobox->getSelectedValue(); - LLSD sdres; - std::stringstream sstream(sdstring); - LLSDSerialize::fromNotation(sdres, sstream, sdstring.size()); - - S32 width = sdres[0]; - S32 height = sdres[1]; - - LLSnapshotLivePreview * previewp = static_cast(mPreviewHandle.get()); - if (previewp && combobox->getCurrentIndex() >= 0) - { - S32 original_width = 0 , original_height = 0 ; - previewp->getSize(original_width, original_height) ; - - if (width == 0 || height == 0) - { - // take resolution from current window size - lldebugs << "Setting preview res from window: " << gViewerWindow->getWindowWidthRaw() << "x" << gViewerWindow->getWindowHeightRaw() << llendl; - previewp->setSize(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw()); - } - else - { - // use the resolution from the selected pre-canned drop-down choice - lldebugs << "Setting preview res selected from combo: " << width << "x" << height << llendl; - previewp->setSize(width, height); - } - - checkAspectRatio(width); - - previewp->getSize(width, height); - - if(original_width != width || original_height != height) - { - previewp->setSize(width, height); - - // hide old preview as the aspect ratio could be wrong - lldebugs << "updating thumbnail" << llendl; - - previewp->updateSnapshot(FALSE, TRUE); - if(do_update) - { - lldebugs << "Will update controls" << llendl; - updateControls(); - setNeedRefresh(true); - } - } - - } -} - -void LLSocialPhotoPanel::setNeedRefresh(bool need) -{ - mRefreshLabel->setVisible(need); - mNeedRefresh = need; -} - -void LLSocialPhotoPanel::checkAspectRatio(S32 index) -{ - LLSnapshotLivePreview *previewp = getPreviewView() ; - - BOOL keep_aspect = FALSE; - - if (0 == index) // current window size - { - keep_aspect = TRUE; - } - else // predefined resolution - { - keep_aspect = FALSE; - } - - if (previewp) - { - previewp->mKeepAspectRatio = keep_aspect; - } -} - -LLSnapshotLivePreview* LLSocialPhotoPanel::getPreviewView() -{ - LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)mPreviewHandle.get(); - return previewp; -} - -void LLSocialPhotoPanel::updateControls() -{ - LLSnapshotLivePreview* previewp = getPreviewView(); - BOOL got_bytes = previewp && previewp->getDataSize() > 0; - BOOL got_snap = previewp && previewp->getSnapshotUpToDate(); - LLSnapshotLivePreview::ESnapshotType shot_type = previewp->getSnapshotType(); - - // *TODO: Separate maximum size for Web images from postcards - lldebugs << "Is snapshot up-to-date? " << got_snap << llendl; - - LLLocale locale(LLLocale::USER_LOCALE); - std::string bytes_string; - if (got_snap) - { - LLResMgr::getInstance()->getIntegerString(bytes_string, (previewp->getDataSize()) >> 10 ); - } - - //getChild("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : getString("unknown")); - getChild("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : "unknown"); - getChild("file_size_label")->setColor( - shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD - && got_bytes - && previewp->getDataSize() > MAX_POSTCARD_DATASIZE ? LLUIColor(LLColor4::red) : LLUIColorTable::instance().getColor( "LabelTextColor" )); - - LLComboBox* combo = getChild("resolution_combobox"); - LLFloaterSocial* instance = LLFloaterReg::findTypedInstance("social"); - updateResolution(combo, instance, FALSE); -} - -void LLSocialPhotoPanel::onVisibilityChange(const LLSD& new_visibility) -{ - bool visible = new_visibility.asBoolean(); - if (visible && !mPreviewHandle.get()) - { - LLRect full_screen_rect = getRootView()->getRect(); - LLSnapshotLivePreview::Params p; - p.rect(full_screen_rect); - LLSnapshotLivePreview* previewp = new LLSnapshotLivePreview(p); - mPreviewHandle = previewp->getHandle(); - - previewp->setSnapshotType(previewp->SNAPSHOT_WEB); - previewp->setSnapshotFormat(LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG); - //previewp->setSnapshotQuality(98); - previewp->setThumbnailPlaceholderRect(getThumbnailPlaceholderRect()); + mCaptionTextBox = getChild("caption"); + mLocationCheckbox = getChild("add_location_cb"); + mPostButton = getChild("post_btn"); - updateControls(); - } + return LLPanel::postBuild(); } void LLSocialPhotoPanel::draw() @@ -313,7 +168,7 @@ void LLSocialPhotoPanel::draw() if(previewp && previewp->getThumbnailImage()) { bool working = false; //impl.getStatus() == Impl::STATUS_WORKING; - const LLRect& thumbnail_rect = getThumbnailPlaceholderRect(); + const LLRect& thumbnail_rect = mThumbnailPlaceholder->getRect(); const S32 thumbnail_w = previewp->getThumbnailWidth(); const S32 thumbnail_h = previewp->getThumbnailHeight(); @@ -325,8 +180,7 @@ void LLSocialPhotoPanel::draw() S32 offset_x = thumbnail_rect.mLeft + local_offset_x; S32 offset_y = thumbnail_rect.mBottom + local_offset_y; - LLUICtrl * snapshot_panel = getChild("snapshot_panel"); - snapshot_panel->localPointToOtherView(offset_x, offset_y, &offset_x, &offset_y, gFloaterView->getParentFloater(this)); + mSnapshotPanel->localPointToOtherView(offset_x, offset_y, &offset_x, &offset_y, getParentByType()); gGL.matrixMode(LLRender::MM_MODELVIEW); // Apply floater transparency to the texture unless the floater is focused. @@ -373,20 +227,57 @@ void LLSocialPhotoPanel::draw() gGL.pushUIMatrix(); S32 x_pos; S32 y_pos; - snapshot_panel->localPointToOtherView(thumbnail_rect.mLeft, thumbnail_rect.mBottom, &x_pos, &y_pos, gFloaterView->getParentFloater(this)); - + mSnapshotPanel->localPointToOtherView(thumbnail_rect.mLeft, thumbnail_rect.mBottom, &x_pos, &y_pos, getParentByType()); + LLUI::translate((F32) x_pos, (F32) y_pos); mThumbnailPlaceholder->draw(); gGL.popUIMatrix(); } - mPostButton->setEnabled(LLFacebookConnect::instance().isConnected()); + mPostButton->setEnabled(LLFacebookConnect::instance().isConnected()); +} + +LLSnapshotLivePreview* LLSocialPhotoPanel::getPreviewView() +{ + LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)mPreviewHandle.get(); + return previewp; +} + +void LLSocialPhotoPanel::onVisibilityChange(const LLSD& new_visibility) +{ + bool visible = new_visibility.asBoolean(); + if (visible && !mPreviewHandle.get()) + { + LLRect full_screen_rect = getRootView()->getRect(); + LLSnapshotLivePreview::Params p; + p.rect(full_screen_rect); + LLSnapshotLivePreview* previewp = new LLSnapshotLivePreview(p); + mPreviewHandle = previewp->getHandle(); + + previewp->setSnapshotType(previewp->SNAPSHOT_WEB); + previewp->setSnapshotFormat(LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG); + //previewp->setSnapshotQuality(98); + previewp->setThumbnailPlaceholderRect(mThumbnailPlaceholder->getRect()); + + updateControls(); + } +} + +void LLSocialPhotoPanel::onClickNewSnapshot() +{ + LLSnapshotLivePreview* previewp = getPreviewView(); + if (previewp) + { + //setStatus(Impl::STATUS_READY); + lldebugs << "updating snapshot" << llendl; + previewp->updateSnapshot(TRUE); + } } void LLSocialPhotoPanel::onSend() { - std::string caption = getChild("caption")->getValue().asString(); - bool add_location = getChild("add_location_cb")->getValue().asBoolean(); + std::string caption = mCaptionTextBox->getValue().asString(); + bool add_location = mLocationCheckbox->getValue().asBoolean(); if (add_location) { @@ -399,7 +290,6 @@ void LLSocialPhotoPanel::onSend() } LLSnapshotLivePreview* previewp = getPreviewView(); - LLFacebookConnect::instance().sharePhoto(previewp->getFormattedImage(), caption); updateControls(); @@ -411,6 +301,122 @@ void LLSocialPhotoPanel::onSend() } } +void LLSocialPhotoPanel::updateControls() +{ + LLSnapshotLivePreview* previewp = getPreviewView(); + BOOL got_bytes = previewp && previewp->getDataSize() > 0; + BOOL got_snap = previewp && previewp->getSnapshotUpToDate(); + LLSnapshotLivePreview::ESnapshotType shot_type = previewp->getSnapshotType(); + + // *TODO: Separate maximum size for Web images from postcards + lldebugs << "Is snapshot up-to-date? " << got_snap << llendl; + + LLLocale locale(LLLocale::USER_LOCALE); + std::string bytes_string; + if (got_snap) + { + LLResMgr::getInstance()->getIntegerString(bytes_string, (previewp->getDataSize()) >> 10 ); + } + + //getChild("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : getString("unknown")); <---uses localized string + getChild("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : "unknown"); + getChild("file_size_label")->setColor( + shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD + && got_bytes + && previewp->getDataSize() > MAX_POSTCARD_DATASIZE ? LLUIColor(LLColor4::red) : LLUIColorTable::instance().getColor( "LabelTextColor" )); + + updateResolution(FALSE); +} + +void LLSocialPhotoPanel::updateResolution(BOOL do_update) +{ + LLComboBox* combobox = static_cast(mResolutionComboBox); + + std::string sdstring = combobox->getSelectedValue(); + LLSD sdres; + std::stringstream sstream(sdstring); + LLSDSerialize::fromNotation(sdres, sstream, sdstring.size()); + + S32 width = sdres[0]; + S32 height = sdres[1]; + + LLSnapshotLivePreview * previewp = static_cast(mPreviewHandle.get()); + if (previewp && combobox->getCurrentIndex() >= 0) + { + S32 original_width = 0 , original_height = 0 ; + previewp->getSize(original_width, original_height) ; + + if (width == 0 || height == 0) + { + // take resolution from current window size + lldebugs << "Setting preview res from window: " << gViewerWindow->getWindowWidthRaw() << "x" << gViewerWindow->getWindowHeightRaw() << llendl; + previewp->setSize(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw()); + } + else + { + // use the resolution from the selected pre-canned drop-down choice + lldebugs << "Setting preview res selected from combo: " << width << "x" << height << llendl; + previewp->setSize(width, height); + } + + checkAspectRatio(width); + + previewp->getSize(width, height); + + if(original_width != width || original_height != height) + { + previewp->setSize(width, height); + + // hide old preview as the aspect ratio could be wrong + lldebugs << "updating thumbnail" << llendl; + + previewp->updateSnapshot(FALSE, TRUE); + if(do_update) + { + lldebugs << "Will update controls" << llendl; + updateControls(); + setNeedRefresh(true); + } + } + + } +} + +void LLSocialPhotoPanel::checkAspectRatio(S32 index) +{ + LLSnapshotLivePreview *previewp = getPreviewView() ; + + BOOL keep_aspect = FALSE; + + if (0 == index) // current window size + { + keep_aspect = TRUE; + } + else // predefined resolution + { + keep_aspect = FALSE; + } + + if (previewp) + { + previewp->mKeepAspectRatio = keep_aspect; + } +} + +void LLSocialPhotoPanel::setNeedRefresh(bool need) +{ + mRefreshLabel->setVisible(need); + mNeedRefresh = need; +} + +LLUICtrl* LLSocialPhotoPanel::getRefreshBtn() +{ + return mRefreshBtn; +} + +//////////////////////// +//LLSocialCheckinPanel// +//////////////////////// LLSocialCheckinPanel::LLSocialCheckinPanel() : mMapUrl(""), @@ -501,6 +507,9 @@ void LLSocialCheckinPanel::onSend() } } +//////////////////////// +//LLFloaterSocial/////// +//////////////////////// LLFloaterSocial::LLFloaterSocial(const LLSD& key) : LLFloater(key), mSocialPhotoPanel(NULL) @@ -522,15 +531,9 @@ BOOL LLFloaterSocial::postBuild() return LLFloater::postBuild(); } -/*virtual*/ -void LLFloaterSocial::draw() -{ - LLFloater::draw(); -} - void LLFloaterSocial::onOpen(const LLSD& key) { - LLSnapshotLivePreview* preview = static_cast(mSocialPhotoPanel->mPreviewHandle.get()); + LLSnapshotLivePreview* preview = mSocialPhotoPanel->getPreviewView(); if(preview) { lldebugs << "opened, updating snapshot" << llendl; @@ -541,14 +544,13 @@ void LLFloaterSocial::onOpen(const LLSD& key) // static void LLFloaterSocial::preUpdate() { - // FIXME: duplicated code LLFloaterSocial* instance = LLFloaterReg::findTypedInstance("social"); if (instance) { - // Disable the send/post/save buttons until snapshot is ready. + //Will set file size text to 'unknown' instance->mSocialPhotoPanel->updateControls(); - // Force hiding the "Refresh to save" hint because we know we've just started refresh. + //Hides the refresh text instance->mSocialPhotoPanel->setNeedRefresh(false); } } @@ -556,21 +558,22 @@ void LLFloaterSocial::preUpdate() // static void LLFloaterSocial::postUpdate() { - // FIXME: duplicated code LLFloaterSocial* instance = LLFloaterReg::findTypedInstance("social"); if (instance) { - // Enable the send/post/save buttons. + //Will set the file size text instance->mSocialPhotoPanel->updateControls(); - // We've just done refresh. + //Hides the refresh text instance->mSocialPhotoPanel->setNeedRefresh(false); // The refresh button is initially hidden. We show it after the first update, - // i.e. when preview appears. - if (!instance->mSocialPhotoPanel->mRefreshBtn->getVisible()) + // i.e. after snapshot is taken + LLUICtrl * refresh_button = instance->mSocialPhotoPanel->getRefreshBtn(); + + if (!refresh_button->getVisible()) { - instance->mSocialPhotoPanel->mRefreshBtn->setVisible(true); + refresh_button->setVisible(true); } } -- cgit v1.2.3 From 7d17bbe132cf0f799b703bba978d48d44a1377c4 Mon Sep 17 00:00:00 2001 From: Cho Date: Fri, 28 Jun 2013 19:26:07 +0100 Subject: removed unused Me menu items for ACME-637 --- indra/newview/llfloatersocial.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index dfc9024d54..d6c00b7c86 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -128,7 +128,7 @@ mCaptionTextBox(NULL), mLocationCheckbox(NULL), mPostButton(NULL) { - mCommitCallbackRegistrar.add("PostToFacebook.Send", boost::bind(&LLSocialPhotoPanel::onSend, this)); + mCommitCallbackRegistrar.add("SocialSharing.SendPhoto", boost::bind(&LLSocialPhotoPanel::onSend, this)); } LLSocialPhotoPanel::~LLSocialPhotoPanel() -- cgit v1.2.3 From db8422f7841ab875c9dc636e10ae5993216d4a5b Mon Sep 17 00:00:00 2001 From: Cho Date: Fri, 28 Jun 2013 22:31:18 +0100 Subject: made sure photo preview is only generated when photo tab is visible for ACME-649 --- indra/newview/llfloatersocial.cpp | 48 ++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 23 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index d6c00b7c86..4660644969 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -246,20 +246,32 @@ LLSnapshotLivePreview* LLSocialPhotoPanel::getPreviewView() void LLSocialPhotoPanel::onVisibilityChange(const LLSD& new_visibility) { bool visible = new_visibility.asBoolean(); - if (visible && !mPreviewHandle.get()) + if (visible) { - LLRect full_screen_rect = getRootView()->getRect(); - LLSnapshotLivePreview::Params p; - p.rect(full_screen_rect); - LLSnapshotLivePreview* previewp = new LLSnapshotLivePreview(p); - mPreviewHandle = previewp->getHandle(); - - previewp->setSnapshotType(previewp->SNAPSHOT_WEB); - previewp->setSnapshotFormat(LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG); - //previewp->setSnapshotQuality(98); - previewp->setThumbnailPlaceholderRect(mThumbnailPlaceholder->getRect()); - - updateControls(); + if (mPreviewHandle.get()) + { + LLSnapshotLivePreview* preview = getPreviewView(); + if(preview) + { + lldebugs << "opened, updating snapshot" << llendl; + preview->updateSnapshot(TRUE); + } + } + else + { + LLRect full_screen_rect = getRootView()->getRect(); + LLSnapshotLivePreview::Params p; + p.rect(full_screen_rect); + LLSnapshotLivePreview* previewp = new LLSnapshotLivePreview(p); + mPreviewHandle = previewp->getHandle(); + + previewp->setSnapshotType(previewp->SNAPSHOT_WEB); + previewp->setSnapshotFormat(LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG); + //previewp->setSnapshotQuality(98); + previewp->setThumbnailPlaceholderRect(mThumbnailPlaceholder->getRect()); + + updateControls(); + } } } @@ -531,16 +543,6 @@ BOOL LLFloaterSocial::postBuild() return LLFloater::postBuild(); } -void LLFloaterSocial::onOpen(const LLSD& key) -{ - LLSnapshotLivePreview* preview = mSocialPhotoPanel->getPreviewView(); - if(preview) - { - lldebugs << "opened, updating snapshot" << llendl; - preview->updateSnapshot(TRUE); - } -} - // static void LLFloaterSocial::preUpdate() { -- cgit v1.2.3 From 853ad9d70ddcf0cdd354672a5c7baa858de1bb22 Mon Sep 17 00:00:00 2001 From: Cho Date: Wed, 3 Jul 2013 00:35:10 +0100 Subject: Implemented events for LLFacebookConnect state changes for ACME-662 --- indra/newview/llfloatersocial.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 4660644969..50d641865b 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -536,8 +536,8 @@ void LLFloaterSocial::onCancel() BOOL LLFloaterSocial::postBuild() { - // Initiate a connection to Facebook (getConnectionToFacebook() handles the already connected state) - LLFacebookConnect::instance().getConnectionToFacebook(true); + // Initiate a connection to Facebook + LLFacebookConnect::instance().checkConnectionToFacebook(true); // Keep tab of the Photo Panel mSocialPhotoPanel = static_cast(getChild("panel_social_photo")); return LLFloater::postBuild(); -- cgit v1.2.3 From eef8579dd7f9af558041d4d3a4b4aeb39bf280a1 Mon Sep 17 00:00:00 2001 From: Cho Date: Wed, 3 Jul 2013 01:16:41 +0100 Subject: Moved auto-connect to happen when Post button is clicked for ACME-654 and ACME-652 --- indra/newview/llfloatersocial.cpp | 84 +++++++++++++++++++++++++++++++++------ 1 file changed, 72 insertions(+), 12 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 50d641865b..061bcf246d 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -88,7 +88,7 @@ void LLSocialStatusPanel::draw() if (mMessageTextEditor && mPostStatusButton) { std::string message = mMessageTextEditor->getValue().asString(); - mPostStatusButton->setEnabled(!message.empty() && LLFacebookConnect::instance().isConnected()); + mPostStatusButton->setEnabled(!message.empty()); } LLPanel::draw(); @@ -101,8 +101,18 @@ void LLSocialStatusPanel::onSend() std::string message = mMessageTextEditor->getValue().asString(); if (!message.empty()) { - LLFacebookConnect::instance().updateStatus(message); - + // Connect to Facebook if necessary and then post + if (LLFacebookConnect::instance().isConnected()) + { + LLFacebookConnect::instance().updateStatus(message); + } + else + { + LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialStatusPanel", boost::bind(&LLSocialStatusPanel::onConnectedToFacebook, this, _1, message)); + LLFacebookConnect::instance().checkConnectionToFacebook(true); + } + + // Close the floater once "Post" has been pushed LLFloater* floater = getParentByType(); if (floater) { @@ -112,6 +122,18 @@ void LLSocialStatusPanel::onSend() } } +bool LLSocialStatusPanel::onConnectedToFacebook(const LLSD& data, const std::string& message) +{ + if (data.get("enum").asInteger() == LLFacebookConnect::FB_CONNECTED) + { + LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialStatusPanel"); + + LLFacebookConnect::instance().updateStatus(message); + } + + return false; +} + /////////////////////////// //LLSocialPhotoPanel/////// /////////////////////////// @@ -233,8 +255,6 @@ void LLSocialPhotoPanel::draw() mThumbnailPlaceholder->draw(); gGL.popUIMatrix(); } - - mPostButton->setEnabled(LLFacebookConnect::instance().isConnected()); } LLSnapshotLivePreview* LLSocialPhotoPanel::getPreviewView() @@ -302,7 +322,18 @@ void LLSocialPhotoPanel::onSend() } LLSnapshotLivePreview* previewp = getPreviewView(); - LLFacebookConnect::instance().sharePhoto(previewp->getFormattedImage(), caption); + + // Connect to Facebook if necessary and then post + if (LLFacebookConnect::instance().isConnected()) + { + LLFacebookConnect::instance().sharePhoto(previewp->getFormattedImage(), caption); + } + else + { + LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialPhotoPanel", boost::bind(&LLSocialPhotoPanel::onConnectedToFacebook, this, _1, previewp->getFormattedImage(), caption)); + LLFacebookConnect::instance().checkConnectionToFacebook(true); + } + updateControls(); // Close the floater once "Post" has been pushed @@ -313,6 +344,18 @@ void LLSocialPhotoPanel::onSend() } } +bool LLSocialPhotoPanel::onConnectedToFacebook(const LLSD& data, LLPointer image, const std::string& caption) +{ + if (data.get("enum").asInteger() == LLFacebookConnect::FB_CONNECTED) + { + LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialPhotoPanel"); + + LLFacebookConnect::instance().sharePhoto(image, caption); + } + + return false; +} + void LLSocialPhotoPanel::updateControls() { LLSnapshotLivePreview* previewp = getPreviewView(); @@ -482,8 +525,7 @@ void LLSocialCheckinPanel::draw() mMapCheckBox->setEnabled(true); mMapCheckBox->set(mMapCheckBoxValue); } - mPostButton->setEnabled(LLFacebookConnect::instance().isConnected()); - + LLPanel::draw(); } @@ -508,8 +550,16 @@ void LLSocialCheckinPanel::onSend() // Get the caption std::string caption = getChild("place_caption")->getValue().asString(); - // Post all that to Facebook - LLFacebookConnect::instance().postCheckin(slurl_string, region_name, description, map_url, caption); + // Connect to Facebook if necessary and then post + if (LLFacebookConnect::instance().isConnected()) + { + LLFacebookConnect::instance().postCheckin(slurl_string, region_name, description, map_url, caption); + } + else + { + LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialCheckinPanel", boost::bind(&LLSocialCheckinPanel::onConnectedToFacebook, this, _1, slurl_string, region_name, description, map_url, caption)); + LLFacebookConnect::instance().checkConnectionToFacebook(true); + } // Close the floater once "Post" has been pushed LLFloater* floater = getParentByType(); @@ -519,6 +569,18 @@ void LLSocialCheckinPanel::onSend() } } +bool LLSocialCheckinPanel::onConnectedToFacebook(const LLSD& data, const std::string& location, const std::string& name, const std::string& description, const std::string& picture, const std::string& message) +{ + if (data.get("enum").asInteger() == LLFacebookConnect::FB_CONNECTED) + { + LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialCheckinPanel"); + + LLFacebookConnect::instance().postCheckin(location, name, description, picture, message); + } + + return false; +} + //////////////////////// //LLFloaterSocial/////// //////////////////////// @@ -536,8 +598,6 @@ void LLFloaterSocial::onCancel() BOOL LLFloaterSocial::postBuild() { - // Initiate a connection to Facebook - LLFacebookConnect::instance().checkConnectionToFacebook(true); // Keep tab of the Photo Panel mSocialPhotoPanel = static_cast(getChild("panel_social_photo")); return LLFloater::postBuild(); -- cgit v1.2.3 From 8c4a39b2025ef64f6218dc112e37f71c65aac446 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 2 Jul 2013 18:34:17 -0700 Subject: ACME-626 : Implement status and progress update text --- indra/newview/llfloatersocial.cpp | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 4660644969..ddbaa2d704 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -524,7 +524,10 @@ void LLSocialCheckinPanel::onSend() //////////////////////// LLFloaterSocial::LLFloaterSocial(const LLSD& key) : LLFloater(key), - mSocialPhotoPanel(NULL) + mSocialPhotoPanel(NULL), + mStatusErrorText(NULL), + mStatusLoadingText(NULL), + mStatusLoadingIndicator(NULL) { mCommitCallbackRegistrar.add("SocialSharing.Cancel", boost::bind(&LLFloaterSocial::onCancel, this)); } @@ -540,6 +543,10 @@ BOOL LLFloaterSocial::postBuild() LLFacebookConnect::instance().getConnectionToFacebook(true); // Keep tab of the Photo Panel mSocialPhotoPanel = static_cast(getChild("panel_social_photo")); + // Connection status widgets + mStatusErrorText = getChild("connection_error_text"); + mStatusLoadingText = getChild("connection_loading_text"); + mStatusLoadingIndicator = getChild("connection_loading_indicator"); return LLFloater::postBuild(); } @@ -580,3 +587,30 @@ void LLFloaterSocial::postUpdate() } } + +void LLFloaterSocial::draw() +{ + if (mStatusErrorText && mStatusLoadingText && mStatusLoadingIndicator) + { + mStatusErrorText->setVisible(false); + mStatusLoadingText->setVisible(false); + mStatusLoadingIndicator->setVisible(false); + LLFacebookConnect::EConnectionState connection_state = LLFacebookConnect::instance().getConnectionState(); + switch (connection_state) + { + case LLFacebookConnect::FB_NOT_CONNECTED: + break; + case LLFacebookConnect::FB_CONNECTION_IN_PROGRESS: + mStatusLoadingText->setVisible(true); + mStatusLoadingIndicator->setVisible(true); + break; + case LLFacebookConnect::FB_CONNECTED: + break; + case LLFacebookConnect::FB_CONNECTION_FAILED: + mStatusErrorText->setVisible(true); + break; + } + } + LLFloater::draw(); +} + -- cgit v1.2.3 From 55077fd1ae7a00b1a49993d124f2640b17d95bb8 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 2 Jul 2013 20:00:10 -0700 Subject: ACME-626 : Suppress the closing of the floater when clicking Post or we can't see the status --- indra/newview/llfloatersocial.cpp | 21 --------------------- 1 file changed, 21 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 684b177f24..a0dbb7ea95 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -111,13 +111,6 @@ void LLSocialStatusPanel::onSend() LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialStatusPanel", boost::bind(&LLSocialStatusPanel::onConnectedToFacebook, this, _1, message)); LLFacebookConnect::instance().checkConnectionToFacebook(true); } - - // Close the floater once "Post" has been pushed - LLFloater* floater = getParentByType(); - if (floater) - { - floater->closeFloater(); - } } } } @@ -335,13 +328,6 @@ void LLSocialPhotoPanel::onSend() } updateControls(); - - // Close the floater once "Post" has been pushed - LLFloater* floater = getParentByType(); - if (floater) - { - floater->closeFloater(); - } } bool LLSocialPhotoPanel::onConnectedToFacebook(const LLSD& data, LLPointer image, const std::string& caption) @@ -560,13 +546,6 @@ void LLSocialCheckinPanel::onSend() LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialCheckinPanel", boost::bind(&LLSocialCheckinPanel::onConnectedToFacebook, this, _1, slurl_string, region_name, description, map_url, caption)); LLFacebookConnect::instance().checkConnectionToFacebook(true); } - - // Close the floater once "Post" has been pushed - LLFloater* floater = getParentByType(); - if (floater) - { - floater->closeFloater(); - } } bool LLSocialCheckinPanel::onConnectedToFacebook(const LLSD& data, const std::string& location, const std::string& name, const std::string& description, const std::string& picture, const std::string& message) -- cgit v1.2.3 From 4ed5e21ae3fe069126bd43ae0785aa74ba3d0cf7 Mon Sep 17 00:00:00 2001 From: Cho Date: Wed, 3 Jul 2013 22:07:50 +0100 Subject: made some slight reorganizations for ACME-662 --- indra/newview/llfloatersocial.cpp | 137 +++++++++++++++++++++----------------- 1 file changed, 77 insertions(+), 60 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index a0dbb7ea95..57b6cccd32 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -96,37 +96,39 @@ void LLSocialStatusPanel::draw() void LLSocialStatusPanel::onSend() { - if (mMessageTextEditor) + // Connect to Facebook if necessary and then post + if (LLFacebookConnect::instance().isConnected()) { - std::string message = mMessageTextEditor->getValue().asString(); - if (!message.empty()) - { - // Connect to Facebook if necessary and then post - if (LLFacebookConnect::instance().isConnected()) - { - LLFacebookConnect::instance().updateStatus(message); - } - else - { - LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialStatusPanel", boost::bind(&LLSocialStatusPanel::onConnectedToFacebook, this, _1, message)); - LLFacebookConnect::instance().checkConnectionToFacebook(true); - } - } + sendStatus(); + } + else + { + LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialStatusPanel", boost::bind(&LLSocialStatusPanel::onFacebookConnectStateChange, this, _1)); + LLFacebookConnect::instance().checkConnectionToFacebook(true); } } -bool LLSocialStatusPanel::onConnectedToFacebook(const LLSD& data, const std::string& message) +bool LLSocialStatusPanel::onFacebookConnectStateChange(const LLSD& data) { if (data.get("enum").asInteger() == LLFacebookConnect::FB_CONNECTED) { LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialStatusPanel"); - LLFacebookConnect::instance().updateStatus(message); + sendStatus(); } return false; } +void LLSocialStatusPanel::sendStatus() +{ + std::string message = mMessageTextEditor->getValue().asString(); + if (!message.empty()) + { + LLFacebookConnect::instance().updateStatus(message); + } +} + /////////////////////////// //LLSocialPhotoPanel/////// /////////////////////////// @@ -301,47 +303,56 @@ void LLSocialPhotoPanel::onClickNewSnapshot() void LLSocialPhotoPanel::onSend() { - std::string caption = mCaptionTextBox->getValue().asString(); - bool add_location = mLocationCheckbox->getValue().asBoolean(); - - if (add_location) - { - LLSLURL slurl; - LLAgentUI::buildSLURL(slurl); - if (caption.empty()) - caption = slurl.getSLURLString(); - else - caption = caption + " " + slurl.getSLURLString(); - } - - LLSnapshotLivePreview* previewp = getPreviewView(); - // Connect to Facebook if necessary and then post if (LLFacebookConnect::instance().isConnected()) { - LLFacebookConnect::instance().sharePhoto(previewp->getFormattedImage(), caption); + sendPhoto(); } else { - LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialPhotoPanel", boost::bind(&LLSocialPhotoPanel::onConnectedToFacebook, this, _1, previewp->getFormattedImage(), caption)); + LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialPhotoPanel", boost::bind(&LLSocialPhotoPanel::onFacebookConnectStateChange, this, _1)); LLFacebookConnect::instance().checkConnectionToFacebook(true); } - - updateControls(); } -bool LLSocialPhotoPanel::onConnectedToFacebook(const LLSD& data, LLPointer image, const std::string& caption) +bool LLSocialPhotoPanel::onFacebookConnectStateChange(const LLSD& data) { if (data.get("enum").asInteger() == LLFacebookConnect::FB_CONNECTED) { LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialPhotoPanel"); - LLFacebookConnect::instance().sharePhoto(image, caption); + sendPhoto(); } return false; } +void LLSocialPhotoPanel::sendPhoto() +{ + // Get the caption + std::string caption = mCaptionTextBox->getValue().asString(); + + // Add the location if required + bool add_location = mLocationCheckbox->getValue().asBoolean(); + if (add_location) + { + LLSLURL slurl; + LLAgentUI::buildSLURL(slurl); + if (caption.empty()) + caption = slurl.getSLURLString(); + else + caption = caption + " " + slurl.getSLURLString(); + } + + // Get the image + LLSnapshotLivePreview* previewp = getPreviewView(); + + // Post to Facebook + LLFacebookConnect::instance().sharePhoto(previewp->getFormattedImage(), caption); + + updateControls(); +} + void LLSocialPhotoPanel::updateControls() { LLSnapshotLivePreview* previewp = getPreviewView(); @@ -516,6 +527,32 @@ void LLSocialCheckinPanel::draw() } void LLSocialCheckinPanel::onSend() +{ + // Connect to Facebook if necessary and then post + if (LLFacebookConnect::instance().isConnected()) + { + sendCheckin(); + } + else + { + LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialCheckinPanel", boost::bind(&LLSocialCheckinPanel::onFacebookConnectStateChange, this, _1)); + LLFacebookConnect::instance().checkConnectionToFacebook(true); + } +} + +bool LLSocialCheckinPanel::onFacebookConnectStateChange(const LLSD& data) +{ + if (data.get("enum").asInteger() == LLFacebookConnect::FB_CONNECTED) + { + LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialCheckinPanel"); + + sendCheckin(); + } + + return false; +} + +void LLSocialCheckinPanel::sendCheckin() { // Get the location SLURL LLSLURL slurl; @@ -536,28 +573,8 @@ void LLSocialCheckinPanel::onSend() // Get the caption std::string caption = getChild("place_caption")->getValue().asString(); - // Connect to Facebook if necessary and then post - if (LLFacebookConnect::instance().isConnected()) - { - LLFacebookConnect::instance().postCheckin(slurl_string, region_name, description, map_url, caption); - } - else - { - LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialCheckinPanel", boost::bind(&LLSocialCheckinPanel::onConnectedToFacebook, this, _1, slurl_string, region_name, description, map_url, caption)); - LLFacebookConnect::instance().checkConnectionToFacebook(true); - } -} - -bool LLSocialCheckinPanel::onConnectedToFacebook(const LLSD& data, const std::string& location, const std::string& name, const std::string& description, const std::string& picture, const std::string& message) -{ - if (data.get("enum").asInteger() == LLFacebookConnect::FB_CONNECTED) - { - LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialCheckinPanel"); - - LLFacebookConnect::instance().postCheckin(location, name, description, picture, message); - } - - return false; + // Post to Facebook + LLFacebookConnect::instance().postCheckin(slurl_string, region_name, description, map_url, caption); } //////////////////////// -- cgit v1.2.3 From 1dbabed6b5bac8a0fcc1d9a70522eb726e01bae7 Mon Sep 17 00:00:00 2001 From: Cho Date: Wed, 3 Jul 2013 23:42:02 +0100 Subject: made listeners more robust in llfloatersocial.cpp for ACME-665 --- indra/newview/llfloatersocial.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 57b6cccd32..67a9f0c742 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -103,6 +103,7 @@ void LLSocialStatusPanel::onSend() } else { + LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialStatusPanel"); // just in case it is already listening LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialStatusPanel", boost::bind(&LLSocialStatusPanel::onFacebookConnectStateChange, this, _1)); LLFacebookConnect::instance().checkConnectionToFacebook(true); } @@ -310,6 +311,7 @@ void LLSocialPhotoPanel::onSend() } else { + LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialPhotoPanel"); // just in case it is already listening LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialPhotoPanel", boost::bind(&LLSocialPhotoPanel::onFacebookConnectStateChange, this, _1)); LLFacebookConnect::instance().checkConnectionToFacebook(true); } @@ -535,6 +537,7 @@ void LLSocialCheckinPanel::onSend() } else { + LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialCheckinPanel"); // just in case it is already listening LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialCheckinPanel", boost::bind(&LLSocialCheckinPanel::onFacebookConnectStateChange, this, _1)); LLFacebookConnect::instance().checkConnectionToFacebook(true); } -- cgit v1.2.3 From ad8aeecb8331ca68eef9a12536c80a4658885ccb Mon Sep 17 00:00:00 2001 From: Cho Date: Thu, 4 Jul 2013 01:29:54 +0100 Subject: Added auto-connect upon 404 from a POST in LLFacebookConnect, and added FB_POSTED state, for ACME-667 --- indra/newview/llfloatersocial.cpp | 51 +++++++++++++++++++++++++-------------- 1 file changed, 33 insertions(+), 18 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 67a9f0c742..eb3ceaf96e 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -96,6 +96,9 @@ void LLSocialStatusPanel::draw() void LLSocialStatusPanel::onSend() { + LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialStatusPanel"); // just in case it is already listening + LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialStatusPanel", boost::bind(&LLSocialStatusPanel::onFacebookConnectStateChange, this, _1)); + // Connect to Facebook if necessary and then post if (LLFacebookConnect::instance().isConnected()) { @@ -103,19 +106,21 @@ void LLSocialStatusPanel::onSend() } else { - LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialStatusPanel"); // just in case it is already listening - LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialStatusPanel", boost::bind(&LLSocialStatusPanel::onFacebookConnectStateChange, this, _1)); LLFacebookConnect::instance().checkConnectionToFacebook(true); } } bool LLSocialStatusPanel::onFacebookConnectStateChange(const LLSD& data) { - if (data.get("enum").asInteger() == LLFacebookConnect::FB_CONNECTED) + switch (data.get("enum").asInteger()) { - LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialStatusPanel"); - - sendStatus(); + case LLFacebookConnect::FB_CONNECTED: + sendStatus(); + break; + + case LLFacebookConnect::FB_POSTED: + LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialStatusPanel"); + break; } return false; @@ -304,6 +309,9 @@ void LLSocialPhotoPanel::onClickNewSnapshot() void LLSocialPhotoPanel::onSend() { + LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialPhotoPanel"); // just in case it is already listening + LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialPhotoPanel", boost::bind(&LLSocialPhotoPanel::onFacebookConnectStateChange, this, _1)); + // Connect to Facebook if necessary and then post if (LLFacebookConnect::instance().isConnected()) { @@ -311,19 +319,21 @@ void LLSocialPhotoPanel::onSend() } else { - LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialPhotoPanel"); // just in case it is already listening - LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialPhotoPanel", boost::bind(&LLSocialPhotoPanel::onFacebookConnectStateChange, this, _1)); LLFacebookConnect::instance().checkConnectionToFacebook(true); } } bool LLSocialPhotoPanel::onFacebookConnectStateChange(const LLSD& data) { - if (data.get("enum").asInteger() == LLFacebookConnect::FB_CONNECTED) + switch (data.get("enum").asInteger()) { - LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialPhotoPanel"); - - sendPhoto(); + case LLFacebookConnect::FB_CONNECTED: + sendPhoto(); + break; + + case LLFacebookConnect::FB_POSTED: + LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialPhotoPanel"); + break; } return false; @@ -530,6 +540,9 @@ void LLSocialCheckinPanel::draw() void LLSocialCheckinPanel::onSend() { + LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialCheckinPanel"); // just in case it is already listening + LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialCheckinPanel", boost::bind(&LLSocialCheckinPanel::onFacebookConnectStateChange, this, _1)); + // Connect to Facebook if necessary and then post if (LLFacebookConnect::instance().isConnected()) { @@ -537,19 +550,21 @@ void LLSocialCheckinPanel::onSend() } else { - LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialCheckinPanel"); // just in case it is already listening - LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialCheckinPanel", boost::bind(&LLSocialCheckinPanel::onFacebookConnectStateChange, this, _1)); LLFacebookConnect::instance().checkConnectionToFacebook(true); } } bool LLSocialCheckinPanel::onFacebookConnectStateChange(const LLSD& data) { - if (data.get("enum").asInteger() == LLFacebookConnect::FB_CONNECTED) + switch (data.get("enum").asInteger()) { - LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialCheckinPanel"); - - sendCheckin(); + case LLFacebookConnect::FB_CONNECTED: + sendCheckin(); + break; + + case LLFacebookConnect::FB_POSTED: + LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialCheckinPanel"); + break; } return false; -- cgit v1.2.3 From fd4262541946770515ce8a486dd3a69245365def Mon Sep 17 00:00:00 2001 From: Cho Date: Thu, 4 Jul 2013 02:01:51 +0100 Subject: Close floater and clear text upon FB_POSTED for ACME-668 --- indra/newview/llfloatersocial.cpp | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index eb3ceaf96e..2ecadcfaf6 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -120,6 +120,7 @@ bool LLSocialStatusPanel::onFacebookConnectStateChange(const LLSD& data) case LLFacebookConnect::FB_POSTED: LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialStatusPanel"); + clearAndClose(); break; } @@ -135,6 +136,17 @@ void LLSocialStatusPanel::sendStatus() } } +void LLSocialStatusPanel::clearAndClose() +{ + mMessageTextEditor->setValue(""); + + LLFloater* floater = getParentByType(); + if (floater) + { + floater->closeFloater(); + } +} + /////////////////////////// //LLSocialPhotoPanel/////// /////////////////////////// @@ -333,6 +345,7 @@ bool LLSocialPhotoPanel::onFacebookConnectStateChange(const LLSD& data) case LLFacebookConnect::FB_POSTED: LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialPhotoPanel"); + clearAndClose(); break; } @@ -365,6 +378,17 @@ void LLSocialPhotoPanel::sendPhoto() updateControls(); } +void LLSocialPhotoPanel::clearAndClose() +{ + mCaptionTextBox->setValue(""); + + LLFloater* floater = getParentByType(); + if (floater) + { + floater->closeFloater(); + } +} + void LLSocialPhotoPanel::updateControls() { LLSnapshotLivePreview* previewp = getPreviewView(); @@ -564,6 +588,7 @@ bool LLSocialCheckinPanel::onFacebookConnectStateChange(const LLSD& data) case LLFacebookConnect::FB_POSTED: LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialCheckinPanel"); + clearAndClose(); break; } @@ -595,6 +620,17 @@ void LLSocialCheckinPanel::sendCheckin() LLFacebookConnect::instance().postCheckin(slurl_string, region_name, description, map_url, caption); } +void LLSocialCheckinPanel::clearAndClose() +{ + getChild("place_caption")->setValue(""); + + LLFloater* floater = getParentByType(); + if (floater) + { + floater->closeFloater(); + } +} + //////////////////////// //LLFloaterSocial/////// //////////////////////// @@ -680,6 +716,8 @@ void LLFloaterSocial::draw() mStatusLoadingIndicator->setVisible(true); break; case LLFacebookConnect::FB_CONNECTED: + break; + case LLFacebookConnect::FB_POSTED: break; case LLFacebookConnect::FB_CONNECTION_FAILED: case LLFacebookConnect::FB_POST_FAILED: -- cgit v1.2.3 From 6e8b353575f670e50267cb172860a3f8da1dbbd0 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 3 Jul 2013 19:29:42 -0700 Subject: ACME-626 : Simplify the preview drawing code and positioning --- indra/newview/llfloatersocial.cpp | 53 ++++----------------------------------- 1 file changed, 5 insertions(+), 48 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index a0dbb7ea95..fce9d1b28f 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -178,76 +178,33 @@ void LLSocialPhotoPanel::draw() { LLSnapshotLivePreview * previewp = static_cast(mPreviewHandle.get()); - LLPanel::draw(); - - if(previewp && previewp->getThumbnailImage()) + if (previewp && previewp->getThumbnailImage()) { - bool working = false; //impl.getStatus() == Impl::STATUS_WORKING; const LLRect& thumbnail_rect = mThumbnailPlaceholder->getRect(); + const LLRect& snapshot_rect = mSnapshotPanel->getRect(); const S32 thumbnail_w = previewp->getThumbnailWidth(); const S32 thumbnail_h = previewp->getThumbnailHeight(); // calc preview offset within the preview rect const S32 local_offset_x = (thumbnail_rect.getWidth() - thumbnail_w) / 2 ; - const S32 local_offset_y = (thumbnail_rect.getHeight() - thumbnail_h) / 2 ; // preview y pos within the preview rect // calc preview offset within the floater rect S32 offset_x = thumbnail_rect.mLeft + local_offset_x; - S32 offset_y = thumbnail_rect.mBottom + local_offset_y; + S32 offset_y = thumbnail_rect.mBottom - (snapshot_rect.mTop - thumbnail_rect.mTop); mSnapshotPanel->localPointToOtherView(offset_x, offset_y, &offset_x, &offset_y, getParentByType()); gGL.matrixMode(LLRender::MM_MODELVIEW); // Apply floater transparency to the texture unless the floater is focused. F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency(); - LLColor4 color = working ? LLColor4::grey4 : LLColor4::white; + LLColor4 color = LLColor4::white; gl_draw_scaled_image(offset_x, offset_y, thumbnail_w, thumbnail_h, previewp->getThumbnailImage(), color % alpha); previewp->drawPreviewRect(offset_x, offset_y) ; - - // Draw some controls on top of the preview thumbnail. - static const S32 PADDING = 5; - static const S32 REFRESH_LBL_BG_HEIGHT = 32; - - // Reshape and position the posting result message panels at the top of the thumbnail. - // Do this regardless of current posting status (finished or not) to avoid flicker - // when the result message is displayed for the first time. - // if (impl.getStatus() == Impl::STATUS_FINISHED) - { - LLRect result_lbl_rect = mSucceessLblPanel->getRect(); - const S32 result_lbl_h = result_lbl_rect.getHeight(); - result_lbl_rect.setLeftTopAndSize(local_offset_x, local_offset_y + thumbnail_h, thumbnail_w - 1, result_lbl_h); - mSucceessLblPanel->reshape(result_lbl_rect.getWidth(), result_lbl_h); - mSucceessLblPanel->setRect(result_lbl_rect); - mFailureLblPanel->reshape(result_lbl_rect.getWidth(), result_lbl_h); - mFailureLblPanel->setRect(result_lbl_rect); - } - - // Position the refresh button in the bottom left corner of the thumbnail. - mRefreshBtn->setOrigin(local_offset_x + PADDING, local_offset_y + PADDING); - - if (mNeedRefresh) - { - // Place the refresh hint text to the right of the refresh button. - const LLRect& refresh_btn_rect = mRefreshBtn->getRect(); - mRefreshLabel->setOrigin(refresh_btn_rect.mLeft + refresh_btn_rect.getWidth() + PADDING, refresh_btn_rect.mBottom); - - // Draw the refresh hint background. - LLRect refresh_label_bg_rect(offset_x, offset_y + REFRESH_LBL_BG_HEIGHT, offset_x + thumbnail_w - 1, offset_y); - gl_rect_2d(refresh_label_bg_rect, LLColor4::white % 0.9f, TRUE); - } - - gGL.pushUIMatrix(); - S32 x_pos; - S32 y_pos; - mSnapshotPanel->localPointToOtherView(thumbnail_rect.mLeft, thumbnail_rect.mBottom, &x_pos, &y_pos, getParentByType()); - - LLUI::translate((F32) x_pos, (F32) y_pos); - mThumbnailPlaceholder->draw(); - gGL.popUIMatrix(); } + LLPanel::draw(); } LLSnapshotLivePreview* LLSocialPhotoPanel::getPreviewView() -- cgit v1.2.3 From 5c88b679bd2f66fd6fa358ca93047c0aba781e22 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Sun, 7 Jul 2013 22:59:51 -0700 Subject: ACME-626 : More snapshot code cleanup, suppress failure/success indicators since we have a bottom message for that, show/hide the progress indicator --- indra/newview/llfloatersocial.cpp | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 58a9edc524..6d4262a599 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -156,8 +156,8 @@ mSnapshotPanel(NULL), mResolutionComboBox(NULL), mRefreshBtn(NULL), mRefreshLabel(NULL), -mSucceessLblPanel(NULL), -mFailureLblPanel(NULL), +mWorkingIndicator(NULL), +mWorkingLabel(NULL), mThumbnailPlaceholder(NULL), mCaptionTextBox(NULL), mLocationCheckbox(NULL), @@ -184,8 +184,8 @@ BOOL LLSocialPhotoPanel::postBuild() mRefreshBtn = getChild("new_snapshot_btn"); childSetAction("new_snapshot_btn", boost::bind(&LLSocialPhotoPanel::onClickNewSnapshot, this)); mRefreshLabel = getChild("refresh_lbl"); - mSucceessLblPanel = getChild("succeeded_panel"); - mFailureLblPanel = getChild("failed_panel"); + mWorkingIndicator = getChild("working_indicator"); + mWorkingLabel = getChild("working_lbl"); mThumbnailPlaceholder = getChild("thumbnail_placeholder"); mCaptionTextBox = getChild("caption"); mLocationCheckbox = getChild("add_location_cb"); @@ -198,6 +198,7 @@ void LLSocialPhotoPanel::draw() { LLSnapshotLivePreview * previewp = static_cast(mPreviewHandle.get()); + // Display the preview if one is available if (previewp && previewp->getThumbnailImage()) { const LLRect& thumbnail_rect = mThumbnailPlaceholder->getRect(); @@ -224,6 +225,24 @@ void LLSocialPhotoPanel::draw() previewp->drawPreviewRect(offset_x, offset_y) ; } + + // Update the visibility of the working (computing preview) indicators + if (previewp && previewp->getSnapshotUpToDate()) + { + if (mWorkingIndicator->getVisible()) + { + mWorkingIndicator->setVisible(false); + mWorkingIndicator->stop(); + mWorkingLabel->setVisible(false); + } + } + else if (!mWorkingIndicator->getVisible()) + { + mWorkingIndicator->setVisible(true); + mWorkingIndicator->start(); + mWorkingLabel->setVisible(true); + } + LLPanel::draw(); } -- cgit v1.2.3 From a1cc147829be2c341721ea75f713ac66279ad40c Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 8 Jul 2013 13:41:59 -0700 Subject: ACME-626 : More snapshot panel cleanup, autorefresh when changing resolution, simplify working messaging, add tooltip to the refresh button --- indra/newview/llfloatersocial.cpp | 37 ++++--------------------------------- 1 file changed, 4 insertions(+), 33 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 6d4262a599..9986a9c230 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -155,8 +155,6 @@ LLSocialPhotoPanel::LLSocialPhotoPanel() : mSnapshotPanel(NULL), mResolutionComboBox(NULL), mRefreshBtn(NULL), -mRefreshLabel(NULL), -mWorkingIndicator(NULL), mWorkingLabel(NULL), mThumbnailPlaceholder(NULL), mCaptionTextBox(NULL), @@ -183,8 +181,6 @@ BOOL LLSocialPhotoPanel::postBuild() mResolutionComboBox->setCommitCallback(boost::bind(&LLSocialPhotoPanel::updateResolution, this, TRUE)); mRefreshBtn = getChild("new_snapshot_btn"); childSetAction("new_snapshot_btn", boost::bind(&LLSocialPhotoPanel::onClickNewSnapshot, this)); - mRefreshLabel = getChild("refresh_lbl"); - mWorkingIndicator = getChild("working_indicator"); mWorkingLabel = getChild("working_lbl"); mThumbnailPlaceholder = getChild("thumbnail_placeholder"); mCaptionTextBox = getChild("caption"); @@ -226,23 +222,10 @@ void LLSocialPhotoPanel::draw() previewp->drawPreviewRect(offset_x, offset_y) ; } - // Update the visibility of the working (computing preview) indicators - if (previewp && previewp->getSnapshotUpToDate()) - { - if (mWorkingIndicator->getVisible()) - { - mWorkingIndicator->setVisible(false); - mWorkingIndicator->stop(); - mWorkingLabel->setVisible(false); - } - } - else if (!mWorkingIndicator->getVisible()) - { - mWorkingIndicator->setVisible(true); - mWorkingIndicator->start(); - mWorkingLabel->setVisible(true); - } + // Update the visibility of the working (computing preview) label + mWorkingLabel->setVisible(!(previewp && previewp->getSnapshotUpToDate())); + // Draw the rest of the panel on top of it LLPanel::draw(); } @@ -439,7 +422,7 @@ void LLSocialPhotoPanel::updateResolution(BOOL do_update) { lldebugs << "Will update controls" << llendl; updateControls(); - setNeedRefresh(true); + LLSocialPhotoPanel::onClickNewSnapshot(); } } @@ -467,12 +450,6 @@ void LLSocialPhotoPanel::checkAspectRatio(S32 index) } } -void LLSocialPhotoPanel::setNeedRefresh(bool need) -{ - mRefreshLabel->setVisible(need); - mNeedRefresh = need; -} - LLUICtrl* LLSocialPhotoPanel::getRefreshBtn() { return mRefreshBtn; @@ -644,9 +621,6 @@ void LLFloaterSocial::preUpdate() { //Will set file size text to 'unknown' instance->mSocialPhotoPanel->updateControls(); - - //Hides the refresh text - instance->mSocialPhotoPanel->setNeedRefresh(false); } } @@ -659,9 +633,6 @@ void LLFloaterSocial::postUpdate() //Will set the file size text instance->mSocialPhotoPanel->updateControls(); - //Hides the refresh text - instance->mSocialPhotoPanel->setNeedRefresh(false); - // The refresh button is initially hidden. We show it after the first update, // i.e. after snapshot is taken LLUICtrl * refresh_button = instance->mSocialPhotoPanel->getRefreshBtn(); -- cgit v1.2.3 From 0be0b0e8b01338564b1502b8bb2b40e5a9454b0f Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 8 Jul 2013 16:01:20 -0700 Subject: ACME-651 : Implement all missing status messages, tweak colors and positioning --- indra/newview/llfloatersocial.cpp | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 9986a9c230..1d47213a3a 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -591,7 +591,9 @@ void LLSocialCheckinPanel::clearAndClose() LLFloaterSocial::LLFloaterSocial(const LLSD& key) : LLFloater(key), mSocialPhotoPanel(NULL), mStatusErrorText(NULL), + mStatusPostingErrorText(NULL), mStatusLoadingText(NULL), + mStatusPostingText(NULL), mStatusLoadingIndicator(NULL) { mCommitCallbackRegistrar.add("SocialSharing.Cancel", boost::bind(&LLFloaterSocial::onCancel, this)); @@ -608,7 +610,9 @@ BOOL LLFloaterSocial::postBuild() mSocialPhotoPanel = static_cast(getChild("panel_social_photo")); // Connection status widgets mStatusErrorText = getChild("connection_error_text"); + mStatusPostingErrorText = getChild("connection_error_posting_text"); mStatusLoadingText = getChild("connection_loading_text"); + mStatusPostingText = getChild("connection_posting_text"); mStatusLoadingIndicator = getChild("connection_loading_indicator"); return LLFloater::postBuild(); } @@ -647,29 +651,43 @@ void LLFloaterSocial::postUpdate() void LLFloaterSocial::draw() { - if (mStatusErrorText && mStatusLoadingText && mStatusLoadingIndicator) + if (mStatusErrorText && mStatusPostingErrorText && mStatusLoadingText && mStatusPostingText && mStatusLoadingIndicator) { mStatusErrorText->setVisible(false); + mStatusPostingErrorText->setVisible(false); mStatusLoadingText->setVisible(false); + mStatusPostingText->setVisible(false); mStatusLoadingIndicator->setVisible(false); LLFacebookConnect::EConnectionState connection_state = LLFacebookConnect::instance().getConnectionState(); switch (connection_state) { case LLFacebookConnect::FB_NOT_CONNECTED: + // No status displayed when first opening the panel and no connection done break; case LLFacebookConnect::FB_CONNECTION_IN_PROGRESS: - case LLFacebookConnect::FB_POSTING: + // Connection loading indicator mStatusLoadingText->setVisible(true); mStatusLoadingIndicator->setVisible(true); break; + case LLFacebookConnect::FB_POSTING: + // Posting indicator + mStatusPostingText->setVisible(true); + mStatusLoadingIndicator->setVisible(true); + break; case LLFacebookConnect::FB_CONNECTED: + // When successfully connected, no message is displayed break; case LLFacebookConnect::FB_POSTED: + // No success message to show since we actually close the floater after successful posting completion break; case LLFacebookConnect::FB_CONNECTION_FAILED: - case LLFacebookConnect::FB_POST_FAILED: + // Error connecting to the service mStatusErrorText->setVisible(true); break; + case LLFacebookConnect::FB_POST_FAILED: + // Error posting to the service + mStatusPostingErrorText->setVisible(true); + break; } } LLFloater::draw(); -- cgit v1.2.3 From e6ac587f372559c4c84f8b1e4bc5ab94d9a665c3 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 8 Jul 2013 17:12:31 -0700 Subject: ACME-651 : Use localizable strings and simplify the xml for status and error fields --- indra/newview/llfloatersocial.cpp | 33 ++++++++++++++++++--------------- 1 file changed, 18 insertions(+), 15 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 1d47213a3a..b90cc004d3 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -40,6 +40,7 @@ #include "llsdserialize.h" #include "llloadingindicator.h" #include "llslurl.h" +#include "lltrans.h" #include "llsnapshotlivepreview.h" #include "llviewerregion.h" #include "llviewercontrol.h" @@ -591,9 +592,7 @@ void LLSocialCheckinPanel::clearAndClose() LLFloaterSocial::LLFloaterSocial(const LLSD& key) : LLFloater(key), mSocialPhotoPanel(NULL), mStatusErrorText(NULL), - mStatusPostingErrorText(NULL), mStatusLoadingText(NULL), - mStatusPostingText(NULL), mStatusLoadingIndicator(NULL) { mCommitCallbackRegistrar.add("SocialSharing.Cancel", boost::bind(&LLFloaterSocial::onCancel, this)); @@ -610,9 +609,7 @@ BOOL LLFloaterSocial::postBuild() mSocialPhotoPanel = static_cast(getChild("panel_social_photo")); // Connection status widgets mStatusErrorText = getChild("connection_error_text"); - mStatusPostingErrorText = getChild("connection_error_posting_text"); mStatusLoadingText = getChild("connection_loading_text"); - mStatusPostingText = getChild("connection_posting_text"); mStatusLoadingIndicator = getChild("connection_loading_indicator"); return LLFloater::postBuild(); } @@ -651,42 +648,48 @@ void LLFloaterSocial::postUpdate() void LLFloaterSocial::draw() { - if (mStatusErrorText && mStatusPostingErrorText && mStatusLoadingText && mStatusPostingText && mStatusLoadingIndicator) + if (mStatusErrorText && mStatusLoadingText && mStatusLoadingIndicator) { mStatusErrorText->setVisible(false); - mStatusPostingErrorText->setVisible(false); mStatusLoadingText->setVisible(false); - mStatusPostingText->setVisible(false); mStatusLoadingIndicator->setVisible(false); LLFacebookConnect::EConnectionState connection_state = LLFacebookConnect::instance().getConnectionState(); + std::string status_text; + switch (connection_state) { case LLFacebookConnect::FB_NOT_CONNECTED: // No status displayed when first opening the panel and no connection done + case LLFacebookConnect::FB_CONNECTED: + // When successfully connected, no message is displayed + case LLFacebookConnect::FB_POSTED: + // No success message to show since we actually close the floater after successful posting completion break; case LLFacebookConnect::FB_CONNECTION_IN_PROGRESS: // Connection loading indicator mStatusLoadingText->setVisible(true); + status_text = LLTrans::getString("SocialFacebookConnecting"); + mStatusLoadingText->setValue(status_text); mStatusLoadingIndicator->setVisible(true); break; case LLFacebookConnect::FB_POSTING: // Posting indicator - mStatusPostingText->setVisible(true); + mStatusLoadingText->setVisible(true); + status_text = LLTrans::getString("SocialFacebookPosting"); + mStatusLoadingText->setValue(status_text); mStatusLoadingIndicator->setVisible(true); - break; - case LLFacebookConnect::FB_CONNECTED: - // When successfully connected, no message is displayed break; - case LLFacebookConnect::FB_POSTED: - // No success message to show since we actually close the floater after successful posting completion - break; case LLFacebookConnect::FB_CONNECTION_FAILED: // Error connecting to the service mStatusErrorText->setVisible(true); + status_text = LLTrans::getString("SocialFacebookErrorConnecting"); + mStatusErrorText->setValue(status_text); break; case LLFacebookConnect::FB_POST_FAILED: // Error posting to the service - mStatusPostingErrorText->setVisible(true); + mStatusErrorText->setVisible(true); + status_text = LLTrans::getString("SocialFacebookErrorPosting"); + mStatusErrorText->setValue(status_text); break; } } -- cgit v1.2.3 From 073a7f5096d271f51885601d01bb1494daa6ff4a Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Tue, 9 Jul 2013 16:59:10 -0700 Subject: Layout tweaks of the social floater --- indra/newview/llfloatersocial.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index b90cc004d3..d8eb7c5e59 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -199,7 +199,6 @@ void LLSocialPhotoPanel::draw() if (previewp && previewp->getThumbnailImage()) { const LLRect& thumbnail_rect = mThumbnailPlaceholder->getRect(); - const LLRect& snapshot_rect = mSnapshotPanel->getRect(); const S32 thumbnail_w = previewp->getThumbnailWidth(); const S32 thumbnail_h = previewp->getThumbnailHeight(); @@ -208,7 +207,8 @@ void LLSocialPhotoPanel::draw() // calc preview offset within the floater rect S32 offset_x = thumbnail_rect.mLeft + local_offset_x; - S32 offset_y = thumbnail_rect.mBottom - (snapshot_rect.mTop - thumbnail_rect.mTop); + // Hack : "15" is to compensate for "top=8" of "stack_photo" and "top=7" of "tabs" + S32 offset_y = thumbnail_rect.mBottom - 15; mSnapshotPanel->localPointToOtherView(offset_x, offset_y, &offset_x, &offset_y, getParentByType()); -- cgit v1.2.3 From b22b47fde552d2b1951858b7a4707876744cf396 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 10 Jul 2013 19:26:42 -0700 Subject: ACME-671 : Disable social panel UX while transaction (Post or Connection) is ongoing --- indra/newview/llfloatersocial.cpp | 45 ++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 12 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index d8eb7c5e59..4c384efae1 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -71,7 +71,8 @@ std::string get_map_url() LLSocialStatusPanel::LLSocialStatusPanel() : mMessageTextEditor(NULL), - mPostStatusButton(NULL) + mPostButton(NULL), + mCancelButton(NULL) { mCommitCallbackRegistrar.add("SocialSharing.SendStatus", boost::bind(&LLSocialStatusPanel::onSend, this)); } @@ -79,18 +80,22 @@ LLSocialStatusPanel::LLSocialStatusPanel() : BOOL LLSocialStatusPanel::postBuild() { mMessageTextEditor = getChild("status_message"); - mPostStatusButton = getChild("post_status_btn"); + mPostButton = getChild("post_status_btn"); + mCancelButton = getChild("cancel_status_btn"); return LLPanel::postBuild(); } void LLSocialStatusPanel::draw() { - if (mMessageTextEditor && mPostStatusButton) + if (mMessageTextEditor && mPostButton && mCancelButton) { - std::string message = mMessageTextEditor->getValue().asString(); - mPostStatusButton->setEnabled(!message.empty()); - } + bool no_ongoing_connection = !(LLFacebookConnect::instance().isTransactionOngoing()); + std::string message = mMessageTextEditor->getValue().asString(); + mMessageTextEditor->setEnabled(no_ongoing_connection); + mCancelButton->setEnabled(no_ongoing_connection); + mPostButton->setEnabled(no_ongoing_connection && !message.empty()); + } LLPanel::draw(); } @@ -184,9 +189,10 @@ BOOL LLSocialPhotoPanel::postBuild() childSetAction("new_snapshot_btn", boost::bind(&LLSocialPhotoPanel::onClickNewSnapshot, this)); mWorkingLabel = getChild("working_lbl"); mThumbnailPlaceholder = getChild("thumbnail_placeholder"); - mCaptionTextBox = getChild("caption"); + mCaptionTextBox = getChild("photo_caption"); mLocationCheckbox = getChild("add_location_cb"); - mPostButton = getChild("post_btn"); + mPostButton = getChild("post_photo_btn"); + mCancelButton = getChild("cancel_photo_btn"); return LLPanel::postBuild(); } @@ -195,6 +201,14 @@ void LLSocialPhotoPanel::draw() { LLSnapshotLivePreview * previewp = static_cast(mPreviewHandle.get()); + bool no_ongoing_connection = !(LLFacebookConnect::instance().isTransactionOngoing()); + mPostButton->setEnabled(no_ongoing_connection); + mCancelButton->setEnabled(no_ongoing_connection); + mCaptionTextBox->setEnabled(no_ongoing_connection); + mResolutionComboBox->setEnabled(no_ongoing_connection); + mRefreshBtn->setEnabled(no_ongoing_connection); + mLocationCheckbox->setEnabled(no_ongoing_connection); + // Display the preview if one is available if (previewp && previewp->getThumbnailImage()) { @@ -471,6 +485,8 @@ BOOL LLSocialCheckinPanel::postBuild() { // Keep pointers to widgets so we don't traverse the UI hierarchy too often mPostButton = getChild("post_place_btn"); + mCancelButton = getChild("cancel_place_btn"); + mMessageTextEditor = getChild("place_caption"); mMapLoadingIndicator = getChild("map_loading_indicator"); mMapPlaceholder = getChild("map_placeholder"); mMapCheckBox = getChild("add_place_view_cb"); @@ -481,6 +497,11 @@ BOOL LLSocialCheckinPanel::postBuild() void LLSocialCheckinPanel::draw() { + bool no_ongoing_connection = !(LLFacebookConnect::instance().isTransactionOngoing()); + mPostButton->setEnabled(no_ongoing_connection); + mCancelButton->setEnabled(no_ongoing_connection); + mMessageTextEditor->setEnabled(no_ongoing_connection); + std::string map_url = get_map_url(); // Did we change location? if (map_url != mMapUrl) @@ -509,7 +530,7 @@ void LLSocialCheckinPanel::draw() // Now hide the loading indicator, bring the tile in view and reenable the checkbox with its previous value mMapLoadingIndicator->setVisible(false); mMapPlaceholder->setVisible(true); - mMapCheckBox->setEnabled(true); + mMapCheckBox->setEnabled(no_ongoing_connection); mMapCheckBox->set(mMapCheckBoxValue); } @@ -564,11 +585,11 @@ void LLSocialCheckinPanel::sendCheckin() LLAgentUI::buildLocationString(description, LLAgentUI::LOCATION_FORMAT_NORMAL_COORDS, gAgent.getPositionAgent()); // Optionally add the region map view - bool add_map_view = getChild("add_place_view_cb")->getValue().asBoolean(); + bool add_map_view = mMapCheckBox->getValue().asBoolean(); std::string map_url = (add_map_view ? get_map_url() : DEFAULT_CHECKIN_ICON_URL); // Get the caption - std::string caption = getChild("place_caption")->getValue().asString(); + std::string caption = mMessageTextEditor->getValue().asString(); // Post to Facebook LLFacebookConnect::instance().postCheckin(slurl_string, region_name, description, map_url, caption); @@ -576,7 +597,7 @@ void LLSocialCheckinPanel::sendCheckin() void LLSocialCheckinPanel::clearAndClose() { - getChild("place_caption")->setValue(""); + mMessageTextEditor->setValue(""); LLFloater* floater = getParentByType(); if (floater) -- cgit v1.2.3 From 0530eac42c8cbb4f41131e8d7796006b47ba1fa5 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 12 Jul 2013 17:57:31 -0700 Subject: ACME-701 : Align all social panels UX, recenter the preview in the photo panel --- indra/newview/llfloatersocial.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 4c384efae1..c8c203fc25 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -168,6 +168,7 @@ mLocationCheckbox(NULL), mPostButton(NULL) { mCommitCallbackRegistrar.add("SocialSharing.SendPhoto", boost::bind(&LLSocialPhotoPanel::onSend, this)); + mCommitCallbackRegistrar.add("SocialSharing.RefreshPhoto", boost::bind(&LLSocialPhotoPanel::onClickNewSnapshot, this)); } LLSocialPhotoPanel::~LLSocialPhotoPanel() @@ -186,7 +187,6 @@ BOOL LLSocialPhotoPanel::postBuild() mResolutionComboBox = getChild("resolution_combobox"); mResolutionComboBox->setCommitCallback(boost::bind(&LLSocialPhotoPanel::updateResolution, this, TRUE)); mRefreshBtn = getChild("new_snapshot_btn"); - childSetAction("new_snapshot_btn", boost::bind(&LLSocialPhotoPanel::onClickNewSnapshot, this)); mWorkingLabel = getChild("working_lbl"); mThumbnailPlaceholder = getChild("thumbnail_placeholder"); mCaptionTextBox = getChild("photo_caption"); @@ -217,15 +217,18 @@ void LLSocialPhotoPanel::draw() const S32 thumbnail_h = previewp->getThumbnailHeight(); // calc preview offset within the preview rect - const S32 local_offset_x = (thumbnail_rect.getWidth() - thumbnail_w) / 2 ; + const S32 local_offset_x = (thumbnail_rect.getWidth() - thumbnail_w) / 2 ; + const S32 local_offset_y = (thumbnail_rect.getHeight() - thumbnail_h) / 2 ; // calc preview offset within the floater rect - S32 offset_x = thumbnail_rect.mLeft + local_offset_x; - // Hack : "15" is to compensate for "top=8" of "stack_photo" and "top=7" of "tabs" - S32 offset_y = thumbnail_rect.mBottom - 15; - + // Hack : To get the full offset, we need to take into account each and every offset of each widgets up to the floater. + // This is almost as arbitrary as using a fixed offset so that's what we do here for the sake of simplicity. + // *TODO : Get the offset looking through the hierarchy of widgets, should be done in postBuild() so to avoid traversing the hierarchy each time. + S32 offset_x = thumbnail_rect.mLeft + local_offset_x - 1; + S32 offset_y = thumbnail_rect.mBottom + local_offset_y - 39; + mSnapshotPanel->localPointToOtherView(offset_x, offset_y, &offset_x, &offset_y, getParentByType()); - + gGL.matrixMode(LLRender::MM_MODELVIEW); // Apply floater transparency to the texture unless the floater is focused. F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency(); -- cgit v1.2.3 From 095c53fa060b3d336b408e8b87f30518c8db36cd Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Wed, 17 Jul 2013 17:50:54 -0700 Subject: ACME-731 Create the llsocialaccountpanel class to handle input/feedback. --- indra/newview/llfloatersocial.cpp | 77 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index c8c203fc25..66624f6355 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -48,6 +48,7 @@ static LLRegisterPanelClassWrapper t_panel_status("llsocialstatuspanel"); static LLRegisterPanelClassWrapper t_panel_photo("llsocialphotopanel"); static LLRegisterPanelClassWrapper t_panel_checkin("llsocialcheckinpanel"); +static LLRegisterPanelClassWrapper t_panel_account("llsocialaccountpanel"); const S32 MAX_POSTCARD_DATASIZE = 1024 * 1024; // one megabyte const std::string DEFAULT_CHECKIN_ICON_URL = "http://logok.org/wp-content/uploads/2010/07/podcastlogo1.jpg"; @@ -609,6 +610,82 @@ void LLSocialCheckinPanel::clearAndClose() } } +/////////////////////////// +//LLSocialAccountPanel////// +/////////////////////////// + +LLSocialAccountPanel::LLSocialAccountPanel() : +mAccountCaptionLabel(NULL), +mAccountNameLabel(NULL), +mPanelButtons(NULL), +mConnectButton(NULL), +mUseAnotherAccountButton(NULL), +mDisconnectButton(NULL) +{ + mCommitCallbackRegistrar.add("SocialSharing.Connect", boost::bind(&LLSocialAccountPanel::onConnect, this)); + mCommitCallbackRegistrar.add("SocialSharing.UseAnotherAccount", boost::bind(&LLSocialAccountPanel::onUseAnotherAccount, this)); + mCommitCallbackRegistrar.add("SocialSharing.Disconnect", boost::bind(&LLSocialAccountPanel::onDisconnect, this)); +} + +BOOL LLSocialAccountPanel::postBuild() +{ + mAccountCaptionLabel = getChild("account_caption_label"); + mAccountNameLabel = getChild("account_name_label"); + mPanelButtons = getChild("panel_buttons"); + mConnectButton = getChild("connect_btn"); + mUseAnotherAccountButton = getChild("use_another_account_btn"); + mDisconnectButton = getChild("disconnect_btn"); + + hideConnectButton(); + + return LLPanel::postBuild(); +} + +void LLSocialAccountPanel::showConnectButton() +{ + if(!mConnectButton->getVisible()) + { + mConnectButton->setVisible(TRUE); + LLRect mLayoutStackRect = mPanelButtons->getRect(); + F32 deltaTopPadding = mConnectButton->getRect().mBottom - mUseAnotherAccountButton->getRect().mTop; + mLayoutStackRect.translate(0, -(mConnectButton->getRect().getHeight() + deltaTopPadding)); + mPanelButtons->setRect(mLayoutStackRect); + + mUseAnotherAccountButton->setVisible(FALSE); + mDisconnectButton->setVisible(FALSE); + } +} + +void LLSocialAccountPanel::hideConnectButton() +{ + if(mConnectButton->getVisible()) + { + mConnectButton->setVisible(FALSE); + LLRect mLayoutStackRect = mPanelButtons->getRect(); + F32 deltaTopPadding = mConnectButton->getRect().mBottom - mUseAnotherAccountButton->getRect().mTop; + mLayoutStackRect.translate(0, mConnectButton->getRect().getHeight() + deltaTopPadding); + mPanelButtons->setRect(mLayoutStackRect); + + mUseAnotherAccountButton->setVisible(TRUE); + mDisconnectButton->setVisible(TRUE); + } +} + +void LLSocialAccountPanel::onConnect() +{ + hideConnectButton(); +} + +void LLSocialAccountPanel::onUseAnotherAccount() +{ + +} + +void LLSocialAccountPanel::onDisconnect() +{ + showConnectButton(); +} + //////////////////////// //LLFloaterSocial/////// //////////////////////// -- cgit v1.2.3 From b2e2282e988ab8c7d989d8554a41fda8b8c6e691 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Thu, 18 Jul 2013 16:13:14 -0700 Subject: ACME-727 Display 'Not connected to Facebook' when the user does not have a FB token --- indra/newview/llfloatersocial.cpp | 60 +++++++++++++++++++++++++++++++++++++-- 1 file changed, 57 insertions(+), 3 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 66624f6355..d64e4273f4 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -625,6 +625,8 @@ mDisconnectButton(NULL) mCommitCallbackRegistrar.add("SocialSharing.Connect", boost::bind(&LLSocialAccountPanel::onConnect, this)); mCommitCallbackRegistrar.add("SocialSharing.UseAnotherAccount", boost::bind(&LLSocialAccountPanel::onUseAnotherAccount, this)); mCommitCallbackRegistrar.add("SocialSharing.Disconnect", boost::bind(&LLSocialAccountPanel::onDisconnect, this)); + + setVisibleCallback(boost::bind(&LLSocialAccountPanel::onVisibilityChange, this, _2)); } BOOL LLSocialAccountPanel::postBuild() @@ -636,9 +638,61 @@ BOOL LLSocialAccountPanel::postBuild() mUseAnotherAccountButton = getChild("use_another_account_btn"); mDisconnectButton = getChild("disconnect_btn"); + return LLPanel::postBuild(); +} + +void LLSocialAccountPanel::onVisibilityChange(const LLSD& new_visibility) +{ + bool visible = new_visibility.asBoolean(); + + if(visible) + { + LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialAccountPanel"); + LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialAccountPanel", boost::bind(&LLSocialAccountPanel::onFacebookConnectStateChange, this, _1)); + + if(LLFacebookConnect::instance().isConnected()) + { hideConnectButton(); + mAccountCaptionLabel->setText(getString("facebook_connected")); + mAccountNameLabel->setText(std::string("[secondlife:/// Philippe Bossut]")); - return LLPanel::postBuild(); + } + else + { + mAccountCaptionLabel->setText(getString("facebook_disconnected")); + mAccountNameLabel->setText(std::string("")); + LLFacebookConnect::instance().checkConnectionToFacebook(); + } + } + else + { + LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialAccountPanel"); + } +} + +bool LLSocialAccountPanel::onFacebookConnectStateChange(const LLSD& data) +{ + + switch (data.get("enum").asInteger()) + { + case LLFacebookConnect::FB_CONNECTED: + case LLFacebookConnect::FB_POSTING: + case LLFacebookConnect::FB_POSTED: + case LLFacebookConnect::FB_POST_FAILED: + mAccountCaptionLabel->setText(getString("facebook_connected")); + mAccountNameLabel->setText(std::string("[secondlife:/// Philippe Bossut]")); + hideConnectButton(); + break; + case LLFacebookConnect::FB_NOT_CONNECTED: + case LLFacebookConnect::FB_CONNECTION_IN_PROGRESS: + case LLFacebookConnect::FB_CONNECTION_FAILED: + mAccountCaptionLabel->setText(getString("facebook_disconnected")); + mAccountNameLabel->setText(std::string("")); + showConnectButton(); + break; + } + + return false; } void LLSocialAccountPanel::showConnectButton() @@ -673,7 +727,7 @@ void LLSocialAccountPanel::hideConnectButton() void LLSocialAccountPanel::onConnect() { - hideConnectButton(); + LLFacebookConnect::instance().checkConnectionToFacebook(true); } void LLSocialAccountPanel::onUseAnotherAccount() @@ -683,7 +737,7 @@ void LLSocialAccountPanel::onUseAnotherAccount() void LLSocialAccountPanel::onDisconnect() { - showConnectButton(); + LLFacebookConnect::instance().disconnectFromFacebook(); } //////////////////////// -- cgit v1.2.3 From 03563fcaa17c0af776c49baaa59421921603cddd Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Thu, 18 Jul 2013 16:23:11 -0700 Subject: ACME-728: When the 'Disconnect' button is clicked the fbc-service disconnect route should be called --- indra/newview/llfloatersocial.cpp | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index d64e4273f4..e61d86c474 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -652,15 +652,11 @@ void LLSocialAccountPanel::onVisibilityChange(const LLSD& new_visibility) if(LLFacebookConnect::instance().isConnected()) { - hideConnectButton(); - mAccountCaptionLabel->setText(getString("facebook_connected")); - mAccountNameLabel->setText(std::string("[secondlife:/// Philippe Bossut]")); - + showConnectedLayout(); } else { - mAccountCaptionLabel->setText(getString("facebook_disconnected")); - mAccountNameLabel->setText(std::string("")); + showDisconnectedLayout(); LLFacebookConnect::instance().checkConnectionToFacebook(); } } @@ -679,16 +675,12 @@ bool LLSocialAccountPanel::onFacebookConnectStateChange(const LLSD& data) case LLFacebookConnect::FB_POSTING: case LLFacebookConnect::FB_POSTED: case LLFacebookConnect::FB_POST_FAILED: - mAccountCaptionLabel->setText(getString("facebook_connected")); - mAccountNameLabel->setText(std::string("[secondlife:/// Philippe Bossut]")); - hideConnectButton(); + showConnectedLayout(); break; case LLFacebookConnect::FB_NOT_CONNECTED: case LLFacebookConnect::FB_CONNECTION_IN_PROGRESS: case LLFacebookConnect::FB_CONNECTION_FAILED: - mAccountCaptionLabel->setText(getString("facebook_disconnected")); - mAccountNameLabel->setText(std::string("")); - showConnectButton(); + showDisconnectedLayout(); break; } @@ -725,6 +717,20 @@ void LLSocialAccountPanel::hideConnectButton() } } +void LLSocialAccountPanel::showDisconnectedLayout() +{ + mAccountCaptionLabel->setText(getString("facebook_disconnected")); + mAccountNameLabel->setText(std::string("")); + showConnectButton(); +} + +void LLSocialAccountPanel::showConnectedLayout() +{ + mAccountCaptionLabel->setText(getString("facebook_connected")); + mAccountNameLabel->setText(std::string("[secondlife:/// Philippe Bossut]")); + hideConnectButton(); +} + void LLSocialAccountPanel::onConnect() { LLFacebookConnect::instance().checkConnectionToFacebook(true); -- cgit v1.2.3 From c3c61018cd2d6547c4976c04edc4d3212cf3fb31 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Fri, 19 Jul 2013 16:36:55 -0700 Subject: ACME-732 Create the viewer side info route responder --- indra/newview/llfloatersocial.cpp | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index e61d86c474..d734518cbb 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -650,6 +650,11 @@ void LLSocialAccountPanel::onVisibilityChange(const LLSD& new_visibility) LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialAccountPanel"); LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialAccountPanel", boost::bind(&LLSocialAccountPanel::onFacebookConnectStateChange, this, _1)); + LLFacebookConnect::instance().loadFacebookInfo(); + + LLEventPumps::instance().obtain("FacebookConnectInfo").stopListening("LLSocialAccountPanel"); + LLEventPumps::instance().obtain("FacebookConnectInfo").listen("LLSocialAccountPanel", boost::bind(&LLSocialAccountPanel::onFacebookConnectInfoChange, this)); + if(LLFacebookConnect::instance().isConnected()) { showConnectedLayout(); @@ -663,6 +668,7 @@ void LLSocialAccountPanel::onVisibilityChange(const LLSD& new_visibility) else { LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialAccountPanel"); + LLEventPumps::instance().obtain("FacebookConnectInfo").stopListening("LLSocialAccountPanel"); } } @@ -687,6 +693,21 @@ bool LLSocialAccountPanel::onFacebookConnectStateChange(const LLSD& data) return false; } +bool LLSocialAccountPanel::onFacebookConnectInfoChange() +{ + LLSD info = LLFacebookConnect::instance().getInfo(); + std::string clickable_name; + + if(info.has("link") && info.has("name")) + { + clickable_name = "[" + info["link"].asString() + " " + info["name"].asString() + "]"; + } + + mAccountNameLabel->setText(clickable_name); + + return false; +} + void LLSocialAccountPanel::showConnectButton() { if(!mConnectButton->getVisible()) @@ -726,8 +747,9 @@ void LLSocialAccountPanel::showDisconnectedLayout() void LLSocialAccountPanel::showConnectedLayout() { + LLFacebookConnect::instance().loadFacebookInfo(); + mAccountCaptionLabel->setText(getString("facebook_connected")); - mAccountNameLabel->setText(std::string("[secondlife:/// Philippe Bossut]")); hideConnectButton(); } -- cgit v1.2.3 From 827553f314d411c489bd99048181be5f5ff16d89 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Mon, 22 Jul 2013 15:49:26 -0700 Subject: ACME-726: Display 'You are connected to Facebook as' text and the user's account name --- indra/newview/llfloatersocial.cpp | 10 ---------- 1 file changed, 10 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index d734518cbb..e93a560f8f 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -713,11 +713,6 @@ void LLSocialAccountPanel::showConnectButton() if(!mConnectButton->getVisible()) { mConnectButton->setVisible(TRUE); - LLRect mLayoutStackRect = mPanelButtons->getRect(); - F32 deltaTopPadding = mConnectButton->getRect().mBottom - mUseAnotherAccountButton->getRect().mTop; - mLayoutStackRect.translate(0, -(mConnectButton->getRect().getHeight() + deltaTopPadding)); - mPanelButtons->setRect(mLayoutStackRect); - mUseAnotherAccountButton->setVisible(FALSE); mDisconnectButton->setVisible(FALSE); } @@ -728,11 +723,6 @@ void LLSocialAccountPanel::hideConnectButton() if(mConnectButton->getVisible()) { mConnectButton->setVisible(FALSE); - LLRect mLayoutStackRect = mPanelButtons->getRect(); - F32 deltaTopPadding = mConnectButton->getRect().mBottom - mUseAnotherAccountButton->getRect().mTop; - mLayoutStackRect.translate(0, mConnectButton->getRect().getHeight() + deltaTopPadding); - mPanelButtons->setRect(mLayoutStackRect); - mUseAnotherAccountButton->setVisible(TRUE); mDisconnectButton->setVisible(TRUE); } -- cgit v1.2.3 From 58d107130b41d9e1380079db6f29578a56ee99fb Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 22 Jul 2013 17:25:21 -0700 Subject: ACME-741: Fixed: Do not try to get FB account info when the user is not connected to FB (otherwise, it autoconnects...) --- indra/newview/llfloatersocial.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index d734518cbb..acfb0960be 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -650,8 +650,6 @@ void LLSocialAccountPanel::onVisibilityChange(const LLSD& new_visibility) LLEventPumps::instance().obtain("FacebookConnectState").stopListening("LLSocialAccountPanel"); LLEventPumps::instance().obtain("FacebookConnectState").listen("LLSocialAccountPanel", boost::bind(&LLSocialAccountPanel::onFacebookConnectStateChange, this, _1)); - LLFacebookConnect::instance().loadFacebookInfo(); - LLEventPumps::instance().obtain("FacebookConnectInfo").stopListening("LLSocialAccountPanel"); LLEventPumps::instance().obtain("FacebookConnectInfo").listen("LLSocialAccountPanel", boost::bind(&LLSocialAccountPanel::onFacebookConnectInfoChange, this)); -- cgit v1.2.3 From 882b2508db4519b328016802ab72093df7911e68 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Mon, 22 Jul 2013 18:49:22 -0700 Subject: ACME-729 Implement the 'Use another account...' button --- indra/newview/llfloatersocial.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index e93a560f8f..f0bd1bb71a 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -750,7 +750,7 @@ void LLSocialAccountPanel::onConnect() void LLSocialAccountPanel::onUseAnotherAccount() { - + LLFacebookConnect::instance().disconnectThenConnectToFacebook(); } void LLSocialAccountPanel::onDisconnect() -- cgit v1.2.3 From 66522bb6bdff50f5f6838c1410e2cc4ab45a0a62 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Tue, 23 Jul 2013 13:31:41 -0700 Subject: ACME-677 Make the 'Connect...', 'Disconnect' and 'Use another account...' buttons disabled upon clicking --- indra/newview/llfloatersocial.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 2eb112d328..3c8d4d6fb9 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -641,6 +641,22 @@ BOOL LLSocialAccountPanel::postBuild() return LLPanel::postBuild(); } +void LLSocialAccountPanel::draw() +{ + LLFacebookConnect::EConnectionState connection_state = LLFacebookConnect::instance().getConnectionState(); + + //Disable the 'disconnect' button and the 'use another account' button when disconnecting in progress + bool disconnecting = connection_state == LLFacebookConnect::FB_DISCONNECTING; + mDisconnectButton->setEnabled(!disconnecting); + mUseAnotherAccountButton->setEnabled(!disconnecting); + + //Disable the 'connect' button when a connection is in progress + bool connecting = connection_state == LLFacebookConnect::FB_CONNECTION_IN_PROGRESS; + mConnectButton->setEnabled(!connecting); + + LLPanel::draw(); +} + void LLSocialAccountPanel::onVisibilityChange(const LLSD& new_visibility) { bool visible = new_visibility.asBoolean(); @@ -862,6 +878,13 @@ void LLFloaterSocial::draw() status_text = LLTrans::getString("SocialFacebookErrorPosting"); mStatusErrorText->setValue(status_text); break; + case LLFacebookConnect::FB_DISCONNECTING: + // Disconnecting loading indicator + mStatusLoadingText->setVisible(true); + status_text = LLTrans::getString("SocialFacebookDisconnecting"); + mStatusLoadingText->setValue(status_text); + mStatusLoadingIndicator->setVisible(true); + break; } } LLFloater::draw(); -- cgit v1.2.3 From 0254b74abfeadb1dea8b37435288512887baff0d Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Thu, 25 Jul 2013 16:04:58 -0700 Subject: ACME-773 Remove the 'Use another account...' in the ACCOUNT panel --- indra/newview/llfloatersocial.cpp | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 3c8d4d6fb9..129934ae16 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -44,6 +44,7 @@ #include "llsnapshotlivepreview.h" #include "llviewerregion.h" #include "llviewercontrol.h" +#include "llviewermedia.h" static LLRegisterPanelClassWrapper t_panel_status("llsocialstatuspanel"); static LLRegisterPanelClassWrapper t_panel_photo("llsocialphotopanel"); @@ -619,11 +620,9 @@ mAccountCaptionLabel(NULL), mAccountNameLabel(NULL), mPanelButtons(NULL), mConnectButton(NULL), -mUseAnotherAccountButton(NULL), mDisconnectButton(NULL) { mCommitCallbackRegistrar.add("SocialSharing.Connect", boost::bind(&LLSocialAccountPanel::onConnect, this)); - mCommitCallbackRegistrar.add("SocialSharing.UseAnotherAccount", boost::bind(&LLSocialAccountPanel::onUseAnotherAccount, this)); mCommitCallbackRegistrar.add("SocialSharing.Disconnect", boost::bind(&LLSocialAccountPanel::onDisconnect, this)); setVisibleCallback(boost::bind(&LLSocialAccountPanel::onVisibilityChange, this, _2)); @@ -635,7 +634,6 @@ BOOL LLSocialAccountPanel::postBuild() mAccountNameLabel = getChild("account_name_label"); mPanelButtons = getChild("panel_buttons"); mConnectButton = getChild("connect_btn"); - mUseAnotherAccountButton = getChild("use_another_account_btn"); mDisconnectButton = getChild("disconnect_btn"); return LLPanel::postBuild(); @@ -648,7 +646,6 @@ void LLSocialAccountPanel::draw() //Disable the 'disconnect' button and the 'use another account' button when disconnecting in progress bool disconnecting = connection_state == LLFacebookConnect::FB_DISCONNECTING; mDisconnectButton->setEnabled(!disconnecting); - mUseAnotherAccountButton->setEnabled(!disconnecting); //Disable the 'connect' button when a connection is in progress bool connecting = connection_state == LLFacebookConnect::FB_CONNECTION_IN_PROGRESS; @@ -669,10 +666,12 @@ void LLSocialAccountPanel::onVisibilityChange(const LLSD& new_visibility) LLEventPumps::instance().obtain("FacebookConnectInfo").stopListening("LLSocialAccountPanel"); LLEventPumps::instance().obtain("FacebookConnectInfo").listen("LLSocialAccountPanel", boost::bind(&LLSocialAccountPanel::onFacebookConnectInfoChange, this)); + //Connected if(LLFacebookConnect::instance().isConnected()) { showConnectedLayout(); } + //Check if connected (show disconnected layout in meantime) else { showDisconnectedLayout(); @@ -712,6 +711,7 @@ bool LLSocialAccountPanel::onFacebookConnectInfoChange() LLSD info = LLFacebookConnect::instance().getInfo(); std::string clickable_name; + //Strings of format [http://www.somewebsite.com Click Me] become clickable text if(info.has("link") && info.has("name")) { clickable_name = "[" + info["link"].asString() + " " + info["name"].asString() + "]"; @@ -727,7 +727,6 @@ void LLSocialAccountPanel::showConnectButton() if(!mConnectButton->getVisible()) { mConnectButton->setVisible(TRUE); - mUseAnotherAccountButton->setVisible(FALSE); mDisconnectButton->setVisible(FALSE); } } @@ -737,7 +736,6 @@ void LLSocialAccountPanel::hideConnectButton() if(mConnectButton->getVisible()) { mConnectButton->setVisible(FALSE); - mUseAnotherAccountButton->setVisible(TRUE); mDisconnectButton->setVisible(TRUE); } } @@ -760,11 +758,9 @@ void LLSocialAccountPanel::showConnectedLayout() void LLSocialAccountPanel::onConnect() { LLFacebookConnect::instance().checkConnectionToFacebook(true); -} -void LLSocialAccountPanel::onUseAnotherAccount() -{ - LLFacebookConnect::instance().disconnectThenConnectToFacebook(); + //Clears browser cookies so that the user must enter their FB creds when connecting/re-connecting + LLViewerMedia::clearAllCookies(); } void LLSocialAccountPanel::onDisconnect() -- cgit v1.2.3 From 7b56020d66d18145256752f9c8d66a20d02f960c Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Fri, 26 Jul 2013 18:49:31 -0700 Subject: ACME-755 Clear FB cookies by removing cookies from the .facebook.com domain --- indra/newview/llfloatersocial.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 129934ae16..8ca5043a35 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -39,6 +39,7 @@ #include "llresmgr.h" // LLLocale #include "llsdserialize.h" #include "llloadingindicator.h" +#include "llplugincookiestore.h" #include "llslurl.h" #include "lltrans.h" #include "llsnapshotlivepreview.h" @@ -759,8 +760,8 @@ void LLSocialAccountPanel::onConnect() { LLFacebookConnect::instance().checkConnectionToFacebook(true); - //Clears browser cookies so that the user must enter their FB creds when connecting/re-connecting - LLViewerMedia::clearAllCookies(); + //Clear only the facebook browser cookies so that the facebook login screen appears + LLViewerMedia::getCookieStore()->removeCookiesByDomain(".facebook.com"); } void LLSocialAccountPanel::onDisconnect() -- cgit v1.2.3 From a2b1e06c3def4a8a97a41f3379c336864ede21f8 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Wed, 31 Jul 2013 19:04:45 -0700 Subject: ACME-778: Adjusted the facebook code so that isConnected() does not depend on state changes. Instead it returns true if the user successfully connected and false if the user successfully disconnected. --- indra/newview/llfloatersocial.cpp | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 8ca5043a35..0041ee9d7e 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -688,20 +688,17 @@ void LLSocialAccountPanel::onVisibilityChange(const LLSD& new_visibility) bool LLSocialAccountPanel::onFacebookConnectStateChange(const LLSD& data) { - - switch (data.get("enum").asInteger()) + if(LLFacebookConnect::instance().isConnected()) { - case LLFacebookConnect::FB_CONNECTED: - case LLFacebookConnect::FB_POSTING: - case LLFacebookConnect::FB_POSTED: - case LLFacebookConnect::FB_POST_FAILED: + //In process of disconnecting so leave the layout as is + if(data.get("enum").asInteger() != LLFacebookConnect::FB_DISCONNECTING) + { showConnectedLayout(); - break; - case LLFacebookConnect::FB_NOT_CONNECTED: - case LLFacebookConnect::FB_CONNECTION_IN_PROGRESS: - case LLFacebookConnect::FB_CONNECTION_FAILED: - showDisconnectedLayout(); - break; + } + } + else + { + showDisconnectedLayout(); } return false; @@ -882,6 +879,12 @@ void LLFloaterSocial::draw() mStatusLoadingText->setValue(status_text); mStatusLoadingIndicator->setVisible(true); break; + case LLFacebookConnect::FB_DISCONNECT_FAILED: + // Error disconnecting from the service + mStatusErrorText->setVisible(true); + status_text = LLTrans::getString("SocialFacebookErrorDisconnecting"); + mStatusErrorText->setValue(status_text); + break; } } LLFloater::draw(); -- cgit v1.2.3 From 12bbf0e92251818c397bc4e33a26395b3ad98175 Mon Sep 17 00:00:00 2001 From: Gilbert Gonzales Date: Thu, 1 Aug 2013 11:41:55 -0700 Subject: ACME-773 Making cookie clearing occur during disc and connect. --- indra/newview/llfloatersocial.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 0041ee9d7e..4c8aec4e99 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -764,6 +764,8 @@ void LLSocialAccountPanel::onConnect() void LLSocialAccountPanel::onDisconnect() { LLFacebookConnect::instance().disconnectFromFacebook(); + + LLViewerMedia::getCookieStore()->removeCookiesByDomain(".facebook.com"); } //////////////////////// -- cgit v1.2.3 From dd70cc8f32aab7712f92198c43c8b4d86b8c5e73 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 2 Aug 2013 12:44:50 -0700 Subject: ACME : Fix a spurious crash when showing the Advanced->Shortcuts menu just after launch --- indra/newview/llfloatersocial.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 4c8aec4e99..4cbc9c0218 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -374,7 +374,7 @@ void LLSocialPhotoPanel::updateControls() LLSnapshotLivePreview* previewp = getPreviewView(); BOOL got_bytes = previewp && previewp->getDataSize() > 0; BOOL got_snap = previewp && previewp->getSnapshotUpToDate(); - LLSnapshotLivePreview::ESnapshotType shot_type = previewp->getSnapshotType(); + LLSnapshotLivePreview::ESnapshotType shot_type = (previewp ? previewp->getSnapshotType() : LLSnapshotLivePreview::SNAPSHOT_POSTCARD); // *TODO: Separate maximum size for Web images from postcards lldebugs << "Is snapshot up-to-date? " << got_snap << llendl; -- cgit v1.2.3 From 56b54aaf2954765f68c4fbe843495fdcdb918744 Mon Sep 17 00:00:00 2001 From: Cho Date: Sat, 3 Aug 2013 01:42:31 +0100 Subject: made checkin use a placeholder location URL when the given SLURL is not valid --- indra/newview/llfloatersocial.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 4cbc9c0218..eb9a7d2400 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -53,6 +53,7 @@ static LLRegisterPanelClassWrapper t_panel_checkin("llsoci static LLRegisterPanelClassWrapper t_panel_account("llsocialaccountpanel"); const S32 MAX_POSTCARD_DATASIZE = 1024 * 1024; // one megabyte +const std::string DEFAULT_CHECKIN_LOCATION_URL = "http://maps.secondlife.com/"; const std::string DEFAULT_CHECKIN_ICON_URL = "http://logok.org/wp-content/uploads/2010/07/podcastlogo1.jpg"; std::string get_map_url() @@ -582,6 +583,13 @@ void LLSocialCheckinPanel::sendCheckin() LLSLURL slurl; LLAgentUI::buildSLURL(slurl); std::string slurl_string = slurl.getSLURLString(); + + // Use a valid http:// URL if the scheme is secondlife:// + LLURI slurl_uri(slurl_string); + if (slurl_uri.scheme() == LLSLURL::SLURL_SECONDLIFE_SCHEME) + { + slurl_string = DEFAULT_CHECKIN_LOCATION_URL; + } // Get the region name std::string region_name = gAgent.getRegion()->getName(); -- cgit v1.2.3 From 35278461964653fc032995afdc366f096c937a14 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 2 Aug 2013 19:25:10 -0700 Subject: ACME-796 : Do not flip the fbc state to failure while connecting through web browser. Handle the dismiss case as best as possible. --- indra/newview/llfloatersocial.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index eb9a7d2400..59db93f4b2 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -684,8 +684,12 @@ void LLSocialAccountPanel::onVisibilityChange(const LLSD& new_visibility) else { showDisconnectedLayout(); - LLFacebookConnect::instance().checkConnectionToFacebook(); } + if ((LLFacebookConnect::instance().getConnectionState() == LLFacebookConnect::FB_NOT_CONNECTED) || + (LLFacebookConnect::instance().getConnectionState() == LLFacebookConnect::FB_CONNECTION_FAILED)) + { + LLFacebookConnect::instance().checkConnectionToFacebook(); + } } else { -- cgit v1.2.3 From 9167198312ac98f02640ecc3c445fa721413febd Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 7 Aug 2013 16:12:29 -0700 Subject: ACME-814 : Disable Post in Photo panel while the preview is processing --- indra/newview/llfloatersocial.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 59db93f4b2..937f76648d 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -205,8 +205,8 @@ void LLSocialPhotoPanel::draw() { LLSnapshotLivePreview * previewp = static_cast(mPreviewHandle.get()); + // Enable interaction only if no transaction with the service is on-going (prevent duplicated posts) bool no_ongoing_connection = !(LLFacebookConnect::instance().isTransactionOngoing()); - mPostButton->setEnabled(no_ongoing_connection); mCancelButton->setEnabled(no_ongoing_connection); mCaptionTextBox->setEnabled(no_ongoing_connection); mResolutionComboBox->setEnabled(no_ongoing_connection); @@ -247,6 +247,9 @@ void LLSocialPhotoPanel::draw() // Update the visibility of the working (computing preview) label mWorkingLabel->setVisible(!(previewp && previewp->getSnapshotUpToDate())); + // Enable Post if we have a preview to send and no on going connection being processed + mPostButton->setEnabled(no_ongoing_connection && (previewp && previewp->getSnapshotUpToDate())); + // Draw the rest of the panel on top of it LLPanel::draw(); } -- cgit v1.2.3 From 77baf98d12c75621f8b1d69824abf01b9aa260f7 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Wed, 7 Aug 2013 18:45:50 -0700 Subject: ACME-820 : Let checkin checkbox be available and swap tile map / default tile when toggling --- indra/newview/llfloatersocial.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 937f76648d..66a586b16b 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -499,8 +499,8 @@ BOOL LLSocialCheckinPanel::postBuild() mMessageTextEditor = getChild("place_caption"); mMapLoadingIndicator = getChild("map_loading_indicator"); mMapPlaceholder = getChild("map_placeholder"); + mMapDefault = getChild("map_default"); mMapCheckBox = getChild("add_place_view_cb"); - mMapCheckBoxValue = mMapCheckBox->get(); return LLPanel::postBuild(); } @@ -511,6 +511,7 @@ void LLSocialCheckinPanel::draw() mPostButton->setEnabled(no_ongoing_connection); mCancelButton->setEnabled(no_ongoing_connection); mMessageTextEditor->setEnabled(no_ongoing_connection); + mMapCheckBox->setEnabled(no_ongoing_connection); std::string map_url = get_map_url(); // Did we change location? @@ -524,9 +525,6 @@ void LLSocialCheckinPanel::draw() // In the meantime, put the "loading" indicator on, hide the tile map and disable the checkbox mMapLoadingIndicator->setVisible(true); mMapPlaceholder->setVisible(false); - mMapCheckBoxValue = mMapCheckBox->get(); - mMapCheckBox->set(false); - mMapCheckBox->setEnabled(false); } // Are we done loading the map tile? if (mReloadingMapTexture && mMapTexture->isFullyLoaded()) @@ -540,9 +538,10 @@ void LLSocialCheckinPanel::draw() // Now hide the loading indicator, bring the tile in view and reenable the checkbox with its previous value mMapLoadingIndicator->setVisible(false); mMapPlaceholder->setVisible(true); - mMapCheckBox->setEnabled(no_ongoing_connection); - mMapCheckBox->set(mMapCheckBoxValue); } + // Show the default icon if that's the checkbox value (the real one...) + // This will hide/show the loading indicator and/or tile underneath + mMapDefault->setVisible(!(mMapCheckBox->get())); LLPanel::draw(); } -- cgit v1.2.3 From abc2abf45dbe69daa0130ad823ca7184acc9d8df Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Mon, 12 Aug 2013 20:26:33 -0700 Subject: ACME-820 : Use the LL hosted default image for the default map tile in checkin --- indra/newview/llfloatersocial.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 66a586b16b..4c17d9e40d 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -54,7 +54,7 @@ static LLRegisterPanelClassWrapper t_panel_account("llsoci const S32 MAX_POSTCARD_DATASIZE = 1024 * 1024; // one megabyte const std::string DEFAULT_CHECKIN_LOCATION_URL = "http://maps.secondlife.com/"; -const std::string DEFAULT_CHECKIN_ICON_URL = "http://logok.org/wp-content/uploads/2010/07/podcastlogo1.jpg"; +const std::string DEFAULT_CHECKIN_ICON_URL = "http://map.secondlife.com.s3.amazonaws.com/map_placeholder.png"; std::string get_map_url() { -- cgit v1.2.3 From 6c45b3677ee06cd58056447a4b7b45fa78df8b74 Mon Sep 17 00:00:00 2001 From: Cho Date: Sat, 24 Aug 2013 02:15:08 +0100 Subject: added Google Analytics query parameters to URLs for FBC photos and checkins for ACME-854 --- indra/newview/llfloatersocial.cpp | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'indra/newview/llfloatersocial.cpp') diff --git a/indra/newview/llfloatersocial.cpp b/indra/newview/llfloatersocial.cpp index 4c17d9e40d..2a74c8e3ea 100644 --- a/indra/newview/llfloatersocial.cpp +++ b/indra/newview/llfloatersocial.cpp @@ -55,6 +55,8 @@ static LLRegisterPanelClassWrapper t_panel_account("llsoci const S32 MAX_POSTCARD_DATASIZE = 1024 * 1024; // one megabyte const std::string DEFAULT_CHECKIN_LOCATION_URL = "http://maps.secondlife.com/"; const std::string DEFAULT_CHECKIN_ICON_URL = "http://map.secondlife.com.s3.amazonaws.com/map_placeholder.png"; +const std::string DEFAULT_CHECKIN_QUERY_PARAMETERS = "?sourceid=slshare_checkin&utm_source=facebook&utm_medium=checkin&utm_campaign=slshare"; +const std::string DEFAULT_PHOTO_QUERY_PARAMETERS = "?sourceid=slshare_photo&utm_source=facebook&utm_medium=photo&utm_campaign=slshare"; std::string get_map_url() { @@ -345,12 +347,19 @@ void LLSocialPhotoPanel::sendPhoto() bool add_location = mLocationCheckbox->getValue().asBoolean(); if (add_location) { + // Get the SLURL for the location LLSLURL slurl; LLAgentUI::buildSLURL(slurl); + std::string slurl_string = slurl.getSLURLString(); + + // Add query parameters so Google Analytics can track incoming clicks! + slurl_string += DEFAULT_PHOTO_QUERY_PARAMETERS; + + // Add it to the caption (pretty crude, but we don't have a better option with photos) if (caption.empty()) - caption = slurl.getSLURLString(); + caption = slurl_string; else - caption = caption + " " + slurl.getSLURLString(); + caption = caption + " " + slurl_string; } // Get the image @@ -592,6 +601,9 @@ void LLSocialCheckinPanel::sendCheckin() { slurl_string = DEFAULT_CHECKIN_LOCATION_URL; } + + // Add query parameters so Google Analytics can track incoming clicks! + slurl_string += DEFAULT_CHECKIN_QUERY_PARAMETERS; // Get the region name std::string region_name = gAgent.getRegion()->getName(); -- cgit v1.2.3