Enable/disable upload/send button correctly.
Passes an 'index' magic number to the upload/save functions which pass that back to the *Done callbacks, so we know if the *raw* snapshot is still up to date when the upload succeeds or fails.
This commit is contained in:
@@ -49,9 +49,9 @@
|
||||
/// Class LLFloaterFeed
|
||||
///----------------------------------------------------------------------------
|
||||
|
||||
LLFloaterFeed::LLFloaterFeed(LLImagePNG* png, LLViewerTexture* img, LLVector2 const& img_scale) :
|
||||
LLFloaterFeed::LLFloaterFeed(LLImagePNG* png, LLViewerTexture* img, LLVector2 const& img_scale, int index) :
|
||||
LLFloater(std::string("Feed Floater")),
|
||||
mPNGImage(png), mViewerImage(img), mImageScale(img_scale)
|
||||
mPNGImage(png), mViewerImage(img), mImageScale(img_scale), mSnapshotIndex(index)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -70,11 +70,11 @@ BOOL LLFloaterFeed::postBuild()
|
||||
}
|
||||
|
||||
// static
|
||||
LLFloaterFeed* LLFloaterFeed::showFromSnapshot(LLImagePNG* png, LLViewerTexture* img, LLVector2 const& image_scale)
|
||||
LLFloaterFeed* LLFloaterFeed::showFromSnapshot(LLImagePNG* png, LLViewerTexture* img, LLVector2 const& image_scale, int index)
|
||||
{
|
||||
// Take the images from the caller
|
||||
// It's now our job to clean them up
|
||||
LLFloaterFeed* instance = new LLFloaterFeed(png, img, image_scale);
|
||||
LLFloaterFeed* instance = new LLFloaterFeed(png, img, image_scale, index);
|
||||
|
||||
LLUICtrlFactory::getInstance()->buildFloater(instance, "floater_snapshot_feed.xml");
|
||||
|
||||
@@ -135,9 +135,17 @@ void LLFloaterFeed::draw(void)
|
||||
|
||||
void LLFloaterFeed::onClickCancel()
|
||||
{
|
||||
// Return false on cancel, to enable the upload button again.
|
||||
LLFloaterSnapshot::saveFeedDone(false, mSnapshotIndex);
|
||||
close(false);
|
||||
}
|
||||
|
||||
void LLFloaterFeed::onClose(bool app_quitting)
|
||||
{
|
||||
LLFloaterSnapshot::saveFeedDone(false, mSnapshotIndex);
|
||||
destroy();
|
||||
}
|
||||
|
||||
void LLFloaterFeed::onClickPost()
|
||||
{
|
||||
if (mPNGImage.notNull())
|
||||
|
||||
@@ -42,13 +42,14 @@ class LLViewerTexture;
|
||||
class LLFloaterFeed : public LLFloater
|
||||
{
|
||||
public:
|
||||
LLFloaterFeed(LLImagePNG* png, LLViewerTexture* img, LLVector2 const& img_scale);
|
||||
LLFloaterFeed(LLImagePNG* png, LLViewerTexture* img, LLVector2 const& img_scale, int index);
|
||||
virtual ~LLFloaterFeed();
|
||||
|
||||
/*virtual*/ void onClose(bool app_quitting);
|
||||
/*virtual*/ BOOL postBuild();
|
||||
/*virtual*/ void draw();
|
||||
|
||||
static LLFloaterFeed* showFromSnapshot(LLImagePNG* png, LLViewerTexture* img, LLVector2 const& img_scale);
|
||||
static LLFloaterFeed* showFromSnapshot(LLImagePNG* png, LLViewerTexture* img, LLVector2 const& img_scale, int index);
|
||||
|
||||
void onClickCancel();
|
||||
void onClickPost();
|
||||
@@ -56,7 +57,8 @@ public:
|
||||
protected:
|
||||
LLPointer<LLImagePNG> mPNGImage;
|
||||
LLPointer<LLViewerTexture> mViewerImage;
|
||||
const LLVector2 mImageScale;
|
||||
LLVector2 const mImageScale;
|
||||
int mSnapshotIndex;
|
||||
};
|
||||
|
||||
#endif // LL_LLFLOATERFEED_H
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
#include "llassetuploadresponders.h"
|
||||
|
||||
#include "hippogridmanager.h"
|
||||
#include "llfloatersnapshot.h"
|
||||
|
||||
#if LL_MSVC
|
||||
#pragma warning( disable : 4265 ) // "class has virtual functions, but destructor is not virtual"
|
||||
@@ -84,13 +85,14 @@ LLFloaterPostcard::instance_list_t LLFloaterPostcard::sInstances;
|
||||
/// Class LLFloaterPostcard
|
||||
///----------------------------------------------------------------------------
|
||||
|
||||
LLFloaterPostcard::LLFloaterPostcard(LLImageJPEG* jpeg, LLViewerTexture *img, const LLVector2& img_scale, const LLVector3d& pos_taken_global)
|
||||
LLFloaterPostcard::LLFloaterPostcard(LLImageJPEG* jpeg, LLViewerTexture *img, const LLVector2& img_scale, const LLVector3d& pos_taken_global, int index)
|
||||
: LLFloater(std::string("Postcard Floater")),
|
||||
mJPEGImage(jpeg),
|
||||
mViewerImage(img),
|
||||
mImageScale(img_scale),
|
||||
mPosTakenGlobal(pos_taken_global),
|
||||
mHasFirstMsgFocus(false)
|
||||
mHasFirstMsgFocus(false),
|
||||
mSnapshotIndex(index)
|
||||
{
|
||||
init();
|
||||
}
|
||||
@@ -146,11 +148,11 @@ BOOL LLFloaterPostcard::postBuild()
|
||||
|
||||
|
||||
// static
|
||||
LLFloaterPostcard* LLFloaterPostcard::showFromSnapshot(LLImageJPEG *jpeg, LLViewerTexture *img, const LLVector2 &image_scale, const LLVector3d& pos_taken_global)
|
||||
LLFloaterPostcard* LLFloaterPostcard::showFromSnapshot(LLImageJPEG *jpeg, LLViewerTexture *img, const LLVector2 &image_scale, const LLVector3d& pos_taken_global, int index)
|
||||
{
|
||||
// Take the images from the caller
|
||||
// It's now our job to clean them up
|
||||
LLFloaterPostcard *instance = new LLFloaterPostcard(jpeg, img, image_scale, pos_taken_global);
|
||||
LLFloaterPostcard *instance = new LLFloaterPostcard(jpeg, img, image_scale, pos_taken_global, index);
|
||||
|
||||
LLUICtrlFactory::getInstance()->buildFloater(instance, "floater_postcard.xml");
|
||||
|
||||
@@ -221,25 +223,47 @@ void LLFloaterPostcard::onClickCancel(void* data)
|
||||
if (data)
|
||||
{
|
||||
LLFloaterPostcard *self = (LLFloaterPostcard *)data;
|
||||
|
||||
LLFloaterSnapshot::savePostcardDone(false, self->mSnapshotIndex);
|
||||
self->close(false);
|
||||
}
|
||||
}
|
||||
|
||||
void LLFloaterPostcard::onClose(bool app_quitting)
|
||||
{
|
||||
LLFloaterSnapshot::savePostcardDone(false, mSnapshotIndex);
|
||||
destroy();
|
||||
}
|
||||
|
||||
class LLSendPostcardResponder : public LLAssetUploadResponder
|
||||
{
|
||||
private:
|
||||
int mSnapshotIndex;
|
||||
|
||||
public:
|
||||
LLSendPostcardResponder(const LLSD &post_data,
|
||||
const LLUUID& vfile_id,
|
||||
LLAssetType::EType asset_type):
|
||||
LLAssetUploadResponder(post_data, vfile_id, asset_type)
|
||||
LLAssetType::EType asset_type,
|
||||
int index) :
|
||||
LLAssetUploadResponder(post_data, vfile_id, asset_type),
|
||||
mSnapshotIndex(index)
|
||||
{
|
||||
}
|
||||
// *TODO define custom uploadFailed here so it's not such a generic message
|
||||
void uploadComplete(const LLSD& content)
|
||||
/*virtual*/ void uploadComplete(const LLSD& content)
|
||||
{
|
||||
// we don't care about what the server returns from this post, just clean up the UI
|
||||
LLUploadDialog::modalUploadFinished();
|
||||
LLFloaterSnapshot::savePostcardDone(true, mSnapshotIndex);
|
||||
}
|
||||
/*virtual*/ void uploadFailure(const LLSD& content)
|
||||
{
|
||||
LLAssetUploadResponder::uploadFailure(content);
|
||||
LLFloaterSnapshot::savePostcardDone(false, mSnapshotIndex);
|
||||
}
|
||||
/*virtual*/ void error(U32 statusNum, const std::string& reason)
|
||||
{
|
||||
LLAssetUploadResponder::error(statusNum, reason);
|
||||
LLFloaterSnapshot::savePostcardDone(false, mSnapshotIndex);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -292,6 +316,8 @@ void LLFloaterPostcard::uploadCallback(const LLUUID& asset_id, void *user_data,
|
||||
|
||||
LLUploadDialog::modalUploadFinished();
|
||||
|
||||
LLFloaterSnapshot::savePostcardDone(!result, self->mSnapshotIndex);
|
||||
|
||||
if (result)
|
||||
{
|
||||
LLSD args;
|
||||
@@ -396,7 +422,7 @@ void LLFloaterPostcard::sendPostcard()
|
||||
body["name"] = childGetValue("name_form").asString();
|
||||
body["subject"] = childGetValue("subject_form").asString();
|
||||
body["msg"] = childGetValue("msg_form").asString();
|
||||
LLHTTPClient::post(url, body, new LLSendPostcardResponder(body, mAssetID, LLAssetType::AT_IMAGE_JPEG));
|
||||
LLHTTPClient::post(url, body, new LLSendPostcardResponder(body, mAssetID, LLAssetType::AT_IMAGE_JPEG, mSnapshotIndex));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -50,14 +50,15 @@ class LLFloaterPostcard
|
||||
: public LLFloater
|
||||
{
|
||||
public:
|
||||
LLFloaterPostcard(LLImageJPEG* jpeg, LLViewerTexture *img, const LLVector2& img_scale, const LLVector3d& pos_taken_global);
|
||||
virtual ~LLFloaterPostcard();
|
||||
LLFloaterPostcard(LLImageJPEG* jpeg, LLViewerTexture *img, const LLVector2& img_scale, const LLVector3d& pos_taken_global, int index);
|
||||
/*virtual*/ ~LLFloaterPostcard();
|
||||
|
||||
virtual void init();
|
||||
virtual BOOL postBuild();
|
||||
virtual void draw();
|
||||
/*virtual*/ void init();
|
||||
/*virtual*/ BOOL postBuild();
|
||||
/*virtual*/ void draw();
|
||||
/*virtual*/ void onClose(bool app_quitting);
|
||||
|
||||
static LLFloaterPostcard* showFromSnapshot(LLImageJPEG *jpeg, LLViewerTexture *img, const LLVector2& img_scale, const LLVector3d& pos_taken_global);
|
||||
static LLFloaterPostcard* showFromSnapshot(LLImageJPEG *jpeg, LLViewerTexture *img, const LLVector2& img_scale, const LLVector3d& pos_taken_global, int index);
|
||||
|
||||
static void onClickCancel(void* data);
|
||||
static void onClickSend(void* data);
|
||||
@@ -82,6 +83,7 @@ protected:
|
||||
LLVector2 mImageScale;
|
||||
LLVector3d mPosTakenGlobal;
|
||||
bool mHasFirstMsgFocus;
|
||||
int mSnapshotIndex;
|
||||
|
||||
typedef std::set<LLFloaterPostcard*> instance_list_t;
|
||||
static instance_list_t sInstances;
|
||||
|
||||
@@ -178,11 +178,12 @@ public:
|
||||
LLFloaterFeed* getCaptionAndSaveFeed();
|
||||
LLFloaterPostcard* savePostcard();
|
||||
void saveTexture();
|
||||
void saveTextureDone(bool success, LLPointer<LLImageFormatted> const& formatted_image);
|
||||
void saveTextureDone(bool success, int index);
|
||||
static void saveTextureDone(LLUUID const& asset_id, void* user_data, S32 status, LLExtStat ext_status);
|
||||
void saveLocal();
|
||||
void saveLocalDone(bool success, LLPointer<LLImageFormatted> const& formatted_image);
|
||||
void saveFeedDone(bool success, LLPointer<LLImageFormatted> const& formatted_image);
|
||||
void saveLocalDone(bool success, int index);
|
||||
void saveFeedDone(bool success, int index);
|
||||
void savePostcardDone(bool success, int index);
|
||||
void close(LLFloaterSnapshot* view);
|
||||
void doCloseAfterSave();
|
||||
|
||||
@@ -264,6 +265,7 @@ private:
|
||||
bool mCallbackHappened;
|
||||
bool mSaveSuccessful;
|
||||
LLFloaterSnapshot* mCloseCalled;
|
||||
int mSnapshotIndex;
|
||||
|
||||
public:
|
||||
static std::set<LLSnapshotLivePreview*> sList;
|
||||
@@ -326,7 +328,9 @@ LLSnapshotLivePreview::LLSnapshotLivePreview (const LLRect& rect) :
|
||||
mCameraPos(LLViewerCamera::getInstance()->getOrigin()),
|
||||
mCameraRot(LLViewerCamera::getInstance()->getQuaternion()),
|
||||
mSnapshotActive(FALSE),
|
||||
mSnapshotBufferType(LLViewerWindow::SNAPSHOT_TYPE_COLOR)
|
||||
mSnapshotBufferType(LLViewerWindow::SNAPSHOT_TYPE_COLOR),
|
||||
mCloseCalled(NULL),
|
||||
mSnapshotIndex(0)
|
||||
{
|
||||
DoutEntering(dc::notice, "LLSnapshotLivePreview() [" << (void*)this << "]");
|
||||
setSnapshotQuality(gSavedSettings.getS32("SnapshotQuality"));
|
||||
@@ -821,6 +825,7 @@ BOOL LLSnapshotLivePreview::onIdle(LLSnapshotLivePreview* previewp)
|
||||
|
||||
// Grab the raw image and encode it into desired format.
|
||||
Dout(dc::notice, "LLSnapshotLivePreview::onIdle: Actually making a new snapshot!");
|
||||
previewp->mSnapshotIndex++;
|
||||
previewp->mFormattedImage = NULL;
|
||||
previewp->mFormattedUpToDate = false;
|
||||
previewp->mUsedBy = 0; // This snapshot wasn't used yet.
|
||||
@@ -1186,16 +1191,20 @@ void LLSnapshotLivePreview::getRawSize(S32& w, S32& h) const
|
||||
|
||||
LLFloaterFeed* LLSnapshotLivePreview::getCaptionAndSaveFeed()
|
||||
{
|
||||
if (mCloseCalled)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
mCallbackHappened = false;
|
||||
mSaveSuccessful = false;
|
||||
mCloseCalled = NULL;
|
||||
addUsedBy(LLSnapshotLivePreview::SNAPSHOT_FEED);
|
||||
addUsedBy(SNAPSHOT_FEED);
|
||||
|
||||
if (mFullScreenPreviewTexture.isNull())
|
||||
{
|
||||
// This should never happen!
|
||||
llwarns << "The snapshot image has not been generated!" << llendl;
|
||||
saveFeedDone(false, mFormattedImage);
|
||||
saveFeedDone(false, mSnapshotIndex);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1208,23 +1217,31 @@ LLFloaterFeed* LLSnapshotLivePreview::getCaptionAndSaveFeed()
|
||||
if (!png)
|
||||
{
|
||||
llwarns << "Formatted image not a PNG" << llendl;
|
||||
saveFeedDone(false, mFormattedImage);
|
||||
saveFeedDone(false, mSnapshotIndex);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
LLFloaterFeed* floater = LLFloaterFeed::showFromSnapshot(png, mFullScreenPreviewTexture, image_scale);
|
||||
|
||||
//updateSnapshot(FALSE, FALSE);
|
||||
LLFloaterFeed* floater = LLFloaterFeed::showFromSnapshot(png, mFullScreenPreviewTexture, image_scale, mSnapshotIndex);
|
||||
|
||||
return floater;
|
||||
}
|
||||
|
||||
LLFloaterPostcard* LLSnapshotLivePreview::savePostcard()
|
||||
{
|
||||
if (mCloseCalled)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
mCallbackHappened = false;
|
||||
mSaveSuccessful = false;
|
||||
addUsedBy(SNAPSHOT_POSTCARD);
|
||||
|
||||
if(mFullScreenPreviewTexture.isNull())
|
||||
{
|
||||
//this should never happen!!
|
||||
llwarns << "The snapshot image has not been generated!" << llendl ;
|
||||
savePostcardDone(false, mSnapshotIndex);
|
||||
return NULL ;
|
||||
}
|
||||
|
||||
@@ -1239,28 +1256,31 @@ LLFloaterPostcard* LLSnapshotLivePreview::savePostcard()
|
||||
if(!jpg)
|
||||
{
|
||||
llwarns << "Formatted image not a JPEG" << llendl;
|
||||
savePostcardDone(false, mSnapshotIndex);
|
||||
return NULL;
|
||||
}
|
||||
LLFloaterPostcard* floater = LLFloaterPostcard::showFromSnapshot(jpg, mFullScreenPreviewTexture, image_scale, mPosTakenGlobal);
|
||||
updateSnapshot(FALSE, FALSE);
|
||||
LLFloaterPostcard* floater = LLFloaterPostcard::showFromSnapshot(jpg, mFullScreenPreviewTexture, image_scale, mPosTakenGlobal, mSnapshotIndex);
|
||||
|
||||
addUsedBy(SNAPSHOT_POSTCARD);
|
||||
return floater;
|
||||
}
|
||||
|
||||
class saveTextureUserData {
|
||||
public:
|
||||
saveTextureUserData(LLSnapshotLivePreview* self, LLPointer<LLImageFormatted> const& formatted_image) : mSelf(self), mFormattedImage(formatted_image) { }
|
||||
saveTextureUserData(LLSnapshotLivePreview* self, int index) : mSelf(self), mSnapshotIndex(index) { }
|
||||
LLSnapshotLivePreview* mSelf;
|
||||
LLPointer<LLImageFormatted> mFormattedImage;
|
||||
int mSnapshotIndex;
|
||||
};
|
||||
|
||||
void LLSnapshotLivePreview::saveTexture()
|
||||
{
|
||||
if (mCloseCalled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
mCallbackHappened = false;
|
||||
mSaveSuccessful = false;
|
||||
mCloseCalled = NULL;
|
||||
addUsedBy(LLSnapshotLivePreview::SNAPSHOT_TEXTURE);
|
||||
addUsedBy(SNAPSHOT_TEXTURE);
|
||||
|
||||
// gen a new uuid for this asset
|
||||
LLTransactionID tid;
|
||||
@@ -1284,7 +1304,7 @@ void LLSnapshotLivePreview::saveTexture()
|
||||
LLFloaterPerms::getGroupPerms(), // that is more permissive than other uploads
|
||||
LLFloaterPerms::getEveryonePerms(),
|
||||
"Snapshot : " + pos_string,
|
||||
callback, expected_upload_cost, new saveTextureUserData(this, mFormattedImage));
|
||||
callback, expected_upload_cost, new saveTextureUserData(this, mSnapshotIndex));
|
||||
|
||||
gViewerWindow->playSnapshotAnimAndSound();
|
||||
LLViewerStats::getInstance()->incStat(LLViewerStats::ST_SNAPSHOT_COUNT );
|
||||
@@ -1292,38 +1312,34 @@ void LLSnapshotLivePreview::saveTexture()
|
||||
|
||||
void LLSnapshotLivePreview::saveLocal()
|
||||
{
|
||||
if (mCloseCalled)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
mCallbackHappened = false;
|
||||
mSaveSuccessful = false;
|
||||
mCloseCalled = NULL;
|
||||
addUsedBy(LLSnapshotLivePreview::SNAPSHOT_LOCAL);
|
||||
gViewerWindow->saveImageNumbered(mFormattedImage); // This calls saveLocalDone() immediately, or later.
|
||||
addUsedBy(SNAPSHOT_LOCAL);
|
||||
|
||||
gViewerWindow->saveImageNumbered(mFormattedImage, mSnapshotIndex); // This calls saveLocalDone() immediately, or later.
|
||||
}
|
||||
|
||||
void LLSnapshotLivePreview::close(LLFloaterSnapshot* view)
|
||||
{
|
||||
if (getSnapshotType() != LLSnapshotLivePreview::SNAPSHOT_LOCAL &&
|
||||
getSnapshotType() != LLSnapshotLivePreview::SNAPSHOT_FEED &&
|
||||
getSnapshotType() != LLSnapshotLivePreview::SNAPSHOT_TEXTURE)
|
||||
mCloseCalled = view;
|
||||
if (mCallbackHappened)
|
||||
{
|
||||
view->close();
|
||||
doCloseAfterSave();
|
||||
}
|
||||
else
|
||||
{
|
||||
mCloseCalled = view;
|
||||
if (mCallbackHappened)
|
||||
{
|
||||
doCloseAfterSave();
|
||||
}
|
||||
else
|
||||
{
|
||||
view->setEnabled(FALSE);
|
||||
}
|
||||
view->setEnabled(FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
void LLSnapshotLivePreview::saveFeedDone(bool success, LLPointer<LLImageFormatted> const& formatted_image)
|
||||
void LLSnapshotLivePreview::saveFeedDone(bool success, int index)
|
||||
{
|
||||
if (formatted_image.get() != mFormattedImage.get())
|
||||
if (mSnapshotIndex != index)
|
||||
{
|
||||
// The snapshot was already replaced, so this callback has nothing to do with us anymore.
|
||||
if (!success)
|
||||
@@ -1338,7 +1354,8 @@ void LLSnapshotLivePreview::saveFeedDone(bool success, LLPointer<LLImageFormatte
|
||||
if (!success)
|
||||
{
|
||||
// Enable Upload button.
|
||||
delUsedBy(LLSnapshotLivePreview::SNAPSHOT_FEED);
|
||||
delUsedBy(SNAPSHOT_FEED);
|
||||
LLFloaterSnapshot::updateControls();
|
||||
}
|
||||
if (mCloseCalled)
|
||||
{
|
||||
@@ -1346,9 +1363,35 @@ void LLSnapshotLivePreview::saveFeedDone(bool success, LLPointer<LLImageFormatte
|
||||
}
|
||||
}
|
||||
|
||||
void LLSnapshotLivePreview::saveTextureDone(bool success, LLPointer<LLImageFormatted> const& formatted_image)
|
||||
void LLSnapshotLivePreview::savePostcardDone(bool success, int index)
|
||||
{
|
||||
if (formatted_image.get() != mFormattedImage.get())
|
||||
if (mSnapshotIndex != index)
|
||||
{
|
||||
// The snapshot was already replaced, so this callback has nothing to do with us anymore.
|
||||
if (!success)
|
||||
{
|
||||
llwarns << "Permanent failure to email snapshot" << llendl;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
mCallbackHappened = true;
|
||||
mSaveSuccessful = success;
|
||||
if (!success)
|
||||
{
|
||||
// Enable Upload button.
|
||||
delUsedBy(SNAPSHOT_POSTCARD);
|
||||
LLFloaterSnapshot::updateControls();
|
||||
}
|
||||
if (mCloseCalled)
|
||||
{
|
||||
doCloseAfterSave();
|
||||
}
|
||||
}
|
||||
|
||||
void LLSnapshotLivePreview::saveTextureDone(bool success, int index)
|
||||
{
|
||||
if (mSnapshotIndex != index)
|
||||
{
|
||||
// The snapshot was already replaced, so this callback has nothing to do with us anymore.
|
||||
if (!success)
|
||||
@@ -1364,6 +1407,7 @@ void LLSnapshotLivePreview::saveTextureDone(bool success, LLPointer<LLImageForma
|
||||
{
|
||||
// Enable Upload button.
|
||||
delUsedBy(LLSnapshotLivePreview::SNAPSHOT_TEXTURE);
|
||||
LLFloaterSnapshot::updateControls();
|
||||
}
|
||||
if (mCloseCalled)
|
||||
{
|
||||
@@ -1382,13 +1426,13 @@ void LLSnapshotLivePreview::saveTextureDone(LLUUID const& asset_id, void* user_d
|
||||
LLNotificationsUtil::add("UploadSnapshotFail", args);
|
||||
}
|
||||
saveTextureUserData* data = (saveTextureUserData*)user_data;
|
||||
data->mSelf->saveTextureDone(success, data->mFormattedImage);
|
||||
data->mSelf->saveTextureDone(success, data->mSnapshotIndex);
|
||||
delete data;
|
||||
}
|
||||
|
||||
void LLSnapshotLivePreview::saveLocalDone(bool success, LLPointer<LLImageFormatted> const& formatted_image)
|
||||
void LLSnapshotLivePreview::saveLocalDone(bool success, int index)
|
||||
{
|
||||
if (formatted_image.get() != mFormattedImage.get())
|
||||
if (mSnapshotIndex != index)
|
||||
{
|
||||
// The snapshot was already replaced, so this callback has nothing to do with us anymore.
|
||||
if (!success)
|
||||
@@ -1403,7 +1447,8 @@ void LLSnapshotLivePreview::saveLocalDone(bool success, LLPointer<LLImageFormatt
|
||||
if (!success)
|
||||
{
|
||||
// Enable Save button.
|
||||
delUsedBy(LLSnapshotLivePreview::SNAPSHOT_LOCAL);
|
||||
delUsedBy(SNAPSHOT_LOCAL);
|
||||
LLFloaterSnapshot::updateControls();
|
||||
}
|
||||
if (mCloseCalled)
|
||||
{
|
||||
@@ -1425,6 +1470,7 @@ void LLSnapshotLivePreview::doCloseAfterSave()
|
||||
else
|
||||
{
|
||||
mCloseCalled->setEnabled(TRUE);
|
||||
mCloseCalled = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1945,22 +1991,32 @@ void LLFloaterSnapshot::Impl::onCommitSave(LLUICtrl* ctrl, void* data)
|
||||
|
||||
// Called from LLViewerWindow::saveImageNumbered, LLViewerWindow::saveImageNumbered_continued1 and LLViewerWindow::saveImageNumbered_continued2.
|
||||
//static
|
||||
void LLFloaterSnapshot::saveLocalDone(bool success, LLPointer<LLImageFormatted> const& formatted_image)
|
||||
void LLFloaterSnapshot::saveLocalDone(bool success, int index)
|
||||
{
|
||||
LLSnapshotLivePreview* previewp = LLFloaterSnapshot::Impl::getPreviewView(sInstance);
|
||||
if (previewp)
|
||||
{
|
||||
previewp->saveLocalDone(success, formatted_image);
|
||||
previewp->saveLocalDone(success, index);
|
||||
}
|
||||
}
|
||||
|
||||
//static
|
||||
void LLFloaterSnapshot::saveFeedDone(bool success, LLPointer<LLImageFormatted> const& formatted_image)
|
||||
void LLFloaterSnapshot::saveFeedDone(bool success, int index)
|
||||
{
|
||||
LLSnapshotLivePreview* previewp = LLFloaterSnapshot::Impl::getPreviewView(sInstance);
|
||||
if (previewp)
|
||||
{
|
||||
previewp->saveFeedDone(success, formatted_image);
|
||||
previewp->saveFeedDone(success, index);
|
||||
}
|
||||
}
|
||||
|
||||
//static
|
||||
void LLFloaterSnapshot::savePostcardDone(bool success, int index)
|
||||
{
|
||||
LLSnapshotLivePreview* previewp = LLFloaterSnapshot::Impl::getPreviewView(sInstance);
|
||||
if (previewp)
|
||||
{
|
||||
previewp->savePostcardDone(success, index);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2226,6 +2282,7 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, bool
|
||||
LLSnapshotLivePreview* previewp = getPreviewView(view);
|
||||
LLSnapshotLivePreview::ESnapshotType shot_type = (LLSnapshotLivePreview::ESnapshotType)gSavedSettings.getS32("LastSnapshotType");
|
||||
|
||||
#if 0 // Broken -- not doing this for now.
|
||||
// Is the snapshot was already used (saved or uploaded) and no manual changes
|
||||
// have been made since to the current destination type, and the raw snapshot
|
||||
// is still up to date with regard to visibility of UI, HUD and BufferType etc?
|
||||
@@ -2394,6 +2451,7 @@ void LLFloaterSnapshot::Impl::updateResolution(LLUICtrl* ctrl, void* data, bool
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
view->getChild<LLComboBox>("feed_size_combo")->selectNthItem(gSavedSettings.getS32("SnapshotFeedLastResolution"));
|
||||
view->getChild<LLComboBox>("feed_aspect_combo")->selectNthItem(gSavedSettings.getS32("SnapshotFeedLastAspect"));
|
||||
|
||||
@@ -72,8 +72,9 @@ public:
|
||||
static S32 getUIWinHeightShort() {return sUIWinHeightShort ;}
|
||||
static S32 getUIWinWidth() {return sUIWinWidth ;}
|
||||
|
||||
static void saveLocalDone(bool success, LLPointer<LLImageFormatted> const& formatted_image);
|
||||
static void saveFeedDone(bool success, LLPointer<LLImageFormatted> const& formatted_image);
|
||||
static void saveLocalDone(bool success, int index);
|
||||
static void saveFeedDone(bool success, int index);
|
||||
static void savePostcardDone(bool success, int index);
|
||||
|
||||
static void updateControls();
|
||||
|
||||
|
||||
@@ -574,7 +574,7 @@ class LLFileTakeSnapshotToDisk : public view_listener_t
|
||||
formatted->enableOverSize() ;
|
||||
formatted->encode(raw, 0);
|
||||
formatted->disableOverSize();
|
||||
gViewerWindow->saveImageNumbered(formatted);
|
||||
gViewerWindow->saveImageNumbered(formatted, -1);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -3986,11 +3986,11 @@ BOOL LLViewerWindow::mousePointOnLandGlobal(const S32 x, const S32 y, LLVector3d
|
||||
}
|
||||
|
||||
// Saves an image to the harddrive as "SnapshotX" where X >= 1.
|
||||
void LLViewerWindow::saveImageNumbered(LLPointer<LLImageFormatted> image)
|
||||
void LLViewerWindow::saveImageNumbered(LLPointer<LLImageFormatted> image, int index)
|
||||
{
|
||||
if (!image)
|
||||
{
|
||||
LLFloaterSnapshot::saveLocalDone(false, image);
|
||||
LLFloaterSnapshot::saveLocalDone(false, index);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -4019,15 +4019,15 @@ void LLViewerWindow::saveImageNumbered(LLPointer<LLImageFormatted> image)
|
||||
// pick a directory in which to save
|
||||
AIFilePicker* filepicker = AIFilePicker::create(); // Deleted in LLViewerWindow::saveImageNumbered_continued1
|
||||
filepicker->open(proposed_name, pick_type, "", "snapshot");
|
||||
filepicker->run(boost::bind(&LLViewerWindow::saveImageNumbered_continued1, this, image, extension, filepicker));
|
||||
filepicker->run(boost::bind(&LLViewerWindow::saveImageNumbered_continued1, this, image, extension, filepicker, index));
|
||||
return;
|
||||
}
|
||||
|
||||
// LLViewerWindow::sSnapshotBaseName and LLViewerWindow::sSnapshotDir already known. Go straight to saveImageNumbered_continued2.
|
||||
saveImageNumbered_continued2(image, extension);
|
||||
saveImageNumbered_continued2(image, extension, index);
|
||||
}
|
||||
|
||||
void LLViewerWindow::saveImageNumbered_continued1(LLPointer<LLImageFormatted> image, std::string const& extension, AIFilePicker* filepicker)
|
||||
void LLViewerWindow::saveImageNumbered_continued1(LLPointer<LLImageFormatted> image, std::string const& extension, AIFilePicker* filepicker, int index)
|
||||
{
|
||||
if (filepicker->hasFilename())
|
||||
{
|
||||
@@ -4037,15 +4037,15 @@ void LLViewerWindow::saveImageNumbered_continued1(LLPointer<LLImageFormatted> im
|
||||
LLViewerWindow::sSnapshotBaseName = gDirUtilp->getBaseFileName(filepath, true);
|
||||
LLViewerWindow::sSnapshotDir = gDirUtilp->getDirName(filepath);
|
||||
|
||||
saveImageNumbered_continued2(image, extension);
|
||||
saveImageNumbered_continued2(image, extension, index);
|
||||
}
|
||||
else
|
||||
{
|
||||
LLFloaterSnapshot::saveLocalDone(false, image);
|
||||
LLFloaterSnapshot::saveLocalDone(false, index);
|
||||
}
|
||||
}
|
||||
|
||||
void LLViewerWindow::saveImageNumbered_continued2(LLPointer<LLImageFormatted> image, std::string const& extension)
|
||||
void LLViewerWindow::saveImageNumbered_continued2(LLPointer<LLImageFormatted> image, std::string const& extension, int index)
|
||||
{
|
||||
// Look for an unused file name
|
||||
std::string filepath;
|
||||
@@ -4069,11 +4069,11 @@ void LLViewerWindow::saveImageNumbered_continued2(LLPointer<LLImageFormatted> im
|
||||
if (image->save(filepath))
|
||||
{
|
||||
playSnapshotAnimAndSound();
|
||||
LLFloaterSnapshot::saveLocalDone(true, image);
|
||||
LLFloaterSnapshot::saveLocalDone(true, index);
|
||||
}
|
||||
else
|
||||
{
|
||||
LLFloaterSnapshot::saveLocalDone(false, image);
|
||||
LLFloaterSnapshot::saveLocalDone(false, index);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -320,9 +320,9 @@ public:
|
||||
BOOL thumbnailSnapshot(LLImageRaw *raw, S32 preview_width, S32 preview_height, BOOL show_ui, BOOL do_rebuild, ESnapshotType type) ;
|
||||
BOOL isSnapshotLocSet() const { return ! sSnapshotDir.empty(); }
|
||||
void resetSnapshotLoc() const { sSnapshotDir.clear(); }
|
||||
void saveImageNumbered(LLPointer<LLImageFormatted> image);
|
||||
void saveImageNumbered_continued1(LLPointer<LLImageFormatted> image, std::string const& extension, AIFilePicker* filepicker);
|
||||
void saveImageNumbered_continued2(LLPointer<LLImageFormatted> image, std::string const& extension);
|
||||
void saveImageNumbered(LLPointer<LLImageFormatted> image, int index);
|
||||
void saveImageNumbered_continued1(LLPointer<LLImageFormatted> image, std::string const& extension, AIFilePicker* filepicker, int index);
|
||||
void saveImageNumbered_continued2(LLPointer<LLImageFormatted> image, std::string const& extension, int index);
|
||||
|
||||
// Reset the directory where snapshots are saved.
|
||||
// Client will open directory picker on next snapshot save.
|
||||
|
||||
Reference in New Issue
Block a user