From e17b9de293084da0de0ce12290c9ae1939184337 Mon Sep 17 00:00:00 2001 From: Merov Linden Date: Fri, 31 May 2013 19:07:09 -0700 Subject: ACME-453, ACME-455, ACME-456, ACME-465 : Duplicate and tweak the Snapshot Profile UI to create the Snapshot Facebook UI --- indra/newview/CMakeLists.txt | 1 + indra/newview/llpanelsnapshotfacebook.cpp | 101 +++++++++++ indra/newview/llpanelsnapshotoptions.cpp | 7 + indra/newview/skins/default/textures/textures.xml | 1 + .../default/textures/toolbar_icons/facebook.png | Bin 0 -> 1180 bytes .../skins/default/xui/en/floater_snapshot.xml | 24 ++- .../default/xui/en/panel_snapshot_facebook.xml | 199 +++++++++++++++++++++ .../default/xui/en/panel_snapshot_options.xml | 23 ++- 8 files changed, 351 insertions(+), 5 deletions(-) create mode 100755 indra/newview/llpanelsnapshotfacebook.cpp create mode 100755 indra/newview/skins/default/textures/toolbar_icons/facebook.png create mode 100755 indra/newview/skins/default/xui/en/panel_snapshot_facebook.xml (limited to 'indra') diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt index 477600ca01..f01c2f714d 100755 --- a/indra/newview/CMakeLists.txt +++ b/indra/newview/CMakeLists.txt @@ -434,6 +434,7 @@ 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 new file mode 100755 index 0000000000..50c5b62fe7 --- /dev/null +++ b/indra/newview/llpanelsnapshotfacebook.cpp @@ -0,0 +1,101 @@ +/** + * @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" + +/** + * 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*/ 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(); +}; + +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) +{ + LLPanelSnapshot::onOpen(key); +} + +// virtual +void LLPanelSnapshotFacebook::updateControls(const LLSD& info) +{ + const bool have_snapshot = info.has("have-snapshot") ? info["have-snapshot"].asBoolean() : true; + getChild("post_btn")->setEnabled(have_snapshot); +} + +void LLPanelSnapshotFacebook::onSend() +{ + std::string caption = getChild("caption")->getValue().asString(); + bool add_location = getChild("add_location_cb")->getValue().asBoolean(); + + LLWebProfile::uploadImage(LLFloaterSnapshot::getImageData(), caption, add_location); + LLFloaterSnapshot::postSave(); +} diff --git a/indra/newview/llpanelsnapshotoptions.cpp b/indra/newview/llpanelsnapshotoptions.cpp index 554fabe5b3..14953f3cf9 100755 --- a/indra/newview/llpanelsnapshotoptions.cpp +++ b/indra/newview/llpanelsnapshotoptions.cpp @@ -51,6 +51,7 @@ private: void updateUploadCost(); void openPanel(const std::string& panel_name); void onSaveToProfile(); + void onSaveToFacebook(); void onSaveToEmail(); void onSaveToInventory(); void onSaveToComputer(); @@ -60,6 +61,7 @@ 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)); @@ -99,6 +101,11 @@ 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/textures/textures.xml b/indra/newview/skins/default/textures/textures.xml index 18146943a5..a0b46bab0b 100755 --- a/indra/newview/skins/default/textures/textures.xml +++ b/indra/newview/skins/default/textures/textures.xml @@ -567,6 +567,7 @@ with the same filename but different name + diff --git a/indra/newview/skins/default/textures/toolbar_icons/facebook.png b/indra/newview/skins/default/textures/toolbar_icons/facebook.png new file mode 100755 index 0000000000..32fe2bf8ac Binary files /dev/null and b/indra/newview/skins/default/textures/toolbar_icons/facebook.png differ diff --git a/indra/newview/skins/default/xui/en/floater_snapshot.xml b/indra/newview/skins/default/xui/en/floater_snapshot.xml index 49d64767cc..e8e7fb77c1 100755 --- a/indra/newview/skins/default/xui/en/floater_snapshot.xml +++ b/indra/newview/skins/default/xui/en/floater_snapshot.xml @@ -21,7 +21,11 @@ Sending Email + name="facebook_progress_str"> + Posting to Facebook + + Posting + name="facebook_succeeded_str"> + Image uploaded + + Image uploaded + name="facebook_failed_str"> + Failed to upload image to your Facebook timeline. + + Failed to upload image to your Profile Feed. + + + + + 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 d2f29ade44..8cf5bfb426 100755 --- a/indra/newview/skins/default/xui/en/panel_snapshot_options.xml +++ b/indra/newview/skins/default/xui/en/panel_snapshot_options.xml @@ -5,6 +5,25 @@ layout="topleft" name="panel_snapshot_options" width="490"> + -- cgit v1.2.3