summaryrefslogtreecommitdiff
path: root/indra/newview/llfloatersnapshot.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llfloatersnapshot.cpp')
-rw-r--r--indra/newview/llfloatersnapshot.cpp332
1 files changed, 218 insertions, 114 deletions
diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp
index f3baa482a0..36e8ad9dfc 100644
--- a/indra/newview/llfloatersnapshot.cpp
+++ b/indra/newview/llfloatersnapshot.cpp
@@ -2,31 +2,25 @@
* @file llfloatersnapshot.cpp
* @brief Snapshot preview window, allowing saving, e-mailing, etc.
*
- * $LicenseInfo:firstyear=2004&license=viewergpl$
- *
- * Copyright (c) 2004-2009, Linden Research, Inc.
- *
+ * $LicenseInfo:firstyear=2004&license=viewerlgpl$
* Second Life Viewer Source Code
- * The source code in this file ("Source Code") is provided by Linden Lab
- * to you under the terms of the GNU General Public License, version 2.0
- * ("GPL"), unless you have obtained a separate licensing agreement
- * ("Other License"), formally executed by you and Linden Lab. Terms of
- * the GPL can be found in doc/GPL-license.txt in this distribution, or
- * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+ * Copyright (C) 2010, Linden Research, Inc.
*
- * There are special exceptions to the terms and conditions of the GPL as
- * it is applied to this Source Code. View the full text of the exception
- * in the file doc/FLOSS-exception.txt in this software distribution, or
- * online at
- * http://secondlifegrid.net/programs/open_source/licensing/flossexception
+ * 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.
*
- * By copying, modifying or distributing this software, you acknowledge
- * that you have read and understood your obligations described above,
- * and agree to abide by those obligations.
+ * 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.
*
- * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
- * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
- * COMPLETENESS OR PERFORMANCE.
+ * 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$
*/
@@ -41,11 +35,13 @@
#include "llagentcamera.h"
#include "llcallbacklist.h"
#include "llcriticaldamp.h"
+#include "llfloaterperms.h"
#include "llui.h"
#include "llfocusmgr.h"
#include "llbutton.h"
#include "llcombobox.h"
#include "lleconomy.h"
+#include "lllandmarkactions.h"
#include "llsliderctrl.h"
#include "llspinctrl.h"
#include "llviewercontrol.h"
@@ -59,6 +55,7 @@
#include "llradiogroup.h"
#include "lltoolfocus.h"
#include "lltoolmgr.h"
+#include "llwebsharing.h"
#include "llworld.h"
#include "llagentui.h"
@@ -86,8 +83,8 @@
///----------------------------------------------------------------------------
/// Local function declarations, constants, enums, and typedefs
///----------------------------------------------------------------------------
-S32 LLFloaterSnapshot::sUIWinHeightLong = 526 ;
-S32 LLFloaterSnapshot::sUIWinHeightShort = LLFloaterSnapshot::sUIWinHeightLong - 230 ;
+S32 LLFloaterSnapshot::sUIWinHeightLong = 530 ;
+S32 LLFloaterSnapshot::sUIWinHeightShort = LLFloaterSnapshot::sUIWinHeightLong - 240 ;
S32 LLFloaterSnapshot::sUIWinWidth = 215 ;
LLSnapshotFloaterView* gSnapshotFloaterView = NULL;
@@ -115,7 +112,8 @@ public:
{
SNAPSHOT_POSTCARD,
SNAPSHOT_TEXTURE,
- SNAPSHOT_LOCAL
+ SNAPSHOT_LOCAL,
+ SNAPSHOT_WEB
};
@@ -161,6 +159,7 @@ public:
void setSnapshotQuality(S32 quality);
void setSnapshotBufferType(LLViewerWindow::ESnapshotType type) { mSnapshotBufferType = type; }
void updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail = FALSE, F32 delay = 0.f);
+ void saveWeb();
LLFloaterPostcard* savePostcard();
void saveTexture();
BOOL saveLocal();
@@ -173,6 +172,9 @@ public:
// Returns TRUE when snapshot generated, FALSE otherwise.
static BOOL onIdle( void* snapshot_preview );
+ // callback for region name resolve
+ void regionNameCallback(LLImageJPEG* snapshot, LLSD& metadata, const std::string& name, S32 x, S32 y, S32 z);
+
private:
LLColor4 mColor;
LLPointer<LLViewerTexture> mViewerImage[2]; //used to represent the scene when the frame is frozen.
@@ -826,9 +828,19 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview )
// delete any existing image
previewp->mFormattedImage = NULL;
// now create the new one of the appropriate format.
- // note: postcards hardcoded to use jpeg always.
- LLFloaterSnapshot::ESnapshotFormat format = previewp->getSnapshotType() == SNAPSHOT_POSTCARD
- ? LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG : previewp->getSnapshotFormat();
+ // note: postcards and web hardcoded to use jpeg always.
+ LLFloaterSnapshot::ESnapshotFormat format;
+
+ if (previewp->getSnapshotType() == SNAPSHOT_POSTCARD ||
+ previewp->getSnapshotType() == SNAPSHOT_WEB)
+ {
+ format = LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG;
+ }
+ else
+ {
+ format = previewp->getSnapshotFormat();
+ }
+
switch(format)
{
case LLFloaterSnapshot::SNAPSHOT_FORMAT_PNG:
@@ -988,8 +1000,8 @@ void LLSnapshotLivePreview::saveTexture()
LLFolderType::FT_SNAPSHOT_CATEGORY,
LLInventoryType::IT_SNAPSHOT,
PERM_ALL, // Note: Snapshots to inventory is a special case of content upload
- PERM_NONE, // that ignores the user's premissions preferences and continues to
- PERM_NONE, // always use these fairly permissive hard-coded initial perms. - MG
+ LLFloaterPerms::getGroupPerms(), // that is more permissive than other uploads
+ LLFloaterPerms::getEveryonePerms(),
"Snapshot : " + pos_string,
callback, expected_upload_cost, userdata);
gViewerWindow->playSnapshotAnimAndSound();
@@ -1021,6 +1033,33 @@ BOOL LLSnapshotLivePreview::saveLocal()
return success;
}
+void LLSnapshotLivePreview::saveWeb()
+{
+ // *FIX: Will break if the window closes because of CloseSnapshotOnKeep!
+ // Needs to pass on ownership of the image.
+ LLImageJPEG* jpg = dynamic_cast<LLImageJPEG*>(mFormattedImage.get());
+ if(!jpg)
+ {
+ llwarns << "Formatted image not a JPEG" << llendl;
+ return;
+ }
+
+ LLSD metadata;
+ metadata["description"] = getChild<LLLineEditor>("description")->getText();
+
+ LLLandmarkActions::getRegionNameAndCoordsFromPosGlobal(gAgentCamera.getCameraPositionGlobal(),
+ boost::bind(&LLSnapshotLivePreview::regionNameCallback, this, jpg, metadata, _1, _2, _3, _4));
+
+ gViewerWindow->playSnapshotAnimAndSound();
+}
+
+void LLSnapshotLivePreview::regionNameCallback(LLImageJPEG* snapshot, LLSD& metadata, const std::string& name, S32 x, S32 y, S32 z)
+{
+ metadata["slurl"] = LLSLURL(name, LLVector3d(x, y, z)).getSLURLString();
+
+ LLWebSharing::instance().shareSnapshot(snapshot, metadata);
+}
+
///----------------------------------------------------------------------------
/// Class LLFloaterSnapshot::Impl
///----------------------------------------------------------------------------
@@ -1071,6 +1110,7 @@ public:
private:
static LLSnapshotLivePreview::ESnapshotType getTypeIndex(LLFloaterSnapshot* floater);
+ static LLSD getTypeName(LLSnapshotLivePreview::ESnapshotType index);
static ESnapshotFormat getFormatIndex(LLFloaterSnapshot* floater);
static LLViewerWindow::ESnapshotType getLayerType(LLFloaterSnapshot* floater);
static void comboSetCustom(LLFloaterSnapshot *floater, const std::string& comboname);
@@ -1096,17 +1136,51 @@ LLSnapshotLivePreview* LLFloaterSnapshot::Impl::getPreviewView(LLFloaterSnapshot
LLSnapshotLivePreview::ESnapshotType LLFloaterSnapshot::Impl::getTypeIndex(LLFloaterSnapshot* floater)
{
LLSnapshotLivePreview::ESnapshotType index = LLSnapshotLivePreview::SNAPSHOT_POSTCARD;
- LLSD value = floater->childGetValue("snapshot_type_radio");
+ LLSD value = floater->getChild<LLUICtrl>("snapshot_type_radio")->getValue();
+
const std::string id = value.asString();
if (id == "postcard")
+ {
index = LLSnapshotLivePreview::SNAPSHOT_POSTCARD;
+ }
else if (id == "texture")
+ {
index = LLSnapshotLivePreview::SNAPSHOT_TEXTURE;
+ }
else if (id == "local")
+ {
index = LLSnapshotLivePreview::SNAPSHOT_LOCAL;
+ }
+ else if (id == "share_to_web")
+ {
+ index = LLSnapshotLivePreview::SNAPSHOT_WEB;
+ }
+
return index;
}
+// static
+LLSD LLFloaterSnapshot::Impl::getTypeName(LLSnapshotLivePreview::ESnapshotType index)
+{
+ std::string id;
+ switch (index)
+ {
+ case LLSnapshotLivePreview::SNAPSHOT_WEB:
+ id = "share_to_web";
+ break;
+ case LLSnapshotLivePreview::SNAPSHOT_POSTCARD:
+ id = "postcard";
+ break;
+ case LLSnapshotLivePreview::SNAPSHOT_TEXTURE:
+ id = "texture";
+ break;
+ case LLSnapshotLivePreview::SNAPSHOT_LOCAL:
+ default:
+ id = "local";
+ break;
+ }
+ return LLSD(id);
+}
// static
LLFloaterSnapshot::ESnapshotFormat LLFloaterSnapshot::Impl::getFormatIndex(LLFloaterSnapshot* floater)
@@ -1132,7 +1206,7 @@ LLFloaterSnapshot::ESnapshotFormat LLFloaterSnapshot::Impl::getFormatIndex(LLFlo
LLViewerWindow::ESnapshotType LLFloaterSnapshot::Impl::getLayerType(LLFloaterSnapshot* floater)
{
LLViewerWindow::ESnapshotType type = LLViewerWindow::SNAPSHOT_TYPE_COLOR;
- LLSD value = floater->childGetValue("layer_types");
+ LLSD value = floater->getChild<LLUICtrl>("layer_types")->getValue();
const std::string id = value.asString();
if (id == "colors")
type = LLViewerWindow::SNAPSHOT_TYPE_COLOR;
@@ -1175,7 +1249,7 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp)
previewp->setSize(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw());
}
- bool use_freeze_frame = floaterp->childGetValue("freeze_frame_check").asBoolean();
+ bool use_freeze_frame = floaterp->getChild<LLUICtrl>("freeze_frame_check")->getValue().asBoolean();
if (use_freeze_frame)
{
@@ -1243,56 +1317,64 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp)
void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)
{
LLRadioGroup* snapshot_type_radio = floater->getChild<LLRadioGroup>("snapshot_type_radio");
- snapshot_type_radio->setSelectedIndex(gSavedSettings.getS32("LastSnapshotType"));
- LLSnapshotLivePreview::ESnapshotType shot_type = getTypeIndex(floater);
- ESnapshotFormat shot_format = (ESnapshotFormat)gSavedSettings.getS32("SnapshotFormat"); //getFormatIndex(floater); LLViewerWindow::ESnapshotType layer_type = getLayerType(floater);
+ LLSnapshotLivePreview::ESnapshotType shot_type = (LLSnapshotLivePreview::ESnapshotType)gSavedSettings.getS32("LastSnapshotType");
+ snapshot_type_radio->setSelectedByValue(getTypeName(shot_type), true);
+
+ ESnapshotFormat shot_format = (ESnapshotFormat)gSavedSettings.getS32("SnapshotFormat");
LLViewerWindow::ESnapshotType layer_type = getLayerType(floater);
- floater->childSetVisible("postcard_size_combo", FALSE);
- floater->childSetVisible("texture_size_combo", FALSE);
- floater->childSetVisible("local_size_combo", FALSE);
+ floater->getChildView("share_to_web")->setVisible( gSavedSettings.getBOOL("SnapshotSharingEnabled"));
+
+ floater->getChildView("postcard_size_combo")->setVisible( FALSE);
+ floater->getChildView("texture_size_combo")->setVisible( FALSE);
+ floater->getChildView("local_size_combo")->setVisible( FALSE);
floater->getChild<LLComboBox>("postcard_size_combo")->selectNthItem(gSavedSettings.getS32("SnapshotPostcardLastResolution"));
floater->getChild<LLComboBox>("texture_size_combo")->selectNthItem(gSavedSettings.getS32("SnapshotTextureLastResolution"));
floater->getChild<LLComboBox>("local_size_combo")->selectNthItem(gSavedSettings.getS32("SnapshotLocalLastResolution"));
floater->getChild<LLComboBox>("local_format_combo")->selectNthItem(gSavedSettings.getS32("SnapshotFormat"));
- floater->childSetVisible("upload_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_TEXTURE);
- floater->childSetVisible("send_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD);
- floater->childSetVisible("save_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL);
- floater->childSetEnabled("keep_aspect_check", shot_type != LLSnapshotLivePreview::SNAPSHOT_TEXTURE && !floater->impl.mAspectRatioCheckOff);
- floater->childSetEnabled("layer_types", shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL);
+ // *TODO: Separate settings for Web images from postcards
+ floater->getChildView("send_btn")->setVisible( shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD ||
+ shot_type == LLSnapshotLivePreview::SNAPSHOT_WEB);
+ floater->getChildView("upload_btn")->setVisible(shot_type == LLSnapshotLivePreview::SNAPSHOT_TEXTURE);
+ floater->getChildView("save_btn")->setVisible( shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL);
+ floater->getChildView("keep_aspect_check")->setEnabled(shot_type != LLSnapshotLivePreview::SNAPSHOT_TEXTURE && !floater->impl.mAspectRatioCheckOff);
+ floater->getChildView("layer_types")->setEnabled(shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL);
BOOL is_advance = gSavedSettings.getBOOL("AdvanceSnapshot");
BOOL is_local = shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL;
- BOOL show_slider =
- shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD
- || (is_local && shot_format == LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG);
-
- floater->childSetVisible("more_btn", !is_advance); // the only item hidden in advanced mode
- floater->childSetVisible("less_btn", is_advance);
- floater->childSetVisible("type_label2", is_advance);
- floater->childSetVisible("format_label", is_advance && is_local);
- floater->childSetVisible("local_format_combo", is_advance && is_local);
- floater->childSetVisible("layer_types", is_advance);
- floater->childSetVisible("layer_type_label", is_advance);
- floater->childSetVisible("snapshot_width", is_advance);
- floater->childSetVisible("snapshot_height", is_advance);
- floater->childSetVisible("keep_aspect_check", is_advance);
- floater->childSetVisible("ui_check", is_advance);
- floater->childSetVisible("hud_check", is_advance);
- floater->childSetVisible("keep_open_check", is_advance);
- floater->childSetVisible("freeze_frame_check", is_advance);
- floater->childSetVisible("auto_snapshot_check", is_advance);
- floater->childSetVisible("image_quality_slider", is_advance && show_slider);
+ BOOL show_slider = (shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD ||
+ shot_type == LLSnapshotLivePreview::SNAPSHOT_WEB ||
+ (is_local && shot_format == LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG));
+
+ floater->getChildView("more_btn")->setVisible( !is_advance); // the only item hidden in advanced mode
+ floater->getChildView("less_btn")->setVisible( is_advance);
+ floater->getChildView("type_label2")->setVisible( is_advance);
+ floater->getChildView("format_label")->setVisible( is_advance && is_local);
+ floater->getChildView("local_format_combo")->setVisible( is_advance && is_local);
+ floater->getChildView("layer_types")->setVisible( is_advance);
+ floater->getChildView("layer_type_label")->setVisible( is_advance);
+ floater->getChildView("snapshot_width")->setVisible( is_advance);
+ floater->getChildView("snapshot_height")->setVisible( is_advance);
+ floater->getChildView("keep_aspect_check")->setVisible( is_advance);
+ floater->getChildView("ui_check")->setVisible( is_advance);
+ floater->getChildView("hud_check")->setVisible( is_advance);
+ floater->getChildView("keep_open_check")->setVisible( is_advance);
+ floater->getChildView("freeze_frame_check")->setVisible( is_advance);
+ floater->getChildView("auto_snapshot_check")->setVisible( is_advance);
+ floater->getChildView("image_quality_slider")->setVisible( is_advance && show_slider);
LLSnapshotLivePreview* previewp = getPreviewView(floater);
BOOL got_bytes = previewp && previewp->getDataSize() > 0;
BOOL got_snap = previewp && previewp->getSnapshotUpToDate();
- floater->childSetEnabled("send_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD && got_snap && previewp->getDataSize() <= MAX_POSTCARD_DATASIZE);
- floater->childSetEnabled("upload_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_TEXTURE && got_snap);
- floater->childSetEnabled("save_btn", shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL && got_snap);
+ // *TODO: Separate maximum size for Web images from postcards
+ floater->getChildView("send_btn")->setEnabled((shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD ||
+ shot_type == LLSnapshotLivePreview::SNAPSHOT_WEB) &&
+ got_snap && previewp->getDataSize() <= MAX_POSTCARD_DATASIZE);
+ floater->getChildView("upload_btn")->setEnabled(shot_type == LLSnapshotLivePreview::SNAPSHOT_TEXTURE && got_snap);
+ floater->getChildView("save_btn")->setEnabled(shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL && got_snap);
LLLocale locale(LLLocale::USER_LOCALE);
std::string bytes_string;
@@ -1301,19 +1383,21 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)
LLResMgr::getInstance()->getIntegerString(bytes_string, (previewp->getDataSize()) >> 10 );
}
S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
- floater->childSetLabelArg("texture", "[AMOUNT]", llformat("%d",upload_cost));
- floater->childSetLabelArg("upload_btn", "[AMOUNT]", llformat("%d",upload_cost));
- floater->childSetTextArg("file_size_label", "[SIZE]", got_snap ? bytes_string : floater->getString("unknown"));
- floater->childSetColor("file_size_label",
+ floater->getChild<LLUICtrl>("texture")->setLabelArg("[AMOUNT]", llformat("%d",upload_cost));
+ floater->getChild<LLUICtrl>("upload_btn")->setLabelArg("[AMOUNT]", llformat("%d",upload_cost));
+ floater->getChild<LLUICtrl>("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : floater->getString("unknown"));
+ floater->getChild<LLUICtrl>("file_size_label")->setColor(
shot_type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD
&& got_bytes
&& previewp->getDataSize() > MAX_POSTCARD_DATASIZE ? LLUIColor(LLColor4::red) : LLUIColorTable::instance().getColor( "LabelTextColor" ));
switch(shot_type)
{
+ // *TODO: Separate settings for Web images from postcards
+ case LLSnapshotLivePreview::SNAPSHOT_WEB:
case LLSnapshotLivePreview::SNAPSHOT_POSTCARD:
layer_type = LLViewerWindow::SNAPSHOT_TYPE_COLOR;
- floater->childSetValue("layer_types", "colors");
+ floater->getChild<LLUICtrl>("layer_types")->setValue("colors");
if(is_advance)
{
setResolution(floater, "postcard_size_combo");
@@ -1321,7 +1405,7 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)
break;
case LLSnapshotLivePreview::SNAPSHOT_TEXTURE:
layer_type = LLViewerWindow::SNAPSHOT_TYPE_COLOR;
- floater->childSetValue("layer_types", "colors");
+ floater->getChild<LLUICtrl>("layer_types")->setValue("colors");
if(is_advance)
{
setResolution(floater, "texture_size_combo");
@@ -1402,28 +1486,39 @@ void LLFloaterSnapshot::Impl::onClickKeep(void* data)
{
LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;
LLSnapshotLivePreview* previewp = getPreviewView(view);
-
+
if (previewp)
{
- if (previewp->getSnapshotType() == LLSnapshotLivePreview::SNAPSHOT_POSTCARD)
+ switch (previewp->getSnapshotType())
{
- LLFloaterPostcard* floater = previewp->savePostcard();
- // if still in snapshot mode, put postcard floater in snapshot floaterview
- // and link it to snapshot floater
- if (floater && !gSavedSettings.getBOOL("CloseSnapshotOnKeep"))
+ case LLSnapshotLivePreview::SNAPSHOT_WEB:
+ previewp->saveWeb();
+ break;
+
+ case LLSnapshotLivePreview::SNAPSHOT_POSTCARD:
{
- gFloaterView->removeChild(floater);
- gSnapshotFloaterView->addChild(floater);
- view->addDependentFloater(floater, FALSE);
+ LLFloaterPostcard* floater = previewp->savePostcard();
+ // if still in snapshot mode, put postcard floater in snapshot floaterview
+ // and link it to snapshot floater
+ if (floater && !gSavedSettings.getBOOL("CloseSnapshotOnKeep"))
+ {
+ gFloaterView->removeChild(floater);
+ gSnapshotFloaterView->addChild(floater);
+ view->addDependentFloater(floater, FALSE);
+ }
}
- }
- else if (previewp->getSnapshotType() == LLSnapshotLivePreview::SNAPSHOT_TEXTURE)
- {
+ break;
+
+ case LLSnapshotLivePreview::SNAPSHOT_TEXTURE:
previewp->saveTexture();
- }
- else
- {
+ break;
+
+ case LLSnapshotLivePreview::SNAPSHOT_LOCAL:
previewp->saveLocal();
+ break;
+
+ default:
+ break;
}
if (gSavedSettings.getBOOL("CloseSnapshotOnKeep"))
@@ -1610,7 +1705,7 @@ void LLFloaterSnapshot::Impl::checkAspectRatio(LLFloaterSnapshot *view, S32 inde
if(0 == index) //current window size
{
view->impl.mAspectRatioCheckOff = true ;
- view->childSetEnabled("keep_aspect_check", FALSE) ;
+ view->getChildView("keep_aspect_check")->setEnabled(FALSE) ;
if(previewp)
{
@@ -1622,7 +1717,7 @@ void LLFloaterSnapshot::Impl::checkAspectRatio(LLFloaterSnapshot *view, S32 inde
view->impl.mAspectRatioCheckOff = false ;
//if(LLSnapshotLivePreview::SNAPSHOT_TEXTURE != gSavedSettings.getS32("LastSnapshotType"))
{
- view->childSetEnabled("keep_aspect_check", TRUE) ;
+ view->getChildView("keep_aspect_check")->setEnabled(TRUE) ;
if(previewp)
{
@@ -1633,7 +1728,7 @@ void LLFloaterSnapshot::Impl::checkAspectRatio(LLFloaterSnapshot *view, S32 inde
else
{
view->impl.mAspectRatioCheckOff = true ;
- view->childSetEnabled("keep_aspect_check", FALSE) ;
+ view->getChildView("keep_aspect_check")->setEnabled(FALSE) ;
if(previewp)
{
@@ -1648,18 +1743,22 @@ static std::string lastSnapshotWidthName()
{
switch(gSavedSettings.getS32("LastSnapshotType"))
{
- case LLSnapshotLivePreview::SNAPSHOT_POSTCARD: return "LastSnapshotToEmailWidth";
- case LLSnapshotLivePreview::SNAPSHOT_TEXTURE: return "LastSnapshotToInventoryWidth";
- default: return "LastSnapshotToDiskWidth";
+ // *TODO: Separate settings for Web snapshots and postcards
+ case LLSnapshotLivePreview::SNAPSHOT_WEB: return "LastSnapshotToEmailWidth";
+ case LLSnapshotLivePreview::SNAPSHOT_POSTCARD: return "LastSnapshotToEmailWidth";
+ case LLSnapshotLivePreview::SNAPSHOT_TEXTURE: return "LastSnapshotToInventoryWidth";
+ default: return "LastSnapshotToDiskWidth";
}
}
static std::string lastSnapshotHeightName()
{
switch(gSavedSettings.getS32("LastSnapshotType"))
{
- case LLSnapshotLivePreview::SNAPSHOT_POSTCARD: return "LastSnapshotToEmailHeight";
- case LLSnapshotLivePreview::SNAPSHOT_TEXTURE: return "LastSnapshotToInventoryHeight";
- default: return "LastSnapshotToDiskHeight";
+ // *TODO: Separate settings for Web snapshots and postcards
+ case LLSnapshotLivePreview::SNAPSHOT_WEB: return "LastSnapshotToEmailHeight";
+ case LLSnapshotLivePreview::SNAPSHOT_POSTCARD: return "LastSnapshotToEmailHeight";
+ case LLSnapshotLivePreview::SNAPSHOT_TEXTURE: return "LastSnapshotToInventoryHeight";
+ default: return "LastSnapshotToDiskHeight";
}
}
@@ -1718,10 +1817,10 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL
resetSnapshotSizeOnUI(view, width, height) ;
}
- if(view->childGetValue("snapshot_width").asInteger() != width || view->childGetValue("snapshot_height").asInteger() != height)
+ if(view->getChild<LLUICtrl>("snapshot_width")->getValue().asInteger() != width || view->getChild<LLUICtrl>("snapshot_height")->getValue().asInteger() != height)
{
- view->childSetValue("snapshot_width", width);
- view->childSetValue("snapshot_height", height);
+ view->getChild<LLUICtrl>("snapshot_width")->setValue(width);
+ view->getChild<LLUICtrl>("snapshot_height")->setValue(height);
}
if(original_width != width || original_height != height)
@@ -1773,7 +1872,7 @@ void LLFloaterSnapshot::Impl::onCommitSnapshotType(LLUICtrl* ctrl, void* data)
//static
void LLFloaterSnapshot::Impl::onCommitSnapshotFormat(LLUICtrl* ctrl, void* data)
{
- LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;
+ LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;
if (view)
{
gSavedSettings.setS32("SnapshotFormat", getFormatIndex(view));
@@ -1904,8 +2003,8 @@ void LLFloaterSnapshot::Impl::onCommitCustomResolution(LLUICtrl *ctrl, void* dat
LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;
if (view)
{
- S32 w = llfloor((F32)view->childGetValue("snapshot_width").asReal());
- S32 h = llfloor((F32)view->childGetValue("snapshot_height").asReal());
+ S32 w = llfloor((F32)view->getChild<LLUICtrl>("snapshot_width")->getValue().asReal());
+ S32 h = llfloor((F32)view->getChild<LLUICtrl>("snapshot_height")->getValue().asReal());
LLSnapshotLivePreview* previewp = getPreviewView(view);
if (previewp)
@@ -1972,7 +2071,6 @@ LLFloaterSnapshot::LLFloaterSnapshot(const LLSD& key)
: LLFloater(key),
impl (*(new Impl))
{
- //Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this, "floater_snapshot.xml", FALSE);
}
// Destroys the object
@@ -1994,6 +2092,12 @@ LLFloaterSnapshot::~LLFloaterSnapshot()
BOOL LLFloaterSnapshot::postBuild()
{
+ // Kick start Web Sharing, to fetch its config data if it needs to.
+ if (gSavedSettings.getBOOL("SnapshotSharingEnabled"))
+ {
+ LLWebSharing::instance().init();
+ }
+
childSetCommitCallback("snapshot_type_radio", Impl::onCommitSnapshotType, this);
childSetCommitCallback("local_format_combo", Impl::onCommitSnapshotFormat, this);
@@ -2008,34 +2112,34 @@ BOOL LLFloaterSnapshot::postBuild()
childSetAction("discard_btn", Impl::onClickDiscard, this);
childSetCommitCallback("image_quality_slider", Impl::onCommitQuality, this);
- childSetValue("image_quality_slider", gSavedSettings.getS32("SnapshotQuality"));
+ getChild<LLUICtrl>("image_quality_slider")->setValue(gSavedSettings.getS32("SnapshotQuality"));
childSetCommitCallback("snapshot_width", Impl::onCommitCustomResolution, this);
childSetCommitCallback("snapshot_height", Impl::onCommitCustomResolution, this);
childSetCommitCallback("ui_check", Impl::onClickUICheck, this);
- childSetValue("ui_check", gSavedSettings.getBOOL("RenderUIInSnapshot"));
+ getChild<LLUICtrl>("ui_check")->setValue(gSavedSettings.getBOOL("RenderUIInSnapshot"));
childSetCommitCallback("hud_check", Impl::onClickHUDCheck, this);
- childSetValue("hud_check", gSavedSettings.getBOOL("RenderHUDInSnapshot"));
+ getChild<LLUICtrl>("hud_check")->setValue(gSavedSettings.getBOOL("RenderHUDInSnapshot"));
childSetCommitCallback("keep_open_check", Impl::onClickKeepOpenCheck, this);
- childSetValue("keep_open_check", !gSavedSettings.getBOOL("CloseSnapshotOnKeep"));
+ getChild<LLUICtrl>("keep_open_check")->setValue(!gSavedSettings.getBOOL("CloseSnapshotOnKeep"));
childSetCommitCallback("keep_aspect_check", Impl::onClickKeepAspectCheck, this);
- childSetValue("keep_aspect_check", gSavedSettings.getBOOL("KeepAspectForSnapshot"));
+ getChild<LLUICtrl>("keep_aspect_check")->setValue(gSavedSettings.getBOOL("KeepAspectForSnapshot"));
childSetCommitCallback("layer_types", Impl::onCommitLayerTypes, this);
- childSetValue("layer_types", "colors");
- childSetEnabled("layer_types", FALSE);
+ getChild<LLUICtrl>("layer_types")->setValue("colors");
+ getChildView("layer_types")->setEnabled(FALSE);
- childSetValue("snapshot_width", gSavedSettings.getS32(lastSnapshotWidthName()));
- childSetValue("snapshot_height", gSavedSettings.getS32(lastSnapshotHeightName()));
+ getChild<LLUICtrl>("snapshot_width")->setValue(gSavedSettings.getS32(lastSnapshotWidthName()));
+ getChild<LLUICtrl>("snapshot_height")->setValue(gSavedSettings.getS32(lastSnapshotHeightName()));
- childSetValue("freeze_frame_check", gSavedSettings.getBOOL("UseFreezeFrame"));
+ getChild<LLUICtrl>("freeze_frame_check")->setValue(gSavedSettings.getBOOL("UseFreezeFrame"));
childSetCommitCallback("freeze_frame_check", Impl::onCommitFreezeFrame, this);
- childSetValue("auto_snapshot_check", gSavedSettings.getBOOL("AutoSnapshot"));
+ getChild<LLUICtrl>("auto_snapshot_check")->setValue(gSavedSettings.getBOOL("AutoSnapshot"));
childSetCommitCallback("auto_snapshot_check", Impl::onClickAutoSnap, this);
childSetCommitCallback("postcard_size_combo", Impl::onCommitResolution, this);