MAINT-3286 FIXED Fix error message on snapshot save when user has no L$

meow-7.2.2
andreykproductengine 2016-04-13 18:59:00 +03:00
parent 2311d8c2b2
commit eec33adf34
5 changed files with 63 additions and 7 deletions

View File

@ -42,6 +42,8 @@
#include "llfloaterperms.h"
#include "llviewercontrol.h"
#include "llviewermenufile.h" // upload_new_resource()
#include "llstatusbar.h" // can_afford_transaction()
#include "llnotificationsutil.h"
#include "lluictrlfactory.h"
#include "llstring.h"
#include "lleconomy.h"
@ -161,12 +163,15 @@ void LLFloaterNameDesc::onBtnOK( )
LLAssetStorage::LLStoreAssetCallback callback = NULL;
S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); // kinda hack - assumes that unsubclassed LLFloaterNameDesc is only used for uploading chargeable assets, which it is right now (it's only used unsubclassed for the sound upload dialog, and THAT should be a subclass).
void *nruserdata = NULL;
std::string display_name = LLStringUtil::null;
LLResourceUploadInfo::ptr_t uploadInfo(new LLNewFileResourceUploadInfo(
if (can_afford_transaction(expected_upload_cost))
{
void *nruserdata = NULL;
std::string display_name = LLStringUtil::null;
LLResourceUploadInfo::ptr_t uploadInfo(new LLNewFileResourceUploadInfo(
mFilenameAndPath,
getChild<LLUICtrl>("name_form")->getValue().asString(),
getChild<LLUICtrl>("name_form")->getValue().asString(),
getChild<LLUICtrl>("description_form")->getValue().asString(), 0,
LLFolderType::FT_NONE, LLInventoryType::IT_NONE,
LLFloaterPerms::getNextOwnerPerms("Uploads"),
@ -174,7 +179,14 @@ void LLFloaterNameDesc::onBtnOK( )
LLFloaterPerms::getEveryonePerms("Uploads"),
expected_upload_cost));
upload_new_resource(uploadInfo, callback, nruserdata);
upload_new_resource(uploadInfo, callback, nruserdata);
}
else
{
LLSD args;
args["COST"] = llformat("%d", expected_upload_cost);
LLNotificationsUtil::add("ErrorTextureCannotAfford", args);
}
closeFloater(false);
}

View File

@ -1417,6 +1417,20 @@ void LLFloaterSnapshot::postPanelSwitch()
instance->impl.setStatus(Impl::STATUS_READY);
}
// static
void LLFloaterSnapshot::inventorySaveFailed()
{
LLFloaterSnapshot* instance = findInstance();
if (!instance)
{
llassert(instance != NULL);
return;
}
instance->impl.updateControls(instance);
instance->impl.setStatus(Impl::STATUS_FINISHED, false, "inventory");
}
// static
LLPointer<LLImageFormatted> LLFloaterSnapshot::getImageData()
{

View File

@ -61,6 +61,7 @@ public:
static BOOL saveLocal();
static void postSave();
static void postPanelSwitch();
static void inventorySaveFailed();
static LLPointer<LLImageFormatted> getImageData();
static const LLVector3d& getPosTakenGlobal();
static void setAgentEmail(const std::string& email);

View File

@ -34,6 +34,8 @@
#include "llfloatersnapshot.h" // FIXME: replace with a snapshot storage model
#include "llpanelsnapshot.h"
#include "llviewercontrol.h" // gSavedSettings
#include "llstatusbar.h" // can_afford_transaction()
#include "llnotificationsutil.h"
/**
* The panel provides UI for saving snapshot as an inventory texture.
@ -102,6 +104,17 @@ void LLPanelSnapshotInventory::onResolutionCommit(LLUICtrl* ctrl)
void LLPanelSnapshotInventory::onSend()
{
LLFloaterSnapshot::saveTexture();
LLFloaterSnapshot::postSave();
S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
if (can_afford_transaction(expected_upload_cost))
{
LLFloaterSnapshot::saveTexture();
LLFloaterSnapshot::postSave();
}
else
{
LLSD args;
args["COST"] = llformat("%d", expected_upload_cost);
LLNotificationsUtil::add("ErrorPhotoCannotAfford", args);
LLFloaterSnapshot::inventorySaveFailed();
}
}

View File

@ -1164,6 +1164,22 @@ Error encoding snapshot.
<tag>fail</tag>
</notification>
<notification
icon="alertmodal.tga"
name="ErrorPhotoCannotAfford"
type="alertmodal">
You need L$[COST] to save a photo to your inventory. You may either buy L$ or save the photo to your computer instead.
<tag>fail</tag>
</notification>
<notification
icon="alertmodal.tga"
name="ErrorTextureCannotAfford"
type="alertmodal">
You need L$[COST] to save a texture to your inventory. You may either buy L$ or save the photo to your computer instead.
<tag>fail</tag>
</notification>
<notification
icon="alertmodal.tga"
name="ErrorUploadingPostcard"