summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaternamedesc.cpp
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2019-11-19 16:15:19 +0000
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2019-11-19 16:15:19 +0000
commiteb6e64ec401382fd2fbbbb27830e828035a6e5af (patch)
tree90983b525d9b7af423644ed5267a04f397828df3 /indra/newview/llfloaternamedesc.cpp
parent5b20fca991c109df40b5e8ee0f750507c57f46a1 (diff)
SL-10499 - Fixes for benefits info and upload, especially bulk upload
Diffstat (limited to 'indra/newview/llfloaternamedesc.cpp')
-rw-r--r--indra/newview/llfloaternamedesc.cpp31
1 files changed, 24 insertions, 7 deletions
diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp
index fa1ed57d1f..937dd60f0f 100644
--- a/indra/newview/llfloaternamedesc.cpp
+++ b/indra/newview/llfloaternamedesc.cpp
@@ -63,7 +63,7 @@ const S32 PREVIEW_HPAD = PREVIEW_RESIZE_HANDLE_SIZE;
//-----------------------------------------------------------------------------
LLFloaterNameDesc::LLFloaterNameDesc(const LLSD& filename )
: LLFloater(filename),
- mIsAudio(FALSE)
+ mIsAudio(FALSE)
{
mFilenameAndPath = filename.asString();
mFilename = gDirUtilp->getBaseFileName(mFilenameAndPath, false);
@@ -123,14 +123,33 @@ BOOL LLFloaterNameDesc::postBuild()
// Cancel button
getChild<LLUICtrl>("cancel_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnCancel, this));
- // FIXME PREMIUM - depends - what are we uploading here?
- getChild<LLUICtrl>("ok_btn")->setLabelArg("[AMOUNT]", llformat("%d", LLAgentBenefits::instance().getTextureUploadCost()));
+ S32 expected_upload_cost = getExpectedUploadCost();
+ getChild<LLUICtrl>("ok_btn")->setLabelArg("[AMOUNT]", llformat("%d", expected_upload_cost));
setDefaultBtn("ok_btn");
return TRUE;
}
+S32 LLFloaterNameDesc::getExpectedUploadCost() const
+{
+ std::string exten = gDirUtilp->getExtension(mFilename);
+ LLAssetType::EType asset_type;
+ S32 upload_cost = -1;
+ if (LLResourceUploadInfo::findAssetTypeOfExtension(exten, asset_type))
+ {
+ if (!LLAgentBenefits::instance().findUploadCost(asset_type, upload_cost))
+ {
+ LL_WARNS() << "Unable to find upload cost for asset type " << asset_type << LL_ENDL;
+ }
+ }
+ else
+ {
+ LL_WARNS() << "Unable to find upload cost for " << mFilename << LL_ENDL;
+ }
+ return upload_cost;
+}
+
//-----------------------------------------------------------------------------
// LLFloaterNameDesc()
//-----------------------------------------------------------------------------
@@ -162,10 +181,8 @@ void LLFloaterNameDesc::onBtnOK( )
{
getChildView("ok_btn")->setEnabled(FALSE); // don't allow inadvertent extra uploads
- // FIXME PREMIUM - upload cost. Need to know which asset type this is, use agent benefits.
LLAssetStorage::LLStoreAssetCallback callback = NULL;
- S32 expected_upload_cost = LLAgentBenefits::instance().getTextureUploadCost(); // 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).
-
+ S32 expected_upload_cost = getExpectedUploadCost();
if (can_afford_transaction(expected_upload_cost))
{
void *nruserdata = NULL;
@@ -187,7 +204,7 @@ void LLFloaterNameDesc::onBtnOK( )
{
LLSD args;
args["COST"] = llformat("%d", expected_upload_cost);
- LLNotificationsUtil::add("ErrorTextureCannotAfford", args);
+ LLNotificationsUtil::add("ErrorCannotAffordUpload", args);
}
closeFloater(false);