From 0a25d9b1ba4f01ae391319d35e4f573dc6624365 Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Wed, 16 Nov 2011 19:46:31 +0200 Subject: EXP-1562 WIP Turned the Save button into flyout (Save / Save as). By the way, fixed: * inability to save a snapshot to disk after pressing "Cancel" in the file picker. * displaying "Saved to computer!" after pressing "Cancel" in the file picker. --- indra/newview/llpanelsnapshotlocal.cpp | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'indra/newview/llpanelsnapshotlocal.cpp') 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 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("image_quality_slider")->setCommitCallback(boost::bind(&LLPanelSnapshotLocal::onQualitySliderCommit, this, _1)); getChild("local_format_combo")->setCommitCallback(boost::bind(&LLPanelSnapshotLocal::onFormatComboCommit, this, _1)); + getChild("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(); + } } -- cgit v1.2.3