summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
Diffstat (limited to 'indra')
-rw-r--r--indra/newview/llfloatersnapshot.cpp16
-rw-r--r--indra/newview/llfloatersnapshot.h2
-rw-r--r--indra/newview/llpanelsnapshotlocal.cpp27
-rw-r--r--indra/newview/skins/default/xui/en/panel_snapshot_local.xml15
4 files changed, 37 insertions, 23 deletions
diff --git a/indra/newview/llfloatersnapshot.cpp b/indra/newview/llfloatersnapshot.cpp
index 181570138e..5b26e93898 100644
--- a/indra/newview/llfloatersnapshot.cpp
+++ b/indra/newview/llfloatersnapshot.cpp
@@ -997,13 +997,7 @@ void LLSnapshotLivePreview::saveTexture()
BOOL LLSnapshotLivePreview::saveLocal()
{
- BOOL success = gViewerWindow->saveImageNumbered(mFormattedImage, true);
-
- // Relinquish image memory. Save button will be disabled as a side-effect.
- lldebugs << "resetting formatted image after saving to disk" << llendl;
- mFormattedImage = NULL;
- mDataSize = 0;
- updateSnapshot(FALSE, FALSE);
+ BOOL success = gViewerWindow->saveImageNumbered(mFormattedImage);
if(success)
{
@@ -2465,7 +2459,7 @@ void LLFloaterSnapshot::saveTexture()
}
// static
-void LLFloaterSnapshot::saveLocal()
+BOOL LLFloaterSnapshot::saveLocal()
{
lldebugs << "saveLocal" << llendl;
// FIXME: duplicated code
@@ -2473,16 +2467,16 @@ void LLFloaterSnapshot::saveLocal()
if (!instance)
{
llassert(instance != NULL);
- return;
+ return FALSE;
}
LLSnapshotLivePreview* previewp = Impl::getPreviewView(instance);
if (!previewp)
{
llassert(previewp != NULL);
- return;
+ return FALSE;
}
- previewp->saveLocal();
+ return previewp->saveLocal();
}
// static
diff --git a/indra/newview/llfloatersnapshot.h b/indra/newview/llfloatersnapshot.h
index 48015ad4d7..afe135fa40 100644
--- a/indra/newview/llfloatersnapshot.h
+++ b/indra/newview/llfloatersnapshot.h
@@ -58,7 +58,7 @@ public:
// TODO: create a snapshot model instead
static LLFloaterSnapshot* getInstance();
static void saveTexture();
- static void saveLocal();
+ static BOOL saveLocal();
static void preUpdate();
static void postUpdate();
static void postSave();
diff --git a/indra/newview/llpanelsnapshotlocal.cpp b/indra/newview/llpanelsnapshotlocal.cpp
index eaa27b8d41..4a2614fa7d 100644
--- a/indra/newview/llpanelsnapshotlocal.cpp
+++ b/indra/newview/llpanelsnapshotlocal.cpp
@@ -34,6 +34,7 @@
#include "llfloatersnapshot.h" // FIXME: replace with a snapshot storage model
#include "llpanelsnapshot.h"
#include "llviewercontrol.h" // gSavedSettings
+#include "llviewerwindow.h"
/**
* The panel provides UI for saving snapshot to a local folder.
@@ -58,14 +59,13 @@ private:
void onFormatComboCommit(LLUICtrl* ctrl);
void onQualitySliderCommit(LLUICtrl* ctrl);
- void onSend();
+ void onSaveFlyoutCommit(LLUICtrl* ctrl);
};
static LLRegisterPanelClassWrapper<LLPanelSnapshotLocal> panel_class("llpanelsnapshotlocal");
LLPanelSnapshotLocal::LLPanelSnapshotLocal()
{
- mCommitCallbackRegistrar.add("Local.Save", boost::bind(&LLPanelSnapshotLocal::onSend, this));
mCommitCallbackRegistrar.add("Local.Cancel", boost::bind(&LLPanelSnapshotLocal::cancel, this));
}
@@ -74,6 +74,7 @@ BOOL LLPanelSnapshotLocal::postBuild()
{
getChild<LLUICtrl>("image_quality_slider")->setCommitCallback(boost::bind(&LLPanelSnapshotLocal::onQualitySliderCommit, this, _1));
getChild<LLUICtrl>("local_format_combo")->setCommitCallback(boost::bind(&LLPanelSnapshotLocal::onFormatComboCommit, this, _1));
+ getChild<LLUICtrl>("save_btn")->setCommitCallback(boost::bind(&LLPanelSnapshotLocal::onSaveFlyoutCommit, this, _1));
return LLPanelSnapshot::postBuild();
}
@@ -142,13 +143,25 @@ void LLPanelSnapshotLocal::onQualitySliderCommit(LLUICtrl* ctrl)
LLFloaterSnapshot::getInstance()->notify(info);
}
-void LLPanelSnapshotLocal::onSend()
+void LLPanelSnapshotLocal::onSaveFlyoutCommit(LLUICtrl* ctrl)
{
+ if (ctrl->getValue().asString() == "save as")
+ {
+ gViewerWindow->resetSnapshotLoc();
+ }
+
LLFloaterSnapshot* floater = LLFloaterSnapshot::getInstance();
floater->notify(LLSD().with("set-working", true));
- LLFloaterSnapshot::saveLocal();
- LLFloaterSnapshot::postSave();
- goBack();
- floater->notify(LLSD().with("set-finished", LLSD().with("ok", true).with("msg", "local")));
+ BOOL saved = LLFloaterSnapshot::saveLocal();
+ if (saved)
+ {
+ LLFloaterSnapshot::postSave();
+ goBack();
+ floater->notify(LLSD().with("set-finished", LLSD().with("ok", true).with("msg", "local")));
+ }
+ else
+ {
+ cancel();
+ }
}
diff --git a/indra/newview/skins/default/xui/en/panel_snapshot_local.xml b/indra/newview/skins/default/xui/en/panel_snapshot_local.xml
index fc4b85ae2a..30403a21dd 100644
--- a/indra/newview/skins/default/xui/en/panel_snapshot_local.xml
+++ b/indra/newview/skins/default/xui/en/panel_snapshot_local.xml
@@ -179,16 +179,23 @@
<button.commit_callback
function="Local.Cancel" />
</button>
- <button
+ <flyout_button
follows="right|bottom"
height="23"
label="Save"
layout="topleft"
left_delta="-106"
name="save_btn"
+ tool_tip="Save image to a file"
top_delta="0"
width="100">
- <button.commit_callback
- function="Local.Save" />
- </button>
+ <flyout_button.item
+ label="Save"
+ name="save_item"
+ value="save" />
+ <flyout_button.item
+ label="Save As..."
+ name="saveas_item"
+ value="save as" />
+ </flyout_button>
</panel>