From 60af7c826caf3b96548988fc9ffbc3a12e227fb4 Mon Sep 17 00:00:00 2001 From: Mnikolenko ProductEngine Date: Tue, 3 Feb 2015 13:16:26 +0200 Subject: MAINT-4812 FIXED Remove sending snapshot as email from the viewer. --- indra/newview/llfloatersnapshot.cpp | 29 +-- indra/newview/llfloatersnapshot.h | 1 - indra/newview/llpanelsnapshotoptions.cpp | 7 - indra/newview/llpanelsnapshotpostcard.cpp | 244 --------------------- indra/newview/llsnapshotlivepreview.cpp | 2 +- indra/newview/llsnapshotlivepreview.h | 2 +- indra/newview/llviewermessage.cpp | 1 - .../default/xui/de/panel_snapshot_postcard.xml | 21 -- .../skins/default/xui/en/floater_snapshot.xml | 6 - .../default/xui/en/panel_snapshot_options.xml | 17 -- .../default/xui/en/panel_snapshot_postcard.xml | 103 --------- .../default/xui/es/panel_snapshot_postcard.xml | 17 -- .../default/xui/fr/panel_snapshot_postcard.xml | 17 -- .../default/xui/it/panel_snapshot_postcard.xml | 17 -- .../default/xui/ja/panel_snapshot_postcard.xml | 17 -- .../default/xui/pt/panel_snapshot_postcard.xml | 17 -- .../default/xui/ru/panel_snapshot_postcard.xml | 17 -- .../default/xui/tr/panel_snapshot_postcard.xml | 17 -- .../default/xui/zh/panel_snapshot_postcard.xml | 17 -- 19 files changed, 4 insertions(+), 565 deletions(-) delete mode 100755 indra/newview/llpanelsnapshotpostcard.cpp delete mode 100755 indra/newview/skins/default/xui/de/panel_snapshot_postcard.xml delete mode 100755 indra/newview/skins/default/xui/en/panel_snapshot_postcard.xml delete mode 100755 indra/newview/skins/default/xui/es/panel_snapshot_postcard.xml delete mode 100755 indra/newview/skins/default/xui/fr/panel_snapshot_postcard.xml delete mode 100755 indra/newview/skins/default/xui/it/panel_snapshot_postcard.xml delete mode 100755 indra/newview/skins/default/xui/ja/panel_snapshot_postcard.xml delete mode 100755 indra/newview/skins/default/xui/pt/panel_snapshot_postcard.xml delete mode 100755 indra/newview/skins/default/xui/ru/panel_snapshot_postcard.xml delete mode 100755 indra/newview/skins/default/xui/tr/panel_snapshot_postcard.xml delete mode 100755 indra/newview/skins/default/xui/zh/panel_snapshot_postcard.xml (limited to 'indra') diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp index 1d0ddc2ced..08a0b74494 100755 --- a/indra/newview/llfloatersnapshot.cpp +++ b/indra/newview/llfloatersnapshot.cpp @@ -169,11 +169,7 @@ LLSnapshotLivePreview::ESnapshotType LLFloaterSnapshot::Impl::getActiveSnapshotT name = spanel->getName(); } - if (name == "panel_snapshot_postcard") - { - type = LLSnapshotLivePreview::SNAPSHOT_POSTCARD; - } - else if (name == "panel_snapshot_inventory") + if (name == "panel_snapshot_inventory") { type = LLSnapshotLivePreview::SNAPSHOT_TEXTURE; } @@ -424,7 +420,6 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) } LLSnapshotLivePreview* previewp = getPreviewView(floater); - BOOL got_bytes = previewp && previewp->getDataSize() > 0; BOOL got_snap = previewp && previewp->getSnapshotUpToDate(); // *TODO: Separate maximum size for Web images from postcards @@ -447,10 +442,7 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) } floater->getChild("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : floater->getString("unknown")); - floater->getChild("file_size_label")->setColor( - shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD - && got_bytes - && previewp->getDataSize() > MAX_POSTCARD_DATASIZE ? LLUIColor(LLColor4::red) : LLUIColorTable::instance().getColor( "LabelTextColor" )); + floater->getChild("file_size_label")->setColor(LLUIColorTable::instance().getColor( "LabelTextColor" )); // Update the width and height spinners based on the corresponding resolution combos. (?) switch(shot_type) @@ -460,11 +452,6 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater) floater->getChild("layer_types")->setValue("colors"); setResolution(floater, "profile_size_combo"); break; - case LLSnapshotLivePreview::SNAPSHOT_POSTCARD: - layer_type = LLViewerWindow::SNAPSHOT_TYPE_COLOR; - floater->getChild("layer_types")->setValue("colors"); - setResolution(floater, "postcard_size_combo"); - break; case LLSnapshotLivePreview::SNAPSHOT_TEXTURE: layer_type = LLViewerWindow::SNAPSHOT_TYPE_COLOR; floater->getChild("layer_types")->setValue("colors"); @@ -1452,18 +1439,6 @@ const LLVector3d& LLFloaterSnapshot::getPosTakenGlobal() return previewp->getPosTakenGlobal(); } -// static -void LLFloaterSnapshot::setAgentEmail(const std::string& email) -{ - LLFloaterSnapshot* instance = findInstance(); - if (instance) - { - LLSideTrayPanelContainer* panel_container = instance->getChild("panel_container"); - LLPanel* postcard_panel = panel_container->getPanelByName("panel_snapshot_postcard"); - postcard_panel->notify(LLSD().with("agent-email", email)); - } -} - ///---------------------------------------------------------------------------- /// Class LLSnapshotFloaterView ///---------------------------------------------------------------------------- diff --git a/indra/newview/llfloatersnapshot.h b/indra/newview/llfloatersnapshot.h index 0bb9474bb5..5bcf1d3099 100755 --- a/indra/newview/llfloatersnapshot.h +++ b/indra/newview/llfloatersnapshot.h @@ -63,7 +63,6 @@ public: static void postPanelSwitch(); static LLPointer getImageData(); static const LLVector3d& getPosTakenGlobal(); - static void setAgentEmail(const std::string& email); static const LLRect& getThumbnailPlaceholderRect() { return sThumbnailPlaceholder->getRect(); } diff --git a/indra/newview/llpanelsnapshotoptions.cpp b/indra/newview/llpanelsnapshotoptions.cpp index 0fc9ceec83..f41bdd8881 100755 --- a/indra/newview/llpanelsnapshotoptions.cpp +++ b/indra/newview/llpanelsnapshotoptions.cpp @@ -56,7 +56,6 @@ private: void updateUploadCost(); void openPanel(const std::string& panel_name); void onSaveToProfile(); - void onSaveToEmail(); void onSaveToInventory(); void onSaveToComputer(); void onSendToFacebook(); @@ -69,7 +68,6 @@ static LLPanelInjector panel_class("llpanelsnapshotoptio LLPanelSnapshotOptions::LLPanelSnapshotOptions() { 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)); mCommitCallbackRegistrar.add("Snapshot.SaveToComputer", boost::bind(&LLPanelSnapshotOptions::onSaveToComputer, this)); mCommitCallbackRegistrar.add("Snapshot.SendToFacebook", boost::bind(&LLPanelSnapshotOptions::onSendToFacebook, this)); @@ -120,11 +118,6 @@ void LLPanelSnapshotOptions::onSaveToProfile() openPanel("panel_snapshot_profile"); } -void LLPanelSnapshotOptions::onSaveToEmail() -{ - openPanel("panel_snapshot_postcard"); -} - void LLPanelSnapshotOptions::onSaveToInventory() { openPanel("panel_snapshot_inventory"); diff --git a/indra/newview/llpanelsnapshotpostcard.cpp b/indra/newview/llpanelsnapshotpostcard.cpp deleted file mode 100755 index 8e37b1418c..0000000000 --- a/indra/newview/llpanelsnapshotpostcard.cpp +++ /dev/null @@ -1,244 +0,0 @@ -/** - * @file llpanelsnapshotpostcard.cpp - * @brief Postcard sending panel. - * - * $LicenseInfo:firstyear=2011&license=viewerlgpl$ - * Second Life Viewer Source Code - * Copyright (C) 2011, 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 "llcombobox.h" -#include "llnotificationsutil.h" -#include "llsidetraypanelcontainer.h" -#include "llsliderctrl.h" -#include "llspinctrl.h" -#include "lltexteditor.h" - -#include "llagent.h" -#include "llagentui.h" -#include "llfloatersnapshot.h" // FIXME: replace with a snapshot storage model -#include "llpanelsnapshot.h" -#include "llpostcard.h" -#include "llviewercontrol.h" // gSavedSettings -#include "llviewerwindow.h" - -#include - -/** - * Sends postcard via email. - */ -class LLPanelSnapshotPostcard -: public LLPanelSnapshot -{ - LOG_CLASS(LLPanelSnapshotPostcard); - -public: - LLPanelSnapshotPostcard(); - /*virtual*/ BOOL postBuild(); - /*virtual*/ void onOpen(const LLSD& key); - /*virtual*/ S32 notify(const LLSD& info); - -private: - /*virtual*/ std::string getWidthSpinnerName() const { return "postcard_snapshot_width"; } - /*virtual*/ std::string getHeightSpinnerName() const { return "postcard_snapshot_height"; } - /*virtual*/ std::string getAspectRatioCBName() const { return "postcard_keep_aspect_check"; } - /*virtual*/ std::string getImageSizeComboName() const { return "postcard_size_combo"; } - /*virtual*/ std::string getImageSizePanelName() const { return "postcard_image_size_lp"; } - /*virtual*/ LLFloaterSnapshot::ESnapshotFormat getImageFormat() const { return LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG; } - /*virtual*/ void updateControls(const LLSD& info); - - bool missingSubjMsgAlertCallback(const LLSD& notification, const LLSD& response); - void sendPostcard(); - - void onMsgFormFocusRecieved(); - void onFormatComboCommit(LLUICtrl* ctrl); - void onQualitySliderCommit(LLUICtrl* ctrl); - void onSend(); - - bool mHasFirstMsgFocus; - std::string mAgentEmail; -}; - -static LLPanelInjector panel_class("llpanelsnapshotpostcard"); - -LLPanelSnapshotPostcard::LLPanelSnapshotPostcard() -: mHasFirstMsgFocus(false) -{ - mCommitCallbackRegistrar.add("Postcard.Send", boost::bind(&LLPanelSnapshotPostcard::onSend, this)); - mCommitCallbackRegistrar.add("Postcard.Cancel", boost::bind(&LLPanelSnapshotPostcard::cancel, this)); - -} - -// virtual -BOOL LLPanelSnapshotPostcard::postBuild() -{ - // pick up the user's up-to-date email address - gAgent.sendAgentUserInfoRequest(); - - std::string name_string; - LLAgentUI::buildFullname(name_string); - getChild("name_form")->setValue(LLSD(name_string)); - - // For the first time a user focuses to .the msg box, all text will be selected. - getChild("msg_form")->setFocusChangedCallback(boost::bind(&LLPanelSnapshotPostcard::onMsgFormFocusRecieved, this)); - - getChild("to_form")->setFocus(TRUE); - - getChild("image_quality_slider")->setCommitCallback(boost::bind(&LLPanelSnapshotPostcard::onQualitySliderCommit, this, _1)); - - return LLPanelSnapshot::postBuild(); -} - -// virtual -void LLPanelSnapshotPostcard::onOpen(const LLSD& key) -{ - LLPanelSnapshot::onOpen(key); -} - -// virtual -S32 LLPanelSnapshotPostcard::notify(const LLSD& info) -{ - if (!info.has("agent-email")) - { - llassert(info.has("agent-email")); - return 0; - } - - if (mAgentEmail.empty()) - { - mAgentEmail = info["agent-email"].asString(); - } - - return 1; -} - -// virtual -void LLPanelSnapshotPostcard::updateControls(const LLSD& info) -{ - getChild("image_quality_slider")->setValue(gSavedSettings.getS32("SnapshotQuality")); - updateImageQualityLevel(); - - const bool have_snapshot = info.has("have-snapshot") ? info["have-snapshot"].asBoolean() : true; - getChild("send_btn")->setEnabled(have_snapshot); -} - -bool LLPanelSnapshotPostcard::missingSubjMsgAlertCallback(const LLSD& notification, const LLSD& response) -{ - S32 option = LLNotificationsUtil::getSelectedOption(notification, response); - if(0 == option) - { - // User clicked OK - if((getChild("subject_form")->getValue().asString()).empty()) - { - // Stuff the subject back into the form. - getChild("subject_form")->setValue(getString("default_subject")); - } - - if (!mHasFirstMsgFocus) - { - // The user never switched focus to the message window. - // Using the default string. - getChild("msg_form")->setValue(getString("default_message")); - } - - sendPostcard(); - } - return false; -} - - -void LLPanelSnapshotPostcard::sendPostcard() -{ - std::string to(getChild("to_form")->getValue().asString()); - std::string subject(getChild("subject_form")->getValue().asString()); - - LLSD postcard = LLSD::emptyMap(); - postcard["pos-global"] = LLFloaterSnapshot::getPosTakenGlobal().getValue(); - postcard["to"] = to; - postcard["from"] = mAgentEmail; - postcard["name"] = getChild("name_form")->getValue().asString(); - postcard["subject"] = subject; - postcard["msg"] = getChild("msg_form")->getValue().asString(); - LLPostCard::send(LLFloaterSnapshot::getImageData(), postcard); - - // Give user feedback of the event. - gViewerWindow->playSnapshotAnimAndSound(); - - LLFloaterSnapshot::postSave(); -} - -void LLPanelSnapshotPostcard::onMsgFormFocusRecieved() -{ - LLTextEditor* msg_form = getChild("msg_form"); - if (msg_form->hasFocus() && !mHasFirstMsgFocus) - { - mHasFirstMsgFocus = true; - msg_form->setText(LLStringUtil::null); - } -} - -void LLPanelSnapshotPostcard::onFormatComboCommit(LLUICtrl* ctrl) -{ - // will call updateControls() - LLFloaterSnapshot::getInstance()->notify(LLSD().with("image-format-change", true)); -} - -void LLPanelSnapshotPostcard::onQualitySliderCommit(LLUICtrl* ctrl) -{ - updateImageQualityLevel(); - - LLSliderCtrl* slider = (LLSliderCtrl*)ctrl; - S32 quality_val = llfloor((F32)slider->getValue().asReal()); - LLSD info; - info["image-quality-change"] = quality_val; - LLFloaterSnapshot::getInstance()->notify(info); // updates the "SnapshotQuality" setting -} - -void LLPanelSnapshotPostcard::onSend() -{ - // Validate input. - std::string to(getChild("to_form")->getValue().asString()); - - boost::regex email_format("[A-Za-z0-9.%+-_]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,}(,[ \t]*[A-Za-z0-9.%+-_]+@[A-Za-z0-9.-]+\\.[A-Za-z]{2,})*"); - - if (to.empty() || !boost::regex_match(to, email_format)) - { - LLNotificationsUtil::add("PromptRecipientEmail"); - return; - } - - if (mAgentEmail.empty() || !boost::regex_match(mAgentEmail, email_format)) - { - LLNotificationsUtil::add("PromptSelfEmail"); - return; - } - - std::string subject(getChild("subject_form")->getValue().asString()); - if(subject.empty() || !mHasFirstMsgFocus) - { - LLNotificationsUtil::add("PromptMissingSubjMsg", LLSD(), LLSD(), boost::bind(&LLPanelSnapshotPostcard::missingSubjMsgAlertCallback, this, _1, _2)); - return; - } - - // Send postcard. - sendPostcard(); -} diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp index 050b88413d..234e922104 100644 --- a/indra/newview/llsnapshotlivepreview.cpp +++ b/indra/newview/llsnapshotlivepreview.cpp @@ -86,7 +86,7 @@ LLSnapshotLivePreview::LLSnapshotLivePreview (const LLSnapshotLivePreview::Param mNeedsFlash(TRUE), mSnapshotQuality(gSavedSettings.getS32("SnapshotQuality")), mDataSize(0), - mSnapshotType(SNAPSHOT_POSTCARD), + mSnapshotType(SNAPSHOT_LOCAL), mSnapshotFormat(LLFloaterSnapshot::ESnapshotFormat(gSavedSettings.getS32("SnapshotFormat"))), mSnapshotUpToDate(FALSE), mCameraPos(LLViewerCamera::getInstance()->getOrigin()), diff --git a/indra/newview/llsnapshotlivepreview.h b/indra/newview/llsnapshotlivepreview.h index fed33bf37c..f479de59d4 100644 --- a/indra/newview/llsnapshotlivepreview.h +++ b/indra/newview/llsnapshotlivepreview.h @@ -42,7 +42,7 @@ class LLSnapshotLivePreview : public LLView public: enum ESnapshotType { - SNAPSHOT_POSTCARD, + SNAPSHOT_POSTCARD_DEPRECIATED, SNAPSHOT_TEXTURE, SNAPSHOT_LOCAL, SNAPSHOT_WEB diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index 0fbecd5180..056114cb6b 100755 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -7109,7 +7109,6 @@ void process_user_info_reply(LLMessageSystem* msg, void**) msg->getString( "UserData", "DirectoryVisibility", dir_visibility); LLFloaterPreference::updateUserInfo(dir_visibility, im_via_email); - LLFloaterSnapshot::setAgentEmail(email); } diff --git a/indra/newview/skins/default/xui/de/panel_snapshot_postcard.xml b/indra/newview/skins/default/xui/de/panel_snapshot_postcard.xml deleted file mode 100755 index ead56f2885..0000000000 --- a/indra/newview/skins/default/xui/de/panel_snapshot_postcard.xml +++ /dev/null @@ -1,21 +0,0 @@ - - - - Postkarte aus [SECOND_LIFE]. - - - Sehen Sie mal! - - - Senden... - - - E-Mail - - - - - - - \ No newline at end of file diff --git a/indra/newview/skins/default/xui/en/panel_snapshot_postcard.xml b/indra/newview/skins/default/xui/en/panel_snapshot_postcard.xml deleted file mode 100755 index 975b08be05..0000000000 --- a/indra/newview/skins/default/xui/en/panel_snapshot_postcard.xml +++ /dev/null @@ -1,103 +0,0 @@ - - - - Postcard from [SECOND_LIFE]. - - - Check this out! - - - Sending... - - - - E-mail - - - - - - - - - \ No newline at end of file diff --git a/indra/newview/skins/default/xui/es/panel_snapshot_postcard.xml b/indra/newview/skins/default/xui/es/panel_snapshot_postcard.xml deleted file mode 100755 index 649d547ba0..0000000000 --- a/indra/newview/skins/default/xui/es/panel_snapshot_postcard.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - Postal desde [SECOND_LIFE]. - - - ¡Mira esto! - - - Enviando... - - - Correo-e - -