diff options
| author | Tofu Linden <tofu.linden@lindenlab.com> | 2010-05-26 08:43:57 +0100 |
|---|---|---|
| committer | Tofu Linden <tofu.linden@lindenlab.com> | 2010-05-26 08:43:57 +0100 |
| commit | 12cf2112413a62b44638cf080c2fdf4608db8a65 (patch) | |
| tree | 0a41eaa71baf9f7431b442b4b61b5eadb57e61cd /indra/newview/llviewermenu.cpp | |
| parent | b59a80f20bd6b778ea9edfe8f5b78b2e5a25864e (diff) | |
| parent | 14418c197076d0eb01bb0852b8716fa966bc9d53 (diff) | |
merge from viewer-public
Diffstat (limited to 'indra/newview/llviewermenu.cpp')
| -rw-r--r-- | indra/newview/llviewermenu.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/indra/newview/llviewermenu.cpp b/indra/newview/llviewermenu.cpp index 5ae64b2530..57ee7a1388 100644 --- a/indra/newview/llviewermenu.cpp +++ b/indra/newview/llviewermenu.cpp @@ -108,6 +108,7 @@ #include "lluilistener.h" #include "llappearancemgr.h" #include "lltrans.h" +#include "lleconomy.h" using namespace LLVOAvatarDefines; @@ -7694,6 +7695,42 @@ class LLWorldToggleCameraControls : public view_listener_t } }; +class LLUploadCostCalculator : public view_listener_t +{ + std::string mCostStr; + + bool handleEvent(const LLSD& userdata) + { + std::string menu_name = userdata.asString(); + gMenuHolder->childSetLabelArg(menu_name, "[COST]", mCostStr); + + return true; + } + + void calculateCost(); + +public: + LLUploadCostCalculator() + { + calculateCost(); + } +}; + +void LLUploadCostCalculator::calculateCost() +{ + S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); + + // getPriceUpload() returns -1 if no data available yet. + if(upload_cost >= 0) + { + mCostStr = llformat("%d", upload_cost); + } + else + { + mCostStr = llformat("%d", gSavedSettings.getU32("DefaultUploadCost")); + } +} + void show_navbar_context_menu(LLView* ctrl, S32 x, S32 y) { static LLMenuGL* show_navbar_context_menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_hide_navbar.xml", @@ -7735,6 +7772,8 @@ void initialize_menus() enable.add("IsGodCustomerService", boost::bind(&is_god_customer_service)); enable.add("IsGodCustomerService", boost::bind(&is_god_customer_service)); + view_listener_t::addEnable(new LLUploadCostCalculator(), "Upload.CalculateCosts"); + // Agent commit.add("Agent.toggleFlying", boost::bind(&LLAgent::toggleFlying)); enable.add("Agent.enableFlying", boost::bind(&LLAgent::enableFlying)); |
