summaryrefslogtreecommitdiff
path: root/indra/newview/llviewermenu.cpp
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2019-11-14 15:01:50 +0000
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2019-11-14 15:01:50 +0000
commit7df0a4ddd0c48358e7152733aaba01464f2620be (patch)
treee556c0150e21ffbcfec0b1a901d62e3f8451576f /indra/newview/llviewermenu.cpp
parentb3b103efe59c347a7268d820876888fe9297d7dd (diff)
SL-10499, SL-10497 - use LLAgentBenefits info
Diffstat (limited to 'indra/newview/llviewermenu.cpp')
-rw-r--r--indra/newview/llviewermenu.cpp54
1 files changed, 38 insertions, 16 deletions
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 <boost/regex.hpp>
+#include <boost/algorithm/string.hpp>
#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<std::string> 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));