@@ -114,6 +114,8 @@ LLStatusBar::LLStatusBar(const LLRect& rect)
114
114
mBtnVolume(NULL ),
115
115
mBoxBalance(NULL ),
116
116
mBalance(0 ),
117
+ mBalanceClicked(false ),
118
+ mObscureBalance(false ),
117
119
mHealth(100 ),
118
120
mSquareMetersCredit(0 ),
119
121
mSquareMetersCommitted(0 ),
@@ -125,20 +127,11 @@ LLStatusBar::LLStatusBar(const LLRect& rect)
125
127
// status bar can possible overlay menus?
126
128
setMouseOpaque (false );
127
129
128
- mBalanceTimer = new LLFrameTimer ();
129
- mHealthTimer = new LLFrameTimer ();
130
-
131
130
buildFromFile (" panel_status_bar.xml" );
132
131
}
133
132
134
133
LLStatusBar::~LLStatusBar ()
135
134
{
136
- delete mBalanceTimer ;
137
- mBalanceTimer = NULL ;
138
-
139
- delete mHealthTimer ;
140
- mHealthTimer = NULL ;
141
-
142
135
// LLView destructor cleans up children
143
136
}
144
137
@@ -171,7 +164,8 @@ bool LLStatusBar::postBuild()
171
164
getChild<LLUICtrl>(" goShop" )->setCommitCallback (boost::bind (&LLWeb::loadURL, gSavedSettings .getString (" MarketplaceURL" ), LLStringUtil::null, LLStringUtil::null));
172
165
173
166
mBoxBalance = getChild<LLTextBox>(" balance" );
174
- mBoxBalance ->setClickedCallback ( &LLStatusBar::onClickBalance, this );
167
+ mBoxBalance ->setClickedCallback (&LLStatusBar::onClickRefreshBalance, this );
168
+ mBoxBalance ->setDoubleClickCallback ([this ](LLUICtrl*, S32 x, S32 y, MASK mask) { onClickToggleBalance (); });
175
169
176
170
mIconPresetsCamera = getChild<LLIconCtrl>( " presets_icon_camera" );
177
171
mIconPresetsCamera ->setMouseEnterCallback (boost::bind (&LLStatusBar::onMouseEnterPresetsCamera, this ));
@@ -191,12 +185,14 @@ bool LLStatusBar::postBuild()
191
185
192
186
gSavedSettings .getControl (" MuteAudio" )->getSignal ()->connect (boost::bind (&LLStatusBar::onVolumeChanged, this , _2));
193
187
gSavedSettings .getControl (" EnableVoiceChat" )->getSignal ()->connect (boost::bind (&LLStatusBar::onVoiceChanged, this , _2));
188
+ gSavedSettings .getControl (" ObscureBalanceInStatusBar" )->getSignal ()->connect (boost::bind (&LLStatusBar::onObscureBalanceChanged, this , _2));
194
189
195
190
if (!gSavedSettings .getBOOL (" EnableVoiceChat" ) && LLAppViewer::instance ()->isSecondInstance ())
196
191
{
197
192
// Indicate that second instance started without sound
198
193
mBtnVolume ->setImageUnselected (LLUI::getUIImage (" VoiceMute_Off" ));
199
194
}
195
+ mObscureBalance = gSavedSettings .getBOOL (" ObscureBalanceInStatusBar" );
200
196
201
197
// Adding Net Stat Graph
202
198
S32 x = getRect ().getWidth () - 2 ;
@@ -319,6 +315,12 @@ void LLStatusBar::refresh()
319
315
mTextTime ->setToolTip (dtStr);
320
316
}
321
317
318
+ if (mBalanceClicked && mBalanceClickTimer .getElapsedTimeF32 () > 1 .f )
319
+ {
320
+ mBalanceClicked = false ;
321
+ sendMoneyBalanceRequest ();
322
+ }
323
+
322
324
LLRect r;
323
325
const S32 MENU_RIGHT = gMenuBarView ->getRightmostMenuEdge ();
324
326
@@ -384,9 +386,17 @@ void LLStatusBar::setBalance(S32 balance)
384
386
std::string money_str = LLResMgr::getInstance ()->getMonetaryString ( balance );
385
387
386
388
LLStringUtil::format_map_t string_args;
387
- string_args[" [AMT]" ] = llformat (" %s" , money_str.c_str ());
389
+ if (mObscureBalance )
390
+ {
391
+ string_args[" [AMT]" ] = " ****" ;
392
+ }
393
+ else
394
+ {
395
+ string_args[" [AMT]" ] = llformat (" %s" , money_str.c_str ());
396
+ }
388
397
std::string label_str = getString (" buycurrencylabel" , string_args);
389
398
mBoxBalance ->setValue (label_str);
399
+ mBoxBalance ->setToolTipArg (LLStringExplicit (" [AMT]" ), llformat (" %s" , money_str.c_str ()));
390
400
391
401
updateBalancePanelPosition ();
392
402
@@ -406,8 +416,6 @@ void LLStatusBar::setBalance(S32 balance)
406
416
407
417
if ( balance != mBalance )
408
418
{
409
- mBalanceTimer ->reset ();
410
- mBalanceTimer ->setTimerExpirySec ( ICON_TIMER_EXPIRY );
411
419
mBalance = balance;
412
420
}
413
421
}
@@ -459,9 +467,6 @@ void LLStatusBar::setHealth(S32 health)
459
467
}
460
468
}
461
469
}
462
-
463
- mHealthTimer ->reset ();
464
- mHealthTimer ->setTimerExpirySec ( ICON_TIMER_EXPIRY );
465
470
}
466
471
467
472
mHealth = health;
@@ -621,13 +626,27 @@ static void onClickVolume(void* data)
621
626
}
622
627
623
628
// static
624
- void LLStatusBar::onClickBalance (void * )
629
+ void LLStatusBar::onClickRefreshBalance (void * data )
625
630
{
626
- // Force a balance request message:
627
- LLStatusBar::sendMoneyBalanceRequest ();
631
+ LLStatusBar* status_bar = (LLStatusBar*)data;
632
+
633
+ if (!status_bar->mBalanceClicked )
634
+ {
635
+ // Schedule a balance request message:
636
+ status_bar->mBalanceClicked = true ;
637
+ status_bar->mBalanceClickTimer .reset ();
638
+ }
628
639
// The refresh of the display (call to setBalance()) will be done by process_money_balance_reply()
629
640
}
630
641
642
+ void LLStatusBar::onClickToggleBalance ()
643
+ {
644
+ mObscureBalance = !mObscureBalance ;
645
+ gSavedSettings .setBOOL (" ObscureBalanceInStatusBar" , mObscureBalance );
646
+ setBalance (mBalance );
647
+ mBalanceClicked = false ; // supress click
648
+ }
649
+
631
650
// static
632
651
void LLStatusBar::onClickMediaToggle (void * data)
633
652
{
@@ -657,6 +676,12 @@ void LLStatusBar::onVoiceChanged(const LLSD& newvalue)
657
676
refresh ();
658
677
}
659
678
679
+ void LLStatusBar::onObscureBalanceChanged (const LLSD& newvalue)
680
+ {
681
+ mObscureBalance = newvalue.asBoolean ();
682
+ setBalance (mBalance );
683
+ }
684
+
660
685
void LLStatusBar::onUpdateFilterTerm ()
661
686
{
662
687
LLWString searchValue = utf8str_to_wstring ( mFilterEdit ->getValue () );
0 commit comments