diff options
| author | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2019-11-19 16:15:19 +0000 | 
|---|---|---|
| committer | Brad Payne (Vir Linden) <vir@lindenlab.com> | 2019-11-19 16:15:19 +0000 | 
| commit | eb6e64ec401382fd2fbbbb27830e828035a6e5af (patch) | |
| tree | 90983b525d9b7af423644ed5267a04f397828df3 | |
| parent | 5b20fca991c109df40b5e8ee0f750507c57f46a1 (diff) | |
SL-10499 - Fixes for benefits info and upload, especially bulk upload
| -rw-r--r-- | indra/newview/llfloaternamedesc.cpp | 31 | ||||
| -rw-r--r-- | indra/newview/llfloaternamedesc.h | 3 | ||||
| -rw-r--r-- | indra/newview/llpanelmaininventory.cpp | 10 | ||||
| -rw-r--r-- | indra/newview/llstartup.cpp | 2 | ||||
| -rw-r--r-- | indra/newview/llviewerassetupload.cpp | 6 | ||||
| -rw-r--r-- | indra/newview/llviewerassetupload.h | 1 | ||||
| -rw-r--r-- | indra/newview/llviewermenu.cpp | 10 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/menu_viewer.xml | 2 | ||||
| -rw-r--r-- | indra/newview/skins/default/xui/en/notifications.xml | 8 | 
9 files changed, 49 insertions, 24 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); diff --git a/indra/newview/llfloaternamedesc.h b/indra/newview/llfloaternamedesc.h index 41643681ac..589f470e82 100644 --- a/indra/newview/llfloaternamedesc.h +++ b/indra/newview/llfloaternamedesc.h @@ -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(); diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index b81dce4e31..a57ee83285 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -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);  	}  } diff --git a/indra/newview/llstartup.cpp b/indra/newview/llstartup.cpp index 2f9bc786ca..c144ea2f8e 100644 --- a/indra/newview/llstartup.cpp +++ b/indra/newview/llstartup.cpp @@ -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; diff --git a/indra/newview/llviewerassetupload.cpp b/indra/newview/llviewerassetupload.cpp index de35f9911c..4cbb88d4f1 100644 --- a/indra/newview/llviewerassetupload.cpp +++ b/indra/newview/llviewerassetupload.cpp @@ -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)  { diff --git a/indra/newview/llviewerassetupload.h b/indra/newview/llviewerassetupload.h index 8ef25ad6fd..6301359021 100644 --- a/indra/newview/llviewerassetupload.h +++ b/indra/newview/llviewerassetupload.h @@ -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: diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index c1de275174..e88acc2ac4 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -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)); diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 9b27e8b03d..362ddfd27a 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -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 diff --git a/indra/newview/skins/default/xui/en/notifications.xml b/indra/newview/skins/default/xui/en/notifications.xml index 2df0b1cbf4..f93113ebd0 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -1291,6 +1291,14 @@ Error encoding snapshot.    <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"     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.  | 
