From 7df0a4ddd0c48358e7152733aaba01464f2620be Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Thu, 14 Nov 2019 15:01:50 +0000 Subject: SL-10499, SL-10497 - use LLAgentBenefits info --- indra/newview/llviewermenu.cpp | 54 +++++++++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 16 deletions(-) (limited to 'indra/newview/llviewermenu.cpp') diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index dc82719109..0fda4d3df8 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -45,6 +45,7 @@ // newview includes #include "llagent.h" #include "llagentaccess.h" +#include "llagentbenefits.h" #include "llagentcamera.h" #include "llagentui.h" #include "llagentwearables.h" @@ -134,6 +135,7 @@ #include "llstartup.h" #include "boost/unordered_map.hpp" #include +#include #include "llcleanup.h" using namespace LLAvatarAppearanceDefines; @@ -508,13 +510,15 @@ void init_menus() gViewerWindow->setMenuBackgroundColor(false, LLGridManager::getInstance()->isInProductionGrid()); - // Assume L$10 for now, the server will tell us the real cost at login // *TODO:Also fix cost in llfolderview.cpp for Inventory menus - const std::string upload_cost("10"); - gMenuHolder->childSetLabelArg("Upload Image", "[COST]", upload_cost); - gMenuHolder->childSetLabelArg("Upload Sound", "[COST]", upload_cost); - gMenuHolder->childSetLabelArg("Upload Animation", "[COST]", upload_cost); - gMenuHolder->childSetLabelArg("Bulk Upload", "[COST]", upload_cost); + const std::string texture_upload_cost_str = std::to_string(LLAgentBenefits::instance().getTextureUploadCost()); + const std::string sound_upload_cost_str = std::to_string(LLAgentBenefits::instance().getSoundUploadCost()); + const std::string animation_upload_cost_str = std::to_string(LLAgentBenefits::instance().getAnimationUploadCost()); + 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); @@ -8665,18 +8669,30 @@ class LLUploadCostCalculator : public view_listener_t bool handleEvent(const LLSD& userdata) { - std::string menu_name = userdata.asString(); + std::vector fields; + boost::split(fields, userdata.asString(), boost::is_any_of(",")); + if (fields.size()<1) + { + return false; + } + std::string menu_name = fields[0]; + std::string asset_type_str = "texture"; + if (fields.size()>1) + { + asset_type_str = fields[1]; + } + LL_DEBUGS("Benefits") << "userdata " << userdata << " menu_name " << menu_name << " asset_type_str " << asset_type_str << LL_ENDL; + calculateCost(asset_type_str); gMenuHolder->childSetLabelArg(menu_name, "[COST]", mCostStr); return true; } - void calculateCost(); + void calculateCost(const std::string& asset_type_str); public: LLUploadCostCalculator() { - calculateCost(); } }; @@ -8702,19 +8718,24 @@ class LLToggleUIHints : public view_listener_t } }; -void LLUploadCostCalculator::calculateCost() +void LLUploadCostCalculator::calculateCost(const std::string& asset_type_str) { - S32 upload_cost = LLGlobalEconomy::getInstance()->getPriceUpload(); + // FIXME PREMIUM reasonable default? + S32 upload_cost = LLAgentBenefits::instance().getTextureUploadCost(); - // getPriceUpload() returns -1 if no data available yet. - if(upload_cost >= 0) + if (asset_type_str == "texture") { - mCostStr = llformat("%d", upload_cost); + upload_cost = LLAgentBenefits::instance().getTextureUploadCost(); } - else + else if (asset_type_str == "animation") + { + upload_cost = LLAgentBenefits::instance().getAnimationUploadCost(); + } + else if (asset_type_str == "sound") { - mCostStr = llformat("%d", gSavedSettings.getU32("DefaultUploadCost")); + upload_cost = LLAgentBenefits::instance().getSoundUploadCost(); } + mCostStr = std::to_string(upload_cost); } void show_navbar_context_menu(LLView* ctrl, S32 x, S32 y) @@ -8819,6 +8840,7 @@ 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)); -- cgit v1.2.3 From 65550520ed00699098b221a1166e4c1763333d58 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Fri, 15 Nov 2019 15:13:11 +0000 Subject: SL-10499 - benefits. Removed no-longer-needed lleconomy files and classes. Group-related costs and limits via benefits. --- indra/newview/llviewermenu.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'indra/newview/llviewermenu.cpp') diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 0fda4d3df8..ef3c1f4c14 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -128,7 +128,6 @@ #include "lluilistener.h" #include "llappearancemgr.h" #include "lltrans.h" -#include "lleconomy.h" #include "lltoolgrab.h" #include "llwindow.h" #include "llpathfindingmanager.h" -- cgit v1.2.3 From 5b20fca991c109df40b5e8ee0f750507c57f46a1 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Mon, 18 Nov 2019 19:32:47 +0000 Subject: possible fix for mac compilation error --- indra/newview/llviewermenu.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'indra/newview/llviewermenu.cpp') diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index ef3c1f4c14..c1de275174 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -8669,7 +8669,8 @@ class LLUploadCostCalculator : public view_listener_t bool handleEvent(const LLSD& userdata) { std::vector fields; - boost::split(fields, userdata.asString(), boost::is_any_of(",")); + std::string str = userdata.asString(); + boost::split(fields, str, boost::is_any_of(",")); if (fields.size()<1) { return false; -- cgit v1.2.3 From eb6e64ec401382fd2fbbbb27830e828035a6e5af Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Tue, 19 Nov 2019 16:15:19 +0000 Subject: SL-10499 - Fixes for benefits info and upload, especially bulk upload --- indra/newview/llviewermenu.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/newview/llviewermenu.cpp') 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)); -- cgit v1.2.3 From 4300b204f0fc519d3e2dabc7e1296284e5908611 Mon Sep 17 00:00:00 2001 From: "Brad Payne (Vir Linden)" Date: Wed, 20 Nov 2019 14:03:57 +0000 Subject: SL-10499 - handle package info from benefits service --- indra/newview/llviewermenu.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'indra/newview/llviewermenu.cpp') diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index e88acc2ac4..49a4eb6a4d 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -510,9 +510,9 @@ void init_menus() LLGridManager::getInstance()->isInProductionGrid()); // *TODO:Also fix cost in llfolderview.cpp for Inventory menus - const std::string texture_upload_cost_str = std::to_string(LLAgentBenefits::instance().getTextureUploadCost()); - const std::string sound_upload_cost_str = std::to_string(LLAgentBenefits::instance().getSoundUploadCost()); - const std::string animation_upload_cost_str = std::to_string(LLAgentBenefits::instance().getAnimationUploadCost()); + const std::string texture_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getTextureUploadCost()); + const std::string sound_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getSoundUploadCost()); + const std::string animation_upload_cost_str = std::to_string(LLAgentBenefitsMgr::current().getAnimationUploadCost()); 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); @@ -8722,15 +8722,15 @@ void LLUploadCostCalculator::calculateCost(const std::string& asset_type_str) if (asset_type_str == "texture") { - upload_cost = LLAgentBenefits::instance().getTextureUploadCost(); + upload_cost = LLAgentBenefitsMgr::current().getTextureUploadCost(); } else if (asset_type_str == "animation") { - upload_cost = LLAgentBenefits::instance().getAnimationUploadCost(); + upload_cost = LLAgentBenefitsMgr::current().getAnimationUploadCost(); } else if (asset_type_str == "sound") { - upload_cost = LLAgentBenefits::instance().getSoundUploadCost(); + upload_cost = LLAgentBenefitsMgr::current().getSoundUploadCost(); } if (upload_cost < 0) { -- cgit v1.2.3