diff options
Diffstat (limited to 'indra/newview/llpanelmaininventory.cpp')
-rw-r--r-- | indra/newview/llpanelmaininventory.cpp | 46 |
1 files changed, 43 insertions, 3 deletions
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp index 961d3dec8b..a5a61f0c7b 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" @@ -50,6 +51,8 @@ #include "llviewermenu.h" #include "llviewertexturelist.h" +const std::string FILTERS_FILENAME("filters.xml"); + static LLRegisterPanelClassWrapper<LLPanelMainInventory> t_inventory("panel_main_inventory"); void on_file_loaded_for_save(BOOL success, @@ -97,7 +100,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) @@ -158,7 +162,7 @@ BOOL LLPanelMainInventory::postBuild() // Now load the stored settings from disk, if available. std::ostringstream filterSaveName; - filterSaveName << gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "filters.xml"); + filterSaveName << gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, FILTERS_FILENAME); llinfos << "LLPanelMainInventory::init: reading from " << filterSaveName << llendl; llifstream file(filterSaveName.str()); LLSD savedFilterState; @@ -228,7 +232,7 @@ LLPanelMainInventory::~LLPanelMainInventory( void ) } std::ostringstream filterSaveName; - filterSaveName << gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, "filters.xml"); + filterSaveName << gDirUtilp->getExpandedFilename(LL_PATH_PER_SL_ACCOUNT, FILTERS_FILENAME); llofstream filtersFile(filterSaveName.str()); if(!LLSDSerialize::toPrettyXML(filterRoot, filtersFile)) { @@ -895,6 +899,8 @@ void LLPanelMainInventory::onGearButtonClick() void LLPanelMainInventory::onAddButtonClick() { + setUploadCostIfNeeded(); + showActionMenu(mMenuAdd,"add_btn"); } @@ -1131,5 +1137,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 // //////////////////////////////////////////////////////////////////////////////// |