diff options
author | Leyla Farazha <leyla@lindenlab.com> | 2010-01-04 15:04:38 -0800 |
---|---|---|
committer | Leyla Farazha <leyla@lindenlab.com> | 2010-01-04 15:04:38 -0800 |
commit | 53abe3c7802b8c8579ce868b4ecb05d9ebdd20ef (patch) | |
tree | 4a2c9b325f6ceb75403db9d29e1efa583de434e3 /indra/newview/llpanelmaininventory.cpp | |
parent | 34328eed67a10ccca73ec78cd70488ac35f2ee91 (diff) | |
parent | 1355d16d2f24f9d623df70059b1f0001cf673209 (diff) |
Merge
Diffstat (limited to 'indra/newview/llpanelmaininventory.cpp')
-rw-r--r-- | indra/newview/llpanelmaininventory.cpp | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 961d3dec8b..e74a39c85c 100644 --- a/indra/newview/llpanelmaininventory.cpp +++ b/indra/newview/llpanelmaininventory.cpp @@ -35,6 +35,7 @@ #include "llagent.h" #include "lldndbutton.h" +#include "lleconomy.h" #include "llfilepicker.h" #include "llfloaterinventory.h" #include "llinventorybridge.h" @@ -97,7 +98,8 @@ LLPanelMainInventory::LLPanelMainInventory() mSavedFolderState(NULL), mFilterText(""), mMenuGearDefault(NULL), - mMenuAdd(NULL) + mMenuAdd(NULL), + mNeedUploadCost(true) { LLMemType mt(LLMemType::MTYPE_INVENTORY_VIEW_INIT); // Menu Callbacks (non contex menus) @@ -895,6 +897,8 @@ void LLPanelMainInventory::onGearButtonClick() void LLPanelMainInventory::onAddButtonClick() { + setUploadCostIfNeeded(); + showActionMenu(mMenuAdd,"add_btn"); } @@ -1131,5 +1135,39 @@ bool LLPanelMainInventory::handleDragAndDropToTrash(BOOL drop, EDragAndDropType return true; } +void LLPanelMainInventory::setUploadCostIfNeeded() +{ + // *NOTE dzaporozhan + // Upload cost is set in process_economy_data() (llviewermessage.cpp). But since we + // have two instances of Inventory panel at the moment(and two instances of context menu), + // call to gMenuHolder->childSetLabelArg() sets upload cost only for one of the instances. + + if(mNeedUploadCost && mMenuAdd) + { + LLMenuItemBranchGL* upload_menu = mMenuAdd->findChild<LLMenuItemBranchGL>("upload"); + if(upload_menu) + { + S32 upload_cost = -1;//LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); + std::string cost_str; + + // getPriceUpload() returns -1 if no data available yet. + if(upload_cost >= 0) + { + mNeedUploadCost = false; + cost_str = llformat("%d", upload_cost); + } + else + { + cost_str = llformat("%d", gSavedSettings.getU32("DefaultUploadCost")); + } + + upload_menu->getChild<LLView>("Upload Image")->setLabelArg("[COST]", cost_str); + upload_menu->getChild<LLView>("Upload Sound")->setLabelArg("[COST]", cost_str); + upload_menu->getChild<LLView>("Upload Animation")->setLabelArg("[COST]", cost_str); + upload_menu->getChild<LLView>("Bulk Upload")->setLabelArg("[COST]", cost_str); + } + } +} + // List Commands // //////////////////////////////////////////////////////////////////////////////// |