MAINT-5232: Normalize LLGlobalEconomy's use of LLSingleton.
LLSingleton currently presents two different usage styles: deriving MyClass from LLSingleton<MyClass>, or just using a typedef. Turns out LLGlobalEconomy is the ONLY class using the typedef style -- and the apologetic comment talks about a potential maintenance that hasn't actually happened. Derive LLGlobalEconomy from LLSingleton<LLGlobalEconomy>, like everyone else.meow-7.2.2
parent
d15ec90bc9
commit
6a82ff08d9
|
|
@ -42,17 +42,12 @@ public:
|
|||
virtual void onEconomyDataChange() = 0;
|
||||
};
|
||||
|
||||
class LLGlobalEconomy
|
||||
class LLGlobalEconomy: public LLSingleton<LLGlobalEconomy>
|
||||
{
|
||||
public:
|
||||
LLGlobalEconomy();
|
||||
virtual ~LLGlobalEconomy();
|
||||
|
||||
// This class defines its singleton internally as a typedef instead of inheriting from
|
||||
// LLSingleton like most others because the LLRegionEconomy sub-class might also
|
||||
// become a singleton and this pattern will more easily disambiguate them.
|
||||
typedef LLSingleton<LLGlobalEconomy> Singleton;
|
||||
|
||||
void initSingleton() { }
|
||||
|
||||
virtual void print();
|
||||
|
|
|
|||
|
|
@ -334,7 +334,7 @@ void LLAssetUploadResponder::uploadFailure(const LLSD& content)
|
|||
// deal with L$ errors
|
||||
if (reason == "insufficient funds")
|
||||
{
|
||||
S32 price = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
|
||||
S32 price = LLGlobalEconomy::getInstance()->getPriceUpload();
|
||||
LLStringUtil::format_map_t args;
|
||||
args["AMOUNT"] = llformat("%d", price);
|
||||
LLBuyCurrencyHTML::openCurrencyFloater( LLTrans::getString("uploading_costs", args), price );
|
||||
|
|
@ -405,7 +405,7 @@ void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content)
|
|||
asset_type == LLAssetType::AT_MESH)
|
||||
{
|
||||
expected_upload_cost =
|
||||
LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
|
||||
LLGlobalEconomy::getInstance()->getPriceUpload();
|
||||
}
|
||||
|
||||
on_new_single_inventory_upload_complete(
|
||||
|
|
@ -467,7 +467,7 @@ void LLNewAgentInventoryResponder::uploadComplete(const LLSD& content)
|
|||
everyone_perms,
|
||||
display_name,
|
||||
callback,
|
||||
LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(),
|
||||
LLGlobalEconomy::getInstance()->getPriceUpload(),
|
||||
userdata);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -993,7 +993,7 @@ void LLFloaterBvhPreview::onBtnOK(void* userdata)
|
|||
std::string name = floaterp->getChild<LLUICtrl>("name_form")->getValue().asString();
|
||||
std::string desc = floaterp->getChild<LLUICtrl>("description_form")->getValue().asString();
|
||||
LLAssetStorage::LLStoreAssetCallback callback = NULL;
|
||||
S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
|
||||
S32 expected_upload_cost = LLGlobalEconomy::getInstance()->getPriceUpload();
|
||||
void *userdata = NULL;
|
||||
upload_new_resource(floaterp->mTransactionID, // tid
|
||||
LLAssetType::AT_ANIMATION,
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ BOOL LLFloaterNameDesc::postBuild()
|
|||
// Cancel button
|
||||
getChild<LLUICtrl>("cancel_btn")->setCommitCallback(boost::bind(&LLFloaterNameDesc::onBtnCancel, this));
|
||||
|
||||
getChild<LLUICtrl>("ok_btn")->setLabelArg("[AMOUNT]", llformat("%d", LLGlobalEconomy::Singleton::getInstance()->getPriceUpload() ));
|
||||
getChild<LLUICtrl>("ok_btn")->setLabelArg("[AMOUNT]", llformat("%d", LLGlobalEconomy::getInstance()->getPriceUpload() ));
|
||||
|
||||
setDefaultBtn("ok_btn");
|
||||
|
||||
|
|
@ -160,7 +160,7 @@ void LLFloaterNameDesc::onBtnOK( )
|
|||
getChildView("ok_btn")->setEnabled(FALSE); // don't allow inadvertent extra uploads
|
||||
|
||||
LLAssetStorage::LLStoreAssetCallback callback = NULL;
|
||||
S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload(); // kinda hack - assumes that unsubclassed LLFloaterNameDesc is only used for uploading chargeable assets, which it is right now (it's only used unsubclassed for the sound upload dialog, and THAT should be a subclass).
|
||||
S32 expected_upload_cost = LLGlobalEconomy::getInstance()->getPriceUpload(); // kinda hack - assumes that unsubclassed LLFloaterNameDesc is only used for uploading chargeable assets, which it is right now (it's only used unsubclassed for the sound upload dialog, and THAT should be a subclass).
|
||||
void *nruserdata = NULL;
|
||||
std::string display_name = LLStringUtil::null;
|
||||
|
||||
|
|
|
|||
|
|
@ -1278,7 +1278,7 @@ void LLPanelMainInventory::setUploadCostIfNeeded()
|
|||
LLMenuItemBranchGL* upload_menu = mMenuAdd->findChild<LLMenuItemBranchGL>("upload");
|
||||
if(upload_menu)
|
||||
{
|
||||
S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
|
||||
S32 upload_cost = LLGlobalEconomy::getInstance()->getPriceUpload();
|
||||
std::string cost_str;
|
||||
|
||||
// getPriceUpload() returns -1 if no data available yet.
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ BOOL LLPanelSnapshotInventory::postBuild()
|
|||
// virtual
|
||||
void LLPanelSnapshotInventory::onOpen(const LLSD& key)
|
||||
{
|
||||
getChild<LLUICtrl>("hint_lbl")->setTextArg("[UPLOAD_COST]", llformat("%d", LLGlobalEconomy::Singleton::getInstance()->getPriceUpload()));
|
||||
getChild<LLUICtrl>("hint_lbl")->setTextArg("[UPLOAD_COST]", llformat("%d", LLGlobalEconomy::getInstance()->getPriceUpload()));
|
||||
LLPanelSnapshot::onOpen(key);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -75,12 +75,12 @@ LLPanelSnapshotOptions::LLPanelSnapshotOptions()
|
|||
mCommitCallbackRegistrar.add("Snapshot.SendToFacebook", boost::bind(&LLPanelSnapshotOptions::onSendToFacebook, this));
|
||||
mCommitCallbackRegistrar.add("Snapshot.SendToTwitter", boost::bind(&LLPanelSnapshotOptions::onSendToTwitter, this));
|
||||
mCommitCallbackRegistrar.add("Snapshot.SendToFlickr", boost::bind(&LLPanelSnapshotOptions::onSendToFlickr, this));
|
||||
LLGlobalEconomy::Singleton::getInstance()->addObserver(this);
|
||||
LLGlobalEconomy::getInstance()->addObserver(this);
|
||||
}
|
||||
|
||||
LLPanelSnapshotOptions::~LLPanelSnapshotOptions()
|
||||
{
|
||||
LLGlobalEconomy::Singleton::getInstance()->removeObserver(this);
|
||||
LLGlobalEconomy::getInstance()->removeObserver(this);
|
||||
}
|
||||
|
||||
// virtual
|
||||
|
|
@ -97,7 +97,7 @@ void LLPanelSnapshotOptions::onOpen(const LLSD& key)
|
|||
|
||||
void LLPanelSnapshotOptions::updateUploadCost()
|
||||
{
|
||||
S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
|
||||
S32 upload_cost = LLGlobalEconomy::getInstance()->getPriceUpload();
|
||||
getChild<LLUICtrl>("save_to_inventory_btn")->setLabelArg("[AMOUNT]", llformat("%d", upload_cost));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1005,7 +1005,7 @@ void LLSnapshotLivePreview::saveTexture()
|
|||
std::string who_took_it;
|
||||
LLAgentUI::buildFullname(who_took_it);
|
||||
LLAssetStorage::LLStoreAssetCallback callback = NULL;
|
||||
S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
|
||||
S32 expected_upload_cost = LLGlobalEconomy::getInstance()->getPriceUpload();
|
||||
void *userdata = NULL;
|
||||
upload_new_resource(tid, // tid
|
||||
LLAssetType::AT_TEXTURE,
|
||||
|
|
|
|||
|
|
@ -8461,7 +8461,7 @@ class LLToggleUIHints : public view_listener_t
|
|||
|
||||
void LLUploadCostCalculator::calculateCost()
|
||||
{
|
||||
S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
|
||||
S32 upload_cost = LLGlobalEconomy::getInstance()->getPriceUpload();
|
||||
|
||||
// getPriceUpload() returns -1 if no data available yet.
|
||||
if(upload_cost >= 0)
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ class LLFileEnableUpload : public view_listener_t
|
|||
{
|
||||
bool handleEvent(const LLSD& userdata)
|
||||
{
|
||||
bool new_value = gStatusBar && LLGlobalEconomy::Singleton::getInstance() && (gStatusBar->getBalance() >= LLGlobalEconomy::Singleton::getInstance()->getPriceUpload());
|
||||
bool new_value = gStatusBar && LLGlobalEconomy::getInstance() && (gStatusBar->getBalance() >= LLGlobalEconomy::getInstance()->getPriceUpload());
|
||||
return new_value;
|
||||
}
|
||||
};
|
||||
|
|
@ -433,7 +433,7 @@ class LLFileUploadBulk : public view_listener_t
|
|||
|
||||
std::string display_name = LLStringUtil::null;
|
||||
LLAssetStorage::LLStoreAssetCallback callback = NULL;
|
||||
S32 expected_upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
|
||||
S32 expected_upload_cost = LLGlobalEconomy::getInstance()->getPriceUpload();
|
||||
void *userdata = NULL;
|
||||
|
||||
upload_new_resource(
|
||||
|
|
|
|||
|
|
@ -6222,9 +6222,9 @@ void process_frozen_message(LLMessageSystem *msgsystem, void **user_data)
|
|||
// do some extra stuff once we get our economy data
|
||||
void process_economy_data(LLMessageSystem *msg, void** /*user_data*/)
|
||||
{
|
||||
LLGlobalEconomy::processEconomyData(msg, LLGlobalEconomy::Singleton::getInstance());
|
||||
LLGlobalEconomy::processEconomyData(msg, LLGlobalEconomy::getInstance());
|
||||
|
||||
S32 upload_cost = LLGlobalEconomy::Singleton::getInstance()->getPriceUpload();
|
||||
S32 upload_cost = LLGlobalEconomy::getInstance()->getPriceUpload();
|
||||
|
||||
LL_INFOS_ONCE("Messaging") << "EconomyData message arrived; upload cost is L$" << upload_cost << LL_ENDL;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue