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