From 4005a820f26d4287bf5c14ec011d4f792c5b82bc Mon Sep 17 00:00:00 2001 From: Vadim ProductEngine Date: Fri, 11 Nov 2011 01:37:41 +0200 Subject: EXP-1563 FIXED Negative upload cost displayed on the "Save to My Inventory" button. Update upload cost in the button label when economy data arrives from server. --- indra/newview/llpanelsnapshotoptions.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'indra/newview/llpanelsnapshotoptions.cpp') diff --git a/indra/newview/llpanelsnapshotoptions.cpp b/indra/newview/llpanelsnapshotoptions.cpp index df904b6836..554fabe5b3 100644 --- a/indra/newview/llpanelsnapshotoptions.cpp +++ b/indra/newview/llpanelsnapshotoptions.cpp @@ -37,14 +37,18 @@ */ class LLPanelSnapshotOptions : public LLPanel +, public LLEconomyObserver { LOG_CLASS(LLPanelSnapshotOptions); public: LLPanelSnapshotOptions(); + ~LLPanelSnapshotOptions(); /*virtual*/ void onOpen(const LLSD& key); + /*virtual*/ void onEconomyDataChange() { updateUploadCost(); } private: + void updateUploadCost(); void openPanel(const std::string& panel_name); void onSaveToProfile(); void onSaveToEmail(); @@ -60,10 +64,22 @@ LLPanelSnapshotOptions::LLPanelSnapshotOptions() mCommitCallbackRegistrar.add("Snapshot.SaveToEmail", boost::bind(&LLPanelSnapshotOptions::onSaveToEmail, this)); mCommitCallbackRegistrar.add("Snapshot.SaveToInventory", boost::bind(&LLPanelSnapshotOptions::onSaveToInventory, this)); mCommitCallbackRegistrar.add("Snapshot.SaveToComputer", boost::bind(&LLPanelSnapshotOptions::onSaveToComputer, this)); + + LLGlobalEconomy::Singleton::getInstance()->addObserver(this); +} + +LLPanelSnapshotOptions::~LLPanelSnapshotOptions() +{ + LLGlobalEconomy::Singleton::getInstance()->removeObserver(this); } // virtual void LLPanelSnapshotOptions::onOpen(const LLSD& key) +{ + updateUploadCost(); +} + +void LLPanelSnapshotOptions::updateUploadCost() { S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); getChild("save_to_inventory_btn")->setLabelArg("[AMOUNT]", llformat("%d", upload_cost)); -- cgit v1.2.3