SL-10499 - Fixes for benefits info and upload, especially bulk upload
parent
5b20fca991
commit
eb6e64ec40
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@
|
|||
#include "llfloater.h"
|
||||
#include "llresizehandle.h"
|
||||
#include "llstring.h"
|
||||
#include "llassettype.h"
|
||||
|
||||
class LLLineEditor;
|
||||
class LLButton;
|
||||
|
|
@ -45,6 +46,8 @@ public:
|
|||
void onBtnOK();
|
||||
void onBtnCancel();
|
||||
void doCommit();
|
||||
|
||||
S32 getExpectedUploadCost() const;
|
||||
|
||||
protected:
|
||||
virtual void onCommit();
|
||||
|
|
|
|||
|
|
@ -237,11 +237,6 @@ BOOL LLPanelMainInventory::postBuild()
|
|||
menu->getChild<LLMenuItemGL>("Upload Image")->setLabelArg("[COST]", texture_upload_cost_str);
|
||||
menu->getChild<LLMenuItemGL>("Upload Sound")->setLabelArg("[COST]", sound_upload_cost_str);
|
||||
menu->getChild<LLMenuItemGL>("Upload Animation")->setLabelArg("[COST]", animation_upload_cost_str);
|
||||
|
||||
// FIXME PREMIUM - bulk upload of what? This doesn't work with
|
||||
// mixed items if costs aren't all the same. For now treating
|
||||
// as textures.
|
||||
menu->getChild<LLMenuItemGL>("Bulk Upload")->setLabelArg("[COST]", texture_upload_cost_str);
|
||||
}
|
||||
|
||||
// Trigger callback for focus received so we can deselect items in inbox/outbox
|
||||
|
|
@ -1519,11 +1514,6 @@ void LLPanelMainInventory::setUploadCostIfNeeded()
|
|||
menu->getChild<LLView>("Upload Image")->setLabelArg("[COST]", texture_upload_cost_str);
|
||||
menu->getChild<LLView>("Upload Sound")->setLabelArg("[COST]", sound_upload_cost_str);
|
||||
menu->getChild<LLView>("Upload Animation")->setLabelArg("[COST]", animation_upload_cost_str);
|
||||
|
||||
// FIXME PREMIUM - bulk upload of what? This doesn't work with
|
||||
// mixed items if costs aren't all the same. For now treating
|
||||
// as textures.
|
||||
menu->getChild<LLView>("Bulk Upload")->setLabelArg("[COST]", texture_upload_cost_str);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3254,7 +3254,7 @@ bool process_login_success_response()
|
|||
{
|
||||
LLSD response = LLLoginInstance::getInstance()->getResponse();
|
||||
|
||||
//LL_INFOS() << "login success response:" << ll_pretty_print_sd(response) << LL_ENDL;
|
||||
LL_DEBUGS("Benefits") << "login success response:" << response << LL_ENDL;
|
||||
if (!LLAgentBenefits::instance().init(response["account_level_benefits"]))
|
||||
{
|
||||
LL_ERRS() << "Benefits error" << LL_ENDL;
|
||||
|
|
|
|||
|
|
@ -306,6 +306,12 @@ std::string LLResourceUploadInfo::getDisplayName() const
|
|||
return (mName.empty()) ? mAssetId.asString() : mName;
|
||||
};
|
||||
|
||||
bool LLResourceUploadInfo::findAssetTypeOfExtension(const std::string& exten, LLAssetType::EType& asset_type)
|
||||
{
|
||||
U32 codec;
|
||||
return findAssetTypeAndCodecOfExtension(exten, asset_type, codec);
|
||||
}
|
||||
|
||||
// static
|
||||
bool LLResourceUploadInfo::findAssetTypeAndCodecOfExtension(const std::string& exten, LLAssetType::EType& asset_type, U32& codec)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -87,6 +87,7 @@ public:
|
|||
LLUUID getItemId() const { return mItemId; }
|
||||
LLAssetID getAssetId() const { return mAssetId; }
|
||||
|
||||
static bool findAssetTypeOfExtension(const std::string& exten, LLAssetType::EType& asset_type);
|
||||
static bool findAssetTypeAndCodecOfExtension(const std::string& exten, LLAssetType::EType& asset_type, U32& codec);
|
||||
|
||||
protected:
|
||||
|
|
|
|||
|
|
@ -516,8 +516,6 @@ void init_menus()
|
|||
gMenuHolder->childSetLabelArg("Upload Image", "[COST]", texture_upload_cost_str);
|
||||
gMenuHolder->childSetLabelArg("Upload Sound", "[COST]", sound_upload_cost_str);
|
||||
gMenuHolder->childSetLabelArg("Upload Animation", "[COST]", animation_upload_cost_str);
|
||||
// FIXME PREMIUM - do we need to handle non-texture bulk uploads?
|
||||
gMenuHolder->childSetLabelArg("Bulk Upload", "[COST]", texture_upload_cost_str);
|
||||
|
||||
gAttachSubMenu = gMenuBarView->findChildMenuByName("Attach Object", TRUE);
|
||||
gDetachSubMenu = gMenuBarView->findChildMenuByName("Detach Object", TRUE);
|
||||
|
|
@ -8720,8 +8718,7 @@ class LLToggleUIHints : public view_listener_t
|
|||
|
||||
void LLUploadCostCalculator::calculateCost(const std::string& asset_type_str)
|
||||
{
|
||||
// FIXME PREMIUM reasonable default?
|
||||
S32 upload_cost = LLAgentBenefits::instance().getTextureUploadCost();
|
||||
S32 upload_cost = -1;
|
||||
|
||||
if (asset_type_str == "texture")
|
||||
{
|
||||
|
|
@ -8735,6 +8732,10 @@ void LLUploadCostCalculator::calculateCost(const std::string& asset_type_str)
|
|||
{
|
||||
upload_cost = LLAgentBenefits::instance().getSoundUploadCost();
|
||||
}
|
||||
if (upload_cost < 0)
|
||||
{
|
||||
LL_WARNS() << "Unable to find upload cost for asset_type_str " << asset_type_str << LL_ENDL;
|
||||
}
|
||||
mCostStr = std::to_string(upload_cost);
|
||||
}
|
||||
|
||||
|
|
@ -8840,7 +8841,6 @@ void initialize_menus()
|
|||
|
||||
enable.add("displayViewerEventRecorderMenuItems",boost::bind(&LLViewerEventRecorder::displayViewerEventRecorderMenuItems,&LLViewerEventRecorder::instance()));
|
||||
|
||||
// FIXME PREMIUM these need to be distinguished by asset type - see menu_viewer.xml
|
||||
view_listener_t::addEnable(new LLUploadCostCalculator(), "Upload.CalculateCosts");
|
||||
|
||||
enable.add("Conversation.IsConversationLoggingAllowed", boost::bind(&LLFloaterIMContainer::isConversationLoggingAllowed));
|
||||
|
|
|
|||
|
|
@ -1347,7 +1347,7 @@
|
|||
function="File.VisibleUploadModel"/>
|
||||
</menu_item_call>
|
||||
<menu_item_call
|
||||
label="Bulk..."
|
||||
labe="Bulk..."
|
||||
layout="topleft"
|
||||
name="Bulk Upload">
|
||||
<menu_item_call.on_visible
|
||||
|
|
|
|||
|
|
@ -1289,6 +1289,14 @@ Error encoding snapshot.
|
|||
<tag>fail</tag>
|
||||
</notification>
|
||||
|
||||
<notification
|
||||
icon="alertmodal.tga"
|
||||
name="ErrorCannotAffordUpload"
|
||||
type="alertmodal">
|
||||
You need L$[COST] to upload this item.
|
||||
<tag>fail</tag>
|
||||
</notification>
|
||||
|
||||
<notification
|
||||
icon="alertmodal.tga"
|
||||
name="ErrorTextureCannotAfford"
|
||||
|
|
|
|||
Loading…
Reference in New Issue