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 | |
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')
-rw-r--r-- | indra/newview/llpanelmaininventory.cpp | 2 | ||||
-rw-r--r-- | indra/newview/llviewermenu.cpp | 39 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_viewer.xml | 113 |
3 files changed, 125 insertions, 29 deletions
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 5ff51b8165..54d1b46016 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -1187,7 +1187,7 @@ void LLPanelMainInventory::setUploadCostIfNeeded() LLMenuItemBranchGL* upload_menu = mMenuAdd->findChild<LLMenuItemBranchGL>("upload"); if(upload_menu) { - S32 upload_cost = -1;//LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); + S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); std::string cost_str; // getPriceUpload() returns -1 if no data available yet. 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)); diff --git a/indra/newview/skins/default/xui/en/menu_viewer.xml b/indra/newview/skins/default/xui/en/menu_viewer.xml index 16c2581d63..aff8f7ddf4 100644 --- a/indra/newview/skins/default/xui/en/menu_viewer.xml +++ b/indra/newview/skins/default/xui/en/menu_viewer.xml @@ -521,6 +521,52 @@ <menu_item_check.on_enable function="Tools.EnableToolNotPie" /> </menu_item_check> + <menu + create_jump_keys="true" + label="Select Linked Parts" + name="Select Linked Parts" + tear_off="true"> + <menu_item_call + label="Select Next Part" + name="Select Next Part" + shortcut="control|."> + <menu_item_call.on_click + function="Tools.SelectNextPart" + parameter="next" /> + <menu_item_call.on_enable + function="Tools.EnableSelectNextPart" /> + </menu_item_call> + <menu_item_call + label="Select Previous Part" + name="Select Previous Part" + shortcut="control|,"> + <menu_item_call.on_click + function="Tools.SelectNextPart" + parameter="previous" /> + <menu_item_call.on_enable + function="Tools.EnableSelectNextPart" /> + </menu_item_call> + <menu_item_call + label="Include Next Part" + name="Include Next Part" + shortcut="control|shift|."> + <menu_item_call.on_click + function="Tools.SelectNextPart" + parameter="includenext" /> + <menu_item_call.on_enable + function="Tools.EnableSelectNextPart" /> + </menu_item_call> + <menu_item_call + label="Include Previous Part" + name="Include Previous Part" + shortcut="control|shift|,"> + <menu_item_call.on_click + function="Tools.SelectNextPart" + parameter="includeprevious" /> + <menu_item_call.on_enable + function="Tools.EnableSelectNextPart" /> + </menu_item_call> + </menu> <menu_item_separator/> <menu_item_call label="Focus on Selection" @@ -764,49 +810,60 @@ </menu> <menu create_jump_keys="true" - label="Select Linked Parts" - name="Select Linked Parts" + label="Upload" + layout="topleft" + name="Upload" tear_off="true"> <menu_item_call - label="Select Next Part" - name="Select Next Part" - shortcut="control|."> + label="Image (L$[COST])..." + layout="topleft" + name="Upload Image" + shortcut="control|U"> <menu_item_call.on_click - function="Tools.SelectNextPart" - parameter="next" /> + function="File.UploadImage" + parameter="" /> <menu_item_call.on_enable - function="Tools.EnableSelectNextPart" /> + function="File.EnableUpload" /> + <menu_item_call.on_visible + function="Upload.CalculateCosts" + parameter="Upload Image" /> </menu_item_call> <menu_item_call - label="Select Previous Part" - name="Select Previous Part" - shortcut="control|,"> + label="Sound (L$[COST])..." + layout="topleft" + name="Upload Sound"> <menu_item_call.on_click - function="Tools.SelectNextPart" - parameter="previous" /> + function="File.UploadSound" + parameter="" /> <menu_item_call.on_enable - function="Tools.EnableSelectNextPart" /> + function="File.EnableUpload" /> + <menu_item_call.on_visible + function="Upload.CalculateCosts" + parameter="Upload Sound" /> </menu_item_call> <menu_item_call - label="Include Next Part" - name="Include Next Part" - shortcut="control|shift|."> + label="Animation (L$[COST])..." + layout="topleft" + name="Upload Animation"> <menu_item_call.on_click - function="Tools.SelectNextPart" - parameter="includenext" /> + function="File.UploadAnim" + parameter="" /> <menu_item_call.on_enable - function="Tools.EnableSelectNextPart" /> + function="File.EnableUpload" /> + <menu_item_call.on_visible + function="Upload.CalculateCosts" + parameter="Upload Animation" /> </menu_item_call> <menu_item_call - label="Include Previous Part" - name="Include Previous Part" - shortcut="control|shift|,"> + label="Bulk (L$[COST] per file)..." + layout="topleft" + name="Bulk Upload"> <menu_item_call.on_click - function="Tools.SelectNextPart" - parameter="includeprevious" /> - <menu_item_call.on_enable - function="Tools.EnableSelectNextPart" /> + function="File.UploadBulk" + parameter="" /> </menu_item_call> + <menu_item_separator + layout="topleft" /> </menu> </menu> <menu @@ -3210,4 +3267,4 @@ </menu> </menu> </menu> -</menu_bar> +</menu_bar>
\ No newline at end of file |