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.cpp745
1 files changed, 406 insertions, 339 deletions
diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp
index 357c10c6b6..e8a89bb705 100644
--- a/indra/newview/llfloatersnapshot.cpp
+++ b/indra/newview/llfloatersnapshot.cpp
@@ -39,33 +39,30 @@
// Viewer includes
#include "llagent.h"
#include "llagentcamera.h"
-#include "llagentui.h"
-#include "llavatarpropertiesprocessor.h"
-#include "llbottomtray.h"
-#include "llbutton.h"
#include "llcallbacklist.h"
-#include "llcheckboxctrl.h"
-#include "llcombobox.h"
#include "llcriticaldamp.h"
-#include "lleconomy.h"
-#include "llfloaterpostcard.h"
+#include "llui.h"
#include "llfocusmgr.h"
+#include "llbutton.h"
+#include "llcombobox.h"
+#include "lleconomy.h"
#include "lllandmarkactions.h"
-#include "llradiogroup.h"
#include "llsliderctrl.h"
-#include "llslurl.h"
#include "llspinctrl.h"
-#include "lltoolfocus.h"
-#include "lltoolmgr.h"
-#include "llui.h"
-#include "lluictrlfactory.h"
-#include "llviewercamera.h"
#include "llviewercontrol.h"
-#include "llviewermenufile.h" // upload_new_resource()
+#include "lluictrlfactory.h"
#include "llviewerstats.h"
+#include "llviewercamera.h"
#include "llviewerwindow.h"
-#include "llweb.h"
+#include "llviewermenufile.h" // upload_new_resource()
+#include "llfloaterpostcard.h"
+#include "llcheckboxctrl.h"
+#include "llradiogroup.h"
+#include "lltoolfocus.h"
+#include "lltoolmgr.h"
+#include "llwebsharing.h"
#include "llworld.h"
+#include "llagentui.h"
// Linden library includes
#include "llfontgl.h"
@@ -91,8 +88,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;
@@ -119,9 +116,9 @@ public:
enum ESnapshotType
{
SNAPSHOT_POSTCARD,
- SNAPSHOT_WEB,
SNAPSHOT_TEXTURE,
- SNAPSHOT_LOCAL
+ SNAPSHOT_LOCAL,
+ SNAPSHOT_WEB
};
@@ -167,10 +164,10 @@ 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 set_as_profile_pic = false);
+ void saveTexture();
BOOL saveLocal();
- void saveWeb(std::string url);
BOOL setThumbnailImageSize() ;
void generateThumbnailImage(BOOL force_update = FALSE) ;
@@ -179,9 +176,9 @@ public:
// Returns TRUE when snapshot generated, FALSE otherwise.
static BOOL onIdle( void* snapshot_preview );
-
+
// callback for region name resolve
- void regionNameCallback(std::string url, LLSD body, const std::string& name, S32 x, S32 y, S32 z);
+ void regionNameCallback(LLImageJPEG* snapshot, LLSD& metadata, const std::string& name, S32 x, S32 y, S32 z);
private:
LLColor4 mColor;
@@ -303,7 +300,7 @@ F32 LLSnapshotLivePreview::getAspect()
F32 image_aspect_ratio = ((F32)mWidth[mCurImageIndex]) / ((F32)mHeight[mCurImageIndex]);
F32 window_aspect_ratio = ((F32)getRect().getWidth()) / ((F32)getRect().getHeight());
- if (!mKeepAspectRatio)
+ if (!mKeepAspectRatio)//gSavedSettings.getBOOL("KeepAspectForSnapshot"))
{
return image_aspect_ratio;
}
@@ -636,20 +633,20 @@ BOOL LLSnapshotLivePreview::setThumbnailImageSize()
F32 window_aspect_ratio = ((F32)window_width) / ((F32)window_height);
// UI size for thumbnail
- LLFloater* floater = LLFloaterReg::getInstance("snapshot");
- mThumbnailWidth = floater->getChild<LLView>("thumbnail_placeholder")->getRect().getWidth();
- mThumbnailHeight = floater->getChild<LLView>("thumbnail_placeholder")->getRect().getHeight();
-
+ S32 max_width = LLFloaterSnapshot::getUIWinWidth() - 20;
+ S32 max_height = 90;
- if (window_aspect_ratio > (F32)mThumbnailWidth / mThumbnailHeight)
+ if (window_aspect_ratio > (F32)max_width / max_height)
{
// image too wide, shrink to width
- mThumbnailHeight = llround((F32)mThumbnailWidth / window_aspect_ratio);
+ mThumbnailWidth = max_width;
+ mThumbnailHeight = llround((F32)max_width / window_aspect_ratio);
}
else
{
// image too tall, shrink to height
- mThumbnailWidth = llround((F32)mThumbnailHeight * window_aspect_ratio);
+ mThumbnailHeight = max_height;
+ mThumbnailWidth = llround((F32)max_height * window_aspect_ratio);
}
if(mThumbnailWidth > window_width || mThumbnailHeight > window_height)
@@ -835,12 +832,11 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview )
{
// delete any existing image
previewp->mFormattedImage = NULL;
-
// now create the new one of the appropriate format.
// note: postcards and web hardcoded to use jpeg always.
LLFloaterSnapshot::ESnapshotFormat format;
-
- if (previewp->getSnapshotType() == SNAPSHOT_POSTCARD ||
+
+ if (previewp->getSnapshotType() == SNAPSHOT_POSTCARD ||
previewp->getSnapshotType() == SNAPSHOT_WEB)
{
format = LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG;
@@ -849,7 +845,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview )
{
format = previewp->getSnapshotFormat();
}
-
+
switch(format)
{
case LLFloaterSnapshot::SNAPSHOT_FORMAT_PNG:
@@ -976,21 +972,13 @@ LLFloaterPostcard* LLSnapshotLivePreview::savePostcard()
return floater;
}
-// Callback for asset upload
-void profile_pic_upload_callback(const LLUUID& uuid, void *user_data, S32 status, LLExtStat ext_status)
-{
- LLFloaterSnapshot* floater = LLFloaterReg::getTypedInstance<LLFloaterSnapshot>("snapshot");
- floater->setAsProfilePic(uuid);
-}
-
-
-void LLSnapshotLivePreview::saveTexture(bool set_as_profile_pic)
+void LLSnapshotLivePreview::saveTexture()
{
// gen a new uuid for this asset
LLTransactionID tid;
tid.generate();
LLAssetID new_asset_id = tid.makeAssetID(gAgent.getSecureSessionID());
-
+
LLPointer<LLImageJ2C> formatted = new LLImageJ2C;
LLPointer<LLImageRaw> scaled = new LLImageRaw(mPreviewImage->getData(),
mPreviewImage->getWidth(),
@@ -1001,23 +989,17 @@ void LLSnapshotLivePreview::saveTexture(bool set_as_profile_pic)
if (formatted->encode(scaled, 0.0f))
{
- LLAssetStorage::LLStoreAssetCallback callback = NULL;
-
- if (set_as_profile_pic)
- {
- callback = profile_pic_upload_callback;
- }
-
LLVFile::writeFile(formatted->getData(), formatted->getDataSize(), gVFS, new_asset_id, LLAssetType::AT_TEXTURE);
std::string pos_string;
LLAgentUI::buildLocationString(pos_string, LLAgentUI::LOCATION_FORMAT_FULL);
std::string who_took_it;
LLAgentUI::buildFullname(who_took_it);
+ LLAssetStorage::LLStoreAssetCallback callback = NULL;
S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
- std::string snapname = "Snapshot : " + pos_string;
+ void *userdata = NULL;
upload_new_resource(tid, // tid
LLAssetType::AT_TEXTURE,
- snapname,
+ "Snapshot : " + pos_string,
"Taken by " + who_took_it + " at " + pos_string,
0,
LLFolderType::FT_SNAPSHOT_CATEGORY,
@@ -1025,8 +1007,8 @@ void LLSnapshotLivePreview::saveTexture(bool set_as_profile_pic)
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
- snapname,
- callback, expected_upload_cost, NULL);
+ "Snapshot : " + pos_string,
+ callback, expected_upload_cost, userdata);
gViewerWindow->playSnapshotAnimAndSound();
}
else
@@ -1056,79 +1038,31 @@ BOOL LLSnapshotLivePreview::saveLocal()
return success;
}
-
-class LLSendWebResponder : public LLHTTPClient::Responder
+void LLSnapshotLivePreview::saveWeb()
{
-public:
-
- virtual void error(U32 status, const std::string& reason)
- {
- llwarns << status << ": " << reason << llendl;
- LLNotificationsUtil::add("ShareToWebFailed");
- }
-
- virtual void result(const LLSD& content)
- {
- std::string response_url = content["response_url"].asString();
-
- if (!response_url.empty())
- {
- LLWeb::loadURLExternal(response_url);
- }
- else
- {
- LLNotificationsUtil::add("ShareToWebFailed");
- }
- }
-
-};
-
-void LLSnapshotLivePreview::saveWeb(std::string url)
-{
- if (url.empty())
- {
- llwarns << "No share to web url" << llendl;
- return;
- }
-
+ // *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;
}
-
-/* figure out if there's a better way to serialize */
- LLSD body;
- std::vector<U8> binary_image;
- U8* data = jpg->getData();
- for (int i = 0; i < jpg->getDataSize(); i++)
- {
- binary_image.push_back(data[i]);
- }
-
- body["image"] = binary_image;
-
- body["description"] = getChild<LLLineEditor>("description")->getText();
- std::string name;
- LLAgentUI::buildFullname(name);
+ LLSD metadata;
+ metadata["description"] = getChild<LLLineEditor>("description")->getText();
- body["avatar_name"] = name;
-
LLLandmarkActions::getRegionNameAndCoordsFromPosGlobal(gAgentCamera.getCameraPositionGlobal(),
- boost::bind(&LLSnapshotLivePreview::regionNameCallback, this, url, body, _1, _2, _3, _4));
-
+ boost::bind(&LLSnapshotLivePreview::regionNameCallback, this, jpg, metadata, _1, _2, _3, _4));
+
gViewerWindow->playSnapshotAnimAndSound();
}
-
-void LLSnapshotLivePreview::regionNameCallback(std::string url, LLSD body, const std::string& name, S32 x, S32 y, S32 z)
+void LLSnapshotLivePreview::regionNameCallback(LLImageJPEG* snapshot, LLSD& metadata, const std::string& name, S32 x, S32 y, S32 z)
{
- body["slurl"] = LLSLURL::buildSLURL(name, x, y, z);
+ metadata["slurl"] = LLSLURL(name, LLVector3d(x, y, z)).getSLURLString();
- LLHTTPClient::post(url, body,
- new LLSendWebResponder());
+ LLWebSharing::instance().shareSnapshot(snapshot, metadata);
}
///----------------------------------------------------------------------------
@@ -1150,6 +1084,9 @@ public:
mAvatarPauseHandles.clear();
}
+ static void onClickDiscard(void* data);
+ static void onClickKeep(void* data);
+ static void onCommitSave(LLUICtrl* ctrl, void* data);
static void onClickNewSnapshot(void* data);
static void onClickAutoSnap(LLUICtrl *ctrl, void* data);
//static void onClickAdvanceSnap(LLUICtrl *ctrl, void* data);
@@ -1164,11 +1101,9 @@ public:
static void updateResolution(LLUICtrl* ctrl, void* data, BOOL do_update = TRUE);
static void onCommitFreezeFrame(LLUICtrl* ctrl, void* data);
static void onCommitLayerTypes(LLUICtrl* ctrl, void*data);
+ static void onCommitSnapshotType(LLUICtrl* ctrl, void* data);
static void onCommitSnapshotFormat(LLUICtrl* ctrl, void* data);
static void onCommitCustomResolution(LLUICtrl *ctrl, void* data);
- static void onCommitSnapshot(LLFloaterSnapshot* view, LLSnapshotLivePreview::ESnapshotType type);
- static void onCommitProfilePic(LLFloaterSnapshot* view);
- static void onToggleAdvanced(LLUICtrl *ctrl, void* data);
static void resetSnapshotSizeOnUI(LLFloaterSnapshot *view, S32 width, S32 height) ;
static BOOL checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL isWidthChanged, S32 max_value);
@@ -1176,8 +1111,11 @@ public:
static void setResolution(LLFloaterSnapshot* floater, const std::string& comboname);
static void updateControls(LLFloaterSnapshot* floater);
static void updateLayout(LLFloaterSnapshot* floater);
+ static void updateResolutionTextEntry(LLFloaterSnapshot* floater);
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);
@@ -1200,6 +1138,56 @@ LLSnapshotLivePreview* LLFloaterSnapshot::Impl::getPreviewView(LLFloaterSnapshot
}
// static
+LLSnapshotLivePreview::ESnapshotType LLFloaterSnapshot::Impl::getTypeIndex(LLFloaterSnapshot* floater)
+{
+ LLSnapshotLivePreview::ESnapshotType index = LLSnapshotLivePreview::SNAPSHOT_POSTCARD;
+ 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)
{
ESnapshotFormat index = SNAPSHOT_FORMAT_PNG;
@@ -1223,7 +1211,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;
@@ -1247,24 +1235,35 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp)
{
LLSnapshotLivePreview* previewp = getPreviewView(floaterp);
+ S32 delta_height = gSavedSettings.getBOOL("AdvanceSnapshot") ? 0 : floaterp->getUIWinHeightShort() - floaterp->getUIWinHeightLong() ;
+
if(!gSavedSettings.getBOOL("AdvanceSnapshot")) //set to original window resolution
{
previewp->mKeepAspectRatio = TRUE;
- floaterp->getChild<LLComboBox>("snapshot_size_combo")->setCurrentByIndex(0);
- gSavedSettings.setS32("SnapshotLastResolution", 0);
+ floaterp->getChild<LLComboBox>("postcard_size_combo")->setCurrentByIndex(0);
+ gSavedSettings.setS32("SnapshotPostcardLastResolution", 0);
+
+ floaterp->getChild<LLComboBox>("texture_size_combo")->setCurrentByIndex(0);
+ gSavedSettings.setS32("SnapshotTextureLastResolution", 0);
+
+ floaterp->getChild<LLComboBox>("local_size_combo")->setCurrentByIndex(0);
+ gSavedSettings.setS32("SnapshotLocalLastResolution", 0);
LLSnapshotLivePreview* previewp = getPreviewView(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)
{
// stop all mouse events at fullscreen preview layer
floaterp->getParent()->setMouseOpaque(TRUE);
+ // shrink to smaller layout
+ floaterp->reshape(floaterp->getRect().getWidth(), floaterp->getUIWinHeightLong() + delta_height);
+
// can see and interact with fullscreen preview now
if (previewp)
{
@@ -1293,6 +1292,7 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp)
else // turning off freeze frame mode
{
floaterp->getParent()->setMouseOpaque(FALSE);
+ floaterp->reshape(floaterp->getRect().getWidth(), floaterp->getUIWinHeightLong() + delta_height);
if (previewp)
{
previewp->setVisible(FALSE);
@@ -1321,7 +1321,137 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp)
// static
void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)
{
+ LLRadioGroup* snapshot_type_radio = floater->getChild<LLRadioGroup>("snapshot_type_radio");
+ 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->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"));
+
+ // *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 ||
+ 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();
+
+ // *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;
+ if (got_snap)
+ {
+ LLResMgr::getInstance()->getIntegerString(bytes_string, (previewp->getDataSize()) >> 10 );
+ }
+ S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
+ 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->getChild<LLUICtrl>("layer_types")->setValue("colors");
+ if(is_advance)
+ {
+ setResolution(floater, "postcard_size_combo");
+ }
+ break;
+ case LLSnapshotLivePreview::SNAPSHOT_TEXTURE:
+ layer_type = LLViewerWindow::SNAPSHOT_TYPE_COLOR;
+ floater->getChild<LLUICtrl>("layer_types")->setValue("colors");
+ if(is_advance)
+ {
+ setResolution(floater, "texture_size_combo");
+ }
+ break;
+ case LLSnapshotLivePreview::SNAPSHOT_LOCAL:
+ if(is_advance)
+ {
+ setResolution(floater, "local_size_combo");
+ }
+ break;
+ default:
+ break;
+ }
+
+ updateResolutionTextEntry(floater);
+
+ if (previewp)
+ {
+ previewp->setSnapshotType(shot_type);
+ previewp->setSnapshotFormat(shot_format);
+ previewp->setSnapshotBufferType(layer_type);
+ }
+}
+
+// static
+void LLFloaterSnapshot::Impl::updateResolutionTextEntry(LLFloaterSnapshot* floater)
+{
+ LLSpinCtrl* width_spinner = floater->getChild<LLSpinCtrl>("snapshot_width");
+ LLSpinCtrl* height_spinner = floater->getChild<LLSpinCtrl>("snapshot_height");
+ if(getTypeIndex(floater) == LLSnapshotLivePreview::SNAPSHOT_TEXTURE)
+ {
+ width_spinner->setAllowEdit(FALSE);
+ height_spinner->setAllowEdit(FALSE);
+ }
+ else
+ {
+ width_spinner->setAllowEdit(TRUE);
+ height_spinner->setAllowEdit(TRUE);
+ }
}
// static
@@ -1335,6 +1465,81 @@ void LLFloaterSnapshot::Impl::checkAutoSnapshot(LLSnapshotLivePreview* previewp,
}
// static
+void LLFloaterSnapshot::Impl::onClickDiscard(void* data)
+{
+ LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;
+
+ if (view)
+ {
+ view->closeFloater();
+ }
+}
+
+
+// static
+void LLFloaterSnapshot::Impl::onCommitSave(LLUICtrl* ctrl, void* data)
+{
+ if (ctrl->getValue().asString() == "save as")
+ {
+ gViewerWindow->resetSnapshotLoc();
+ }
+ onClickKeep(data);
+}
+
+// static
+void LLFloaterSnapshot::Impl::onClickKeep(void* data)
+{
+ LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;
+ LLSnapshotLivePreview* previewp = getPreviewView(view);
+
+ if (previewp)
+ {
+ switch (previewp->getSnapshotType())
+ {
+ case LLSnapshotLivePreview::SNAPSHOT_WEB:
+ previewp->saveWeb();
+ break;
+
+ case LLSnapshotLivePreview::SNAPSHOT_POSTCARD:
+ {
+ 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);
+ }
+ }
+ break;
+
+ case LLSnapshotLivePreview::SNAPSHOT_TEXTURE:
+ previewp->saveTexture();
+ break;
+
+ case LLSnapshotLivePreview::SNAPSHOT_LOCAL:
+ previewp->saveLocal();
+ break;
+
+ default:
+ break;
+ }
+
+ if (gSavedSettings.getBOOL("CloseSnapshotOnKeep"))
+ {
+ view->closeFloater();
+ }
+ else
+ {
+ checkAutoSnapshot(previewp);
+ }
+
+ updateControls(view);
+ }
+}
+
+// static
void LLFloaterSnapshot::Impl::onClickNewSnapshot(void* data)
{
LLSnapshotLivePreview* previewp = getPreviewView((LLFloaterSnapshot *)data);
@@ -1505,7 +1710,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)
{
@@ -1517,7 +1722,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)
{
@@ -1528,7 +1733,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)
{
@@ -1543,18 +1748,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";
}
}
@@ -1570,8 +1779,10 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL
}
// save off all selected resolution values
- gSavedSettings.setS32("SnapshotLastResolution", view->getChild<LLComboBox>("snapshot_size_combo")->getCurrentIndex());
-
+ gSavedSettings.setS32("SnapshotPostcardLastResolution", view->getChild<LLComboBox>("postcard_size_combo")->getCurrentIndex());
+ gSavedSettings.setS32("SnapshotTextureLastResolution", view->getChild<LLComboBox>("texture_size_combo")->getCurrentIndex());
+ gSavedSettings.setS32("SnapshotLocalLastResolution", view->getChild<LLComboBox>("local_size_combo")->getCurrentIndex());
+
std::string sdstring = combobox->getSelectedValue();
LLSD sdres;
std::stringstream sstream(sdstring);
@@ -1611,10 +1822,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)
@@ -1651,135 +1862,22 @@ void LLFloaterSnapshot::Impl::onCommitLayerTypes(LLUICtrl* ctrl, void*data)
}
//static
-void LLFloaterSnapshot::Impl::onToggleAdvanced(LLUICtrl* ctrl, void* data)
-{
- LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;
-
- LLPanel* advanced_panel = view->getChild<LLPanel>("snapshot_advanced");
-
- if (advanced_panel->getVisible())
- {
- advanced_panel->setVisible(false);
-
- // shrink floater back to original size
- view->reshape(view->getRect().getWidth() - advanced_panel->getRect().getWidth(), view->getRect().getHeight());
-
- view->getChild<LLButton>("hide_advanced")->setVisible(false);
- view->getChild<LLButton>("show_advanced")->setVisible(true);
- }
- else
- {
- advanced_panel->setVisible(true);
- // stretch the floater so it can accommodate the advanced panel
- view->reshape(view->getRect().getWidth() + advanced_panel->getRect().getWidth(), view->getRect().getHeight());
-
- view->getChild<LLButton>("hide_advanced")->setVisible(true);
- view->getChild<LLButton>("show_advanced")->setVisible(false);
- }
-}
-
-// This object represents a pending request for avatar properties information
-class LLAvatarDataRequest : public LLAvatarPropertiesObserver
+void LLFloaterSnapshot::Impl::onCommitSnapshotType(LLUICtrl* ctrl, void* data)
{
-public:
- LLAvatarDataRequest(const LLUUID& avatar_id, const LLUUID& image_id, LLFloaterSnapshot* floater)
- : mAvatarID(avatar_id),
- mImageID(image_id),
- mSnapshotFloater(floater)
-
- {
- }
-
- ~LLAvatarDataRequest()
- {
- // remove ourselves as an observer
- LLAvatarPropertiesProcessor::getInstance()->
- removeObserver(mAvatarID, this);
- }
-
- void processProperties(void* data, EAvatarProcessorType type)
- {
- // route the data to the inspector
- if (data
- && type == APT_PROPERTIES)
- {
-
- LLAvatarData* avatar_data = static_cast<LLAvatarData*>(data);
-
- LLAvatarData new_data(*avatar_data);
- new_data.image_id = mImageID;
-
- LLAvatarPropertiesProcessor::getInstance()->sendAvatarPropertiesUpdate(&new_data);
-
- delete this;
- }
- }
-
- // Store avatar ID so we can un-register the observer on destruction
- LLUUID mAvatarID;
- LLUUID mImageID;
- LLFloaterSnapshot* mSnapshotFloater;
-};
-
-void LLFloaterSnapshot::Impl::onCommitProfilePic(LLFloaterSnapshot* view)
-{
- //first save to harddrive
- LLSnapshotLivePreview* previewp = getPreviewView(view);
-
- if(previewp)
+ LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;
+ if (view)
{
- previewp->saveTexture(true);
+ gSavedSettings.setS32("LastSnapshotType", getTypeIndex(view));
+ getPreviewView(view)->updateSnapshot(TRUE);
+ updateControls(view);
}
}
-void LLFloaterSnapshot::Impl::onCommitSnapshot(LLFloaterSnapshot* view, LLSnapshotLivePreview::ESnapshotType type)
-{
- LLSnapshotLivePreview* previewp = getPreviewView(view);
-
- if (previewp)
- {
- previewp->setSnapshotType(type);
-
- if (type == LLSnapshotLivePreview::SNAPSHOT_WEB)
- {
- previewp->saveWeb(view->getString("share_to_web_url"));
- }
- else if (type == LLSnapshotLivePreview::SNAPSHOT_LOCAL)
- {
- previewp->saveLocal();
- }
- else if (type == LLSnapshotLivePreview::SNAPSHOT_TEXTURE)
- {
- previewp->saveTexture();
- }
- else if (type == LLSnapshotLivePreview::SNAPSHOT_POSTCARD)
- {
- 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);
- }
- }
-
- if (gSavedSettings.getBOOL("CloseSnapshotOnKeep"))
- {
- view->closeFloater();
- }
- else
- {
- checkAutoSnapshot(previewp);
- }
- }
-}
//static
void LLFloaterSnapshot::Impl::onCommitSnapshotFormat(LLUICtrl* ctrl, void* data)
{
- LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;
+ LLFloaterSnapshot *view = (LLFloaterSnapshot *)data;
if (view)
{
gSavedSettings.setS32("SnapshotFormat", getFormatIndex(view));
@@ -1788,6 +1886,8 @@ void LLFloaterSnapshot::Impl::onCommitSnapshotFormat(LLUICtrl* ctrl, void* data)
}
}
+
+
// Sets the named size combo to "custom" mode.
// static
void LLFloaterSnapshot::Impl::comboSetCustom(LLFloaterSnapshot* floater, const std::string& comboname)
@@ -1796,11 +1896,24 @@ void LLFloaterSnapshot::Impl::comboSetCustom(LLFloaterSnapshot* floater, const s
combo->setCurrentByIndex(combo->getItemCount() - 1); // "custom" is always the last index
- gSavedSettings.setS32("SnapshotLastResolution", combo->getCurrentIndex());
+ if(comboname == "postcard_size_combo")
+ {
+ gSavedSettings.setS32("SnapshotPostcardLastResolution", combo->getCurrentIndex());
+ }
+ else if(comboname == "texture_size_combo")
+ {
+ gSavedSettings.setS32("SnapshotTextureLastResolution", combo->getCurrentIndex());
+ }
+ else if(comboname == "local_size_combo")
+ {
+ gSavedSettings.setS32("SnapshotLocalLastResolution", combo->getCurrentIndex());
+ }
checkAspectRatio(floater, -1); // -1 means custom
}
+
+
//static
BOOL LLFloaterSnapshot::Impl::checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL isWidthChanged, S32 max_value)
{
@@ -1895,8 +2008,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)
@@ -1941,7 +2054,9 @@ void LLFloaterSnapshot::Impl::onCommitCustomResolution(LLUICtrl *ctrl, void* dat
previewp->setSize(w,h);
checkAutoSnapshot(previewp, FALSE);
previewp->updateSnapshot(FALSE, TRUE);
- comboSetCustom(view, "snapshot_size_combo");
+ comboSetCustom(view, "postcard_size_combo");
+ comboSetCustom(view, "texture_size_combo");
+ comboSetCustom(view, "local_size_combo");
}
}
@@ -1958,7 +2073,7 @@ void LLFloaterSnapshot::Impl::onCommitCustomResolution(LLUICtrl *ctrl, void* dat
// Default constructor
LLFloaterSnapshot::LLFloaterSnapshot(const LLSD& key)
- : LLTransientDockableFloater(NULL, true, key),
+ : LLFloater(key),
impl (*(new Impl))
{
//Called from floater reg: LLUICtrlFactory::getInstance()->buildFloater(this, "floater_snapshot.xml", FALSE);
@@ -1983,20 +2098,13 @@ 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();
+ }
- getChild<LLButton>("share")->setCommitCallback(boost::bind(&LLFloaterSnapshot::updateButtons, this, SNAPSHOT_SHARE));
- getChild<LLButton>("save")->setCommitCallback(boost::bind(&LLFloaterSnapshot::updateButtons, this, SNAPSHOT_SAVE));
- getChild<LLButton>("cancel")->setCommitCallback(boost::bind(&LLFloaterSnapshot::updateButtons, this, SNAPSHOT_MAIN));
-
- getChild<LLButton>("share_to_web")->setCommitCallback(boost::bind(&Impl::onCommitSnapshot, this, LLSnapshotLivePreview::SNAPSHOT_WEB));
- getChild<LLButton>("share_to_email")->setCommitCallback(boost::bind(&Impl::onCommitSnapshot, this, LLSnapshotLivePreview::SNAPSHOT_POSTCARD));
- getChild<LLButton>("save_to_inventory")->setCommitCallback(boost::bind(&Impl::onCommitSnapshot, this, LLSnapshotLivePreview::SNAPSHOT_TEXTURE));
- getChild<LLButton>("save_to_computer")->setCommitCallback(boost::bind(&Impl::onCommitSnapshot, this, LLSnapshotLivePreview::SNAPSHOT_LOCAL));
- getChild<LLButton>("set_profile_pic")->setCommitCallback(boost::bind(&Impl::onCommitProfilePic, this));
-
- childSetCommitCallback("show_advanced", Impl::onToggleAdvanced, this);
- childSetCommitCallback("hide_advanced", Impl::onToggleAdvanced, this);
-
+ childSetCommitCallback("snapshot_type_radio", Impl::onCommitSnapshotType, this);
childSetCommitCallback("local_format_combo", Impl::onCommitSnapshotFormat, this);
childSetAction("new_snapshot_btn", Impl::onClickNewSnapshot, this);
@@ -2004,37 +2112,45 @@ BOOL LLFloaterSnapshot::postBuild()
childSetAction("more_btn", Impl::onClickMore, this);
childSetAction("less_btn", Impl::onClickLess, this);
+ childSetAction("upload_btn", Impl::onClickKeep, this);
+ childSetAction("send_btn", Impl::onClickKeep, this);
+ childSetCommitCallback("save_btn", Impl::onCommitSave, this);
+ 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");
+ 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("snapshot_size_combo", Impl::onCommitResolution, this);
+ childSetCommitCallback("postcard_size_combo", Impl::onCommitResolution, this);
+ childSetCommitCallback("texture_size_combo", Impl::onCommitResolution, this);
+ childSetCommitCallback("local_size_combo", Impl::onCommitResolution, this);
// create preview window
LLRect full_screen_rect = getRootView()->getRect();
@@ -2055,14 +2171,8 @@ BOOL LLFloaterSnapshot::postBuild()
impl.mPreviewHandle = previewp->getHandle();
impl.updateControls(this);
impl.updateLayout(this);
-
- //save off the refresh button's rectangle so we can apply offsets with thumbnail resize
- mRefreshBtnRect = getChild<LLButton>("new_snapshot_btn")->getRect();
-
- // make sure we share/hide the general buttons
- updateButtons(SNAPSHOT_MAIN);
- return LLDockableFloater::postBuild();
+ return TRUE;
}
void LLFloaterSnapshot::draw()
@@ -2075,19 +2185,15 @@ void LLFloaterSnapshot::draw()
return;
}
- LLDockableFloater::draw();
-
- LLButton* refresh_btn = getChild<LLButton>("new_snapshot_btn");
- // revert the refresh button to original intended position
- LLRect refresh_rect = mRefreshBtnRect;
+ LLFloater::draw();
if (previewp)
{
if(previewp->getThumbnailImage())
{
- LLRect thumbnail_rect = getChild<LLView>("thumbnail_placeholder")->getRect();
+ LLRect thumbnail_rect = getChild<LLUICtrl>("thumbnail_placeholder")->getRect();
- S32 offset_x = (thumbnail_rect.getWidth() - previewp->getThumbnailWidth()) / 2 + thumbnail_rect.mLeft;
+ S32 offset_x = (getRect().getWidth() - previewp->getThumbnailWidth()) / 2 ;
S32 offset_y = thumbnail_rect.mBottom + (thumbnail_rect.getHeight() - previewp->getThumbnailHeight()) / 2 ;
glMatrixMode(GL_MODELVIEW);
@@ -2096,14 +2202,8 @@ void LLFloaterSnapshot::draw()
previewp->getThumbnailImage(), LLColor4::white);
previewp->drawPreviewRect(offset_x, offset_y) ;
-
- refresh_rect.translate(offset_x - thumbnail_rect.mLeft, offset_y - thumbnail_rect.mBottom);
}
}
-
- refresh_btn->setRect(refresh_rect);
- drawChild(refresh_btn);
-
}
void LLFloaterSnapshot::onOpen(const LLSD& key)
@@ -2117,12 +2217,6 @@ void LLFloaterSnapshot::onOpen(const LLSD& key)
gSnapshotFloaterView->setEnabled(TRUE);
gSnapshotFloaterView->setVisible(TRUE);
gSnapshotFloaterView->adjustToFitScreen(this, FALSE);
-
- LLButton *snapshots = LLBottomTray::getInstance()->getChild<LLButton>("snapshots");
-
- setDockControl(new LLDockControl(
- snapshots, this,
- getDockTongue(), LLDockControl::TOP));
}
void LLFloaterSnapshot::onClose(bool app_quitting)
@@ -2150,33 +2244,6 @@ void LLFloaterSnapshot::update()
}
}
-bool LLFloaterSnapshot::updateButtons(ESnapshotMode mode)
-{
- childSetVisible("share", mode == SNAPSHOT_MAIN);
- childSetVisible("save", mode == SNAPSHOT_MAIN);
- childSetVisible("set_profile_pic", mode == SNAPSHOT_MAIN);
-
- childSetVisible("share_to_web", mode == SNAPSHOT_SHARE);
- childSetVisible("share_to_email", mode == SNAPSHOT_SHARE);
-
- childSetVisible("save_to_inventory", mode == SNAPSHOT_SAVE);
- childSetVisible("save_to_computer", mode == SNAPSHOT_SAVE);
-
- childSetVisible("cancel", mode != SNAPSHOT_MAIN);
-
- return true;
-}
-
-void LLFloaterSnapshot::setAsProfilePic(const LLUUID& image_id)
-{
- LLAvatarDataRequest* avatar_data_request = new LLAvatarDataRequest(gAgent.getID(), image_id, this);
-
- LLAvatarPropertiesProcessor* processor =
- LLAvatarPropertiesProcessor::getInstance();
-
- processor->addObserver(gAgent.getID(), avatar_data_request);
- processor->sendAvatarPropertiesRequest(gAgent.getID());
-}
///----------------------------------------------------------------------------
/// Class LLSnapshotFloaterView