summaryrefslogtreecommitdiff
path: root/indra/newview/llstatusbar.cpp
diff options
context:
space:
mode:
authorTofu Linden <tofu.linden@lindenlab.com>2010-08-24 18:37:53 +0100
committerTofu Linden <tofu.linden@lindenlab.com>2010-08-24 18:37:53 +0100
commit6ba23344c95157793af9e4154933ae8df61630e8 (patch)
treee12956cbe7a0082bbaaa545cb80d9e86b13f88e8 /indra/newview/llstatusbar.cpp
parent01d06a3572c533f810f8f42e7ae9c55051f34aaf (diff)
parent46e6135eef90b7ff0f08b12384a9aafc1a3e91e1 (diff)
merge heads. whew.
Diffstat (limited to 'indra/newview/llstatusbar.cpp')
-rw-r--r--indra/newview/llstatusbar.cpp103
1 files changed, 28 insertions, 75 deletions
diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp
index af011d8599..b622e98971 100644
--- a/indra/newview/llstatusbar.cpp
+++ b/indra/newview/llstatusbar.cpp
@@ -105,8 +105,6 @@ const F32 ICON_TIMER_EXPIRY = 3.f; // How long the balance and health icons sho
const F32 ICON_FLASH_FREQUENCY = 2.f;
const S32 TEXT_HEIGHT = 18;
-static void onClickHealth(void*);
-static void onClickScriptDebug(void*);
static void onClickVolume(void*);
std::vector<std::string> LLStatusBar::sDays;
@@ -189,9 +187,6 @@ BOOL LLStatusBar::postBuild()
gSavedSettings.getControl("MuteAudio")->getSignal()->connect(boost::bind(&LLStatusBar::onVolumeChanged, this, _2));
- childSetAction("scriptout", onClickScriptDebug, this);
- childSetAction("health", onClickHealth, this);
-
// Adding Net Stat Graph
S32 x = getRect().getWidth() - 2;
S32 y = 0;
@@ -229,7 +224,7 @@ BOOL LLStatusBar::postBuild()
mSGPacketLoss->mPerSec = FALSE;
addChild(mSGPacketLoss);
- childSetActionTextbox("stat_btn", onClickStatGraph);
+ getChild<LLTextBox>("stat_btn")->setClickedCallback(onClickStatGraph);
mPanelVolumePulldown = new LLPanelVolumePulldown();
addChild(mPanelVolumePulldown);
@@ -241,14 +236,17 @@ BOOL LLStatusBar::postBuild()
mPanelNearByMedia->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT);
mPanelNearByMedia->setVisible(FALSE);
+ mScriptOut = getChildView("scriptout");
+
return TRUE;
}
// Per-frame updates of visibility
void LLStatusBar::refresh()
{
- bool net_stats_visible = gSavedSettings.getBOOL("ShowNetStats");
-
+ static LLCachedControl<bool> show_net_stats(gSavedSettings, "ShowNetStats", false);
+ bool net_stats_visible = show_net_stats;
+
if (net_stats_visible)
{
// Adding Net Stat Meter back in
@@ -260,26 +258,30 @@ void LLStatusBar::refresh()
mSGBandwidth->setThreshold(2, bwtotal);
}
- // Get current UTC time, adjusted for the user's clock
- // being off.
- time_t utc_time;
- utc_time = time_corrected();
-
- std::string timeStr = getString("time");
- LLSD substitution;
- substitution["datetime"] = (S32) utc_time;
- LLStringUtil::format (timeStr, substitution);
- mTextTime->setText(timeStr);
-
- // set the tooltip to have the date
- std::string dtStr = getString("timeTooltip");
- LLStringUtil::format (dtStr, substitution);
- mTextTime->setToolTip (dtStr);
+ // update clock every 10 seconds
+ if(mClockUpdateTimer.getElapsedTimeF32() > 10.f)
+ {
+ mClockUpdateTimer.reset();
+
+ // Get current UTC time, adjusted for the user's clock
+ // being off.
+ time_t utc_time;
+ utc_time = time_corrected();
+
+ std::string timeStr = getString("time");
+ LLSD substitution;
+ substitution["datetime"] = (S32) utc_time;
+ LLStringUtil::format (timeStr, substitution);
+ mTextTime->setText(timeStr);
+
+ // set the tooltip to have the date
+ std::string dtStr = getString("timeTooltip");
+ LLStringUtil::format (dtStr, substitution);
+ mTextTime->setToolTip (dtStr);
+ }
LLRect r;
const S32 MENU_RIGHT = gMenuBarView->getRightmostMenuEdge();
- S32 x = MENU_RIGHT + MENU_PARCEL_SPACING;
- S32 y = 0;
// reshape menu bar to its content's width
if (MENU_RIGHT != gMenuBarView->getRect().getWidth())
@@ -287,48 +289,9 @@ void LLStatusBar::refresh()
gMenuBarView->reshape(MENU_RIGHT, gMenuBarView->getRect().getHeight());
}
- LLViewerRegion *region = gAgent.getRegion();
- LLParcel *parcel = LLViewerParcelMgr::getInstance()->getAgentParcel();
-
- LLRect buttonRect;
-
- if (LLHUDIcon::iconsNearby())
- {
- childGetRect( "scriptout", buttonRect );
- r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight());
- childSetRect("scriptout",r);
- childSetVisible("scriptout", true);
- x += buttonRect.getWidth();
- }
- else
- {
- childSetVisible("scriptout", false);
- }
-
- if (gAgentCamera.getCameraMode() == CAMERA_MODE_MOUSELOOK &&
- ((region && region->getAllowDamage()) || (parcel && parcel->getAllowDamage())))
- {
- // set visibility based on flashing
- if( mHealthTimer->hasExpired() )
- {
- childSetVisible("health", true);
- }
- else
- {
- BOOL flash = S32(mHealthTimer->getElapsedSeconds() * ICON_FLASH_FREQUENCY) & 1;
- childSetVisible("health", flash);
- }
-
- // Health
- childGetRect( "health", buttonRect );
- r.setOriginAndSize( x, y, buttonRect.getWidth(), buttonRect.getHeight());
- childSetRect("health", r);
- x += buttonRect.getWidth();
- }
-
mSGBandwidth->setVisible(net_stats_visible);
mSGPacketLoss->setVisible(net_stats_visible);
- childSetEnabled("stat_btn", net_stats_visible);
+ getChildView("stat_btn")->setEnabled(net_stats_visible);
// update the master volume button state
bool mute_audio = LLAppViewer::instance()->getMasterSystemAudioMute();
@@ -493,16 +456,6 @@ void LLStatusBar::onClickBuyCurrency()
LLBuyCurrencyHTML::openCurrencyFloater();
}
-static void onClickHealth(void* )
-{
- LLNotificationsUtil::add("NotSafe");
-}
-
-static void onClickScriptDebug(void*)
-{
- LLFloaterScriptDebug::show(LLUUID::null);
-}
-
void LLStatusBar::onMouseEnterVolume()
{
LLButton* volbtn = getChild<LLButton>( "volume_btn" );