diff --git a/indra/newview/llfloaternamedesc.cpp b/indra/newview/llfloaternamedesc.cpp index fa1ed57d1ff7569bdf0c755ed86f102a3cbe4ac1..937dd60f0f4f07cf5ec16ef91f811cfb9f7e84f8 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 41643681ac0fb81cca7699365f75d3d6410571c0..589f470e827906ed230242277ce6ac3a205d3110 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 @@ class LLFloaterNameDesc : public LLFloater 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 b81dce4e318e76edba6a811a8639ae8bfec9de5c..a57ee8328557d1fbaefb86bdc724d005d4b246b9 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 2f9bc786ca55afe1bca41b20746307c5b64c2f28..c144ea2f8e6ae3a40ac4088c3449665f11fb1590 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 de35f9911c0a520c0cc7e0029cbf81916463decf..4cbb88d4f176789c3e25e58bb29e13ca1286610c 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 8ef25ad6fd47b4c763b6929cadb36c5908865580..6301359021b3b49d81a3d00e4db061c217062a4c 100644 --- a/indra/newview/llviewerassetupload.h +++ b/indra/newview/llviewerassetupload.h @@ -87,6 +87,7 @@ class LLResourceUploadInfo 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 c1de275174309b35e473e2b8c92a9fdd555f3721..e88acc2ac4245045d54d0535ef7b901c6fb13b8e 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 9b27e8b03dc4e6a6c3c5742a2da73966a526ee58..362ddfd27ac272537e6e415a65892b322c532147 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 2df0b1cbf4f6fd3ed72cef475a005f04725490ad..f93113ebd01e6da2ddd180e4cad0537eeece1316 100644 --- a/indra/newview/skins/default/xui/en/notifications.xml +++ b/indra/newview/skins/default/xui/en/notifications.xml @@ -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"