diff options
Diffstat (limited to 'indra/newview')
-rwxr-xr-x | indra/newview/CMakeLists.txt | 1 | ||||
-rw-r--r-- | indra/newview/llfloatersocial.cpp | 48 | ||||
-rw-r--r-- | indra/newview/llfloatersocial.h | 1 | ||||
-rwxr-xr-x | indra/newview/llpanelsnapshotfacebook.cpp | 139 | ||||
-rwxr-xr-x | indra/newview/llpanelsnapshotoptions.cpp | 7 | ||||
-rwxr-xr-x | indra/newview/skins/default/xui/en/floater_snapshot.xml | 6 | ||||
-rwxr-xr-x | indra/newview/skins/default/xui/en/panel_snapshot_facebook.xml | 199 | ||||
-rwxr-xr-x | indra/newview/skins/default/xui/en/panel_snapshot_options.xml | 19 |
8 files changed, 25 insertions, 395 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 1f43debe1b..09285bc8f8 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/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(); 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<LLPanelSnapshotFacebook> 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<LLUICtrl>("post_btn")->setEnabled(have_snapshot && is_connected); -} - -// virtual -void LLPanelSnapshotFacebook::updateCustomResControls() -{ - LLPanelSnapshot::updateCustomResControls(); - const bool is_connected = LLFacebookConnect::instance().isConnected(); - getChild<LLUICtrl>("post_btn")->setEnabled(is_connected); -} - -void LLPanelSnapshotFacebook::onSend() -{ - std::string caption = getChild<LLUICtrl>("caption")->getValue().asString(); - bool add_location = getChild<LLUICtrl>("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<LLPanelSnapshotOptions> 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 @@ -269,12 +269,6 @@ name="panel_snapshot_options" top="0" /> <panel - class="llpanelsnapshotfacebook" - follows="all" - layout="topleft" - name="panel_snapshot_facebook" - filename="panel_snapshot_facebook.xml" /> - <panel class="llpanelsnapshotprofile" follows="all" layout="topleft" diff --git a/indra/newview/skins/default/xui/en/panel_snapshot_facebook.xml b/indra/newview/skins/default/xui/en/panel_snapshot_facebook.xml deleted file mode 100755 index 7a89ed69b5..0000000000 --- a/indra/newview/skins/default/xui/en/panel_snapshot_facebook.xml +++ /dev/null @@ -1,199 +0,0 @@ -<?xml version="1.0" encoding="utf-8" standalone="yes" ?> -<panel - height="380" - layout="topleft" - name="panel_snapshot_facebook" - width="490"> - <icon - follows="top|left" - height="18" - image_name="Snapshot_Facebook" - layout="topleft" - left="12" - mouse_opaque="true" - name="title_icon" - top="5" - width="18" /> - <text - follows="top|left|right" - font="SansSerifBold" - height="20" - layout="topleft" - left_pad="12" - length="1" - name="title" - right="-10" - text_color="white" - type="string" - top_delta="4"> - Post to my Facebook timeline - </text> - <view_border - bevel_style="in" - follows="left|top|right" - height="1" - left="10" - layout="topleft" - name="hr" - right="-10" - top_pad="5" - /> - <combo_box - follows="left|top" - height="23" - label="Resolution" - layout="topleft" - left_delta="0" - name="facebook_size_combo" - top_pad="10" - width="250"> - <combo_box.item - label="Current Window" - name="CurrentWindow" - value="[i0,i0]" /> - <combo_box.item - label="640x480" - name="640x480" - value="[i640,i480]" /> - <combo_box.item - label="800x600" - name="800x600" - value="[i800,i600]" /> - <combo_box.item - label="1024x768" - name="1024x768" - value="[i1024,i768]" /> - <combo_box.item - label="Custom" - name="Custom" - value="[i-1,i-1]" /> - </combo_box> - <layout_stack - animate="false" - follows="all" - height="270" - layout="bottomleft" - name="facebook_image_params_ls" - left_delta="0" - orientation="vertical" - top_pad="10" - right="-10"> - <layout_panel - follows="top|left|right" - height="55" - layout="topleft" - left="0" - name="facebook_image_size_lp" - auto_resize="false" - top="0" - right="-1" - visible="true"> - <spinner - allow_text_entry="false" - decimal_digits="0" - follows="left|top" - height="20" - increment="32" - label="Width" - label_width="40" - layout="topleft" - left="10" - max_val="6016" - min_val="32" - name="facebook_snapshot_width" - top_pad="10" - width="95" /> - <spinner - allow_text_entry="false" - decimal_digits="0" - follows="left|top" - height="20" - increment="32" - label="Height" - label_width="40" - layout="topleft" - left_pad="5" - max_val="6016" - min_val="32" - name="facebook_snapshot_height" - top_delta="0" - width="95" /> - <check_box - height="10" - bottom_delta="20" - label="Constrain proportions" - layout="topleft" - left="10" - name="facebook_keep_aspect_check" /> - </layout_panel> - <layout_panel - follows="top|left|right" - height="200" - layout="topleft" - left="0" - name="facebook_image_metadata_lp" - auto_resize="true" - top="0" - right="-1" - visible="true"> - <text - length="1" - follows="top|left|right" - font="SansSerif" - height="16" - layout="topleft" - left="0" - name="caption_label" - right="-10" - top_pad="0" - type="string"> - Caption: - </text> - <text_editor - follows="all" - height="155" - layout="topleft" - left_delta="0" - length="1" - max_length="700" - name="caption" - right="-10" - top_pad="5" - type="string" - word_wrap="true"> - </text_editor> - <check_box - follows="left|bottom" - initial_value="true" - label="Include location" - layout="topleft" - left_delta="0" - name="add_location_cb" - top_pad="15" /> - </layout_panel> - </layout_stack> - <button - follows="right|bottom" - height="23" - label="Cancel" - layout="topleft" - name="cancel_btn" - right="-32" - top="350" - width="100"> - <button.commit_callback - function="SocialSharing.Cancel" /> - </button> - <button - follows="right|bottom" - height="23" - label="Post" - layout="topleft" - left_delta="-106" - name="post_btn" - top_delta="0" - width="100"> - <button.commit_callback - function="SocialSharing.SendPhoto" /> - </button> -</panel> 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"> - <button - follows="left|top|right" - font="SansSerif" - halign="left" - height="38" - image_overlay="Snapshot_Facebook" - image_overlay_alignment="left" - image_top_pad="-2" - imgoverlay_label_space="10" - label="Post to my Facebook timeline" - layout="topleft" - left="10" - name="save_to_facebook_btn" - pad_left="10" - right="-10" - top="5"> - <button.commit_callback - function="Snapshot.SaveToFacebook" /> - </button> <button follows="left|top|right" font="SansSerif" |