Skip to content
Snippets Groups Projects
Commit 03b74be7 authored by Merov Linden's avatar Merov Linden
Browse files

STORM-524 : Add a click event on the L$ balance so to force refresh its...

STORM-524 : Add a click event on the L$ balance so to force refresh its content, modified tooltip to mention this
parent 39e43036
No related branches found
No related tags found
No related merge requests found
...@@ -115,6 +115,7 @@ LLStatusBar::LLStatusBar(const LLRect& rect) ...@@ -115,6 +115,7 @@ LLStatusBar::LLStatusBar(const LLRect& rect)
mSGBandwidth(NULL), mSGBandwidth(NULL),
mSGPacketLoss(NULL), mSGPacketLoss(NULL),
mBtnVolume(NULL), mBtnVolume(NULL),
mBoxBalance(NULL),
mBalance(0), mBalance(0),
mHealth(100), mHealth(100),
mSquareMetersCredit(0), mSquareMetersCredit(0),
...@@ -168,6 +169,9 @@ BOOL LLStatusBar::postBuild() ...@@ -168,6 +169,9 @@ BOOL LLStatusBar::postBuild()
getChild<LLUICtrl>("buyL")->setCommitCallback( getChild<LLUICtrl>("buyL")->setCommitCallback(
boost::bind(&LLStatusBar::onClickBuyCurrency, this)); boost::bind(&LLStatusBar::onClickBuyCurrency, this));
mBoxBalance = getChild<LLTextBox>("balance");
mBoxBalance->setClickedCallback( &LLStatusBar::onClickBalance, this );
mBtnVolume = getChild<LLButton>( "volume_btn" ); mBtnVolume = getChild<LLButton>( "volume_btn" );
mBtnVolume->setClickedCallback( onClickVolume, this ); mBtnVolume->setClickedCallback( onClickVolume, this );
mBtnVolume->setMouseEnterCallback(boost::bind(&LLStatusBar::onMouseEnterVolume, this)); mBtnVolume->setMouseEnterCallback(boost::bind(&LLStatusBar::onMouseEnterVolume, this));
...@@ -304,6 +308,7 @@ void LLStatusBar::setVisibleForMouselook(bool visible) ...@@ -304,6 +308,7 @@ void LLStatusBar::setVisibleForMouselook(bool visible)
{ {
mTextTime->setVisible(visible); mTextTime->setVisible(visible);
getChild<LLUICtrl>("balance_bg")->setVisible(visible); getChild<LLUICtrl>("balance_bg")->setVisible(visible);
mBoxBalance->setVisible(visible);
mBtnVolume->setVisible(visible); mBtnVolume->setVisible(visible);
mMediaToggle->setVisible(visible); mMediaToggle->setVisible(visible);
mSGBandwidth->setVisible(visible); mSGBandwidth->setVisible(visible);
...@@ -330,16 +335,15 @@ void LLStatusBar::setBalance(S32 balance) ...@@ -330,16 +335,15 @@ void LLStatusBar::setBalance(S32 balance)
std::string money_str = LLResMgr::getInstance()->getMonetaryString( balance ); std::string money_str = LLResMgr::getInstance()->getMonetaryString( balance );
LLTextBox* balance_box = getChild<LLTextBox>("balance");
LLStringUtil::format_map_t string_args; LLStringUtil::format_map_t string_args;
string_args["[AMT]"] = llformat("%s", money_str.c_str()); string_args["[AMT]"] = llformat("%s", money_str.c_str());
std::string label_str = getString("buycurrencylabel", string_args); std::string label_str = getString("buycurrencylabel", string_args);
balance_box->setValue(label_str); mBoxBalance->setValue(label_str);
// Resize the L$ balance background to be wide enough for your balance plus the buy button // Resize the L$ balance background to be wide enough for your balance plus the buy button
{ {
const S32 HPAD = 24; const S32 HPAD = 24;
LLRect balance_rect = balance_box->getTextBoundingRect(); LLRect balance_rect = mBoxBalance->getTextBoundingRect();
LLRect buy_rect = getChildView("buyL")->getRect(); LLRect buy_rect = getChildView("buyL")->getRect();
LLView* balance_bg_view = getChildView("balance_bg"); LLView* balance_bg_view = getChildView("balance_bg");
LLRect balance_bg_rect = balance_bg_view->getRect(); LLRect balance_bg_rect = balance_bg_view->getRect();
...@@ -505,6 +509,14 @@ static void onClickVolume(void* data) ...@@ -505,6 +509,14 @@ static void onClickVolume(void* data)
LLAppViewer::instance()->setMasterSystemAudioMute(!mute_audio); LLAppViewer::instance()->setMasterSystemAudioMute(!mute_audio);
} }
//static
void LLStatusBar::onClickBalance(void* )
{
// Force a balance request message:
LLStatusBar::sendMoneyBalanceRequest();
// The refresh of the display (call to setBalance()) will be done by process_money_balance_reply()
}
//static //static
void LLStatusBar::onClickMediaToggle(void* data) void LLStatusBar::onClickMediaToggle(void* data)
{ {
......
...@@ -94,6 +94,7 @@ class LLStatusBar ...@@ -94,6 +94,7 @@ class LLStatusBar
void onClickScreen(S32 x, S32 y); void onClickScreen(S32 x, S32 y);
static void onClickMediaToggle(void* data); static void onClickMediaToggle(void* data);
static void onClickBalance(void* data);
private: private:
LLTextBox *mTextTime; LLTextBox *mTextTime;
...@@ -102,6 +103,7 @@ class LLStatusBar ...@@ -102,6 +103,7 @@ class LLStatusBar
LLStatGraph *mSGPacketLoss; LLStatGraph *mSGPacketLoss;
LLButton *mBtnVolume; LLButton *mBtnVolume;
LLTextBox *mBoxBalance;
LLButton *mMediaToggle; LLButton *mMediaToggle;
LLView* mScriptOut; LLView* mScriptOut;
LLFrameTimer mClockUpdateTimer; LLFrameTimer mClockUpdateTimer;
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
height="18" height="18"
left="0" left="0"
name="balance" name="balance"
tool_tip="My Balance" tool_tip="Click to refresh your L$ balance"
v_pad="4" v_pad="4"
top="0" top="0"
wrap="false" wrap="false"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment