summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xindra/newview/CMakeLists.txt2
-rwxr-xr-xindra/newview/llappviewer.cpp3
-rwxr-xr-xindra/newview/llassetuploadresponders.cpp11
-rw-r--r--indra/newview/llfloaterfacebook.cpp2
-rw-r--r--indra/newview/llfloaterflickr.cpp2
-rw-r--r--indra/newview/llfloateroutfitsnapshot.cpp1586
-rw-r--r--indra/newview/llfloateroutfitsnapshot.h110
-rwxr-xr-xindra/newview/llfloatersnapshot.cpp110
-rwxr-xr-xindra/newview/llfloatersnapshot.h49
-rw-r--r--indra/newview/llfloatertwitter.cpp2
-rw-r--r--indra/newview/lloutfitgallery.cpp51
-rw-r--r--indra/newview/lloutfitgallery.h5
-rwxr-xr-xindra/newview/lloutfitslist.cpp7
-rwxr-xr-xindra/newview/lloutfitslist.h1
-rwxr-xr-xindra/newview/llpanelsnapshot.cpp18
-rwxr-xr-xindra/newview/llpanelsnapshot.h11
-rwxr-xr-xindra/newview/llpanelsnapshotinventory.cpp112
-rwxr-xr-xindra/newview/llpanelsnapshotlocal.cpp19
-rw-r--r--indra/newview/llpanelsnapshotpostcard.cpp11
-rwxr-xr-xindra/newview/llpanelsnapshotprofile.cpp2
-rw-r--r--indra/newview/llsnapshotlivepreview.cpp36
-rw-r--r--indra/newview/llsnapshotlivepreview.h22
-rwxr-xr-xindra/newview/llviewerfloaterreg.cpp4
-rwxr-xr-xindra/newview/llviewermenufile.cpp2
-rw-r--r--indra/newview/skins/default/xui/en/floater_outfit_snapshot.xml462
-rwxr-xr-xindra/newview/skins/default/xui/en/menu_outfit_gear.xml9
-rw-r--r--indra/newview/skins/default/xui/en/panel_outfit_snapshot_inventory.xml147
27 files changed, 2688 insertions, 108 deletions
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 6567654a9d..595a9a5e21 100755
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -271,6 +271,7 @@ set(viewer_SOURCE_FILES
llfloaternamedesc.cpp
llfloaternotificationsconsole.cpp
llfloaternotificationstabbed.cpp
+ llfloateroutfitsnapshot.cpp
llfloaterobjectweights.cpp
llfloateropenobject.cpp
llfloateroutbox.cpp
@@ -894,6 +895,7 @@ set(viewer_HEADER_FILES
llfloaternamedesc.h
llfloaternotificationsconsole.h
llfloaternotificationstabbed.h
+ llfloateroutfitsnapshot.h
llfloaterobjectweights.h
llfloateropenobject.h
llfloateroutbox.h
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 2898d8ca31..1887adc97e 100755
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -203,6 +203,7 @@
#include "llcommandlineparser.h"
#include "llfloatermemleak.h"
#include "llfloaterreg.h"
+#include "llfloateroutfitsnapshot.h"
#include "llfloatersnapshot.h"
#include "llfloaterinventory.h"
@@ -1471,6 +1472,8 @@ bool LLAppViewer::mainLoop()
display();
pingMainloopTimeout("Main:Snapshot");
LLFloaterSnapshot::update(); // take snapshots
+ //TODO: Make one call by moving LLFloaterOutfitSnapshot::update() to LLFloaterSnapshotBase class
+ LLFloaterOutfitSnapshot::update();
gGLActive = FALSE;
}
}
diff --git a/indra/newview/llassetuploadresponders.cpp b/indra/newview/llassetuploadresponders.cpp
index 121ce647a6..86576538ec 100755
--- a/indra/newview/llassetuploadresponders.cpp
+++ b/indra/newview/llassetuploadresponders.cpp
@@ -178,9 +178,14 @@ void on_new_single_inventory_upload_complete(
// Let the Snapshot floater know we have finished uploading a snapshot to inventory.
LLFloater* floater_snapshot = LLFloaterReg::findInstance("snapshot");
- if (asset_type == LLAssetType::AT_TEXTURE && floater_snapshot)
- {
- floater_snapshot->notify(LLSD().with("set-finished", LLSD().with("ok", success).with("msg", "inventory")));
+ if (asset_type == LLAssetType::AT_TEXTURE && floater_snapshot && floater_snapshot->isShown())
+ {
+ floater_snapshot->notify(LLSD().with("set-finished", LLSD().with("ok", success).with("msg", "inventory")));
+ }
+ LLFloater* floater_outfit_snapshot = LLFloaterReg::findInstance("outfit_snapshot");
+ if (asset_type == LLAssetType::AT_TEXTURE && floater_outfit_snapshot && floater_outfit_snapshot->isShown())
+ {
+ floater_outfit_snapshot->notify(LLSD().with("set-finished", LLSD().with("ok", success).with("msg", "inventory")));
}
}
diff --git a/indra/newview/llfloaterfacebook.cpp b/indra/newview/llfloaterfacebook.cpp
index da85d378b2..ff6e342d62 100644
--- a/indra/newview/llfloaterfacebook.cpp
+++ b/indra/newview/llfloaterfacebook.cpp
@@ -488,7 +488,7 @@ void LLFacebookPhotoPanel::onVisibilityChange(BOOL visible)
mQuality = MAX_QUALITY;
previewp->setContainer(this);
- previewp->setSnapshotType(previewp->SNAPSHOT_WEB);
+ previewp->setSnapshotType(LLPanelSnapshot::SNAPSHOT_WEB);
previewp->setSnapshotFormat(LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG);
previewp->setSnapshotQuality(mQuality, false);
previewp->setThumbnailSubsampled(TRUE); // We want the preview to reflect the *saved* image
diff --git a/indra/newview/llfloaterflickr.cpp b/indra/newview/llfloaterflickr.cpp
index cd132b843d..131df22956 100644
--- a/indra/newview/llfloaterflickr.cpp
+++ b/indra/newview/llfloaterflickr.cpp
@@ -238,7 +238,7 @@ void LLFlickrPhotoPanel::onVisibilityChange(BOOL visible)
mPreviewHandle = previewp->getHandle();
previewp->setContainer(this);
- previewp->setSnapshotType(previewp->SNAPSHOT_WEB);
+ previewp->setSnapshotType(LLPanelSnapshot::SNAPSHOT_WEB);
previewp->setSnapshotFormat(LLFloaterSnapshot::SNAPSHOT_FORMAT_PNG);
previewp->setThumbnailSubsampled(TRUE); // We want the preview to reflect the *saved* image
previewp->setAllowRenderUI(FALSE); // We do not want the rendered UI in our snapshots
diff --git a/indra/newview/llfloateroutfitsnapshot.cpp b/indra/newview/llfloateroutfitsnapshot.cpp
new file mode 100644
index 0000000000..8fa54e7f94
--- /dev/null
+++ b/indra/newview/llfloateroutfitsnapshot.cpp
@@ -0,0 +1,1586 @@
+/**
+ * @file llfloatersnapshot.cpp
+ * @brief Snapshot preview window for saving as an outfit thumbnail in visual outfit gallery
+ *
+ * $LicenseInfo:firstyear=2004&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2016, 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 "llfloatersnapshot.h"
+#include "llfloateroutfitsnapshot.h"
+
+#include "llagent.h"
+#include "llfacebookconnect.h"
+#include "llfloaterreg.h"
+#include "llfloaterfacebook.h"
+#include "llfloaterflickr.h"
+#include "llfloatertwitter.h"
+#include "llimagefiltersmanager.h"
+#include "llcheckboxctrl.h"
+#include "llcombobox.h"
+#include "llpostcard.h"
+#include "llresmgr.h" // LLLocale
+#include "llsdserialize.h"
+#include "llsidetraypanelcontainer.h"
+#include "llsnapshotlivepreview.h"
+#include "llspinctrl.h"
+#include "llviewercontrol.h"
+#include "lltoolfocus.h"
+#include "lltoolmgr.h"
+#include "llwebprofile.h"
+
+///----------------------------------------------------------------------------
+/// Local function declarations, constants, enums, and typedefs
+///----------------------------------------------------------------------------
+LLUICtrl* LLFloaterOutfitSnapshot::sThumbnailPlaceholder = NULL;
+LLOutfitSnapshotFloaterView* gOutfitSnapshotFloaterView = NULL;
+
+const F32 AUTO_SNAPSHOT_TIME_DELAY = 1.f;
+
+const S32 MAX_POSTCARD_DATASIZE = 1024 * 1024; // one megabyte
+const S32 MAX_TEXTURE_SIZE = 512 ; //max upload texture size 512 * 512
+
+static LLDefaultChildRegistry::Register<LLOutfitSnapshotFloaterView> r("snapshot_outfit_floater_view");
+
+
+///----------------------------------------------------------------------------
+/// Class LLFloaterSnapshot::Impl
+///----------------------------------------------------------------------------
+
+
+class LLFloaterOutfitSnapshot::Impl
+{
+ LOG_CLASS(LLFloaterOutfitSnapshot::Impl);
+public:
+ typedef enum e_status
+ {
+ STATUS_READY,
+ STATUS_WORKING,
+ STATUS_FINISHED
+ } EStatus;
+
+ Impl()
+ : mAvatarPauseHandles(),
+ mLastToolset(NULL),
+ mAspectRatioCheckOff(false),
+ mNeedRefresh(false),
+ mStatus(STATUS_READY)
+ {
+ }
+ ~Impl()
+ {
+ //unpause avatars
+ mAvatarPauseHandles.clear();
+
+ }
+ static void onClickNewSnapshot(void* data);
+ static void onClickAutoSnap(LLUICtrl *ctrl, void* data);
+ static void onClickFilter(LLUICtrl *ctrl, void* data);
+ //static void onClickAdvanceSnap(LLUICtrl *ctrl, void* data);
+ static void onClickUICheck(LLUICtrl *ctrl, void* data);
+ static void onClickHUDCheck(LLUICtrl *ctrl, void* data);
+ static void applyKeepAspectCheck(LLFloaterOutfitSnapshot* view, BOOL checked);
+ 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 onImageQualityChange(LLFloaterOutfitSnapshot* view, S32 quality_val);
+ static void onImageFormatChange(LLFloaterOutfitSnapshot* view);
+ static void applyCustomResolution(LLFloaterOutfitSnapshot* view, S32 w, S32 h);
+ static void onSnapshotUploadFinished(bool status);
+ static void onSendingPostcardFinished(bool status);
+ static BOOL checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL isWidthChanged, S32 max_value);
+ static void setImageSizeSpinnersValues(LLFloaterOutfitSnapshot *view, S32 width, S32 height) ;
+ static void updateSpinners(LLFloaterOutfitSnapshot* view, LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL is_width_changed);
+
+ static LLPanelSnapshot* getActivePanel(LLFloaterOutfitSnapshot* floater, bool ok_if_not_found = true);
+ static LLPanelSnapshot::ESnapshotType getActiveSnapshotType(LLFloaterOutfitSnapshot* floater);
+ static LLFloaterOutfitSnapshot::ESnapshotFormat getImageFormat(LLFloaterOutfitSnapshot* floater);
+ static LLSpinCtrl* getWidthSpinner(LLFloaterOutfitSnapshot* floater);
+ static LLSpinCtrl* getHeightSpinner(LLFloaterOutfitSnapshot* floater);
+ static void enableAspectRatioCheckbox(LLFloaterOutfitSnapshot* floater, BOOL enable);
+ static void setAspectRatioCheckboxValue(LLFloaterOutfitSnapshot* floater, BOOL checked);
+
+ static LLSnapshotLivePreview* getPreviewView(LLFloaterOutfitSnapshot *floater);
+ static void setResolution(LLFloaterOutfitSnapshot* floater, const std::string& comboname);
+ static void updateControls(LLFloaterOutfitSnapshot* floater);
+ static void updateLayout(LLFloaterOutfitSnapshot* floater);
+ static void setStatus(EStatus status, bool ok = true, const std::string& msg = LLStringUtil::null);
+ EStatus getStatus() const { return mStatus; }
+ static void setNeedRefresh(LLFloaterOutfitSnapshot* floater, bool need);
+
+private:
+ static LLViewerWindow::ESnapshotType getLayerType(LLFloaterOutfitSnapshot* floater);
+ static void comboSetCustom(LLFloaterOutfitSnapshot *floater, const std::string& comboname);
+ static void checkAutoSnapshot(LLSnapshotLivePreview* floater, BOOL update_thumbnail = FALSE);
+ static void checkAspectRatio(LLFloaterOutfitSnapshot *view, S32 index) ;
+ static void setWorking(LLFloaterOutfitSnapshot* floater, bool working);
+ static void setFinished(LLFloaterOutfitSnapshot* floater, bool finished, bool ok = true, const std::string& msg = LLStringUtil::null);
+
+
+public:
+ std::vector<LLAnimPauseRequest> mAvatarPauseHandles;
+
+ LLToolset* mLastToolset;
+ LLHandle<LLView> mPreviewHandle;
+ bool mAspectRatioCheckOff ;
+ bool mNeedRefresh;
+ EStatus mStatus;
+};
+
+
+
+// static
+LLPanelSnapshot* LLFloaterOutfitSnapshot::Impl::getActivePanel(LLFloaterOutfitSnapshot* floater, bool ok_if_not_found)
+{
+ LLPanel* panel = floater->getChild<LLPanel>("panel_outfit_snapshot_inventory");
+ //LLPanel* panel = panel_container->getCurrentPanel();
+ LLPanelSnapshot* active_panel = dynamic_cast<LLPanelSnapshot*>(panel);
+ if (!ok_if_not_found)
+ {
+ llassert_always(active_panel != NULL);
+ }
+ return active_panel;
+}
+
+// static
+LLPanelSnapshot::ESnapshotType LLFloaterOutfitSnapshot::Impl::getActiveSnapshotType(LLFloaterOutfitSnapshot* floater)
+{
+ //LLSnapshotLivePreview::ESnapshotType type = LLSnapshotLivePreview::SNAPSHOT_WEB;
+ //std::string name;
+ LLPanelSnapshot* spanel = getActivePanel(floater);
+
+ //if (spanel)
+ //{
+ // name = spanel->getName();
+ //}
+
+ //if (name == "panel_snapshot_postcard")
+ //{
+ // type = LLSnapshotLivePreview::SNAPSHOT_POSTCARD;
+ //}
+ //else if (name == "panel_snapshot_inventory")
+ //{
+ // type = LLSnapshotLivePreview::SNAPSHOT_TEXTURE;
+ //}
+ //else if (name == "panel_snapshot_local")
+ //{
+ // type = LLSnapshotLivePreview::SNAPSHOT_LOCAL;
+ //}
+
+ //return type;
+ if (spanel)
+ {
+ return spanel->getSnapshotType();
+ }
+ return LLPanelSnapshot::SNAPSHOT_WEB;
+}
+
+// static
+LLFloaterOutfitSnapshot::ESnapshotFormat LLFloaterOutfitSnapshot::Impl::getImageFormat(LLFloaterOutfitSnapshot* floater)
+{
+ //LLPanelSnapshot* active_panel = getActivePanel(floater);
+ // FIXME: if the default is not PNG, profile uploads may fail.
+ //return active_panel ? active_panel->getImageFormat() : LLFloaterOutfitSnapshot::SNAPSHOT_FORMAT_PNG;
+ return LLFloaterOutfitSnapshot::SNAPSHOT_FORMAT_PNG;
+}
+
+// static
+LLSpinCtrl* LLFloaterOutfitSnapshot::Impl::getWidthSpinner(LLFloaterOutfitSnapshot* floater)
+{
+ LLPanelSnapshot* active_panel = getActivePanel(floater);
+ return active_panel ? active_panel->getWidthSpinner() : floater->getChild<LLSpinCtrl>("snapshot_width");
+}
+
+// static
+LLSpinCtrl* LLFloaterOutfitSnapshot::Impl::getHeightSpinner(LLFloaterOutfitSnapshot* floater)
+{
+ LLPanelSnapshot* active_panel = getActivePanel(floater);
+ return active_panel ? active_panel->getHeightSpinner() : floater->getChild<LLSpinCtrl>("snapshot_height");
+}
+
+// static
+void LLFloaterOutfitSnapshot::Impl::enableAspectRatioCheckbox(LLFloaterOutfitSnapshot* floater, BOOL enable)
+{
+ LLPanelSnapshot* active_panel = getActivePanel(floater);
+ if (active_panel)
+ {
+ active_panel->enableAspectRatioCheckbox(enable);
+ }
+}
+
+// static
+void LLFloaterOutfitSnapshot::Impl::setAspectRatioCheckboxValue(LLFloaterOutfitSnapshot* floater, BOOL checked)
+{
+ LLPanelSnapshot* active_panel = getActivePanel(floater);
+ if (active_panel)
+ {
+ active_panel->getChild<LLUICtrl>(active_panel->getAspectRatioCBName())->setValue(checked);
+ }
+}
+
+// static
+LLSnapshotLivePreview* LLFloaterOutfitSnapshot::Impl::getPreviewView(LLFloaterOutfitSnapshot *floater)
+{
+ LLSnapshotLivePreview* previewp = (LLSnapshotLivePreview*)floater->impl.mPreviewHandle.get();
+ return previewp;
+}
+
+// static
+LLViewerWindow::ESnapshotType LLFloaterOutfitSnapshot::Impl::getLayerType(LLFloaterOutfitSnapshot* floater)
+{
+ LLViewerWindow::ESnapshotType type = LLViewerWindow::SNAPSHOT_TYPE_COLOR;
+ LLSD value = floater->getChild<LLUICtrl>("layer_types")->getValue();
+ const std::string id = value.asString();
+ if (id == "colors")
+ type = LLViewerWindow::SNAPSHOT_TYPE_COLOR;
+ else if (id == "depth")
+ type = LLViewerWindow::SNAPSHOT_TYPE_DEPTH;
+ return type;
+}
+
+// static
+void LLFloaterOutfitSnapshot::Impl::setResolution(LLFloaterOutfitSnapshot* floater, const std::string& comboname)
+{
+ LLComboBox* combo = floater->getChild<LLComboBox>(comboname);
+ combo->setVisible(TRUE);
+ updateResolution(combo, floater, FALSE); // to sync spinners with combo
+}
+
+//static
+void LLFloaterOutfitSnapshot::Impl::updateLayout(LLFloaterOutfitSnapshot* floaterp)
+{
+ LLSnapshotLivePreview* previewp = getPreviewView(floaterp);
+
+ BOOL advanced = gSavedSettings.getBOOL("AdvanceSnapshot");
+
+ //BD - Automatically calculate the size of our snapshot window to enlarge
+ // the snapshot preview to its maximum size, this is especially helpfull
+ // for pretty much every aspect ratio other than 1:1.
+ F32 panel_width = 400.f * gViewerWindow->getWorldViewAspectRatio();
+
+ //BD - Make sure we clamp at 700 here because 700 would be for 16:9 which we
+ // consider the maximum. Everything bigger will be clamped and will have
+ // a slightly smaller preview window which most likely won't fill up the
+ // whole snapshot floater as it should.
+ if(panel_width > 700.f)
+ {
+ panel_width = 700.f;
+ }
+
+ S32 floater_width = 224.f;
+ if(advanced)
+ {
+ floater_width = floater_width + panel_width;
+ }
+
+ LLUICtrl* thumbnail_placeholder = floaterp->getChild<LLUICtrl>("thumbnail_placeholder");
+ thumbnail_placeholder->setVisible(advanced);
+ thumbnail_placeholder->reshape(panel_width, thumbnail_placeholder->getRect().getHeight());
+ floaterp->getChild<LLUICtrl>("image_res_text")->setVisible(advanced);
+ floaterp->getChild<LLUICtrl>("file_size_label")->setVisible(advanced);
+ if(!floaterp->isMinimized())
+ {
+ floaterp->reshape(floater_width, floaterp->getRect().getHeight());
+ }
+
+ 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
+ // *TODO: unneeded?
+ floaterp->reshape(floaterp->getRect().getWidth(), floaterp->getRect().getHeight());
+
+ // can see and interact with fullscreen preview now
+ if (previewp)
+ {
+ previewp->setVisible(TRUE);
+ previewp->setEnabled(TRUE);
+ }
+
+ //RN: freeze all avatars
+ LLCharacter* avatarp;
+ for (std::vector<LLCharacter*>::iterator iter = LLCharacter::sInstances.begin();
+ iter != LLCharacter::sInstances.end(); ++iter)
+ {
+ avatarp = *iter;
+ floaterp->impl.mAvatarPauseHandles.push_back(avatarp->requestPause());
+ }
+
+ // freeze everything else
+ gSavedSettings.setBOOL("FreezeTime", TRUE);
+
+ if (LLToolMgr::getInstance()->getCurrentToolset() != gCameraToolset)
+ {
+ floaterp->impl.mLastToolset = LLToolMgr::getInstance()->getCurrentToolset();
+ LLToolMgr::getInstance()->setCurrentToolset(gCameraToolset);
+ }
+ }
+ else // turning off freeze frame mode
+ {
+ floaterp->getParent()->setMouseOpaque(FALSE);
+ // *TODO: unneeded?
+ floaterp->reshape(floaterp->getRect().getWidth(), floaterp->getRect().getHeight());
+ if (previewp)
+ {
+ previewp->setVisible(FALSE);
+ previewp->setEnabled(FALSE);
+ }
+
+ //RN: thaw all avatars
+ floaterp->impl.mAvatarPauseHandles.clear();
+
+ // thaw everything else
+ gSavedSettings.setBOOL("FreezeTime", FALSE);
+
+ // restore last tool (e.g. pie menu, etc)
+ if (floaterp->impl.mLastToolset)
+ {
+ LLToolMgr::getInstance()->setCurrentToolset(floaterp->impl.mLastToolset);
+ }
+ }
+}
+
+// This is the main function that keeps all the GUI controls in sync with the saved settings.
+// It should be called anytime a setting is changed that could affect the controls.
+// No other methods should be changing any of the controls directly except for helpers called by this method.
+// The basic pattern for programmatically changing the GUI settings is to first set the
+// appropriate saved settings and then call this method to sync the GUI with them.
+// FIXME: The above comment seems obsolete now.
+// static
+void LLFloaterOutfitSnapshot::Impl::updateControls(LLFloaterOutfitSnapshot* floater)
+{
+ LLPanelSnapshot::ESnapshotType shot_type = getActiveSnapshotType(floater);
+ LLFloaterSnapshotBase::ESnapshotFormat shot_format = (LLFloaterSnapshotBase::ESnapshotFormat)gSavedSettings.getS32("SnapshotFormat");
+ LLViewerWindow::ESnapshotType layer_type = getLayerType(floater);
+
+ floater->getChild<LLComboBox>("local_format_combo")->selectNthItem(gSavedSettings.getS32("SnapshotFormat"));
+ floater->getChildView("layer_types")->setEnabled(shot_type == LLPanelSnapshot::SNAPSHOT_LOCAL);
+
+ LLPanelSnapshot* active_panel = getActivePanel(floater);
+ if (active_panel)
+ {
+ LLSpinCtrl* width_ctrl = getWidthSpinner(floater);
+ LLSpinCtrl* height_ctrl = getHeightSpinner(floater);
+
+ // Initialize spinners.
+ if (width_ctrl->getValue().asInteger() == 0)
+ {
+ S32 w = gViewerWindow->getWindowWidthRaw();
+ LL_DEBUGS() << "Initializing width spinner (" << width_ctrl->getName() << "): " << w << LL_ENDL;
+ width_ctrl->setValue(w);
+ if (getActiveSnapshotType(floater) == LLPanelSnapshot::SNAPSHOT_TEXTURE)
+ {
+ width_ctrl->setIncrement(w >> 1);
+ }
+ }
+ if (height_ctrl->getValue().asInteger() == 0)
+ {
+ S32 h = gViewerWindow->getWindowHeightRaw();
+ LL_DEBUGS() << "Initializing height spinner (" << height_ctrl->getName() << "): " << h << LL_ENDL;
+ height_ctrl->setValue(h);
+ if (getActiveSnapshotType(floater) == LLPanelSnapshot::SNAPSHOT_TEXTURE)
+ {
+ height_ctrl->setIncrement(h >> 1);
+ }
+ }
+
+ // Clamp snapshot resolution to window size when showing UI or HUD in snapshot.
+ if (gSavedSettings.getBOOL("RenderUIInSnapshot") || gSavedSettings.getBOOL("RenderHUDInSnapshot"))
+ {
+ S32 width = gViewerWindow->getWindowWidthRaw();
+ S32 height = gViewerWindow->getWindowHeightRaw();
+
+ width_ctrl->setMaxValue(width);
+
+ height_ctrl->setMaxValue(height);
+
+ if (width_ctrl->getValue().asInteger() > width)
+ {
+ width_ctrl->forceSetValue(width);
+ }
+ if (height_ctrl->getValue().asInteger() > height)
+ {
+ height_ctrl->forceSetValue(height);
+ }
+ }
+ else
+ {
+ width_ctrl->setMaxValue(6016);
+ height_ctrl->setMaxValue(6016);
+ }
+ }
+
+ 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
+ LL_DEBUGS() << "Is snapshot up-to-date? " << got_snap << LL_ENDL;
+
+ LLLocale locale(LLLocale::USER_LOCALE);
+ std::string bytes_string;
+ if (got_snap)
+ {
+ LLResMgr::getInstance()->getIntegerString(bytes_string, (previewp->getDataSize()) >> 10 );
+ }
+
+ // Update displayed image resolution.
+ LLTextBox* image_res_tb = floater->getChild<LLTextBox>("image_res_text");
+ image_res_tb->setVisible(got_snap);
+ if (got_snap)
+ {
+ image_res_tb->setTextArg("[WIDTH]", llformat("%d", previewp->getEncodedImageWidth()));
+ image_res_tb->setTextArg("[HEIGHT]", llformat("%d", previewp->getEncodedImageHeight()));
+ }
+
+ floater->getChild<LLUICtrl>("file_size_label")->setTextArg("[SIZE]", got_snap ? bytes_string : floater->getString("unknown"));
+ floater->getChild<LLUICtrl>("file_size_label")->setColor(
+ shot_type == LLPanelSnapshot::SNAPSHOT_POSTCARD
+ && got_bytes
+ && previewp->getDataSize() > MAX_POSTCARD_DATASIZE ? LLUIColor(LLColor4::red) : LLUIColorTable::instance().getColor( "LabelTextColor" ));
+
+ // Update the width and height spinners based on the corresponding resolution combos. (?)
+ switch(shot_type)
+ {
+ case LLPanelSnapshot::SNAPSHOT_WEB:
+ layer_type = LLViewerWindow::SNAPSHOT_TYPE_COLOR;
+ floater->getChild<LLUICtrl>("layer_types")->setValue("colors");
+ setResolution(floater, "profile_size_combo");
+ break;
+ case LLPanelSnapshot::SNAPSHOT_POSTCARD:
+ layer_type = LLViewerWindow::SNAPSHOT_TYPE_COLOR;
+ floater->getChild<LLUICtrl>("layer_types")->setValue("colors");
+ setResolution(floater, "postcard_size_combo");
+ break;
+ case LLPanelSnapshot::SNAPSHOT_TEXTURE:
+ layer_type = LLViewerWindow::SNAPSHOT_TYPE_COLOR;
+ floater->getChild<LLUICtrl>("layer_types")->setValue("colors");
+ setResolution(floater, "texture_size_combo");
+ break;
+ case LLPanelSnapshot::SNAPSHOT_LOCAL:
+ setResolution(floater, "local_size_combo");
+ break;
+ default:
+ break;
+ }
+ setAspectRatioCheckboxValue(floater, !floater->impl.mAspectRatioCheckOff && gSavedSettings.getBOOL("KeepAspectForSnapshot"));
+
+ if (previewp)
+ {
+ previewp->setSnapshotType(shot_type);
+ previewp->setSnapshotFormat(shot_format);
+ previewp->setSnapshotBufferType(layer_type);
+ }
+
+ LLPanelSnapshot* current_panel = Impl::getActivePanel(floater);
+ if (current_panel)
+ {
+ LLSD info;
+ info["have-snapshot"] = got_snap;
+ current_panel->updateControls(info);
+ }
+ LL_DEBUGS() << "finished updating controls" << LL_ENDL;
+}
+
+// static
+void LLFloaterOutfitSnapshot::Impl::setStatus(EStatus status, bool ok, const std::string& msg)
+{
+ LLFloaterOutfitSnapshot* floater = LLFloaterOutfitSnapshot::getInstance();
+ switch (status)
+ {
+ case STATUS_READY:
+ setWorking(floater, false);
+ setFinished(floater, false);
+ break;
+ case STATUS_WORKING:
+ setWorking(floater, true);
+ setFinished(floater, false);
+ break;
+ case STATUS_FINISHED:
+ setWorking(floater, false);
+ setFinished(floater, true, ok, msg);
+ break;
+ }
+
+ floater->impl.mStatus = status;
+}
+
+// static
+void LLFloaterOutfitSnapshot::Impl::setNeedRefresh(LLFloaterOutfitSnapshot* floater, bool need)
+{
+ if (!floater) return;
+
+ // Don't display the "Refresh to save" message if we're in auto-refresh mode.
+ if (gSavedSettings.getBOOL("AutoSnapshot"))
+ {
+ need = false;
+ }
+
+ floater->mRefreshLabel->setVisible(need);
+ floater->impl.mNeedRefresh = need;
+}
+
+// static
+void LLFloaterOutfitSnapshot::Impl::checkAutoSnapshot(LLSnapshotLivePreview* previewp, BOOL update_thumbnail)
+{
+ if (previewp)
+ {
+ BOOL autosnap = gSavedSettings.getBOOL("AutoSnapshot");
+ LL_DEBUGS() << "updating " << (autosnap ? "snapshot" : "thumbnail") << LL_ENDL;
+ previewp->updateSnapshot(autosnap, update_thumbnail, autosnap ? AUTO_SNAPSHOT_TIME_DELAY : 0.f);
+ }
+}
+
+// static
+void LLFloaterOutfitSnapshot::Impl::onClickNewSnapshot(void* data)
+{
+ LLSnapshotLivePreview* previewp = getPreviewView((LLFloaterOutfitSnapshot *)data);
+ LLFloaterOutfitSnapshot *view = (LLFloaterOutfitSnapshot *)data;
+ if (previewp && view)
+ {
+ view->impl.setStatus(Impl::STATUS_READY);
+ LL_DEBUGS() << "updating snapshot" << LL_ENDL;
+ previewp->mForceUpdateSnapshot = TRUE;
+ }
+}
+
+// static
+void LLFloaterOutfitSnapshot::Impl::onClickAutoSnap(LLUICtrl *ctrl, void* data)
+{
+ LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl;
+ gSavedSettings.setBOOL( "AutoSnapshot", check->get() );
+
+ LLFloaterOutfitSnapshot *view = (LLFloaterOutfitSnapshot *)data;
+ if (view)
+ {
+ checkAutoSnapshot(getPreviewView(view));
+ updateControls(view);
+ }
+}
+
+// static
+void LLFloaterOutfitSnapshot::Impl::onClickFilter(LLUICtrl *ctrl, void* data)
+{
+ LLFloaterOutfitSnapshot *view = (LLFloaterOutfitSnapshot *)data;
+ if (view)
+ {
+ updateControls(view);
+ LLSnapshotLivePreview* previewp = getPreviewView(view);
+ if (previewp)
+ {
+ checkAutoSnapshot(previewp);
+ // Note : index 0 of the filter drop down is assumed to be "No filter" in whichever locale
+ LLComboBox* filterbox = static_cast<LLComboBox *>(view->getChild<LLComboBox>("filters_combobox"));
+ std::string filter_name = (filterbox->getCurrentIndex() ? filterbox->getSimple() : "");
+ previewp->setFilter(filter_name);
+ previewp->updateSnapshot(TRUE);
+ }
+ }
+}
+
+// static
+void LLFloaterOutfitSnapshot::Impl::onClickUICheck(LLUICtrl *ctrl, void* data)
+{
+ LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl;
+ gSavedSettings.setBOOL( "RenderUIInSnapshot", check->get() );
+
+ LLFloaterOutfitSnapshot *view = (LLFloaterOutfitSnapshot *)data;
+ if (view)
+ {
+ LLSnapshotLivePreview* previewp = getPreviewView(view);
+ if(previewp)
+ {
+ previewp->updateSnapshot(TRUE, TRUE);
+ }
+ updateControls(view);
+ }
+}
+
+// static
+void LLFloaterOutfitSnapshot::Impl::onClickHUDCheck(LLUICtrl *ctrl, void* data)
+{
+ LLCheckBoxCtrl *check = (LLCheckBoxCtrl *)ctrl;
+ gSavedSettings.setBOOL( "RenderHUDInSnapshot", check->get() );
+
+ LLFloaterOutfitSnapshot *view = (LLFloaterOutfitSnapshot *)data;
+ if (view)
+ {
+ LLSnapshotLivePreview* previewp = getPreviewView(view);
+ if(previewp)
+ {
+ previewp->updateSnapshot(TRUE, TRUE);
+ }
+ updateControls(view);
+ }
+}
+
+// static
+void LLFloaterOutfitSnapshot::Impl::applyKeepAspectCheck(LLFloaterOutfitSnapshot* view, BOOL checked)
+{
+ gSavedSettings.setBOOL("KeepAspectForSnapshot", checked);
+
+ if (view)
+ {
+ LLPanelSnapshot* active_panel = getActivePanel(view);
+ if (checked && active_panel)
+ {
+ LLComboBox* combo = view->getChild<LLComboBox>(active_panel->getImageSizeComboName());
+ combo->setCurrentByIndex(combo->getItemCount() - 1); // "custom" is always the last index
+ }
+
+ LLSnapshotLivePreview* previewp = getPreviewView(view) ;
+ if(previewp)
+ {
+ previewp->mKeepAspectRatio = gSavedSettings.getBOOL("KeepAspectForSnapshot") ;
+
+ S32 w, h ;
+ previewp->getSize(w, h) ;
+ updateSpinners(view, previewp, w, h, TRUE); // may change w and h
+
+ LL_DEBUGS() << "updating thumbnail" << LL_ENDL;
+ previewp->setSize(w, h) ;
+ previewp->updateSnapshot(TRUE);
+ checkAutoSnapshot(previewp, TRUE);
+ }
+ }
+}
+
+// static
+void LLFloaterOutfitSnapshot::Impl::onCommitFreezeFrame(LLUICtrl* ctrl, void* data)
+{
+ LLCheckBoxCtrl* check_box = (LLCheckBoxCtrl*)ctrl;
+ LLFloaterOutfitSnapshot *view = (LLFloaterOutfitSnapshot *)data;
+ LLSnapshotLivePreview* previewp = getPreviewView(view);
+
+ if (!view || !check_box || !previewp)
+ {
+ return;
+ }
+
+ gSavedSettings.setBOOL("UseFreezeFrame", check_box->get());
+
+ if (check_box->get())
+ {
+ previewp->prepareFreezeFrame();
+ }
+
+ updateLayout(view);
+}
+
+// static
+void LLFloaterOutfitSnapshot::Impl::checkAspectRatio(LLFloaterOutfitSnapshot *view, S32 index)
+{
+ LLSnapshotLivePreview *previewp = getPreviewView(view) ;
+
+ // Don't round texture sizes; textures are commonly stretched in world, profiles, etc and need to be "squashed" during upload, not cropped here
+ if(LLPanelSnapshot::SNAPSHOT_TEXTURE == getActiveSnapshotType(view))
+ {
+ previewp->mKeepAspectRatio = FALSE ;
+ return ;
+ }
+
+ BOOL keep_aspect = FALSE, enable_cb = FALSE;
+
+ if (0 == index) // current window size
+ {
+ enable_cb = FALSE;
+ keep_aspect = TRUE;
+ }
+ else if (-1 == index) // custom
+ {
+ enable_cb = TRUE;
+ keep_aspect = gSavedSettings.getBOOL("KeepAspectForSnapshot");
+ }
+ else // predefined resolution
+ {
+ enable_cb = FALSE;
+ keep_aspect = FALSE;
+ }
+
+ view->impl.mAspectRatioCheckOff = !enable_cb;
+
+ if (previewp)
+ {
+ previewp->mKeepAspectRatio = keep_aspect;
+ }
+}
+
+// Show/hide upload progress indicators.
+// static
+void LLFloaterOutfitSnapshot::Impl::setWorking(LLFloaterOutfitSnapshot* floater, bool working)
+{
+ LLUICtrl* working_lbl = floater->getChild<LLUICtrl>("working_lbl");
+ working_lbl->setVisible(working);
+ floater->getChild<LLUICtrl>("working_indicator")->setVisible(working);
+
+ if (working)
+ {
+ const std::string panel_name = getActivePanel(floater, false)->getName();
+ const std::string prefix = panel_name.substr(std::string("panel_outfit_snapshot_").size());
+ std::string progress_text = floater->getString(prefix + "_" + "progress_str");
+ working_lbl->setValue(progress_text);
+ }
+
+ // All controls should be disabled while posting.
+ floater->setCtrlsEnabled(!working);
+ LLPanelSnapshot* active_panel = getActivePanel(floater);
+ if (active_panel)
+ {
+ active_panel->enableControls(!working);
+ }
+}
+
+// Show/hide upload status message.
+// static
+void LLFloaterOutfitSnapshot::Impl::setFinished(LLFloaterOutfitSnapshot* floater, bool finished, bool ok, const std::string& msg)
+{
+ floater->mSucceessLblPanel->setVisible(finished && ok);
+ floater->mFailureLblPanel->setVisible(finished && !ok);
+
+ if (finished)
+ {
+ LLUICtrl* finished_lbl = floater->getChild<LLUICtrl>(ok ? "succeeded_lbl" : "failed_lbl");
+ std::string result_text = floater->getString(msg + "_" + (ok ? "succeeded_str" : "failed_str"));
+ finished_lbl->setValue(result_text);
+
+ //LLSideTrayPanelContainer* panel_container = floater->getChild<LLSideTrayPanelContainer>("panel_container");
+ //panel_container->openPreviousPanel();
+ //panel_container->getCurrentPanel()->onOpen(LLSD());
+ LLPanel* snapshot_panel = floater->getChild<LLPanel>("panel_outfit_snapshot_inventory");
+ snapshot_panel->onOpen(LLSD());
+ }
+}
+
+// Apply a new resolution selected from the given combobox.
+// static
+void LLFloaterOutfitSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL do_update)
+{
+ LLComboBox* combobox = (LLComboBox*)ctrl;
+ LLFloaterOutfitSnapshot *view = (LLFloaterOutfitSnapshot *)data;
+
+ if (!view || !combobox)
+ {
+ llassert(view && combobox);
+ return;
+ }
+
+ std::string sdstring = combobox->getSelectedValue();
+ LLSD sdres;
+ std::stringstream sstream(sdstring);
+ LLSDSerialize::fromNotation(sdres, sstream, sdstring.size());
+
+ S32 width = sdres[0];
+ S32 height = sdres[1];
+
+ LLSnapshotLivePreview* previewp = getPreviewView(view);
+ if (previewp && combobox->getCurrentIndex() >= 0)
+ {
+ S32 original_width = 0 , original_height = 0 ;
+ previewp->getSize(original_width, original_height) ;
+
+ if (gSavedSettings.getBOOL("RenderUIInSnapshot") || gSavedSettings.getBOOL("RenderHUDInSnapshot"))
+ { //clamp snapshot resolution to window size when showing UI or HUD in snapshot
+ width = llmin(width, gViewerWindow->getWindowWidthRaw());
+ height = llmin(height, gViewerWindow->getWindowHeightRaw());
+ }
+
+ if (width == 0 || height == 0)
+ {
+ // take resolution from current window size
+ LL_DEBUGS() << "Setting preview res from window: " << gViewerWindow->getWindowWidthRaw() << "x" << gViewerWindow->getWindowHeightRaw() << LL_ENDL;
+ previewp->setSize(gViewerWindow->getWindowWidthRaw(), gViewerWindow->getWindowHeightRaw());
+ }
+ else if (width == -1 || height == -1)
+ {
+ // load last custom value
+ S32 new_width = 0, new_height = 0;
+ LLPanelSnapshot* spanel = getActivePanel(view);
+ if (spanel)
+ {
+ LL_DEBUGS() << "Loading typed res from panel " << spanel->getName() << LL_ENDL;
+ new_width = spanel->getTypedPreviewWidth();
+ new_height = spanel->getTypedPreviewHeight();
+
+ // Limit custom size for inventory snapshots to 512x512 px.
+ if (getActiveSnapshotType(view) == LLPanelSnapshot::SNAPSHOT_TEXTURE)
+ {
+ new_width = llmin(new_width, MAX_TEXTURE_SIZE);
+ new_height = llmin(new_height, MAX_TEXTURE_SIZE);
+ }
+ }
+ else
+ {
+ LL_DEBUGS() << "No custom res chosen, setting preview res from window: "
+ << gViewerWindow->getWindowWidthRaw() << "x" << gViewerWindow->getWindowHeightRaw() << LL_ENDL;
+ new_width = gViewerWindow->getWindowWidthRaw();
+ new_height = gViewerWindow->getWindowHeightRaw();
+ }
+
+ llassert(new_width > 0 && new_height > 0);
+ previewp->setSize(new_width, new_height);
+ }
+ else
+ {
+ // use the resolution from the selected pre-canned drop-down choice
+ LL_DEBUGS() << "Setting preview res selected from combo: " << width << "x" << height << LL_ENDL;
+ previewp->setSize(width, height);
+ }
+
+ checkAspectRatio(view, width) ;
+
+ previewp->getSize(width, height);
+
+ // We use the height spinner here because we come here via the aspect ratio
+ // checkbox as well and we want height always changing to width by default.
+ // If we use the width spinner we would change width according to height by
+ // default, that is not what we want.
+ updateSpinners(view, previewp, width, height, !getHeightSpinner(view)->isDirty()); // may change width and height
+
+ if(getWidthSpinner(view)->getValue().asInteger() != width || getHeightSpinner(view)->getValue().asInteger() != height)
+ {
+ getWidthSpinner(view)->setValue(width);
+ getHeightSpinner(view)->setValue(height);
+ if (getActiveSnapshotType(view) == LLPanelSnapshot::SNAPSHOT_TEXTURE)
+ {
+ getWidthSpinner(view)->setIncrement(width >> 1);
+ getHeightSpinner(view)->setIncrement(height >> 1);
+ }
+ }
+
+ if(original_width != width || original_height != height)
+ {
+ previewp->setSize(width, height);
+
+ // hide old preview as the aspect ratio could be wrong
+ checkAutoSnapshot(previewp, FALSE);
+ LL_DEBUGS() << "updating thumbnail" << LL_ENDL;
+ getPreviewView(view)->updateSnapshot(TRUE);
+ if(do_update)
+ {
+ LL_DEBUGS() << "Will update controls" << LL_ENDL;
+ updateControls(view);
+ }
+ }
+ }
+}
+
+// static
+void LLFloaterOutfitSnapshot::Impl::onCommitLayerTypes(LLUICtrl* ctrl, void*data)
+{
+ LLComboBox* combobox = (LLComboBox*)ctrl;
+
+ LLFloaterOutfitSnapshot *view = (LLFloaterOutfitSnapshot *)data;
+
+ if (view)
+ {
+ LLSnapshotLivePreview* previewp = getPreviewView(view);
+ if (previewp)
+ {
+ previewp->setSnapshotBufferType((LLViewerWindow::ESnapshotType)combobox->getCurrentIndex());
+ }
+ checkAutoSnapshot(previewp, TRUE);
+ }
+}
+
+// static
+void LLFloaterOutfitSnapshot::Impl::onImageQualityChange(LLFloaterOutfitSnapshot* view, S32 quality_val)
+{
+ LLSnapshotLivePreview* previewp = getPreviewView(view);
+ if (previewp)
+ {
+ previewp->setSnapshotQuality(quality_val);
+ }
+}
+
+// static
+void LLFloaterOutfitSnapshot::Impl::onImageFormatChange(LLFloaterOutfitSnapshot* view)
+{
+ if (view)
+ {
+ gSavedSettings.setS32("SnapshotFormat", getImageFormat(view));
+ LL_DEBUGS() << "image format changed, updating snapshot" << LL_ENDL;
+ getPreviewView(view)->updateSnapshot(TRUE);
+ updateControls(view);
+ }
+}
+
+// Sets the named size combo to "custom" mode.
+// static
+void LLFloaterOutfitSnapshot::Impl::comboSetCustom(LLFloaterOutfitSnapshot* floater, const std::string& comboname)
+{
+ LLComboBox* combo = floater->getChild<LLComboBox>(comboname);
+ combo->setCurrentByIndex(combo->getItemCount() - 1); // "custom" is always the last index
+ checkAspectRatio(floater, -1); // -1 means custom
+}
+
+// Update supplied width and height according to the constrain proportions flag; limit them by max_val.
+//static
+BOOL LLFloaterOutfitSnapshot::Impl::checkImageSize(LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL isWidthChanged, S32 max_value)
+{
+ S32 w = width ;
+ S32 h = height ;
+
+ if(previewp && previewp->mKeepAspectRatio)
+ {
+ if(gViewerWindow->getWindowWidthRaw() < 1 || gViewerWindow->getWindowHeightRaw() < 1)
+ {
+ return FALSE ;
+ }
+
+ //aspect ratio of the current window
+ F32 aspect_ratio = (F32)gViewerWindow->getWindowWidthRaw() / gViewerWindow->getWindowHeightRaw() ;
+
+ //change another value proportionally
+ if(isWidthChanged)
+ {
+ height = ll_round(width / aspect_ratio) ;
+ }
+ else
+ {
+ width = ll_round(height * aspect_ratio) ;
+ }
+
+ //bound w/h by the max_value
+ if(width > max_value || height > max_value)
+ {
+ if(width > height)
+ {
+ width = max_value ;
+ height = (S32)(width / aspect_ratio) ;
+ }
+ else
+ {
+ height = max_value ;
+ width = (S32)(height * aspect_ratio) ;
+ }
+ }
+ }
+
+ return (w != width || h != height) ;
+}
+
+//static
+void LLFloaterOutfitSnapshot::Impl::setImageSizeSpinnersValues(LLFloaterOutfitSnapshot *view, S32 width, S32 height)
+{
+ getWidthSpinner(view)->forceSetValue(width);
+ getHeightSpinner(view)->forceSetValue(height);
+ if (getActiveSnapshotType(view) == LLPanelSnapshot::SNAPSHOT_TEXTURE)
+ {
+ getWidthSpinner(view)->setIncrement(width >> 1);
+ getHeightSpinner(view)->setIncrement(height >> 1);
+ }
+}
+
+// static
+void LLFloaterOutfitSnapshot::Impl::updateSpinners(LLFloaterOutfitSnapshot* view, LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL is_width_changed)
+{
+ getWidthSpinner(view)->resetDirty();
+ getHeightSpinner(view)->resetDirty();
+ if (checkImageSize(previewp, width, height, is_width_changed, previewp->getMaxImageSize()))
+ {
+ setImageSizeSpinnersValues(view, width, height);
+ }
+}
+
+// static
+void LLFloaterOutfitSnapshot::Impl::applyCustomResolution(LLFloaterOutfitSnapshot* view, S32 w, S32 h)
+{
+ LL_DEBUGS() << "applyCustomResolution(" << w << ", " << h << ")" << LL_ENDL;
+ if (!view) return;
+
+ LLSnapshotLivePreview* previewp = getPreviewView(view);
+ if (previewp)
+ {
+ S32 curw,curh;
+ previewp->getSize(curw, curh);
+
+ if (w != curw || h != curh)
+ {
+ //if to upload a snapshot, process spinner input in a special way.
+ previewp->setMaxImageSize((S32) getWidthSpinner(view)->getMaxValue()) ;
+
+ previewp->setSize(w,h);
+ checkAutoSnapshot(previewp, FALSE);
+ comboSetCustom(view, "profile_size_combo");
+ comboSetCustom(view, "postcard_size_combo");
+ comboSetCustom(view, "texture_size_combo");
+ comboSetCustom(view, "local_size_combo");
+ LL_DEBUGS() << "applied custom resolution, updating thumbnail" << LL_ENDL;
+ previewp->updateSnapshot(TRUE);
+ }
+ }
+}
+
+// static
+void LLFloaterOutfitSnapshot::Impl::onSnapshotUploadFinished(bool status)
+{
+ setStatus(STATUS_FINISHED, status, "profile");
+}
+
+
+// static
+void LLFloaterOutfitSnapshot::Impl::onSendingPostcardFinished(bool status)
+{
+ setStatus(STATUS_FINISHED, status, "postcard");
+}
+
+
+///----------------------------------------------------------------------------
+/// Class LLFloaterSnapshot
+///----------------------------------------------------------------------------
+
+// Default constructor
+LLFloaterOutfitSnapshot::LLFloaterOutfitSnapshot(const LLSD& key)
+ : LLFloaterSnapshotBase(key),
+ mRefreshBtn(NULL),
+ mRefreshLabel(NULL),
+ mSucceessLblPanel(NULL),
+ mFailureLblPanel(NULL),
+ mOutfitGallery(NULL),
+ impl (*(new Impl))
+{
+}
+
+// Destroys the object
+LLFloaterOutfitSnapshot::~LLFloaterOutfitSnapshot()
+{
+ if (impl.mPreviewHandle.get()) impl.mPreviewHandle.get()->die();
+
+ //unfreeze everything else
+ gSavedSettings.setBOOL("FreezeTime", FALSE);
+
+ if (impl.mLastToolset)
+ {
+ LLToolMgr::getInstance()->setCurrentToolset(impl.mLastToolset);
+ }
+
+ delete &impl;
+}
+
+
+BOOL LLFloaterOutfitSnapshot::postBuild()
+{
+ mRefreshBtn = getChild<LLUICtrl>("new_snapshot_btn");
+ childSetAction("new_snapshot_btn", Impl::onClickNewSnapshot, this);
+ mRefreshLabel = getChild<LLUICtrl>("refresh_lbl");
+ mSucceessLblPanel = getChild<LLUICtrl>("succeeded_panel");
+ mFailureLblPanel = getChild<LLUICtrl>("failed_panel");
+
+ childSetCommitCallback("ui_check", Impl::onClickUICheck, this);
+ getChild<LLUICtrl>("ui_check")->setValue(gSavedSettings.getBOOL("RenderUIInSnapshot"));
+
+ childSetCommitCallback("hud_check", Impl::onClickHUDCheck, this);
+ getChild<LLUICtrl>("hud_check")->setValue(gSavedSettings.getBOOL("RenderHUDInSnapshot"));
+
+ impl.setAspectRatioCheckboxValue(this, gSavedSettings.getBOOL("KeepAspectForSnapshot"));
+
+ childSetCommitCallback("layer_types", Impl::onCommitLayerTypes, this);
+ getChild<LLUICtrl>("layer_types")->setValue("colors");
+ getChildView("layer_types")->setEnabled(FALSE);
+
+ getChild<LLUICtrl>("freeze_frame_check")->setValue(gSavedSettings.getBOOL("UseFreezeFrame"));
+ childSetCommitCallback("freeze_frame_check", Impl::onCommitFreezeFrame, this);
+
+ getChild<LLUICtrl>("auto_snapshot_check")->setValue(gSavedSettings.getBOOL("AutoSnapshot"));
+ childSetCommitCallback("auto_snapshot_check", Impl::onClickAutoSnap, this);
+
+
+ // Filters
+ LLComboBox* filterbox = getChild<LLComboBox>("filters_combobox");
+ std::vector<std::string> filter_list = LLImageFiltersManager::getInstance()->getFiltersList();
+ for (U32 i = 0; i < filter_list.size(); i++)
+ {
+ filterbox->add(filter_list[i]);
+ }
+ childSetCommitCallback("filters_combobox", Impl::onClickFilter, this);
+
+ LLWebProfile::setImageUploadResultCallback(boost::bind(&LLFloaterOutfitSnapshot::Impl::onSnapshotUploadFinished, _1));
+ LLPostCard::setPostResultCallback(boost::bind(&LLFloaterOutfitSnapshot::Impl::onSendingPostcardFinished, _1));
+
+ sThumbnailPlaceholder = getChild<LLUICtrl>("thumbnail_placeholder");
+
+ // create preview window
+ LLRect full_screen_rect = getRootView()->getRect();
+ LLSnapshotLivePreview::Params p;
+ p.rect(full_screen_rect);
+ LLSnapshotLivePreview* previewp = new LLSnapshotLivePreview(p);
+ LLView* parent_view = gSnapshotFloaterView->getParent();
+
+ parent_view->removeChild(gSnapshotFloaterView);
+ // make sure preview is below snapshot floater
+ parent_view->addChild(previewp);
+ parent_view->addChild(gSnapshotFloaterView);
+
+ //move snapshot floater to special purpose snapshotfloaterview
+ gFloaterView->removeChild(this);
+ gSnapshotFloaterView->addChild(this);
+
+ // Pre-select "Current Window" resolution.
+ getChild<LLComboBox>("profile_size_combo")->selectNthItem(0);
+ getChild<LLComboBox>("postcard_size_combo")->selectNthItem(0);
+ getChild<LLComboBox>("texture_size_combo")->selectNthItem(0);
+ getChild<LLComboBox>("local_size_combo")->selectNthItem(8);
+ getChild<LLComboBox>("local_format_combo")->selectNthItem(0);
+
+ impl.mPreviewHandle = previewp->getHandle();
+ previewp->setContainer(this);
+ impl.updateControls(this);
+ impl.updateLayout(this);
+
+
+ previewp->setThumbnailPlaceholderRect(getThumbnailPlaceholderRect());
+
+ return TRUE;
+}
+
+void LLFloaterOutfitSnapshot::draw()
+{
+ LLSnapshotLivePreview* previewp = impl.getPreviewView(this);
+
+ if (previewp && (previewp->isSnapshotActive() || previewp->getThumbnailLock()))
+ {
+ // don't render snapshot window in snapshot, even if "show ui" is turned on
+ return;
+ }
+
+ LLFloater::draw();
+
+ if (previewp && !isMinimized() && sThumbnailPlaceholder->getVisible())
+ {
+ if(previewp->getThumbnailImage())
+ {
+ bool working = impl.getStatus() == Impl::STATUS_WORKING;
+ const LLRect& thumbnail_rect = getThumbnailPlaceholderRect();
+ const S32 thumbnail_w = previewp->getThumbnailWidth();
+ const S32 thumbnail_h = previewp->getThumbnailHeight();
+
+ // calc preview offset within the preview rect
+ const S32 local_offset_x = (thumbnail_rect.getWidth() - thumbnail_w) / 2 ;
+ const S32 local_offset_y = (thumbnail_rect.getHeight() - thumbnail_h) / 2 ; // preview y pos within the preview rect
+
+ // calc preview offset within the floater rect
+ S32 offset_x = thumbnail_rect.mLeft + local_offset_x;
+ S32 offset_y = thumbnail_rect.mBottom + local_offset_y;
+
+ gGL.matrixMode(LLRender::MM_MODELVIEW);
+ // Apply floater transparency to the texture unless the floater is focused.
+ F32 alpha = getTransparencyType() == TT_ACTIVE ? 1.0f : getCurrentTransparency();
+ LLColor4 color = working ? LLColor4::grey4 : LLColor4::white;
+ gl_draw_scaled_image(offset_x, offset_y,
+ thumbnail_w, thumbnail_h,
+ previewp->getThumbnailImage(), color % alpha);
+
+ previewp->drawPreviewRect(offset_x, offset_y) ;
+
+ gGL.pushUIMatrix();
+ LLUI::translate((F32) thumbnail_rect.mLeft, (F32) thumbnail_rect.mBottom);
+ sThumbnailPlaceholder->draw();
+ gGL.popUIMatrix();
+ }
+ }
+ impl.updateLayout(this);
+}
+
+void LLFloaterOutfitSnapshot::onOpen(const LLSD& key)
+{
+ LLSnapshotLivePreview* preview = LLFloaterOutfitSnapshot::Impl::getPreviewView(this);
+ if(preview)
+ {
+ LL_DEBUGS() << "opened, updating snapshot" << LL_ENDL;
+ preview->updateSnapshot(TRUE);
+ }
+ focusFirstItem(FALSE);
+ gSnapshotFloaterView->setEnabled(TRUE);
+ gSnapshotFloaterView->setVisible(TRUE);
+ gSnapshotFloaterView->adjustToFitScreen(this, FALSE);
+
+ impl.updateControls(this);
+ impl.updateLayout(this);
+
+ // Initialize default tab.
+ //getChild<LLSideTrayPanelContainer>("panel_container")->getCurrentPanel()->onOpen(LLSD());
+ //parent->openPanel(panel_name);
+ LLPanel* snapshot_panel = getChild<LLPanel>("panel_outfit_snapshot_inventory");
+ snapshot_panel->onOpen(LLSD());
+ postPanelSwitch();
+
+}
+
+void LLFloaterOutfitSnapshot::onClose(bool app_quitting)
+{
+ getParent()->setMouseOpaque(FALSE);
+
+ //unfreeze everything, hide fullscreen preview
+ LLSnapshotLivePreview* previewp = LLFloaterOutfitSnapshot::Impl::getPreviewView(this);
+ if (previewp)
+ {
+ previewp->setVisible(FALSE);
+ previewp->setEnabled(FALSE);
+ }
+
+ gSavedSettings.setBOOL("FreezeTime", FALSE);
+ impl.mAvatarPauseHandles.clear();
+
+ if (impl.mLastToolset)
+ {
+ LLToolMgr::getInstance()->setCurrentToolset(impl.mLastToolset);
+ }
+}
+
+// virtual
+S32 LLFloaterOutfitSnapshot::notify(const LLSD& info)
+{
+ // A child panel wants to change snapshot resolution.
+ if (info.has("combo-res-change"))
+ {
+ std::string combo_name = info["combo-res-change"]["control-name"].asString();
+ impl.updateResolution(getChild<LLUICtrl>(combo_name), this);
+ return 1;
+ }
+
+ if (info.has("custom-res-change"))
+ {
+ LLSD res = info["custom-res-change"];
+ impl.applyCustomResolution(this, res["w"].asInteger(), res["h"].asInteger());
+ return 1;
+ }
+
+ if (info.has("keep-aspect-change"))
+ {
+ impl.applyKeepAspectCheck(this, info["keep-aspect-change"].asBoolean());
+ return 1;
+ }
+
+ if (info.has("image-quality-change"))
+ {
+ impl.onImageQualityChange(this, info["image-quality-change"].asInteger());
+ return 1;
+ }
+
+ if (info.has("image-format-change"))
+ {
+ impl.onImageFormatChange(this);
+ return 1;
+ }
+
+ if (info.has("set-ready"))
+ {
+ impl.setStatus(Impl::STATUS_READY);
+ return 1;
+ }
+
+ if (info.has("set-working"))
+ {
+ impl.setStatus(Impl::STATUS_WORKING);
+ return 1;
+ }
+
+ if (info.has("set-finished"))
+ {
+ LLSD data = info["set-finished"];
+ impl.setStatus(Impl::STATUS_FINISHED, data["ok"].asBoolean(), data["msg"].asString());
+ return 1;
+ }
+
+ if (info.has("snapshot-updating"))
+ {
+ // Disable the send/post/save buttons until snapshot is ready.
+ impl.updateControls(this);
+ return 1;
+ }
+
+ if (info.has("snapshot-updated"))
+ {
+ // Enable the send/post/save buttons.
+ impl.updateControls(this);
+ // We've just done refresh.
+ impl.setNeedRefresh(this, false);
+
+ // The refresh button is initially hidden. We show it after the first update,
+ // i.e. when preview appears.
+ if (!mRefreshBtn->getVisible())
+ {
+ mRefreshBtn->setVisible(true);
+ }
+ return 1;
+ }
+
+ return 0;
+}
+
+//static
+void LLFloaterOutfitSnapshot::update()
+{
+ LLFloaterOutfitSnapshot* inst = findInstance();
+ LLFloaterFacebook* floater_facebook = LLFloaterReg::findTypedInstance<LLFloaterFacebook>("facebook");
+ LLFloaterFlickr* floater_flickr = LLFloaterReg::findTypedInstance<LLFloaterFlickr>("flickr");
+ LLFloaterTwitter* floater_twitter = LLFloaterReg::findTypedInstance<LLFloaterTwitter>("twitter");
+
+ if (!inst && !floater_facebook && !floater_flickr && !floater_twitter)
+ return;
+
+ BOOL changed = FALSE;
+ LL_DEBUGS() << "npreviews: " << LLSnapshotLivePreview::sList.size() << LL_ENDL;
+ for (std::set<LLSnapshotLivePreview*>::iterator iter = LLSnapshotLivePreview::sList.begin();
+ iter != LLSnapshotLivePreview::sList.end(); ++iter)
+ {
+ changed |= LLSnapshotLivePreview::onIdle(*iter);
+ }
+
+ if (inst && changed)
+ {
+ LL_DEBUGS() << "changed" << LL_ENDL;
+ inst->impl.updateControls(inst);
+ }
+}
+
+// static
+LLFloaterOutfitSnapshot* LLFloaterOutfitSnapshot::getInstance()
+{
+ return LLFloaterReg::getTypedInstance<LLFloaterOutfitSnapshot>("outfit_snapshot");
+}
+
+// static
+LLFloaterOutfitSnapshot* LLFloaterOutfitSnapshot::findInstance()
+{
+ return LLFloaterReg::findTypedInstance<LLFloaterOutfitSnapshot>("outfit_snapshot");
+}
+
+// static
+void LLFloaterOutfitSnapshot::saveTexture()
+{
+ LL_DEBUGS() << "saveTexture" << LL_ENDL;
+
+ // FIXME: duplicated code
+ LLFloaterOutfitSnapshot* instance = findInstance();
+ if (!instance)
+ {
+ llassert(instance != NULL);
+ return;
+ }
+ LLSnapshotLivePreview* previewp = Impl::getPreviewView(instance);
+ if (!previewp)
+ {
+ llassert(previewp != NULL);
+ return;
+ }
+
+ if (instance->mOutfitGallery)
+ {
+ instance->mOutfitGallery->onBeforeOutfitSnapshotSave();
+ }
+ previewp->saveTexture(TRUE, instance->getOutfitID().asString());
+ if (instance->mOutfitGallery)
+ {
+ instance->mOutfitGallery->onAfterOutfitSnapshotSave();
+ }
+ instance->closeFloater();
+}
+
+// static
+BOOL LLFloaterOutfitSnapshot::saveLocal()
+{
+ LL_DEBUGS() << "saveLocal" << LL_ENDL;
+ // FIXME: duplicated code
+ LLFloaterOutfitSnapshot* instance = findInstance();
+ if (!instance)
+ {
+ llassert(instance != NULL);
+ return FALSE;
+ }
+ LLSnapshotLivePreview* previewp = Impl::getPreviewView(instance);
+ if (!previewp)
+ {
+ llassert(previewp != NULL);
+ return FALSE;
+ }
+
+ return previewp->saveLocal();
+}
+
+// static
+void LLFloaterOutfitSnapshot::postSave()
+{
+ LLFloaterOutfitSnapshot* instance = findInstance();
+ if (!instance)
+ {
+ llassert(instance != NULL);
+ return;
+ }
+
+ instance->impl.updateControls(instance);
+ instance->impl.setStatus(Impl::STATUS_WORKING);
+}
+
+// static
+void LLFloaterOutfitSnapshot::postPanelSwitch()
+{
+ LLFloaterOutfitSnapshot* instance = getInstance();
+ instance->impl.updateControls(instance);
+
+ // Remove the success/failure indicator whenever user presses a snapshot option button.
+ instance->impl.setStatus(Impl::STATUS_READY);
+}
+
+// static
+LLPointer<LLImageFormatted> LLFloaterOutfitSnapshot::getImageData()
+{
+ // FIXME: May not work for textures.
+
+ LLFloaterOutfitSnapshot* instance = findInstance();
+ if (!instance)
+ {
+ llassert(instance != NULL);
+ return NULL;
+ }
+
+ LLSnapshotLivePreview* previewp = Impl::getPreviewView(instance);
+ if (!previewp)
+ {
+ llassert(previewp != NULL);
+ return NULL;
+ }
+
+ LLPointer<LLImageFormatted> img = previewp->getFormattedImage();
+ if (!img.get())
+ {
+ LL_WARNS() << "Empty snapshot image data" << LL_ENDL;
+ llassert(img.get() != NULL);
+ }
+
+ return img;
+}
+
+// static
+const LLVector3d& LLFloaterOutfitSnapshot::getPosTakenGlobal()
+{
+ LLFloaterOutfitSnapshot* instance = findInstance();
+ if (!instance)
+ {
+ llassert(instance != NULL);
+ return LLVector3d::zero;
+ }
+
+ LLSnapshotLivePreview* previewp = Impl::getPreviewView(instance);
+ if (!previewp)
+ {
+ llassert(previewp != NULL);
+ return LLVector3d::zero;
+ }
+
+ return previewp->getPosTakenGlobal();
+}
+
+// static
+void LLFloaterOutfitSnapshot::setAgentEmail(const std::string& email)
+{
+ LLFloaterOutfitSnapshot* instance = findInstance();
+ if (instance)
+ {
+ LLSideTrayPanelContainer* panel_container = instance->getChild<LLSideTrayPanelContainer>("panel_container");
+ LLPanel* postcard_panel = panel_container->getPanelByName("panel_snapshot_postcard");
+ postcard_panel->notify(LLSD().with("agent-email", email));
+ }
+}
+
+///----------------------------------------------------------------------------
+/// Class LLSnapshotFloaterView
+///----------------------------------------------------------------------------
+
+LLOutfitSnapshotFloaterView::LLOutfitSnapshotFloaterView (const Params& p) : LLFloaterView (p)
+{
+}
+
+LLOutfitSnapshotFloaterView::~LLOutfitSnapshotFloaterView()
+{
+}
+
+BOOL LLOutfitSnapshotFloaterView::handleKey(KEY key, MASK mask, BOOL called_from_parent)
+{
+ // use default handler when not in freeze-frame mode
+ if(!gSavedSettings.getBOOL("FreezeTime"))
+ {
+ return LLFloaterView::handleKey(key, mask, called_from_parent);
+ }
+
+ if (called_from_parent)
+ {
+ // pass all keystrokes down
+ LLFloaterView::handleKey(key, mask, called_from_parent);
+ }
+ else
+ {
+ // bounce keystrokes back down
+ LLFloaterView::handleKey(key, mask, TRUE);
+ }
+ return TRUE;
+}
+
+BOOL LLOutfitSnapshotFloaterView::handleMouseDown(S32 x, S32 y, MASK mask)
+{
+ // use default handler when not in freeze-frame mode
+ if(!gSavedSettings.getBOOL("FreezeTime"))
+ {
+ return LLFloaterView::handleMouseDown(x, y, mask);
+ }
+ // give floater a change to handle mouse, else camera tool
+ if (childrenHandleMouseDown(x, y, mask) == NULL)
+ {
+ LLToolMgr::getInstance()->getCurrentTool()->handleMouseDown( x, y, mask );
+ }
+ return TRUE;
+}
+
+BOOL LLOutfitSnapshotFloaterView::handleMouseUp(S32 x, S32 y, MASK mask)
+{
+ // use default handler when not in freeze-frame mode
+ if(!gSavedSettings.getBOOL("FreezeTime"))
+ {
+ return LLFloaterView::handleMouseUp(x, y, mask);
+ }
+ // give floater a change to handle mouse, else camera tool
+ if (childrenHandleMouseUp(x, y, mask) == NULL)
+ {
+ LLToolMgr::getInstance()->getCurrentTool()->handleMouseUp( x, y, mask );
+ }
+ return TRUE;
+}
+
+BOOL LLOutfitSnapshotFloaterView::handleHover(S32 x, S32 y, MASK mask)
+{
+ // use default handler when not in freeze-frame mode
+ if(!gSavedSettings.getBOOL("FreezeTime"))
+ {
+ return LLFloaterView::handleHover(x, y, mask);
+ }
+ // give floater a change to handle mouse, else camera tool
+ if (childrenHandleHover(x, y, mask) == NULL)
+ {
+ LLToolMgr::getInstance()->getCurrentTool()->handleHover( x, y, mask );
+ }
+ return TRUE;
+}
diff --git a/indra/newview/llfloateroutfitsnapshot.h b/indra/newview/llfloateroutfitsnapshot.h
new file mode 100644
index 0000000000..176a9520c2
--- /dev/null
+++ b/indra/newview/llfloateroutfitsnapshot.h
@@ -0,0 +1,110 @@
+/**
+ * @file llfloateroutfitsnapshot.h
+ * @brief Snapshot preview window for saving as an outfit thumbnail in visual outfit gallery
+ *
+ * $LicenseInfo:firstyear=2004&license=viewerlgpl$
+ * Second Life Viewer Source Code
+ * Copyright (C) 2016, 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$
+ */
+
+#ifndef LL_LLFLOATEROUTFITSNAPSHOT_H
+#define LL_LLFLOATEROUTFITSNAPSHOT_H
+
+#include "llfloater.h"
+#include "llfloatersnapshot.h"
+#include "lloutfitgallery.h"
+
+class LLSpinCtrl;
+
+class LLFloaterOutfitSnapshot : public LLFloaterSnapshotBase
+{
+ LOG_CLASS(LLFloaterOutfitSnapshot);
+
+public:
+ //typedef enum e_snapshot_format
+ //{
+ // SNAPSHOT_FORMAT_PNG,
+ // SNAPSHOT_FORMAT_JPEG,
+ // SNAPSHOT_FORMAT_BMP
+ //} ESnapshotFormat;
+
+ LLFloaterOutfitSnapshot(const LLSD& key);
+ virtual ~LLFloaterOutfitSnapshot();
+
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void draw();
+ /*virtual*/ void onOpen(const LLSD& key);
+ /*virtual*/ void onClose(bool app_quitting);
+ /*virtual*/ S32 notify(const LLSD& info);
+
+ static void update();
+
+ // TODO: create a snapshot model instead
+ static LLFloaterOutfitSnapshot* getInstance();
+ static LLFloaterOutfitSnapshot* findInstance();
+ static void saveTexture();
+ static BOOL saveLocal();
+ static void postSave();
+ static void postPanelSwitch();
+ static LLPointer<LLImageFormatted> getImageData();
+ static const LLVector3d& getPosTakenGlobal();
+ static void setAgentEmail(const std::string& email);
+
+ static const LLRect& getThumbnailPlaceholderRect() { return sThumbnailPlaceholder->getRect(); }
+
+ void setOutfitID(LLUUID id) { mOutfitID = id; }
+ LLUUID getOutfitID() { return mOutfitID; }
+ void setGallery(LLOutfitGallery* gallery) { mOutfitGallery = gallery; }
+private:
+ static LLUICtrl* sThumbnailPlaceholder;
+ LLUICtrl *mRefreshBtn, *mRefreshLabel;
+ LLUICtrl *mSucceessLblPanel, *mFailureLblPanel;
+
+ class Impl;
+ Impl& impl;
+
+ LLUUID mOutfitID;
+ LLOutfitGallery* mOutfitGallery;
+};
+
+class LLOutfitSnapshotFloaterView : public LLFloaterView
+{
+public:
+ struct Params
+ : public LLInitParam::Block<Params, LLFloaterView::Params>
+ {
+ };
+
+protected:
+ LLOutfitSnapshotFloaterView (const Params& p);
+ friend class LLUICtrlFactory;
+
+public:
+ virtual ~LLOutfitSnapshotFloaterView();
+
+ /*virtual*/ BOOL handleKey(KEY key, MASK mask, BOOL called_from_parent);
+ /*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleMouseUp(S32 x, S32 y, MASK mask);
+ /*virtual*/ BOOL handleHover(S32 x, S32 y, MASK mask);
+};
+
+extern LLOutfitSnapshotFloaterView* gOutfitSnapshotFloaterView;
+
+#endif // LL_LLFLOATEROUTFITSNAPSHOT_H
diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp
index afec981d56..e5a2bd03cd 100755
--- a/indra/newview/llfloatersnapshot.cpp
+++ b/indra/newview/llfloatersnapshot.cpp
@@ -62,11 +62,20 @@ const S32 MAX_TEXTURE_SIZE = 512 ; //max upload texture size 512 * 512
static LLDefaultChildRegistry::Register<LLSnapshotFloaterView> r("snapshot_floater_view");
+LLFloaterSnapshotBase::ImplBase::ImplBase()
+{
+}
+
+LLFloaterSnapshotBase::ImplBase::~ImplBase()
+{
+}
+
+
///----------------------------------------------------------------------------
/// Class LLFloaterSnapshot::Impl
///----------------------------------------------------------------------------
-class LLFloaterSnapshot::Impl
+class LLFloaterSnapshot::Impl : public LLFloaterSnapshotBase::ImplBase
{
LOG_CLASS(LLFloaterSnapshot::Impl);
public:
@@ -111,8 +120,8 @@ public:
static void updateSpinners(LLFloaterSnapshot* view, LLSnapshotLivePreview* previewp, S32& width, S32& height, BOOL is_width_changed);
static LLPanelSnapshot* getActivePanel(LLFloaterSnapshot* floater, bool ok_if_not_found = true);
- static LLSnapshotLivePreview::ESnapshotType getActiveSnapshotType(LLFloaterSnapshot* floater);
- static LLFloaterSnapshot::ESnapshotFormat getImageFormat(LLFloaterSnapshot* floater);
+ static LLPanelSnapshot::ESnapshotType getActiveSnapshotType(LLFloaterSnapshot* floater);
+ static LLFloaterSnapshotBase::ESnapshotFormat getImageFormat(LLFloaterSnapshot* floater);
static LLSpinCtrl* getWidthSpinner(LLFloaterSnapshot* floater);
static LLSpinCtrl* getHeightSpinner(LLFloaterSnapshot* floater);
static void enableAspectRatioCheckbox(LLFloaterSnapshot* floater, BOOL enable);
@@ -158,35 +167,40 @@ LLPanelSnapshot* LLFloaterSnapshot::Impl::getActivePanel(LLFloaterSnapshot* floa
}
// static
-LLSnapshotLivePreview::ESnapshotType LLFloaterSnapshot::Impl::getActiveSnapshotType(LLFloaterSnapshot* floater)
+LLPanelSnapshot::ESnapshotType LLFloaterSnapshot::Impl::getActiveSnapshotType(LLFloaterSnapshot* floater)
{
- LLSnapshotLivePreview::ESnapshotType type = LLSnapshotLivePreview::SNAPSHOT_WEB;
- std::string name;
+ // LLPanelSnapshot::ESnapshotType type = LLPanelSnapshot::SNAPSHOT_WEB;
+ //std::string name;
LLPanelSnapshot* spanel = getActivePanel(floater);
- if (spanel)
- {
- name = spanel->getName();
- }
-
- if (name == "panel_snapshot_postcard")
- {
- type = LLSnapshotLivePreview::SNAPSHOT_POSTCARD;
- }
- else if (name == "panel_snapshot_inventory")
- {
- type = LLSnapshotLivePreview::SNAPSHOT_TEXTURE;
- }
- else if (name == "panel_snapshot_local")
- {
- type = LLSnapshotLivePreview::SNAPSHOT_LOCAL;
- }
-
- return type;
+ //if (spanel)
+ //{
+ // name = spanel->getName();
+ //}
+
+ //if (name == "panel_snapshot_postcard")
+ //{
+ // type = LLPanelSnapshot::SNAPSHOT_POSTCARD;
+ //}
+ //else if (name == "panel_snapshot_inventory")
+ //{
+ // type = LLSnapshotLivePreview::SNAPSHOT_TEXTURE;
+ //}
+ //else if (name == "panel_snapshot_local")
+ //{
+ // type = LLSnapshotLivePreview::SNAPSHOT_LOCAL;
+ //}
+
+ //return type;
+ if (spanel)
+ {
+ return spanel->getSnapshotType();
+ }
+ return LLPanelSnapshot::SNAPSHOT_WEB;
}
// static
-LLFloaterSnapshot::ESnapshotFormat LLFloaterSnapshot::Impl::getImageFormat(LLFloaterSnapshot* floater)
+LLFloaterSnapshotBase::ESnapshotFormat LLFloaterSnapshot::Impl::getImageFormat(LLFloaterSnapshot* floater)
{
LLPanelSnapshot* active_panel = getActivePanel(floater);
// FIXME: if the default is not PNG, profile uploads may fail.
@@ -362,12 +376,12 @@ void LLFloaterSnapshot::Impl::updateLayout(LLFloaterSnapshot* floaterp)
// static
void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)
{
- LLSnapshotLivePreview::ESnapshotType shot_type = getActiveSnapshotType(floater);
+ LLPanelSnapshot::ESnapshotType shot_type = getActiveSnapshotType(floater);
ESnapshotFormat shot_format = (ESnapshotFormat)gSavedSettings.getS32("SnapshotFormat");
LLViewerWindow::ESnapshotType layer_type = getLayerType(floater);
floater->getChild<LLComboBox>("local_format_combo")->selectNthItem(gSavedSettings.getS32("SnapshotFormat"));
- floater->getChildView("layer_types")->setEnabled(shot_type == LLSnapshotLivePreview::SNAPSHOT_LOCAL);
+ floater->getChildView("layer_types")->setEnabled(shot_type == LLPanelSnapshot::SNAPSHOT_LOCAL);
LLPanelSnapshot* active_panel = getActivePanel(floater);
if (active_panel)
@@ -381,7 +395,7 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)
S32 w = gViewerWindow->getWindowWidthRaw();
LL_DEBUGS() << "Initializing width spinner (" << width_ctrl->getName() << "): " << w << LL_ENDL;
width_ctrl->setValue(w);
- if(getActiveSnapshotType(floater) == LLSnapshotLivePreview::SNAPSHOT_TEXTURE)
+ if(getActiveSnapshotType(floater) == LLPanelSnapshot::SNAPSHOT_TEXTURE)
{
width_ctrl->setIncrement(w >> 1);
}
@@ -391,7 +405,7 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)
S32 h = gViewerWindow->getWindowHeightRaw();
LL_DEBUGS() << "Initializing height spinner (" << height_ctrl->getName() << "): " << h << LL_ENDL;
height_ctrl->setValue(h);
- if(getActiveSnapshotType(floater) == LLSnapshotLivePreview::SNAPSHOT_TEXTURE)
+ if(getActiveSnapshotType(floater) == LLPanelSnapshot::SNAPSHOT_TEXTURE)
{
height_ctrl->setIncrement(h >> 1);
}
@@ -448,29 +462,29 @@ void LLFloaterSnapshot::Impl::updateControls(LLFloaterSnapshot* floater)
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
+ shot_type == LLPanelSnapshot::SNAPSHOT_POSTCARD
&& got_bytes
&& previewp->getDataSize() > MAX_POSTCARD_DATASIZE ? LLUIColor(LLColor4::red) : LLUIColorTable::instance().getColor( "LabelTextColor" ));
// Update the width and height spinners based on the corresponding resolution combos. (?)
switch(shot_type)
{
- case LLSnapshotLivePreview::SNAPSHOT_WEB:
+ case LLPanelSnapshot::SNAPSHOT_WEB:
layer_type = LLViewerWindow::SNAPSHOT_TYPE_COLOR;
floater->getChild<LLUICtrl>("layer_types")->setValue("colors");
setResolution(floater, "profile_size_combo");
break;
- case LLSnapshotLivePreview::SNAPSHOT_POSTCARD:
+ case LLPanelSnapshot::SNAPSHOT_POSTCARD:
layer_type = LLViewerWindow::SNAPSHOT_TYPE_COLOR;
floater->getChild<LLUICtrl>("layer_types")->setValue("colors");
setResolution(floater, "postcard_size_combo");
break;
- case LLSnapshotLivePreview::SNAPSHOT_TEXTURE:
+ case LLPanelSnapshot::SNAPSHOT_TEXTURE:
layer_type = LLViewerWindow::SNAPSHOT_TYPE_COLOR;
floater->getChild<LLUICtrl>("layer_types")->setValue("colors");
setResolution(floater, "texture_size_combo");
break;
- case LLSnapshotLivePreview::SNAPSHOT_LOCAL:
+ case LLPanelSnapshot::SNAPSHOT_LOCAL:
setResolution(floater, "local_size_combo");
break;
default:
@@ -686,7 +700,7 @@ void LLFloaterSnapshot::Impl::checkAspectRatio(LLFloaterSnapshot *view, S32 inde
LLSnapshotLivePreview *previewp = getPreviewView(view) ;
// Don't round texture sizes; textures are commonly stretched in world, profiles, etc and need to be "squashed" during upload, not cropped here
- if(LLSnapshotLivePreview::SNAPSHOT_TEXTURE == getActiveSnapshotType(view))
+ if(LLPanelSnapshot::SNAPSHOT_TEXTURE == getActiveSnapshotType(view))
{
previewp->mKeepAspectRatio = FALSE ;
return ;
@@ -813,7 +827,7 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL
new_height = spanel->getTypedPreviewHeight();
// Limit custom size for inventory snapshots to 512x512 px.
- if (getActiveSnapshotType(view) == LLSnapshotLivePreview::SNAPSHOT_TEXTURE)
+ if (getActiveSnapshotType(view) == LLPanelSnapshot::SNAPSHOT_TEXTURE)
{
new_width = llmin(new_width, MAX_TEXTURE_SIZE);
new_height = llmin(new_height, MAX_TEXTURE_SIZE);
@@ -851,7 +865,7 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, BOOL
{
getWidthSpinner(view)->setValue(width);
getHeightSpinner(view)->setValue(height);
- if (getActiveSnapshotType(view) == LLSnapshotLivePreview::SNAPSHOT_TEXTURE)
+ if (getActiveSnapshotType(view) == LLPanelSnapshot::SNAPSHOT_TEXTURE)
{
getWidthSpinner(view)->setIncrement(width >> 1);
getHeightSpinner(view)->setIncrement(height >> 1);
@@ -975,7 +989,7 @@ void LLFloaterSnapshot::Impl::setImageSizeSpinnersValues(LLFloaterSnapshot *view
{
getWidthSpinner(view)->forceSetValue(width);
getHeightSpinner(view)->forceSetValue(height);
- if (getActiveSnapshotType(view) == LLSnapshotLivePreview::SNAPSHOT_TEXTURE)
+ if (getActiveSnapshotType(view) == LLPanelSnapshot::SNAPSHOT_TEXTURE)
{
getWidthSpinner(view)->setIncrement(width >> 1);
getHeightSpinner(view)->setIncrement(height >> 1);
@@ -1036,12 +1050,26 @@ void LLFloaterSnapshot::Impl::onSendingPostcardFinished(bool status)
}
///----------------------------------------------------------------------------
+/// Class LLFloaterSnapshotBase
+///----------------------------------------------------------------------------
+
+// Default constructor
+LLFloaterSnapshotBase::LLFloaterSnapshotBase(const LLSD& key)
+ : LLFloater(key)
+{
+}
+
+LLFloaterSnapshotBase::~LLFloaterSnapshotBase()
+{
+}
+
+///----------------------------------------------------------------------------
/// Class LLFloaterSnapshot
///----------------------------------------------------------------------------
// Default constructor
LLFloaterSnapshot::LLFloaterSnapshot(const LLSD& key)
- : LLFloater(key),
+ : LLFloaterSnapshotBase(key),
mRefreshBtn(NULL),
mRefreshLabel(NULL),
mSucceessLblPanel(NULL),
@@ -1377,7 +1405,7 @@ BOOL LLFloaterSnapshot::saveLocal()
{
LL_DEBUGS() << "saveLocal" << LL_ENDL;
// FIXME: duplicated code
- LLFloaterSnapshot* instance = findInstance();
+ LLFloaterSnapshot* instance = findInstance();
if (!instance)
{
llassert(instance != NULL);
diff --git a/indra/newview/llfloatersnapshot.h b/indra/newview/llfloatersnapshot.h
index 0bb9474bb5..5f9857c8c5 100755
--- a/indra/newview/llfloatersnapshot.h
+++ b/indra/newview/llfloatersnapshot.h
@@ -31,17 +31,45 @@
class LLSpinCtrl;
-class LLFloaterSnapshot : public LLFloater
+class LLFloaterSnapshotBase : public LLFloater
+{
+ LOG_CLASS(LLFloaterSnapshotBase);
+
+public:
+ typedef enum e_snapshot_format
+ {
+ SNAPSHOT_FORMAT_PNG,
+ SNAPSHOT_FORMAT_JPEG,
+ SNAPSHOT_FORMAT_BMP
+ } ESnapshotFormat;
+
+ LLFloaterSnapshotBase(const LLSD& key);
+ virtual ~LLFloaterSnapshotBase();
+
+ ///*virtual*/ S32 notify(const LLSD& info);
+
+ //static LLFloaterSnapshotBase* getInstance();
+ //static LLFloaterSnapshotBase* findInstance();
+ //static void saveTexture();
+ //static BOOL saveLocal();
+ //static void postSave();
+
+protected:
+ class ImplBase;
+ //ImplBase& impl;
+};
+
+class LLFloaterSnapshot : public LLFloaterSnapshotBase
{
LOG_CLASS(LLFloaterSnapshot);
public:
- typedef enum e_snapshot_format
- {
- SNAPSHOT_FORMAT_PNG,
- SNAPSHOT_FORMAT_JPEG,
- SNAPSHOT_FORMAT_BMP
- } ESnapshotFormat;
+ //typedef enum e_snapshot_format
+ //{
+ // SNAPSHOT_FORMAT_PNG,
+ // SNAPSHOT_FORMAT_JPEG,
+ // SNAPSHOT_FORMAT_BMP
+ //} ESnapshotFormat;
LLFloaterSnapshot(const LLSD& key);
virtual ~LLFloaterSnapshot();
@@ -76,6 +104,13 @@ private:
Impl& impl;
};
+class LLFloaterSnapshotBase::ImplBase
+{
+public:
+ ImplBase();
+ ~ImplBase();
+};
+
class LLSnapshotFloaterView : public LLFloaterView
{
public:
diff --git a/indra/newview/llfloatertwitter.cpp b/indra/newview/llfloatertwitter.cpp
index c48b1a3325..984ba587ed 100644
--- a/indra/newview/llfloatertwitter.cpp
+++ b/indra/newview/llfloatertwitter.cpp
@@ -241,7 +241,7 @@ void LLTwitterPhotoPanel::onVisibilityChange(BOOL visible)
mPreviewHandle = previewp->getHandle();
previewp->setContainer(this);
- previewp->setSnapshotType(previewp->SNAPSHOT_WEB);
+ previewp->setSnapshotType(LLPanelSnapshot::SNAPSHOT_WEB);
previewp->setSnapshotFormat(LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG);
previewp->setThumbnailSubsampled(TRUE); // We want the preview to reflect the *saved* image
previewp->setAllowRenderUI(FALSE); // We do not want the rendered UI in our snapshots
diff --git a/indra/newview/lloutfitgallery.cpp b/indra/newview/lloutfitgallery.cpp
index c553d3d338..b351be8de9 100644
--- a/indra/newview/lloutfitgallery.cpp
+++ b/indra/newview/lloutfitgallery.cpp
@@ -39,6 +39,8 @@
#include "llerror.h"
#include "llfilepicker.h"
#include "llfloaterperms.h"
+#include "llfloaterreg.h"
+#include "llfloateroutfitsnapshot.h"
#include "llinventoryfunctions.h"
#include "llinventorymodel.h"
#include "lllocalbitmaps.h"
@@ -636,6 +638,7 @@ void LLOutfitGalleryGearMenu::onUpdateItemsVisibility()
mMenu->setItemVisible("collapse", FALSE);
mMenu->setItemVisible("upload_photo", TRUE);
mMenu->setItemVisible("select_photo", TRUE);
+ mMenu->setItemVisible("take_snapshot", TRUE);
LLOutfitListGearMenuBase::onUpdateItemsVisibility();
}
@@ -659,6 +662,16 @@ void LLOutfitGalleryGearMenu::onSelectPhoto()
}
}
+void LLOutfitGalleryGearMenu::onTakeSnapshot()
+{
+ LLOutfitGallery* gallery = dynamic_cast<LLOutfitGallery*>(mOutfitList);
+ LLUUID selected_outfit_id = getSelectedOutfitID();
+ if (gallery && !selected_outfit_id.isNull())
+ {
+ gallery->onTakeSnapshot(selected_outfit_id);
+ }
+}
+
void LLOutfitGallery::onTextureSelectionChanged(LLInventoryItem* itemp)
{
}
@@ -715,6 +728,16 @@ void LLOutfitGallery::refreshOutfit(const LLUUID& category_id)
updates["name"] = new_name;
update_inventory_item(linked_item->getUUID(), updates, NULL);
mOutfitRenamePending.setNull();
+ LLFloater* inv_floater = LLFloaterReg::getInstance("inventory");
+ if (inv_floater)
+ {
+ inv_floater->closeFloater();
+ }
+ LLFloater* appearance_floater = LLFloaterReg::getInstance("appearance");
+ if (appearance_floater)
+ {
+ appearance_floater->setFocus(TRUE);
+ }
}
break;
}
@@ -798,10 +821,11 @@ void LLOutfitGallery::uploadPhoto(LLUUID outfit_id)
checkRemovePhoto(outfit_id);
std::string upload_pending_name = outfit_id.asString();
+ std::string upload_pending_desc = "";
LLAssetStorage::LLStoreAssetCallback callback = NULL;
LLUUID photo_id = upload_new_resource(filename, // file
upload_pending_name,
- outfit_id.asString(),
+ upload_pending_desc,
0, LLFolderType::FT_NONE, LLInventoryType::IT_NONE,
LLFloaterPerms::getNextOwnerPerms("Uploads"),
LLFloaterPerms::getGroupPerms("Uploads"),
@@ -926,3 +950,28 @@ void LLOutfitGallery::onSelectPhoto(LLUUID selected_outfit_id)
floaterp->setFocus(TRUE);
}
}
+
+void LLOutfitGallery::onTakeSnapshot(LLUUID selected_outfit_id)
+{
+ LLFloaterReg::toggleInstanceOrBringToFront("outfit_snapshot");
+ LLFloaterOutfitSnapshot::getInstance()->setOutfitID(selected_outfit_id);
+ LLFloaterOutfitSnapshot::getInstance()->setGallery(this);
+}
+
+void LLOutfitGallery::onBeforeOutfitSnapshotSave()
+{
+ LLUUID selected_outfit_id = getSelectedOutfitUUID();
+ if (!selected_outfit_id.isNull())
+ {
+ checkRemovePhoto(selected_outfit_id);
+ }
+}
+
+void LLOutfitGallery::onAfterOutfitSnapshotSave()
+{
+ LLUUID selected_outfit_id = getSelectedOutfitUUID();
+ if (!selected_outfit_id.isNull())
+ {
+ mOutfitLinkPending = selected_outfit_id;
+ }
+}
diff --git a/indra/newview/lloutfitgallery.h b/indra/newview/lloutfitgallery.h
index 285c8baf59..dbf891142d 100644
--- a/indra/newview/lloutfitgallery.h
+++ b/indra/newview/lloutfitgallery.h
@@ -85,6 +85,8 @@ public:
/*virtual*/ void draw();
void onSelectPhoto(LLUUID selected_outfit_id);
+ void onTakeSnapshot(LLUUID selected_outfit_id);
+
/*virtual*/ void setFilterSubString(const std::string& string);
@@ -102,6 +104,8 @@ public:
void refreshOutfit(const LLUUID& category_id);
void onTexturePickerCommit(LLTextureCtrl::ETexturePickOp op, LLUUID id);
+ void onBeforeOutfitSnapshotSave();
+ void onAfterOutfitSnapshotSave();
protected:
/*virtual*/ void onHighlightBaseOutfit(LLUUID base_id, LLUUID prev_id);
/*virtual*/ void onSetSelectedOutfitByUUID(const LLUUID& outfit_uuid);
@@ -191,6 +195,7 @@ protected:
private:
/*virtual*/ void onUploadFoto();
/*virtual*/ void onSelectPhoto();
+ /*virtual*/ void onTakeSnapshot();
};
class LLOutfitGalleryItem : public LLPanel
diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp
index b657d2e285..31fe6839f3 100755
--- a/indra/newview/lloutfitslist.cpp
+++ b/indra/newview/lloutfitslist.cpp
@@ -1092,6 +1092,7 @@ LLOutfitListGearMenuBase::LLOutfitListGearMenuBase(LLOutfitListBase* olist)
registrar.add("Gear.UploadPhoto", boost::bind(&LLOutfitListGearMenuBase::onUploadFoto, this));
registrar.add("Gear.SelectPhoto", boost::bind(&LLOutfitListGearMenuBase::onSelectPhoto, this));
+ registrar.add("Gear.TakeSnapshot", boost::bind(&LLOutfitListGearMenuBase::onTakeSnapshot, this));
enable_registrar.add("Gear.OnEnable", boost::bind(&LLOutfitListGearMenuBase::onEnable, this, _2));
enable_registrar.add("Gear.OnVisible", boost::bind(&LLOutfitListGearMenuBase::onVisible, this, _2));
@@ -1235,6 +1236,11 @@ void LLOutfitListGearMenuBase::onSelectPhoto()
}
+void LLOutfitListGearMenuBase::onTakeSnapshot()
+{
+
+}
+
LLOutfitListGearMenu::LLOutfitListGearMenu(LLOutfitListBase* olist)
: LLOutfitListGearMenuBase(olist)
{}
@@ -1249,6 +1255,7 @@ void LLOutfitListGearMenu::onUpdateItemsVisibility()
mMenu->setItemVisible("collapse", TRUE);
mMenu->setItemVisible("upload_photo", FALSE);
mMenu->setItemVisible("select_photo", FALSE);
+ mMenu->setItemVisible("take_snapshot", FALSE);
LLOutfitListGearMenuBase::onUpdateItemsVisibility();
}
diff --git a/indra/newview/lloutfitslist.h b/indra/newview/lloutfitslist.h
index d7c549c417..696a18a36a 100755
--- a/indra/newview/lloutfitslist.h
+++ b/indra/newview/lloutfitslist.h
@@ -165,6 +165,7 @@ protected:
virtual void onUpdateItemsVisibility();
virtual void onUploadFoto();
virtual void onSelectPhoto();
+ virtual void onTakeSnapshot();
const LLUUID& getSelectedOutfitID();
diff --git a/indra/newview/llpanelsnapshot.cpp b/indra/newview/llpanelsnapshot.cpp
index 106fb4997e..ca62f2bdf5 100755
--- a/indra/newview/llpanelsnapshot.cpp
+++ b/indra/newview/llpanelsnapshot.cpp
@@ -76,11 +76,11 @@ void LLPanelSnapshot::onOpen(const LLSD& key)
// e.g. attempt to send a large BMP image by email.
if (old_format != new_format)
{
- LLFloaterSnapshot::getInstance()->notify(LLSD().with("image-format-change", true));
+ getParentByType<LLFloater>()->notify(LLSD().with("image-format-change", true));
}
}
-LLFloaterSnapshot::ESnapshotFormat LLPanelSnapshot::getImageFormat() const
+LLFloaterSnapshotBase::ESnapshotFormat LLPanelSnapshot::getImageFormat() const
{
return LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG;
}
@@ -171,7 +171,7 @@ void LLPanelSnapshot::goBack()
void LLPanelSnapshot::cancel()
{
goBack();
- LLFloaterSnapshot::getInstance()->notify(LLSD().with("set-ready", true));
+ getParentByType<LLFloater>()->notify(LLSD().with("set-ready", true));
}
void LLPanelSnapshot::onCustomResolutionCommit()
@@ -179,6 +179,7 @@ void LLPanelSnapshot::onCustomResolutionCommit()
LLSD info;
LLSpinCtrl *widthSpinner = getChild<LLSpinCtrl>(getWidthSpinnerName());
LLSpinCtrl *heightSpinner = getChild<LLSpinCtrl>(getHeightSpinnerName());
+ //TODO: Refactoring - move this code into some virtual method of LLPanelSnapshotInventory
if (getName() == "panel_snapshot_inventory")
{
S32 width = widthSpinner->getValue().asInteger();
@@ -197,17 +198,22 @@ void LLPanelSnapshot::onCustomResolutionCommit()
info["w"] = widthSpinner->getValue().asInteger();
info["h"] = heightSpinner->getValue().asInteger();
}
- LLFloaterSnapshot::getInstance()->notify(LLSD().with("custom-res-change", info));
+ getParentByType<LLFloater>()->notify(LLSD().with("custom-res-change", info));
}
void LLPanelSnapshot::onResolutionComboCommit(LLUICtrl* ctrl)
{
LLSD info;
info["combo-res-change"]["control-name"] = ctrl->getName();
- LLFloaterSnapshot::getInstance()->notify(info);
+ getParentByType<LLFloater>()->notify(info);
}
void LLPanelSnapshot::onKeepAspectRatioCommit(LLUICtrl* ctrl)
{
- LLFloaterSnapshot::getInstance()->notify(LLSD().with("keep-aspect-change", ctrl->getValue().asBoolean()));
+ getParentByType<LLFloater>()->notify(LLSD().with("keep-aspect-change", ctrl->getValue().asBoolean()));
+}
+
+LLPanelSnapshot::ESnapshotType LLPanelSnapshot::getSnapshotType()
+{
+ return ESnapshotType::SNAPSHOT_WEB;
}
diff --git a/indra/newview/llpanelsnapshot.h b/indra/newview/llpanelsnapshot.h
index 42ad798d60..d64ef3b75a 100755
--- a/indra/newview/llpanelsnapshot.h
+++ b/indra/newview/llpanelsnapshot.h
@@ -37,6 +37,14 @@ class LLSideTrayPanelContainer;
class LLPanelSnapshot: public LLPanel
{
public:
+ enum ESnapshotType
+ {
+ SNAPSHOT_POSTCARD,
+ SNAPSHOT_TEXTURE,
+ SNAPSHOT_LOCAL,
+ SNAPSHOT_WEB
+ };
+
/*virtual*/ BOOL postBuild();
/*virtual*/ void onOpen(const LLSD& key);
@@ -51,7 +59,8 @@ public:
virtual LLSpinCtrl* getWidthSpinner();
virtual LLSpinCtrl* getHeightSpinner();
virtual void enableAspectRatioCheckbox(BOOL enable);
- virtual LLFloaterSnapshot::ESnapshotFormat getImageFormat() const;
+ virtual LLFloaterSnapshotBase::ESnapshotFormat getImageFormat() const;
+ virtual ESnapshotType getSnapshotType();
virtual void updateControls(const LLSD& info) = 0; ///< Update controls from saved settings
void enableControls(BOOL enable);
diff --git a/indra/newview/llpanelsnapshotinventory.cpp b/indra/newview/llpanelsnapshotinventory.cpp
index c55e230b5e..013a564908 100755
--- a/indra/newview/llpanelsnapshotinventory.cpp
+++ b/indra/newview/llpanelsnapshotinventory.cpp
@@ -32,14 +32,43 @@
#include "llspinctrl.h"
#include "llfloatersnapshot.h" // FIXME: replace with a snapshot storage model
+#include "llfloateroutfitsnapshot.h"
#include "llpanelsnapshot.h"
+#include "llsnapshotlivepreview.h"
#include "llviewercontrol.h" // gSavedSettings
/**
* The panel provides UI for saving snapshot as an inventory texture.
*/
+class LLPanelSnapshotInventoryBase
+ : public LLPanelSnapshot
+{
+ LOG_CLASS(LLPanelSnapshotInventoryBase);
+
+public:
+ LLPanelSnapshotInventoryBase();
+//
+// /*virtual*/ BOOL postBuild();
+// /*virtual*/ void onOpen(const LLSD& key);
+//
+// void onResolutionCommit(LLUICtrl* ctrl);
+//
+//private:
+// /*virtual*/ std::string getWidthSpinnerName() const { return "inventory_snapshot_width"; }
+// /*virtual*/ std::string getHeightSpinnerName() const { return "inventory_snapshot_height"; }
+// /*virtual*/ std::string getAspectRatioCBName() const { return "inventory_keep_aspect_check"; }
+// /*virtual*/ std::string getImageSizeComboName() const { return "texture_size_combo"; }
+// /*virtual*/ std::string getImageSizePanelName() const { return LLStringUtil::null; }
+// /*virtual*/ void updateControls(const LLSD& info);
+
+protected:
+ virtual void onSend() = 0;
+ /*virtual*/ LLPanelSnapshot::ESnapshotType getSnapshotType();
+
+};
+
class LLPanelSnapshotInventory
-: public LLPanelSnapshot
+ : public LLPanelSnapshotInventoryBase
{
LOG_CLASS(LLPanelSnapshotInventory);
@@ -58,10 +87,44 @@ private:
/*virtual*/ std::string getImageSizePanelName() const { return LLStringUtil::null; }
/*virtual*/ void updateControls(const LLSD& info);
- void onSend();
+ /*virtual*/ void onSend();
+};
+
+class LLPanelOutfitSnapshotInventory
+ : public LLPanelSnapshotInventoryBase
+{
+ LOG_CLASS(LLPanelOutfitSnapshotInventory);
+
+public:
+ LLPanelOutfitSnapshotInventory();
+ /*virtual*/ BOOL postBuild();
+ /*virtual*/ void onOpen(const LLSD& key);
+
+ void onResolutionCommit(LLUICtrl* ctrl);
+
+ private:
+ /*virtual*/ std::string getWidthSpinnerName() const { return "inventory_snapshot_width"; }
+ /*virtual*/ std::string getHeightSpinnerName() const { return "inventory_snapshot_height"; }
+ /*virtual*/ std::string getAspectRatioCBName() const { return "inventory_keep_aspect_check"; }
+ /*virtual*/ std::string getImageSizeComboName() const { return "texture_size_combo"; }
+ /*virtual*/ std::string getImageSizePanelName() const { return LLStringUtil::null; }
+ /*virtual*/ void updateControls(const LLSD& info);
+
+ /*virtual*/ void onSend();
};
-static LLPanelInjector<LLPanelSnapshotInventory> panel_class("llpanelsnapshotinventory");
+static LLPanelInjector<LLPanelSnapshotInventory> panel_class1("llpanelsnapshotinventory");
+
+static LLPanelInjector<LLPanelOutfitSnapshotInventory> panel_class2("llpaneloutfitsnapshotinventory");
+
+LLPanelSnapshotInventoryBase::LLPanelSnapshotInventoryBase()
+{
+}
+
+LLPanelSnapshot::ESnapshotType LLPanelSnapshotInventoryBase::getSnapshotType()
+{
+ return LLPanelSnapshot::SNAPSHOT_TEXTURE;
+}
LLPanelSnapshotInventory::LLPanelSnapshotInventory()
{
@@ -105,3 +168,46 @@ void LLPanelSnapshotInventory::onSend()
LLFloaterSnapshot::saveTexture();
LLFloaterSnapshot::postSave();
}
+
+LLPanelOutfitSnapshotInventory::LLPanelOutfitSnapshotInventory()
+{
+ mCommitCallbackRegistrar.add("Inventory.SaveOutfitPhoto", boost::bind(&LLPanelOutfitSnapshotInventory::onSend, this));
+ mCommitCallbackRegistrar.add("Inventory.Cancel", boost::bind(&LLPanelOutfitSnapshotInventory::cancel, this));
+}
+
+// virtual
+BOOL LLPanelOutfitSnapshotInventory::postBuild()
+{
+ getChild<LLSpinCtrl>(getWidthSpinnerName())->setAllowEdit(FALSE);
+ getChild<LLSpinCtrl>(getHeightSpinnerName())->setAllowEdit(FALSE);
+
+ getChild<LLUICtrl>(getImageSizeComboName())->setCommitCallback(boost::bind(&LLPanelOutfitSnapshotInventory::onResolutionCommit, this, _1));
+ return LLPanelSnapshot::postBuild();
+}
+
+// virtual
+void LLPanelOutfitSnapshotInventory::onOpen(const LLSD& key)
+{
+ getChild<LLUICtrl>("hint_lbl")->setTextArg("[UPLOAD_COST]", llformat("%d", LLGlobalEconomy::Singleton::getInstance()->getPriceUpload()));
+ LLPanelSnapshot::onOpen(key);
+}
+
+// virtual
+void LLPanelOutfitSnapshotInventory::updateControls(const LLSD& info)
+{
+ const bool have_snapshot = info.has("have-snapshot") ? info["have-snapshot"].asBoolean() : true;
+ getChild<LLUICtrl>("save_btn")->setEnabled(have_snapshot);
+}
+
+void LLPanelOutfitSnapshotInventory::onResolutionCommit(LLUICtrl* ctrl)
+{
+ BOOL current_window_selected = (getChild<LLComboBox>(getImageSizeComboName())->getCurrentIndex() == 3);
+ getChild<LLSpinCtrl>(getWidthSpinnerName())->setVisible(!current_window_selected);
+ getChild<LLSpinCtrl>(getHeightSpinnerName())->setVisible(!current_window_selected);
+}
+
+void LLPanelOutfitSnapshotInventory::onSend()
+{
+ LLFloaterOutfitSnapshot::saveTexture();
+ LLFloaterOutfitSnapshot::postSave();
+}
diff --git a/indra/newview/llpanelsnapshotlocal.cpp b/indra/newview/llpanelsnapshotlocal.cpp
index 01dfdc4ece..954eb63a28 100755
--- a/indra/newview/llpanelsnapshotlocal.cpp
+++ b/indra/newview/llpanelsnapshotlocal.cpp
@@ -33,6 +33,7 @@
#include "llfloatersnapshot.h" // FIXME: replace with a snapshot storage model
#include "llpanelsnapshot.h"
+#include "llsnapshotlivepreview.h"
#include "llviewercontrol.h" // gSavedSettings
#include "llviewerwindow.h"
@@ -55,8 +56,9 @@ private:
/*virtual*/ std::string getAspectRatioCBName() const { return "local_keep_aspect_check"; }
/*virtual*/ std::string getImageSizeComboName() const { return "local_size_combo"; }
/*virtual*/ std::string getImageSizePanelName() const { return "local_image_size_lp"; }
- /*virtual*/ LLFloaterSnapshot::ESnapshotFormat getImageFormat() const;
- /*virtual*/ void updateControls(const LLSD& info);
+ /*virtual*/ LLFloaterSnapshotBase::ESnapshotFormat getImageFormat() const;
+ /*virtual*/ LLPanelSnapshot::ESnapshotType getSnapshotType();
+ /*virtual*/ void updateControls(const LLSD& info);
S32 mLocalFormat;
@@ -94,9 +96,9 @@ void LLPanelSnapshotLocal::onOpen(const LLSD& key)
}
// virtual
-LLFloaterSnapshot::ESnapshotFormat LLPanelSnapshotLocal::getImageFormat() const
+LLFloaterSnapshotBase::ESnapshotFormat LLPanelSnapshotLocal::getImageFormat() const
{
- LLFloaterSnapshot::ESnapshotFormat fmt = LLFloaterSnapshot::SNAPSHOT_FORMAT_PNG;
+ LLFloaterSnapshotBase::ESnapshotFormat fmt = LLFloaterSnapshot::SNAPSHOT_FORMAT_PNG;
LLComboBox* local_format_combo = getChild<LLComboBox>("local_format_combo");
const std::string id = local_format_combo->getValue().asString();
@@ -119,8 +121,8 @@ LLFloaterSnapshot::ESnapshotFormat LLPanelSnapshotLocal::getImageFormat() const
// virtual
void LLPanelSnapshotLocal::updateControls(const LLSD& info)
{
- LLFloaterSnapshot::ESnapshotFormat fmt =
- (LLFloaterSnapshot::ESnapshotFormat) gSavedSettings.getS32("SnapshotFormat");
+ LLFloaterSnapshotBase::ESnapshotFormat fmt =
+ (LLFloaterSnapshotBase::ESnapshotFormat) gSavedSettings.getS32("SnapshotFormat");
getChild<LLComboBox>("local_format_combo")->selectNthItem((S32) fmt);
const bool show_quality_ctrls = (fmt == LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG);
@@ -174,3 +176,8 @@ void LLPanelSnapshotLocal::onSaveFlyoutCommit(LLUICtrl* ctrl)
cancel();
}
}
+
+LLPanelSnapshot::ESnapshotType LLPanelSnapshotLocal::getSnapshotType()
+{
+ return LLPanelSnapshot::SNAPSHOT_LOCAL;
+}
diff --git a/indra/newview/llpanelsnapshotpostcard.cpp b/indra/newview/llpanelsnapshotpostcard.cpp
index 8e37b1418c..2884313f60 100644
--- a/indra/newview/llpanelsnapshotpostcard.cpp
+++ b/indra/newview/llpanelsnapshotpostcard.cpp
@@ -38,6 +38,7 @@
#include "llfloatersnapshot.h" // FIXME: replace with a snapshot storage model
#include "llpanelsnapshot.h"
#include "llpostcard.h"
+#include "llsnapshotlivepreview.h"
#include "llviewercontrol.h" // gSavedSettings
#include "llviewerwindow.h"
@@ -63,8 +64,9 @@ private:
/*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);
+ /*virtual*/ LLFloaterSnapshotBase::ESnapshotFormat getImageFormat() const { return LLFloaterSnapshotBase::SNAPSHOT_FORMAT_JPEG; }
+ /*virtual*/ LLPanelSnapshot::ESnapshotType getSnapshotType();
+ /*virtual*/ void updateControls(const LLSD& info);
bool missingSubjMsgAlertCallback(const LLSD& notification, const LLSD& response);
void sendPostcard();
@@ -242,3 +244,8 @@ void LLPanelSnapshotPostcard::onSend()
// Send postcard.
sendPostcard();
}
+
+LLPanelSnapshot::ESnapshotType LLPanelSnapshotPostcard::getSnapshotType()
+{
+ return LLPanelSnapshot::SNAPSHOT_POSTCARD;
+}
diff --git a/indra/newview/llpanelsnapshotprofile.cpp b/indra/newview/llpanelsnapshotprofile.cpp
index 8949eb73eb..b6fc45fb63 100755
--- a/indra/newview/llpanelsnapshotprofile.cpp
+++ b/indra/newview/llpanelsnapshotprofile.cpp
@@ -58,7 +58,7 @@ private:
/*virtual*/ std::string getAspectRatioCBName() const { return "profile_keep_aspect_check"; }
/*virtual*/ std::string getImageSizeComboName() const { return "profile_size_combo"; }
/*virtual*/ std::string getImageSizePanelName() const { return "profile_image_size_lp"; }
- /*virtual*/ LLFloaterSnapshot::ESnapshotFormat getImageFormat() const { return LLFloaterSnapshot::SNAPSHOT_FORMAT_PNG; }
+ /*virtual*/ LLFloaterSnapshotBase::ESnapshotFormat getImageFormat() const { return LLFloaterSnapshotBase::SNAPSHOT_FORMAT_PNG; }
/*virtual*/ void updateControls(const LLSD& info);
void onSend();
diff --git a/indra/newview/llsnapshotlivepreview.cpp b/indra/newview/llsnapshotlivepreview.cpp
index 8561a89ae5..d40694f2f4 100644
--- a/indra/newview/llsnapshotlivepreview.cpp
+++ b/indra/newview/llsnapshotlivepreview.cpp
@@ -86,8 +86,8 @@ LLSnapshotLivePreview::LLSnapshotLivePreview (const LLSnapshotLivePreview::Param
mNeedsFlash(TRUE),
mSnapshotQuality(gSavedSettings.getS32("SnapshotQuality")),
mDataSize(0),
- mSnapshotType(SNAPSHOT_POSTCARD),
- mSnapshotFormat(LLFloaterSnapshot::ESnapshotFormat(gSavedSettings.getS32("SnapshotFormat"))),
+ mSnapshotType(LLPanelSnapshot::ESnapshotType::SNAPSHOT_POSTCARD),
+ mSnapshotFormat(LLFloaterSnapshotBase::ESnapshotFormat(gSavedSettings.getS32("SnapshotFormat"))),
mSnapshotUpToDate(FALSE),
mCameraPos(LLViewerCamera::getInstance()->getOrigin()),
mCameraRot(LLViewerCamera::getInstance()->getQuaternion()),
@@ -737,7 +737,7 @@ BOOL LLSnapshotLivePreview::onIdle( void* snapshot_preview )
previewp->getWidth(),
previewp->getHeight(),
previewp->mKeepAspectRatio,//gSavedSettings.getBOOL("KeepAspectForSnapshot"),
- previewp->getSnapshotType() == LLSnapshotLivePreview::SNAPSHOT_TEXTURE,
+ previewp->getSnapshotType() == LLPanelSnapshot::SNAPSHOT_TEXTURE,
previewp->mAllowRenderUI && gSavedSettings.getBOOL("RenderUIInSnapshot"),
FALSE,
previewp->mSnapshotBufferType,
@@ -813,7 +813,7 @@ void LLSnapshotLivePreview::prepareFreezeFrame()
mViewerImage[mCurImageIndex] = LLViewerTextureManager::getLocalTexture(scaled.get(), FALSE);
LLPointer<LLViewerTexture> curr_preview_image = mViewerImage[mCurImageIndex];
gGL.getTexUnit(0)->bind(curr_preview_image);
- curr_preview_image->setFilteringOption(getSnapshotType() == SNAPSHOT_TEXTURE ? LLTexUnit::TFO_ANISOTROPIC : LLTexUnit::TFO_POINT);
+ curr_preview_image->setFilteringOption(getSnapshotType() == LLPanelSnapshot::ESnapshotType::SNAPSHOT_TEXTURE ? LLTexUnit::TFO_ANISOTROPIC : LLTexUnit::TFO_POINT);
curr_preview_image->setAddressMode(LLTexUnit::TAM_CLAMP);
@@ -827,7 +827,7 @@ void LLSnapshotLivePreview::prepareFreezeFrame()
S32 LLSnapshotLivePreview::getEncodedImageWidth() const
{
S32 width = getWidth();
- if (getSnapshotType() == SNAPSHOT_TEXTURE)
+ if (getSnapshotType() == LLPanelSnapshot::ESnapshotType::SNAPSHOT_TEXTURE)
{
width = LLImageRaw::biasedDimToPowerOfTwo(width,MAX_TEXTURE_SIZE);
}
@@ -836,7 +836,7 @@ S32 LLSnapshotLivePreview::getEncodedImageWidth() const
S32 LLSnapshotLivePreview::getEncodedImageHeight() const
{
S32 height = getHeight();
- if (getSnapshotType() == SNAPSHOT_TEXTURE)
+ if (getSnapshotType() == LLPanelSnapshot::ESnapshotType::SNAPSHOT_TEXTURE)
{
height = LLImageRaw::biasedDimToPowerOfTwo(height,MAX_TEXTURE_SIZE);
}
@@ -854,7 +854,7 @@ LLPointer<LLImageRaw> LLSnapshotLivePreview::getEncodedImage()
mPreviewImage->getHeight(),
mPreviewImage->getComponents());
- if (getSnapshotType() == SNAPSHOT_TEXTURE)
+ if (getSnapshotType() == LLPanelSnapshot::ESnapshotType::SNAPSHOT_TEXTURE)
{
// We don't store the intermediate formatted image in mFormattedImage in the J2C case
LL_DEBUGS() << "Encoding new image of format J2C" << LL_ENDL;
@@ -903,13 +903,13 @@ void LLSnapshotLivePreview::estimateDataSize()
// Compression ratio
F32 ratio = 1.0;
- if (getSnapshotType() == SNAPSHOT_TEXTURE)
+ if (getSnapshotType() == LLPanelSnapshot::SNAPSHOT_TEXTURE)
{
ratio = 8.0; // This is what we shoot for when compressing to J2C
}
else
{
- LLFloaterSnapshot::ESnapshotFormat format = getSnapshotFormat();
+ LLFloaterSnapshotBase::ESnapshotFormat format = getSnapshotFormat();
switch (format)
{
case LLFloaterSnapshot::SNAPSHOT_FORMAT_PNG:
@@ -947,7 +947,7 @@ LLPointer<LLImageFormatted> LLSnapshotLivePreview::getFormattedImage()
}
// Create the new formatted image of the appropriate format.
- LLFloaterSnapshot::ESnapshotFormat format = getSnapshotFormat();
+ LLFloaterSnapshotBase::ESnapshotFormat format = getSnapshotFormat();
LL_DEBUGS() << "Encoding new image of format " << format << LL_ENDL;
switch (format)
@@ -978,7 +978,7 @@ void LLSnapshotLivePreview::setSize(S32 w, S32 h)
setHeight(h);
}
-void LLSnapshotLivePreview::setSnapshotFormat(LLFloaterSnapshot::ESnapshotFormat format)
+void LLSnapshotLivePreview::setSnapshotFormat(LLFloaterSnapshotBase::ESnapshotFormat format)
{
if (mSnapshotFormat != format)
{
@@ -993,7 +993,7 @@ void LLSnapshotLivePreview::getSize(S32& w, S32& h) const
h = getHeight();
}
-void LLSnapshotLivePreview::saveTexture()
+void LLSnapshotLivePreview::saveTexture(BOOL outfit_snapshot, std::string name)
{
LL_DEBUGS() << "saving texture: " << mPreviewImage->getWidth() << "x" << mPreviewImage->getHeight() << LL_ENDL;
// gen a new uuid for this asset
@@ -1035,13 +1035,17 @@ void LLSnapshotLivePreview::saveTexture()
LLAssetStorage::LLStoreAssetCallback callback = NULL;
S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
void *userdata = NULL;
+ std::string res_name = outfit_snapshot ? name : "Snapshot : " + pos_string;
+ std::string res_desc = outfit_snapshot ? "" : "Taken by " + who_took_it + " at " + pos_string;
+ LLFolderType::EType folder_type = outfit_snapshot ? LLFolderType::FT_NONE : LLFolderType::FT_SNAPSHOT_CATEGORY;
+ LLInventoryType::EType inv_type = outfit_snapshot ? LLInventoryType::IT_NONE : LLInventoryType::IT_SNAPSHOT;
upload_new_resource(tid, // tid
LLAssetType::AT_TEXTURE,
- "Snapshot : " + pos_string,
- "Taken by " + who_took_it + " at " + pos_string,
+ res_name,
+ res_desc,
0,
- LLFolderType::FT_SNAPSHOT_CATEGORY,
- LLInventoryType::IT_SNAPSHOT,
+ folder_type,
+ inv_type,
PERM_ALL, // Note: Snapshots to inventory is a special case of content upload
LLFloaterPerms::getGroupPerms("Uploads"), // that is more permissive than other uploads
LLFloaterPerms::getEveryonePerms("Uploads"),
diff --git a/indra/newview/llsnapshotlivepreview.h b/indra/newview/llsnapshotlivepreview.h
index 57e5d83f8e..b822707d29 100644
--- a/indra/newview/llsnapshotlivepreview.h
+++ b/indra/newview/llsnapshotlivepreview.h
@@ -40,14 +40,6 @@ class LLSnapshotLivePreview : public LLView
{
LOG_CLASS(LLSnapshotLivePreview);
public:
- enum ESnapshotType
- {
- SNAPSHOT_POSTCARD,
- SNAPSHOT_TEXTURE,
- SNAPSHOT_LOCAL,
- SNAPSHOT_WEB
- };
-
struct Params : public LLInitParam::Block<Params, LLView::Params>
{
@@ -80,8 +72,8 @@ public:
void setMaxImageSize(S32 size) ;
S32 getMaxImageSize() {return mMaxImageSize ;}
- ESnapshotType getSnapshotType() const { return mSnapshotType; }
- LLFloaterSnapshot::ESnapshotFormat getSnapshotFormat() const { return mSnapshotFormat; }
+ LLPanelSnapshot::ESnapshotType getSnapshotType() const { return mSnapshotType; }
+ LLFloaterSnapshotBase::ESnapshotFormat getSnapshotFormat() const { return mSnapshotFormat; }
BOOL getSnapshotUpToDate() const { return mSnapshotUpToDate; }
BOOL isSnapshotActive() { return mSnapshotActive; }
LLViewerTexture* getThumbnailImage() const { return mThumbnailImage ; }
@@ -98,8 +90,8 @@ public:
void setImageScaled(BOOL scaled) { mImageScaled[mCurImageIndex] = scaled; }
const LLVector3d& getPosTakenGlobal() const { return mPosTakenGlobal; }
- void setSnapshotType(ESnapshotType type) { mSnapshotType = type; }
- void setSnapshotFormat(LLFloaterSnapshot::ESnapshotFormat format);
+ void setSnapshotType(LLPanelSnapshot::ESnapshotType type) { mSnapshotType = type; }
+ void setSnapshotFormat(LLFloaterSnapshotBase::ESnapshotFormat format);
bool setSnapshotQuality(S32 quality, bool set_by_user = true);
void setSnapshotBufferType(LLViewerWindow::ESnapshotType type) { mSnapshotBufferType = type; }
void setAllowRenderUI(BOOL allow) { mAllowRenderUI = allow; }
@@ -107,7 +99,7 @@ public:
void setFilter(std::string filter_name) { mFilterName = filter_name; }
std::string getFilter() const { return mFilterName; }
void updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail = FALSE, F32 delay = 0.f);
- void saveTexture();
+ void saveTexture(BOOL outfit_snapshot = FALSE, std::string name = "");
BOOL saveLocal();
LLPointer<LLImageFormatted> getFormattedImage();
@@ -169,8 +161,8 @@ private:
LLVector3d mPosTakenGlobal;
S32 mSnapshotQuality;
S32 mDataSize;
- ESnapshotType mSnapshotType;
- LLFloaterSnapshot::ESnapshotFormat mSnapshotFormat;
+ LLPanelSnapshot::ESnapshotType mSnapshotType;
+ LLFloaterSnapshotBase::ESnapshotFormat mSnapshotFormat;
BOOL mSnapshotUpToDate;
LLFrameTimer mFallAnimTimer;
LLVector3 mCameraPos;
diff --git a/indra/newview/llviewerfloaterreg.cpp b/indra/newview/llviewerfloaterreg.cpp
index 14a2627f27..fd48598925 100755
--- a/indra/newview/llviewerfloaterreg.cpp
+++ b/indra/newview/llviewerfloaterreg.cpp
@@ -94,6 +94,7 @@
#include "llfloaterobjectweights.h"
#include "llfloateropenobject.h"
#include "llfloateroutbox.h"
+#include "llfloateroutfitsnapshot.h"
#include "llfloaterpathfindingcharacters.h"
#include "llfloaterpathfindingconsole.h"
#include "llfloaterpathfindinglinksets.h"
@@ -332,7 +333,8 @@ void LLViewerFloaterReg::registerFloaters()
LLFloaterReg::add("scene_load_stats", "floater_scene_load_stats.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSceneLoadStats>);
LLFloaterReg::add("stop_queue", "floater_script_queue.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterNotRunQueue>);
LLFloaterReg::add("snapshot", "floater_snapshot.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSnapshot>);
- LLFloaterReg::add("search", "floater_search.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSearch>);
+ LLFloaterReg::add("outfit_snapshot", "floater_outfit_snapshot.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterOutfitSnapshot>);
+ LLFloaterReg::add("search", "floater_search.xml", (LLFloaterBuildFunc)&LLFloaterReg::build<LLFloaterSearch>);
LLFloaterReg::add("my_profile", "floater_my_web_profile.xml", (LLFloaterBuildFunc)&LLFloaterWebProfile::create);
LLFloaterReg::add("profile", "floater_web_profile.xml", (LLFloaterBuildFunc)&LLFloaterWebProfile::create);
LLFloaterReg::add("how_to", "floater_how_to.xml", (LLFloaterBuildFunc)&LLFloaterWebContent::create);
diff --git a/indra/newview/llviewermenufile.cpp b/indra/newview/llviewermenufile.cpp
index f8e50ba463..7b87d210c0 100755
--- a/indra/newview/llviewermenufile.cpp
+++ b/indra/newview/llviewermenufile.cpp
@@ -556,7 +556,7 @@ class LLFileTakeSnapshotToDisk : public view_listener_t
{
gViewerWindow->playSnapshotAnimAndSound();
LLPointer<LLImageFormatted> formatted;
- LLFloaterSnapshot::ESnapshotFormat fmt = (LLFloaterSnapshot::ESnapshotFormat) gSavedSettings.getS32("SnapshotFormat");
+ LLFloaterSnapshotBase::ESnapshotFormat fmt = (LLFloaterSnapshotBase::ESnapshotFormat) gSavedSettings.getS32("SnapshotFormat");
switch (fmt)
{
case LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG:
diff --git a/indra/newview/skins/default/xui/en/floater_outfit_snapshot.xml b/indra/newview/skins/default/xui/en/floater_outfit_snapshot.xml
new file mode 100644
index 0000000000..7b88b07ca6
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/floater_outfit_snapshot.xml
@@ -0,0 +1,462 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<floater
+ positioning="cascading"
+ legacy_header_height="18"
+ can_minimize="true"
+ can_resize="false"
+ can_close="true"
+ height="455"
+ layout="topleft"
+ name="outfit_snapshot"
+ single_instance="true"
+ help_topic="snapshot"
+ save_rect="true"
+ save_visibility="false"
+ title="OUTFIT SNAPSHOT"
+ width="624"
+ min_height="455">
+ <floater.string
+ name="unknown">
+ unknown
+ </floater.string>
+ <string
+ name="postcard_progress_str">
+ Sending Email
+ </string>
+ <string
+ name="facebook_progress_str">
+ Posting to Facebook
+ </string>
+ <string
+ name="profile_progress_str">
+ Posting
+ </string>
+ <string
+ name="inventory_progress_str">
+ Saving to Inventory
+ </string>
+ <string
+ name="local_progress_str">
+ Saving to Computer
+ </string>
+ <string
+ name="facebook_succeeded_str">
+ Image uploaded
+ </string>
+ <string
+ name="profile_succeeded_str">
+ Image uploaded
+ </string>
+ <string
+ name="postcard_succeeded_str">
+ Email Sent!
+ </string>
+ <string
+ name="inventory_succeeded_str">
+ Saved to Inventory!
+ </string>
+ <string
+ name="local_succeeded_str">
+ Saved to Computer!
+ </string>
+ <string
+ name="facebook_failed_str">
+ Failed to upload image to your Facebook timeline.
+ </string>
+ <string
+ name="profile_failed_str">
+ Failed to upload image to your Profile Feed.
+ </string>
+ <string
+ name="postcard_failed_str">
+ Failed to send email.
+ </string>
+ <string
+ name="inventory_failed_str">
+ Failed to save to inventory.
+ </string>
+ <string
+ name="local_failed_str">
+ Failed to save to computer.
+ </string>
+ <button
+ follows="left|top"
+ height="25"
+ image_overlay="Refresh_Off"
+ image_hover_unselected="Toolbar_Middle_Over"
+ image_selected="Toolbar_Middle_Selected"
+ image_unselected="Toolbar_Middle_Off"
+ image_overlay_alignment="left"
+ imgoverlay_label_space="5"
+ pad_bottom="0"
+ halign="left"
+ layout="topleft"
+ left="10"
+ label="REFRESH"
+ name="new_snapshot_btn"
+ top_pad="26"
+ width="167" />
+ <button
+ follows="left|top"
+ control_name="AdvanceSnapshot"
+ invisibility_control="AdvanceSnapshot"
+ height="25"
+ is_toggle="true"
+ layout="topleft"
+ image_hover_unselected="Toolbar_Middle_Over"
+ image_selected="Toolbar_Middle_Off"
+ image_unselected="Toolbar_Middle_Off"
+ image_overlay="Conv_toolbar_expand"
+ name="retract_btn"
+ left_pad="1"
+ top_delta="0"
+ width="31" />
+ <button
+ follows="left|top"
+ control_name="AdvanceSnapshot"
+ visibility_control="AdvanceSnapshot"
+ height="25"
+ is_toggle="true"
+ layout="topleft"
+ image_overlay="Conv_toolbar_collapse"
+ image_hover_unselected="Toolbar_Middle_Over"
+ image_selected="Toolbar_Middle_Off"
+ image_unselected="Toolbar_Middle_Off"
+ name="extend_btn"
+ left_delta="0"
+ top_delta="0"
+ width="31" />
+ <panel
+ height="154"
+ layout="topleft"
+ follows="top|left"
+ left="0"
+ name="advanced_options_panel"
+ top_pad="-6"
+ width="210">
+ <view_border
+ bevel_style="in"
+ follows="left|top|right"
+ height="1"
+ left="10"
+ layout="topleft"
+ name="advanced_options_hr"
+ right="-1"
+ top_pad="5"
+ />
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ height="13"
+ layout="topleft"
+ left="10"
+ name="layer_type_label"
+ top_pad="10"
+ width="100">
+ Capture:
+ </text>
+ <combo_box
+ follows="left|top|right"
+ height="23"
+ label="Image Layers"
+ layout="topleft"
+ left="30"
+ name="layer_types"
+ right="-2">
+ <combo_box.item
+ label="Colors"
+ name="Colors"
+ value="colors" />
+ <combo_box.item
+ label="Depth"
+ name="Depth"
+ value="depth" />
+ </combo_box>
+ <check_box
+ label="Interface"
+ layout="topleft"
+ left="30"
+ height="16"
+ top_pad="8"
+ width="180"
+ name="ui_check" />
+ <check_box
+ label="HUDs"
+ layout="topleft"
+ height="16"
+ left="30"
+ top_pad="1"
+ width="180"
+ name="hud_check" />
+ <check_box
+ label="Freeze frame (fullscreen)"
+ layout="topleft"
+ height="16"
+ left="10"
+ top_pad="1"
+ width="180"
+ name="freeze_frame_check" />
+ <check_box
+ label="Auto-refresh"
+ layout="topleft"
+ height="16"
+ left="10"
+ top_pad="1"
+ width="180"
+ name="auto_snapshot_check" />
+ <text
+ type="string"
+ length="1"
+ follows="left|top"
+ height="13"
+ layout="topleft"
+ left="10"
+ name="filter_list_label"
+ top_pad="10"
+ width="50">
+ Filter:
+ </text>
+ <combo_box
+ control_name="PhotoFilters"
+ follows="left|right|top"
+ name="filters_combobox"
+ tool_tip="Image filters"
+ top_delta="-3"
+ left="50"
+ right="-1"
+ height="21"
+ width="135">
+ <combo_box.item
+ label="No Filter"
+ name="NoFilter"
+ value="NoFilter" />
+ </combo_box>
+ <view_border
+ bevel_style="in"
+ follows="left|top|right"
+ height="1"
+ left="10"
+ layout="topleft"
+ name="advanced_options_hr"
+ right="-1"
+ top_pad="7"
+ />
+ </panel>
+ <!--
+ <panel_container
+ follows="left|top"
+ height="230"
+ layout="topleft"
+ left="0"
+ name="panel_container"
+ default_panel_name="panel_snapshot_options"
+ top_pad="10"
+ width="215">
+ <panel
+ class="llpanelsnapshotoptions"
+ filename="panel_snapshot_options.xml"
+ follows="all"
+ layout="topleft"
+ left="0"
+ name="panel_snapshot_options"
+ top="0" />
+ <panel
+ class="llpanelsnapshotprofile"
+ follows="all"
+ layout="topleft"
+ name="panel_snapshot_profile"
+ filename="panel_snapshot_profile.xml" />
+ <panel
+ class="llpanelsnapshotpostcard"
+ follows="all"
+ layout="topleft"
+ name="panel_snapshot_postcard"
+ filename="panel_snapshot_postcard.xml" />
+ -->
+ <!--panel
+ class="llpaneloutfitsnapshotinventory"
+ follows="all"
+ layout="topleft"
+ name="panel_outfit_snapshot_inventory"
+ filename="panel_snapshot_inventory.xml"-->
+ <panel
+ class="llpaneloutfitsnapshotinventory"
+ follows="left|top"
+ height="230"
+ layout="topleft"
+ left="0"
+ name="panel_outfit_snapshot_inventory"
+ filename="panel_outfit_snapshot_inventory.xml"
+ top_pad="10"
+ width="215"
+ />
+ <!--
+ <panel
+ class="llpanelsnapshotlocal"
+ follows="all"
+ layout="topleft"
+ name="panel_snapshot_local"
+ filename="panel_snapshot_local.xml" />
+ </panel_container>
+-->
+ <view_border
+ bevel_style="in"
+ follows="left|top"
+ height="1"
+ left="10"
+ layout="topleft"
+ name="status_hr"
+ width="199"
+ top_pad="-16"/>
+ <panel
+ background_visible="false"
+ follows="left|top"
+ font="SansSerifLarge"
+ halign="center"
+ height="20"
+ layout="topleft"
+ left="10"
+ length="1"
+ name="succeeded_panel"
+ width="198"
+ top_pad="1"
+ type="string"
+ visible="false">
+ <text
+ follows="all"
+ font="SansSerif"
+ halign="center"
+ height="18"
+ layout="topleft"
+ left="1"
+ length="1"
+ name="succeeded_lbl"
+ right="-1"
+ text_color="0.2 0.85 0.2 1"
+ top="4"
+ translate="false"
+ type="string">
+ Succeeded
+ </text>
+ </panel>
+ <panel
+ background_visible="false"
+ follows="left|top"
+ font="SansSerifLarge"
+ halign="center"
+ height="20"
+ layout="topleft"
+ left="10"
+ length="1"
+ name="failed_panel"
+ width="198"
+ top_delta="0"
+ type="string"
+ visible="false">
+ <text
+ follows="all"
+ font="SansSerif"
+ halign="center"
+ height="18"
+ layout="topleft"
+ left="1"
+ length="1"
+ name="failed_lbl"
+ right="-1"
+ text_color="0.95 0.4 0.4 1"
+ top="4"
+ translate="false"
+ type="string">
+ Failed
+ </text>
+ </panel>
+ <loading_indicator
+ follows="left|top"
+ height="24"
+ layout="topleft"
+ name="working_indicator"
+ left="10"
+ top_delta="0"
+ visible="false"
+ width="24" />
+ <text
+ follows="left|top"
+ font="SansSerifBold"
+ height="14"
+ layout="topleft"
+ left_pad="3"
+ length="1"
+ halign="left"
+ name="working_lbl"
+ top_delta="5"
+ translate="false"
+ type="string"
+ visible="false"
+ width="162">
+ Working
+ </text>
+ <text
+ follows="left|top"
+ font="SansSerifBold"
+ halign="left"
+ height="18"
+ layout="topleft"
+ left="10"
+ length="1"
+ name="refresh_lbl"
+ text_color="0.95 0.4 0.4 1"
+ top_delta="0"
+ translate="false"
+ type="string"
+ visible="false"
+ width="130">
+ Refresh to save.
+ </text>
+ <ui_ctrl
+ layout="topleft"
+ name="thumbnail_placeholder"
+ top="23"
+ left="215"
+ width="400"
+ height="400"
+ follows="top|left"/>
+ <!--view_border
+ bevel_style="in"
+ height="21"
+ layout="topleft"
+ name="img_info_border"
+ top_pad="0"
+ right="-10"
+ follows="left|top|right"
+ left_delta="0"/>-->
+ <text
+ type="string"
+ font="SansSerifSmall"
+ length="1"
+ follows="left|top|right"
+ height="14"
+ layout="topleft"
+ left="220"
+ right="-20"
+ halign="left"
+ name="image_res_text"
+ top_delta="5"
+ width="200">
+ [WIDTH]px (width) x [HEIGHT]px (height)
+ </text>
+ <text
+ follows="right|top"
+ font="SansSerifSmall"
+ height="14"
+ layout="topleft"
+ left="-65"
+ length="1"
+ halign="right"
+ name="file_size_label"
+ top_delta="0"
+ type="string"
+ width="50">
+ [SIZE] KB
+ </text>
+</floater>
diff --git a/indra/newview/skins/default/xui/en/menu_outfit_gear.xml b/indra/newview/skins/default/xui/en/menu_outfit_gear.xml
index 23133d4f7c..e527e1f901 100755
--- a/indra/newview/skins/default/xui/en/menu_outfit_gear.xml
+++ b/indra/newview/skins/default/xui/en/menu_outfit_gear.xml
@@ -52,7 +52,14 @@
name="select_photo">
<on_click
function="Gear.SelectPhoto" />
- </menu_item_call>
+ </menu_item_call>
+ <menu_item_call
+ label="Take a Snapshot"
+ layout="topleft"
+ name="take_snapshot">
+ <on_click
+ function="Gear.TakeSnapshot" />
+ </menu_item_call>
<menu_item_separator name="sepatator1" />
<!-- copied (with minor modifications) from menu_inventory_add.xml -->
diff --git a/indra/newview/skins/default/xui/en/panel_outfit_snapshot_inventory.xml b/indra/newview/skins/default/xui/en/panel_outfit_snapshot_inventory.xml
new file mode 100644
index 0000000000..ce6309e2ed
--- /dev/null
+++ b/indra/newview/skins/default/xui/en/panel_outfit_snapshot_inventory.xml
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
+<panel
+ height="380"
+ layout="topleft"
+ name="panel_outfit_snapshot_inventory"
+ width="490">
+ <icon
+ follows="top|left"
+ height="18"
+ image_name="Snapshot_Inventory"
+ layout="topleft"
+ left="12"
+ mouse_opaque="true"
+ name="title_icon"
+ top="6"
+ width="18" />
+ <text
+ follows="top|left|right"
+ font="SansSerifBold"
+ height="14"
+ layout="topleft"
+ left_pad="12"
+ length="1"
+ name="title"
+ right="-10"
+ text_color="white"
+ type="string"
+ top_delta="3">
+ Inventory
+ </text>
+ <view_border
+ bevel_style="in"
+ follows="left|top|right"
+ height="1"
+ left="9"
+ layout="topleft"
+ name="hr"
+ right="-5"
+ top_pad="5"
+ />
+ <combo_box
+ follows="top|left|right"
+ height="20"
+ label="Resolution"
+ layout="topleft"
+ left_delta="0"
+ name="texture_size_combo"
+ right="-5"
+ top_pad="5">
+ <combo_box.item
+ label="Small (128x128)"
+ name="Small(128x128)"
+ value="[i128,i128]" />
+ <combo_box.item
+ label="Medium (256x256)"
+ name="Medium(256x256)"
+ value="[i256,i256]" />
+ <combo_box.item
+ label="Large (512x512)"
+ name="Large(512x512)"
+ value="[i512,i512]" />
+ <combo_box.item
+ label="Current Window(512x512)"
+ name="CurrentWindow"
+ value="[i0,i0]" />
+ <combo_box.item
+ label="Custom"
+ name="Custom"
+ value="[i-1,i-1]" />
+ </combo_box>
+ <spinner
+ allow_text_entry="false"
+ decimal_digits="0"
+ follows="left|top"
+ height="20"
+ increment="32"
+ label="Width x Height"
+ label_width="90"
+ layout="topleft"
+ left="10"
+ max_val="6016"
+ min_val="32"
+ name="inventory_snapshot_width"
+ top_pad="7"
+ width="144" />
+ <spinner
+ allow_text_entry="false"
+ decimal_digits="0"
+ follows="left|top"
+ height="20"
+ increment="32"
+ label=""
+ label_width="0"
+ layout="topleft"
+ left_pad="0"
+ max_val="6016"
+ min_val="32"
+ name="inventory_snapshot_height"
+ top_delta="0"
+ width="54" />
+ <check_box
+ top_pad="12"
+ follows="left|top"
+ label="Constrain proportions"
+ layout="topleft"
+ left="10"
+ name="inventory_keep_aspect_check"
+ visible="false" />
+ <text
+ follows="top|left"
+ font="SansSerif"
+ height="56"
+ layout="topleft"
+ left="10"
+ length="1"
+ name="hint_lbl"
+ top_pad="6"
+ width="200"
+ type="string"
+ word_wrap="true">
+ Saving an image to your inventory costs L$[UPLOAD_COST]. To save your image as a texture select one of the square formats.
+ </text>
+ <button
+ follows="right|bottom"
+ height="23"
+ label="Cancel"
+ layout="topleft"
+ name="cancel_btn"
+ right="-5"
+ top="337"
+ width="97">
+ <button.commit_callback
+ function="Inventory.Cancel" />
+ </button>
+ <button
+ follows="left|bottom"
+ height="23"
+ label="Save"
+ layout="topleft"
+ left="10"
+ name="save_btn"
+ top_delta="0"
+ width="97">
+ <button.commit_callback
+ function="Inventory.SaveOutfitPhoto" />
+ </button>
+</panel> \ No newline at end of file