Threaded filepickers for snapshot to disk

Thu, 07 Apr 2016 16:57:55 +0200

author
Ansariel
date
Thu, 07 Apr 2016 16:57:55 +0200
changeset 48943
d14bdd999e78
parent 48942
b2ad5901ecf8
child 48944
32e8b304bc22

Threaded filepickers for snapshot to disk

indra/newview/llfloatersnapshot.cpp file | annotate | diff | revisions
indra/newview/llfloatersnapshot.h file | annotate | diff | revisions
indra/newview/llpanelsnapshotlocal.cpp file | annotate | diff | revisions
indra/newview/llsnapshotlivepreview.cpp file | annotate | diff | revisions
indra/newview/llsnapshotlivepreview.h file | annotate | diff | revisions
indra/newview/llviewermenufile.cpp file | annotate | diff | revisions
indra/newview/llviewerwindow.cpp file | annotate | diff | revisions
indra/newview/llviewerwindow.h file | annotate | diff | revisions
     1.1 --- a/indra/newview/llfloatersnapshot.cpp	Thu Apr 07 14:16:52 2016 +0200
     1.2 +++ b/indra/newview/llfloatersnapshot.cpp	Thu Apr 07 16:57:55 2016 +0200
     1.3 @@ -1551,7 +1551,10 @@
     1.4  }
     1.5  
     1.6  // static
     1.7 -BOOL LLFloaterSnapshot::saveLocal()
     1.8 +// <FS:Ansariel> Threaded filepickers
     1.9 +//BOOL LLFloaterSnapshot::saveLocal()
    1.10 +void LLFloaterSnapshot::saveLocal(boost::function<void(bool)> callback)
    1.11 +// </FS:Ansariel>
    1.12  {
    1.13  	LL_DEBUGS() << "saveLocal" << LL_ENDL;
    1.14  	// FIXME: duplicated code
    1.15 @@ -1559,16 +1562,33 @@
    1.16  	if (!instance)
    1.17  	{
    1.18  		llassert(instance != NULL);
    1.19 -		return FALSE;
    1.20 +		// <FS:Ansariel> Threaded filepickers
    1.21 +		//return FALSE;
    1.22 +		if (callback)
    1.23 +		{
    1.24 +			callback(false);
    1.25 +		}
    1.26 +		return;
    1.27 +		// </FS:Ansariel>
    1.28  	}
    1.29  	LLSnapshotLivePreview* previewp = Impl::getPreviewView(instance);
    1.30  	if (!previewp)
    1.31  	{
    1.32  		llassert(previewp != NULL);
    1.33 -		return FALSE;
    1.34 +		// <FS:Ansariel> Threaded filepickers
    1.35 +		//return FALSE;
    1.36 +		if (callback)
    1.37 +		{
    1.38 +			callback(false);
    1.39 +		}
    1.40 +		return;
    1.41 +		// </FS:Ansariel>
    1.42  	}
    1.43  
    1.44 -	return previewp->saveLocal();
    1.45 +	// <FS:Ansariel> Threaded filepickers
    1.46 +	//return previewp->saveLocal();
    1.47 +	previewp->saveLocal(callback);
    1.48 +	// </FS:Ansariel>
    1.49  }
    1.50  
    1.51  // static
     2.1 --- a/indra/newview/llfloatersnapshot.h	Thu Apr 07 14:16:52 2016 +0200
     2.2 +++ b/indra/newview/llfloatersnapshot.h	Thu Apr 07 16:57:55 2016 +0200
     2.3 @@ -58,7 +58,10 @@
     2.4  	static LLFloaterSnapshot* getInstance();
     2.5  	static LLFloaterSnapshot* findInstance();
     2.6  	static void saveTexture();
     2.7 -	static BOOL saveLocal();
     2.8 +	// <FS:Ansariel> Threaded filepickers
     2.9 +	//static BOOL saveLocal();
    2.10 +	static void saveLocal(boost::function<void(bool)> callback);
    2.11 +	// </FS:Ansariel>
    2.12  	static void postSave();
    2.13  	static void postPanelSwitch();
    2.14  	static LLPointer<LLImageFormatted> getImageData();
     3.1 --- a/indra/newview/llpanelsnapshotlocal.cpp	Thu Apr 07 14:16:52 2016 +0200
     3.2 +++ b/indra/newview/llpanelsnapshotlocal.cpp	Thu Apr 07 16:57:55 2016 +0200
     3.3 @@ -61,6 +61,9 @@
     3.4  	/*virtual*/ LLFloaterSnapshot::ESnapshotFormat getImageFormat() const;
     3.5  	/*virtual*/ void updateControls(const LLSD& info);
     3.6  
     3.7 +	// <FS:Ansariel> Threaded filepickers
     3.8 +	void saveLocalCallback(bool success);
     3.9 +
    3.10  	S32 mLocalFormat;
    3.11  
    3.12  	void onFormatComboCommit(LLUICtrl* ctrl);
    3.13 @@ -180,22 +183,19 @@
    3.14  	LLFloaterSnapshot* floater = LLFloaterSnapshot::getInstance();
    3.15  
    3.16  	floater->notify(LLSD().with("set-working", true));
    3.17 -	BOOL saved = LLFloaterSnapshot::saveLocal();
    3.18 -	if (saved)
    3.19 -	{
    3.20 -		LLFloaterSnapshot::postSave();
    3.21 -		// <FS:Ansariel> Don't return to target selection after taking a snapshot
    3.22 -		//goBack();
    3.23 -		floater->notify(LLSD().with("set-finished", LLSD().with("ok", true).with("msg", "local")));
    3.24 -	}
    3.25 -	else
    3.26 -	{
    3.27 -		// <FS:Ansariel> Notify user if we could not save file
    3.28 -		LLNotificationsUtil::add("CannotSaveSnapshot");
    3.29 -		floater->notify(LLSD().with("set-ready", true));
    3.30 -		// <FS:Ansariel> Don't return to target selection after taking a snapshot
    3.31 -		//cancel();
    3.32 -	}
    3.33 +	// <FS:Ansariel> Threaded filepickers
    3.34 +	//BOOL saved = LLFloaterSnapshot::saveLocal();
    3.35 +	//if (saved)
    3.36 +	//{
    3.37 +	//	LLFloaterSnapshot::postSave();
    3.38 +	//	floater->notify(LLSD().with("set-finished", LLSD().with("ok", true).with("msg", "local")));
    3.39 +	//}
    3.40 +	//else
    3.41 +	//{
    3.42 +	//	cancel();
    3.43 +	//}
    3.44 +	LLFloaterSnapshot::saveLocal(boost::bind(&LLPanelSnapshotLocal::saveLocalCallback, this, _1));
    3.45 +	// </FS:Ansariel>
    3.46  }
    3.47  
    3.48  // <FS:Ansariel> Store settings at logout
    3.49 @@ -206,3 +206,21 @@
    3.50  	gSavedSettings.setS32("LastSnapshotToDiskHeight", getTypedPreviewHeight());
    3.51  }
    3.52  // </FS:Ansariel>
    3.53 +
    3.54 +// <FS:Ansariel> Threaded filepickers
    3.55 +void LLPanelSnapshotLocal::saveLocalCallback(bool success)
    3.56 +{
    3.57 +	LLFloaterSnapshot* floater = LLFloaterSnapshot::getInstance();
    3.58 +
    3.59 +	if (success)
    3.60 +	{
    3.61 +		LLFloaterSnapshot::postSave();
    3.62 +		floater->notify(LLSD().with("set-finished", LLSD().with("ok", true).with("msg", "local")));
    3.63 +	}
    3.64 +	else
    3.65 +	{
    3.66 +		LLNotificationsUtil::add("CannotSaveSnapshot");
    3.67 +		floater->notify(LLSD().with("set-ready", true));
    3.68 +	}
    3.69 +}
    3.70 +// </FS:Ansariel>
     4.1 --- a/indra/newview/llsnapshotlivepreview.cpp	Thu Apr 07 14:16:52 2016 +0200
     4.2 +++ b/indra/newview/llsnapshotlivepreview.cpp	Thu Apr 07 16:57:55 2016 +0200
     4.3 @@ -1095,18 +1095,41 @@
     4.4  	mDataSize = 0;
     4.5  }
     4.6  
     4.7 -BOOL LLSnapshotLivePreview::saveLocal()
     4.8 +// <FS:Ansariel> Threaded filepickers
     4.9 +//BOOL LLSnapshotLivePreview::saveLocal()
    4.10 +//{
    4.11 +//    // Update mFormattedImage if necessary
    4.12 +//    getFormattedImage();
    4.13 +//    
    4.14 +//    // Save the formatted image
    4.15 +//	BOOL success = gViewerWindow->saveImageNumbered(mFormattedImage);
    4.16 +//
    4.17 +//	if(success)
    4.18 +//	{
    4.19 +//		gViewerWindow->playSnapshotAnimAndSound();
    4.20 +//	}
    4.21 +//	return success;
    4.22 +//}
    4.23 +
    4.24 +void LLSnapshotLivePreview::saveLocal(boost::function<void(bool)> callback)
    4.25  {
    4.26 -    // Update mFormattedImage if necessary
    4.27 -    getFormattedImage();
    4.28 -    
    4.29 -    // Save the formatted image
    4.30 -	BOOL success = gViewerWindow->saveImageNumbered(mFormattedImage);
    4.31 +	// Update mFormattedImage if necessary
    4.32 +	getFormattedImage();
    4.33  
    4.34 +	// Save the formatted image
    4.35 +	gViewerWindow->saveImageNumbered(mFormattedImage, false, boost::bind(&LLSnapshotLivePreview::saveLocalCallback, this, _1, callback));
    4.36 +}
    4.37 +
    4.38 +void LLSnapshotLivePreview::saveLocalCallback(bool success, boost::function<void(bool)> callback)
    4.39 +{
    4.40  	if(success)
    4.41  	{
    4.42  		gViewerWindow->playSnapshotAnimAndSound();
    4.43  	}
    4.44 -	return success;
    4.45 +
    4.46 +	if (callback)
    4.47 +	{
    4.48 +		callback(success);
    4.49 +	}
    4.50  }
    4.51 -
    4.52 +// </FS:Ansariel>
     5.1 --- a/indra/newview/llsnapshotlivepreview.h	Thu Apr 07 14:16:52 2016 +0200
     5.2 +++ b/indra/newview/llsnapshotlivepreview.h	Thu Apr 07 16:57:55 2016 +0200
     5.3 @@ -112,7 +112,11 @@
     5.4      std::string  getFilter() const { return mFilterName; }
     5.5  	void updateSnapshot(BOOL new_snapshot, BOOL new_thumbnail = FALSE, F32 delay = 0.f);
     5.6  	void saveTexture();
     5.7 -	BOOL saveLocal();
     5.8 +	// <FS:Ansariel> Threaded filepickers
     5.9 +	//BOOL saveLocal();
    5.10 +	void saveLocal(boost::function<void(bool)> callback);
    5.11 +	void saveLocalCallback(bool success, boost::function<void(bool)> callback);
    5.12 +	// </FS:Ansariel>
    5.13  
    5.14  	LLPointer<LLImageFormatted>	getFormattedImage();
    5.15  	LLPointer<LLImageRaw>		getEncodedImage();
     6.1 --- a/indra/newview/llviewermenufile.cpp	Thu Apr 07 14:16:52 2016 +0200
     6.2 +++ b/indra/newview/llviewermenufile.cpp	Thu Apr 07 16:57:55 2016 +0200
     6.3 @@ -711,6 +711,18 @@
     6.4  	}
     6.5  };
     6.6  
     6.7 +// <FS:Ansariel> Threaded filepickers
     6.8 +LLPointer<LLImageFormatted> sFormattedSnapshotImage = NULL;
     6.9 +void take_snapshot_to_disk_callback(bool success)
    6.10 +{
    6.11 +	sFormattedSnapshotImage = NULL;
    6.12 +	if (success)
    6.13 +	{
    6.14 +		gViewerWindow->playSnapshotAnimAndSound();
    6.15 +	}
    6.16 +}
    6.17 +// </FS:Ansariel>
    6.18 +
    6.19  class LLFileTakeSnapshotToDisk : public view_listener_t
    6.20  {
    6.21  	bool handleEvent(const LLSD& userdata)
    6.22 @@ -734,27 +746,49 @@
    6.23  									   gSavedSettings.getBOOL("RenderUIInSnapshot"),
    6.24  									   FALSE))
    6.25  		{
    6.26 -			gViewerWindow->playSnapshotAnimAndSound();
    6.27 -			LLPointer<LLImageFormatted> formatted;
    6.28 +			// <FS:Ansariel> Threaded filepickers
    6.29 +			//gViewerWindow->playSnapshotAnimAndSound();
    6.30 +			//LLPointer<LLImageFormatted> formatted;
    6.31 +			//LLFloaterSnapshot::ESnapshotFormat fmt = (LLFloaterSnapshot::ESnapshotFormat) gSavedSettings.getS32("SnapshotFormat");
    6.32 +			//switch (fmt)
    6.33 +			//{
    6.34 +			//case LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG:
    6.35 +			//	formatted = new LLImageJPEG(gSavedSettings.getS32("SnapshotQuality"));
    6.36 +			//	break;
    6.37 +			//default:
    6.38 +			//	LL_WARNS() << "Unknown local snapshot format: " << fmt << LL_ENDL;
    6.39 +			//case LLFloaterSnapshot::SNAPSHOT_FORMAT_PNG:
    6.40 +			//	formatted = new LLImagePNG;
    6.41 +			//	break;
    6.42 +			//case LLFloaterSnapshot::SNAPSHOT_FORMAT_BMP:
    6.43 +			//	formatted = new LLImageBMP;
    6.44 +			//	break;
    6.45 +			//}
    6.46 +			//formatted->enableOverSize() ;
    6.47 +			//formatted->encode(raw, 0);
    6.48 +			//formatted->disableOverSize() ;
    6.49 +			//gViewerWindow->saveImageNumbered(formatted);
    6.50 +
    6.51  			LLFloaterSnapshot::ESnapshotFormat fmt = (LLFloaterSnapshot::ESnapshotFormat) gSavedSettings.getS32("SnapshotFormat");
    6.52  			switch (fmt)
    6.53  			{
    6.54  			case LLFloaterSnapshot::SNAPSHOT_FORMAT_JPEG:
    6.55 -				formatted = new LLImageJPEG(gSavedSettings.getS32("SnapshotQuality"));
    6.56 +				sFormattedSnapshotImage = new LLImageJPEG(gSavedSettings.getS32("SnapshotQuality"));
    6.57  				break;
    6.58  			default:
    6.59  				LL_WARNS() << "Unknown local snapshot format: " << fmt << LL_ENDL;
    6.60  			case LLFloaterSnapshot::SNAPSHOT_FORMAT_PNG:
    6.61 -				formatted = new LLImagePNG;
    6.62 +				sFormattedSnapshotImage = new LLImagePNG;
    6.63  				break;
    6.64  			case LLFloaterSnapshot::SNAPSHOT_FORMAT_BMP:
    6.65 -				formatted = new LLImageBMP;
    6.66 +				sFormattedSnapshotImage = new LLImageBMP;
    6.67  				break;
    6.68  			}
    6.69 -			formatted->enableOverSize() ;
    6.70 -			formatted->encode(raw, 0);
    6.71 -			formatted->disableOverSize() ;
    6.72 -			gViewerWindow->saveImageNumbered(formatted);
    6.73 +			sFormattedSnapshotImage->enableOverSize() ;
    6.74 +			sFormattedSnapshotImage->encode(raw, 0);
    6.75 +			sFormattedSnapshotImage->disableOverSize() ;
    6.76 +			gViewerWindow->saveImageNumbered(sFormattedSnapshotImage, false, boost::bind(&take_snapshot_to_disk_callback, _1));
    6.77 +			// </FS:Ansariel>
    6.78  		}
    6.79  		return true;
    6.80  	}
     7.1 --- a/indra/newview/llviewerwindow.cpp	Thu Apr 07 14:16:52 2016 +0200
     7.2 +++ b/indra/newview/llviewerwindow.cpp	Thu Apr 07 16:57:55 2016 +0200
     7.3 @@ -217,6 +217,7 @@
     7.4  #include "llviewerwindowlistener.h"
     7.5  #include "llpaneltopinfobar.h"
     7.6  #include "llimview.h"
     7.7 +#include "llviewermenufile.h"
     7.8  
     7.9  // [RLVa:KB] - Checked: 2010-03-31 (RLVa-1.2.0c)
    7.10  #include "rlvhandler.h"
    7.11 @@ -4703,13 +4704,79 @@
    7.12  	return FALSE;
    7.13  }
    7.14  
    7.15 +// <FS:Ansariel> Threaded filepickers
    7.16 +void do_save_image(LLImageFormatted* image, const std::string& snapshot_dir, const std::string& base_name, const std::string& extension, boost::function<void(bool)> callback)
    7.17 +{
    7.18 +	// Look for an unused file name
    7.19 +	std::string filepath;
    7.20 +	S32 i = 1;
    7.21 +	S32 err = 0;
    7.22 +
    7.23 +	do
    7.24 +	{
    7.25 +		filepath = snapshot_dir;
    7.26 +		filepath += gDirUtilp->getDirDelimiter();
    7.27 +		filepath += base_name;
    7.28 +		filepath += llformat("_%.3d",i);
    7.29 +		filepath += extension;
    7.30 +
    7.31 +		llstat stat_info;
    7.32 +		err = LLFile::stat( filepath, &stat_info );
    7.33 +		i++;
    7.34 +	}
    7.35 +	while( -1 != err );  // search until the file is not found (i.e., stat() gives an error).
    7.36 +
    7.37 +	LL_INFOS() << "Saving snapshot to " << filepath << LL_ENDL;
    7.38 +
    7.39 +	if (gSavedSettings.getBOOL("FSLogSnapshotsToLocal"))
    7.40 +	{
    7.41 +		LLStringUtil::format_map_t args;
    7.42 +		args["FILENAME"] = filepath;
    7.43 +		report_to_nearby_chat(LLTrans::getString("SnapshotSavedToDisk", args));
    7.44 +	}
    7.45 +
    7.46 +	bool success = image->save(filepath);
    7.47 +	if (callback)
    7.48 +	{
    7.49 +		callback(success);
    7.50 +	}
    7.51 +}
    7.52 +
    7.53 +void LLViewerWindow::saveImageCallback(const std::string& filename, LLImageFormatted* image, const std::string& extension, boost::function<void(bool)> callback)
    7.54 +{
    7.55 +	if (!filename.empty())
    7.56 +	{
    7.57 +		LLViewerWindow::sSnapshotBaseName = gDirUtilp->getBaseFileName(filename, true);
    7.58 +		LLViewerWindow::sSnapshotDir = gDirUtilp->getDirName(filename);
    7.59 +
    7.60 +		do_save_image(image, LLViewerWindow::sSnapshotDir, LLViewerWindow::sSnapshotBaseName, extension, callback);
    7.61 +		return;
    7.62 +	}
    7.63 +
    7.64 +	if (callback)
    7.65 +	{
    7.66 +		callback(false);
    7.67 +	}
    7.68 +}
    7.69 +// </FS:Ansariel>
    7.70 +
    7.71  // Saves an image to the harddrive as "SnapshotX" where X >= 1.
    7.72 -BOOL LLViewerWindow::saveImageNumbered(LLImageFormatted *image, bool force_picker)
    7.73 +// <FS:Ansariel> Threaded filepickers
    7.74 +//BOOL LLViewerWindow::saveImageNumbered(LLImageFormatted *image, bool force_picker)
    7.75 +void LLViewerWindow::saveImageNumbered(LLImageFormatted *image, bool force_picker, boost::function<void(bool)> callback)
    7.76 +// </FS:Ansariel>
    7.77  {
    7.78  	if (!image)
    7.79  	{
    7.80  		LL_WARNS() << "No image to save" << LL_ENDL;
    7.81 -		return FALSE;
    7.82 +		// <FS:Ansariel> Threaded filepickers
    7.83 +		//return FALSE;
    7.84 +		if (callback)
    7.85 +		{
    7.86 +			callback(false);
    7.87 +			return;
    7.88 +		}
    7.89 +		// </FS:Ansariel>
    7.90  	}
    7.91  
    7.92  	LLFilePicker::ESaveFilter pick_type;
    7.93 @@ -4727,57 +4794,62 @@
    7.94  	else
    7.95  		pick_type = LLFilePicker::FFSAVE_ALL; // ???
    7.96  	
    7.97 +	// <FS:Ansariel> Threaded filepickers
    7.98 +	//// Get a base file location if needed.
    7.99 +	//if (force_picker || !isSnapshotLocSet())
   7.100 +	//{
   7.101 +	//	std::string proposed_name( sSnapshotBaseName );
   7.102 +
   7.103 +	//	// getSaveFile will append an appropriate extension to the proposed name, based on the ESaveFilter constant passed in.
   7.104 +
   7.105 +	//	// pick a directory in which to save
   7.106 +	//	LLFilePicker& picker = LLFilePicker::instance();
   7.107 +	//	if (!picker.getSaveFile(pick_type, proposed_name))
   7.108 +	//	{
   7.109 +	//		// Clicked cancel
   7.110 +	//		return FALSE;
   7.111 +	//	}
   7.112 +
   7.113 +	//	// Copy the directory + file name
   7.114 +	//	std::string filepath = picker.getFirstFile();
   7.115 +
   7.116 +	//	LLViewerWindow::sSnapshotBaseName = gDirUtilp->getBaseFileName(filepath, true);
   7.117 +	//	LLViewerWindow::sSnapshotDir = gDirUtilp->getDirName(filepath);
   7.118 +	//}
   7.119 +
   7.120 +	//// Look for an unused file name
   7.121 +	//std::string filepath;
   7.122 +	//S32 i = 1;
   7.123 +	//S32 err = 0;
   7.124 +
   7.125 +	//do
   7.126 +	//{
   7.127 +	//	filepath = sSnapshotDir;
   7.128 +	//	filepath += gDirUtilp->getDirDelimiter();
   7.129 +	//	filepath += sSnapshotBaseName;
   7.130 +	//	filepath += llformat("_%.3d",i);
   7.131 +	//	filepath += extension;
   7.132 +
   7.133 +	//	llstat stat_info;
   7.134 +	//	err = LLFile::stat( filepath, &stat_info );
   7.135 +	//	i++;
   7.136 +	//}
   7.137 +	//while( -1 != err );  // search until the file is not found (i.e., stat() gives an error).
   7.138 +
   7.139 +	//LL_INFOS() << "Saving snapshot to " << filepath << LL_ENDL;
   7.140 +	//return image->save(filepath);
   7.141 +
   7.142  	// Get a base file location if needed.
   7.143  	if (force_picker || !isSnapshotLocSet())
   7.144  	{
   7.145  		std::string proposed_name( sSnapshotBaseName );
   7.146  
   7.147 -		// getSaveFile will append an appropriate extension to the proposed name, based on the ESaveFilter constant passed in.
   7.148 -
   7.149 -		// pick a directory in which to save
   7.150 -		LLFilePicker& picker = LLFilePicker::instance();
   7.151 -		if (!picker.getSaveFile(pick_type, proposed_name))
   7.152 -		{
   7.153 -			// Clicked cancel
   7.154 -			return FALSE;
   7.155 -		}
   7.156 -
   7.157 -		// Copy the directory + file name
   7.158 -		std::string filepath = picker.getFirstFile();
   7.159 -
   7.160 -		LLViewerWindow::sSnapshotBaseName = gDirUtilp->getBaseFileName(filepath, true);
   7.161 -		LLViewerWindow::sSnapshotDir = gDirUtilp->getDirName(filepath);
   7.162 -	}
   7.163 -
   7.164 -	// Look for an unused file name
   7.165 -	std::string filepath;
   7.166 -	S32 i = 1;
   7.167 -	S32 err = 0;
   7.168 -
   7.169 -	do
   7.170 -	{
   7.171 -		filepath = sSnapshotDir;
   7.172 -		filepath += gDirUtilp->getDirDelimiter();
   7.173 -		filepath += sSnapshotBaseName;
   7.174 -		filepath += llformat("_%.3d",i);
   7.175 -		filepath += extension;
   7.176 -
   7.177 -		llstat stat_info;
   7.178 -		err = LLFile::stat( filepath, &stat_info );
   7.179 -		i++;
   7.180 -	}
   7.181 -	while( -1 != err );  // search until the file is not found (i.e., stat() gives an error).
   7.182 -
   7.183 -	LL_INFOS() << "Saving snapshot to " << filepath << LL_ENDL;
   7.184 -	//<FS:Kadah> Log snapshot filename to local chat history
   7.185 -	if (gSavedSettings.getBOOL("FSLogSnapshotsToLocal"))
   7.186 -	{
   7.187 -		LLStringUtil::format_map_t args;
   7.188 -		args["FILENAME"] = filepath;
   7.189 -		report_to_nearby_chat(LLTrans::getString("SnapshotSavedToDisk", args));
   7.190 -	}
   7.191 -	//</FS:Kadah>
   7.192 -	return image->save(filepath);
   7.193 +		(new LLGenericSaveFilePicker(pick_type, proposed_name, boost::bind(&LLViewerWindow::saveImageCallback, this, _1, image, extension, callback)))->getFile();
   7.194 +		return;
   7.195 +	}
   7.196 +
   7.197 +	do_save_image(image, LLViewerWindow::sSnapshotDir, LLViewerWindow::sSnapshotBaseName, extension, callback);
   7.198 +	// </FS:Ansariel>
   7.199  }
   7.200  
   7.201  void LLViewerWindow::resetSnapshotLoc()
     8.1 --- a/indra/newview/llviewerwindow.h	Thu Apr 07 14:16:52 2016 +0200
     8.2 +++ b/indra/newview/llviewerwindow.h	Thu Apr 07 16:57:55 2016 +0200
     8.3 @@ -355,7 +355,11 @@
     8.4  	BOOL			thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL do_rebuild, ESnapshotType type) ;
     8.5  	BOOL			isSnapshotLocSet() const { return ! sSnapshotDir.empty(); }
     8.6  	void			resetSnapshotLoc() const { sSnapshotDir.clear(); }
     8.7 -	BOOL		    saveImageNumbered(LLImageFormatted *image, bool force_picker = false);
     8.8 +	// <FS:Ansariel> Threaded filepickers
     8.9 +	//BOOL		    saveImageNumbered(LLImageFormatted *image, bool force_picker = false);
    8.10 +	void			saveImageNumbered(LLImageFormatted *image, bool force_picker = false, boost::function<void(bool)> callback = NULL);
    8.11 +	void			saveImageCallback(const std::string& filename, LLImageFormatted* image, const std::string& extension, boost::function<void(bool)> callback);
    8.12 +	// </FS:Ansariel>
    8.13  
    8.14  	// Reset the directory where snapshots are saved.
    8.15  	// Client will open directory picker on next snapshot save.

mercurial