diff options
| author | Andrew Polunin <apolunin@productengine.com> | 2010-05-25 15:31:07 +0300 |
|---|---|---|
| committer | Andrew Polunin <apolunin@productengine.com> | 2010-05-25 15:31:07 +0300 |
| commit | ecd93410ff819bb301f115e40c8f2d6fef8b2396 (patch) | |
| tree | 27fa100de9463448cadc3f7f1845b53248a2dfde /indra/newview/llviewermenu.cpp | |
| parent | cb0589715265dc1568626fe238aac7417b44ef89 (diff) | |
EXT-7142 FIXED Upload functionality duplicated in the Build menu and Select Linked Parts menu moved up
- LLPanelMainInventory::setUploadCostIfNeeded() - uncommented the line which enables retrieving of the upload cost price using LLGlobalEconomy class.
- Implemented LLUploadCostCalculator event handler in the llviewermenu.cpp (the fact that it should be implemented in this file was discussed with Mike Antipov).
- LLUploadCostCalculator::calculateCost() is implemented only for code readability: it's name is more descriptive than a code snippet placed directly in the constructor (LLPanelMainInventory::setUploadCostIfNeeded() works in similar way: it calculates cost_str only once).
- 'Select Linked Parts' menu was moved below 'Edit Linked Parts'.
- 'Upload' menu was added at the bottom, below 'Options' menu
Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/425/
--HG--
branch : product-engine
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 10ceab2656..d0ac103f56 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; @@ -7658,6 +7659,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", @@ -7699,6 +7736,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)); |
