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 ++++++++++++++++++++------------------- indra/newview/llfloatersocial.h | 1 - 2 files changed, 25 insertions(+), 24 deletions(-) (limited to 'indra/newview') 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() { diff --git a/indra/newview/llfloatersocial.h b/indra/newview/llfloatersocial.h index 95ba688430..89b9e2016a 100644 --- a/indra/newview/llfloatersocial.h +++ b/indra/newview/llfloatersocial.h @@ -110,7 +110,6 @@ public: LLFloaterSocial(const LLSD& key); BOOL postBuild(); void onCancel(); - void onOpen(const LLSD& key); static void preUpdate(); static void postUpdate(); -- cgit v1.2.3 From 1c7a7fe2d1c3f9399a6248551b7b2a8a7e68afdd Mon Sep 17 00:00:00 2001 From: Cho Date: Fri, 28 Jun 2013 23:08:03 +0100 Subject: removed FB photo sharing from snapshot floater for ACME-639 --- indra/newview/CMakeLists.txt | 1 - indra/newview/llpanelsnapshotfacebook.cpp | 139 -------------- indra/newview/llpanelsnapshotoptions.cpp | 7 - .../skins/default/xui/en/floater_snapshot.xml | 6 - .../default/xui/en/panel_snapshot_facebook.xml | 199 --------------------- .../default/xui/en/panel_snapshot_options.xml | 19 -- 6 files changed, 371 deletions(-) delete mode 100755 indra/newview/llpanelsnapshotfacebook.cpp delete mode 100755 indra/newview/skins/default/xui/en/panel_snapshot_facebook.xml (limited to 'indra/newview') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index f593375aed..3d6d315454 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -438,7 +438,6 @@ set(viewer_SOURCE_FILES llpanelprimmediacontrols.cpp llpanelprofile.cpp llpanelsnapshot.cpp - llpanelsnapshotfacebook.cpp llpanelsnapshotinventory.cpp llpanelsnapshotlocal.cpp llpanelsnapshotoptions.cpp diff --git a/indra/newview/llpanelsnapshotfacebook.cpp b/indra/newview/llpanelsnapshotfacebook.cpp deleted file mode 100755 index 94fbb986c0..0000000000 --- a/indra/newview/llpanelsnapshotfacebook.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/** - * @file llpanelsnapshotfacebook.cpp - * @brief Posts a snapshot to the resident Facebook account. - * - * $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" - -// libs -#include "llcombobox.h" -#include "llfloaterreg.h" -#include "llpanel.h" -#include "llspinctrl.h" - -// newview -#include "llfloatersnapshot.h" -#include "llpanelsnapshot.h" -#include "llsidetraypanelcontainer.h" -#include "llwebprofile.h" - -#include "llfacebookconnect.h" -#include "llslurl.h" -#include "llagentui.h" - -/** - * Posts a snapshot to the resident Facebook account. - */ -class LLPanelSnapshotFacebook -: public LLPanelSnapshot -{ - LOG_CLASS(LLPanelSnapshotFacebook); - -public: - LLPanelSnapshotFacebook(); - - /*virtual*/ BOOL postBuild(); - /*virtual*/ void onOpen(const LLSD& key); - -private: - /*virtual*/ void updateCustomResControls(); ///< Show/hide facebook custom controls - /*virtual*/ std::string getWidthSpinnerName() const { return "facebook_snapshot_width"; } - /*virtual*/ std::string getHeightSpinnerName() const { return "facebook_snapshot_height"; } - /*virtual*/ std::string getAspectRatioCBName() const { return "facebook_keep_aspect_check"; } - /*virtual*/ std::string getImageSizeComboName() const { return "facebook_size_combo"; } - /*virtual*/ std::string getImageSizePanelName() const { return "facebook_image_size_lp"; } - /*virtual*/ LLFloaterSnapshot::ESnapshotFormat getImageFormat() const { return LLFloaterSnapshot::SNAPSHOT_FORMAT_PNG; } - /*virtual*/ void updateControls(const LLSD& info); - - void onSend(); - void onImageUploaded(const std::string& caption, const std::string& image_url); -}; - -static LLRegisterPanelClassWrapper panel_class("llpanelsnapshotfacebook"); - -LLPanelSnapshotFacebook::LLPanelSnapshotFacebook() -{ - mCommitCallbackRegistrar.add("PostToFacebook.Send", boost::bind(&LLPanelSnapshotFacebook::onSend, this)); - mCommitCallbackRegistrar.add("PostToFacebook.Cancel", boost::bind(&LLPanelSnapshotFacebook::cancel, this)); -} - -// virtual -BOOL LLPanelSnapshotFacebook::postBuild() -{ - return LLPanelSnapshot::postBuild(); -} - -// virtual -void LLPanelSnapshotFacebook::onOpen(const LLSD& key) -{ - if (!LLFacebookConnect::instance().isConnected()) - { - LLFacebookConnect::instance().getConnectionToFacebook(true); - } - updateControls(key); - LLPanelSnapshot::onOpen(key); -} - -// virtual -void LLPanelSnapshotFacebook::updateControls(const LLSD& info) -{ - const bool have_snapshot = info.has("have-snapshot") ? info["have-snapshot"].asBoolean() : true; - const bool is_connected = LLFacebookConnect::instance().isConnected(); - getChild("post_btn")->setEnabled(have_snapshot && is_connected); -} - -// virtual -void LLPanelSnapshotFacebook::updateCustomResControls() -{ - LLPanelSnapshot::updateCustomResControls(); - const bool is_connected = LLFacebookConnect::instance().isConnected(); - getChild("post_btn")->setEnabled(is_connected); -} - -void LLPanelSnapshotFacebook::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(); -} - -void LLPanelSnapshotFacebook::onImageUploaded(const std::string& caption, const std::string& image_url) -{ - if (!image_url.empty()) - { - LLFacebookConnect::instance().sharePhoto(image_url, caption); - } -} diff --git a/indra/newview/llpanelsnapshotoptions.cpp b/indra/newview/llpanelsnapshotoptions.cpp index 14953f3cf9..554fabe5b3 100755 --- a/indra/newview/llpanelsnapshotoptions.cpp +++ b/indra/newview/llpanelsnapshotoptions.cpp @@ -51,7 +51,6 @@ private: void updateUploadCost(); void openPanel(const std::string& panel_name); void onSaveToProfile(); - void onSaveToFacebook(); void onSaveToEmail(); void onSaveToInventory(); void onSaveToComputer(); @@ -61,7 +60,6 @@ static LLRegisterPanelClassWrapper panel_class("llpanels LLPanelSnapshotOptions::LLPanelSnapshotOptions() { - mCommitCallbackRegistrar.add("Snapshot.SaveToFacebook", boost::bind(&LLPanelSnapshotOptions::onSaveToFacebook, this)); mCommitCallbackRegistrar.add("Snapshot.SaveToProfile", boost::bind(&LLPanelSnapshotOptions::onSaveToProfile, this)); mCommitCallbackRegistrar.add("Snapshot.SaveToEmail", boost::bind(&LLPanelSnapshotOptions::onSaveToEmail, this)); mCommitCallbackRegistrar.add("Snapshot.SaveToInventory", boost::bind(&LLPanelSnapshotOptions::onSaveToInventory, this)); @@ -101,11 +99,6 @@ void LLPanelSnapshotOptions::openPanel(const std::string& panel_name) LLFloaterSnapshot::postPanelSwitch(); } -void LLPanelSnapshotOptions::onSaveToFacebook() -{ - openPanel("panel_snapshot_facebook"); -} - void LLPanelSnapshotOptions::onSaveToProfile() { openPanel("panel_snapshot_profile"); diff --git a/indra/newview/skins/default/xui/en/floater_snapshot.xml b/indra/newview/skins/default/xui/en/floater_snapshot.xml index e8e7fb77c1..853c209bca 100755 --- a/indra/newview/skins/default/xui/en/floater_snapshot.xml +++ b/indra/newview/skins/default/xui/en/floater_snapshot.xml @@ -268,12 +268,6 @@ left="0" name="panel_snapshot_options" top="0" /> - - - - - Post to my Facebook timeline - - - - - - - - - - - - - - - - - - Caption: - - - - - - - - - diff --git a/indra/newview/skins/default/xui/en/panel_snapshot_options.xml b/indra/newview/skins/default/xui/en/panel_snapshot_options.xml index 8cf5bfb426..61c8c971c2 100755 --- a/indra/newview/skins/default/xui/en/panel_snapshot_options.xml +++ b/indra/newview/skins/default/xui/en/panel_snapshot_options.xml @@ -5,25 +5,6 @@ layout="topleft" name="panel_snapshot_options" width="490"> -