diff options
author | Jacek Antonelli | 2008-09-06 18:24:57 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-09-06 18:25:07 -0500 |
commit | 798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch) | |
tree | 1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/newview/llstatusbar.cpp | |
parent | Second Life viewer sources 1.20.15 (diff) | |
download | meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2 meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz |
Second Life viewer sources 1.21.0-RC
Diffstat (limited to 'linden/indra/newview/llstatusbar.cpp')
-rw-r--r-- | linden/indra/newview/llstatusbar.cpp | 133 |
1 files changed, 67 insertions, 66 deletions
diff --git a/linden/indra/newview/llstatusbar.cpp b/linden/indra/newview/llstatusbar.cpp index 42acdcc..2f9227a 100644 --- a/linden/indra/newview/llstatusbar.cpp +++ b/linden/indra/newview/llstatusbar.cpp | |||
@@ -1,33 +1,33 @@ | |||
1 | /** | 1 | /** |
2 | * @file llstatusbar.cpp | 2 | * @file llstatusbar.cpp |
3 | * @brief LLStatusBar class implementation | 3 | * @brief LLStatusBar class implementation |
4 | * | 4 | * |
5 | * $LicenseInfo:firstyear=2002&license=viewergpl$ | 5 | * $LicenseInfo:firstyear=2002&license=viewergpl$ |
6 | * | 6 | * |
7 | * Copyright (c) 2002-2008, Linden Research, Inc. | 7 | * Copyright (c) 2002-2008, Linden Research, Inc. |
8 | * | 8 | * |
9 | * Second Life Viewer Source Code | 9 | * Second Life Viewer Source Code |
10 | * The source code in this file ("Source Code") is provided by Linden Lab | 10 | * The source code in this file ("Source Code") is provided by Linden Lab |
11 | * to you under the terms of the GNU General Public License, version 2.0 | 11 | * to you under the terms of the GNU General Public License, version 2.0 |
12 | * ("GPL"), unless you have obtained a separate licensing agreement | 12 | * ("GPL"), unless you have obtained a separate licensing agreement |
13 | * ("Other License"), formally executed by you and Linden Lab. Terms of | 13 | * ("Other License"), formally executed by you and Linden Lab. Terms of |
14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or | 14 | * the GPL can be found in doc/GPL-license.txt in this distribution, or |
15 | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 | 15 | * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 |
16 | * | 16 | * |
17 | * There are special exceptions to the terms and conditions of the GPL as | 17 | * There are special exceptions to the terms and conditions of the GPL as |
18 | * it is applied to this Source Code. View the full text of the exception | 18 | * it is applied to this Source Code. View the full text of the exception |
19 | * in the file doc/FLOSS-exception.txt in this software distribution, or | 19 | * in the file doc/FLOSS-exception.txt in this software distribution, or |
20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception | 20 | * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception |
21 | * | 21 | * |
22 | * By copying, modifying or distributing this software, you acknowledge | 22 | * By copying, modifying or distributing this software, you acknowledge |
23 | * that you have read and understood your obligations described above, | 23 | * that you have read and understood your obligations described above, |
24 | * and agree to abide by those obligations. | 24 | * and agree to abide by those obligations. |
25 | * | 25 | * |
26 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO | 26 | * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO |
27 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, | 27 | * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, |
28 | * COMPLETENESS OR PERFORMANCE. | 28 | * COMPLETENESS OR PERFORMANCE. |
29 | * $/LicenseInfo$ | 29 | * $/LicenseInfo$ |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include "llviewerprecompiledheaders.h" | 32 | #include "llviewerprecompiledheaders.h" |
33 | 33 | ||
@@ -121,10 +121,10 @@ const U32 LLStatusBar::MAX_DATE_STRING_LENGTH = 2000; | |||
121 | 121 | ||
122 | LLStatusBar::LLStatusBar(const std::string& name, const LLRect& rect) | 122 | LLStatusBar::LLStatusBar(const std::string& name, const LLRect& rect) |
123 | : LLPanel(name, LLRect(), FALSE), // not mouse opaque | 123 | : LLPanel(name, LLRect(), FALSE), // not mouse opaque |
124 | mBalance(0), | 124 | mBalance(0), |
125 | mHealth(100), | 125 | mHealth(100), |
126 | mSquareMetersCredit(0), | 126 | mSquareMetersCredit(0), |
127 | mSquareMetersCommitted(0) | 127 | mSquareMetersCommitted(0) |
128 | { | 128 | { |
129 | // status bar can possible overlay menus? | 129 | // status bar can possible overlay menus? |
130 | setMouseOpaque(FALSE); | 130 | setMouseOpaque(FALSE); |
@@ -150,7 +150,7 @@ LLStatusBar::LLStatusBar(const std::string& name, const LLRect& rect) | |||
150 | 150 | ||
151 | mTextHealth = getChild<LLTextBox>("HealthText" ); | 151 | mTextHealth = getChild<LLTextBox>("HealthText" ); |
152 | mTextTime = getChild<LLTextBox>("TimeText" ); | 152 | mTextTime = getChild<LLTextBox>("TimeText" ); |
153 | 153 | ||
154 | childSetAction("scriptout", onClickScriptDebug, this); | 154 | childSetAction("scriptout", onClickScriptDebug, this); |
155 | childSetAction("health", onClickHealth, this); | 155 | childSetAction("health", onClickHealth, this); |
156 | childSetAction("no_fly", onClickFly, this); | 156 | childSetAction("no_fly", onClickFly, this); |
@@ -179,9 +179,9 @@ LLStatusBar::LLStatusBar(const std::string& name, const LLRect& rect) | |||
179 | mSGBandwidth = new LLStatGraph("BandwidthGraph", r); | 179 | mSGBandwidth = new LLStatGraph("BandwidthGraph", r); |
180 | mSGBandwidth->setFollows(FOLLOWS_BOTTOM | FOLLOWS_RIGHT); | 180 | mSGBandwidth->setFollows(FOLLOWS_BOTTOM | FOLLOWS_RIGHT); |
181 | mSGBandwidth->setStat(&LLViewerStats::getInstance()->mKBitStat); | 181 | mSGBandwidth->setStat(&LLViewerStats::getInstance()->mKBitStat); |
182 | LLString text = childGetText("bandwidth_tooltip") + " "; | 182 | std::string text = childGetText("bandwidth_tooltip") + " "; |
183 | LLUIString bandwidth_tooltip = text; // get the text from XML until this widget is XML driven | 183 | LLUIString bandwidth_tooltip = text; // get the text from XML until this widget is XML driven |
184 | mSGBandwidth->setLabel(bandwidth_tooltip.getString().c_str()); | 184 | mSGBandwidth->setLabel(bandwidth_tooltip.getString()); |
185 | mSGBandwidth->setUnits("Kbps"); | 185 | mSGBandwidth->setUnits("Kbps"); |
186 | mSGBandwidth->setPrecision(0); | 186 | mSGBandwidth->setPrecision(0); |
187 | mSGBandwidth->setMouseOpaque(FALSE); | 187 | mSGBandwidth->setMouseOpaque(FALSE); |
@@ -194,7 +194,7 @@ LLStatusBar::LLStatusBar(const std::string& name, const LLRect& rect) | |||
194 | mSGPacketLoss->setStat(&LLViewerStats::getInstance()->mPacketsLostPercentStat); | 194 | mSGPacketLoss->setStat(&LLViewerStats::getInstance()->mPacketsLostPercentStat); |
195 | text = childGetText("packet_loss_tooltip") + " "; | 195 | text = childGetText("packet_loss_tooltip") + " "; |
196 | LLUIString packet_loss_tooltip = text; // get the text from XML until this widget is XML driven | 196 | LLUIString packet_loss_tooltip = text; // get the text from XML until this widget is XML driven |
197 | mSGPacketLoss->setLabel(packet_loss_tooltip.getString().c_str()); | 197 | mSGPacketLoss->setLabel(packet_loss_tooltip.getString()); |
198 | mSGPacketLoss->setUnits("%"); | 198 | mSGPacketLoss->setUnits("%"); |
199 | mSGPacketLoss->setMin(0.f); | 199 | mSGPacketLoss->setMin(0.f); |
200 | mSGPacketLoss->setMax(5.f); | 200 | mSGPacketLoss->setMax(5.f); |
@@ -233,8 +233,8 @@ void LLStatusBar::draw() | |||
233 | if (isBackgroundVisible()) | 233 | if (isBackgroundVisible()) |
234 | { | 234 | { |
235 | gl_drop_shadow(0, getRect().getHeight(), getRect().getWidth(), 0, | 235 | gl_drop_shadow(0, getRect().getHeight(), getRect().getWidth(), 0, |
236 | LLUI::sColorsGroup->getColor("ColorDropShadow"), | 236 | LLUI::sColorsGroup->getColor("ColorDropShadow"), |
237 | LLUI::sConfigGroup->getS32("DropShadowFloater") ); | 237 | LLUI::sConfigGroup->getS32("DropShadowFloater") ); |
238 | } | 238 | } |
239 | LLPanel::draw(); | 239 | LLPanel::draw(); |
240 | } | 240 | } |
@@ -252,10 +252,10 @@ void LLStatusBar::refresh() | |||
252 | mSGBandwidth->setThreshold(2, bwtotal); | 252 | mSGBandwidth->setThreshold(2, bwtotal); |
253 | 253 | ||
254 | // *TODO: Localize / translate time | 254 | // *TODO: Localize / translate time |
255 | 255 | ||
256 | // Get current UTC time, adjusted for the user's clock | 256 | // Get current UTC time, adjusted for the user's clock |
257 | // being off. | 257 | // being off. |
258 | U32 utc_time; | 258 | time_t utc_time; |
259 | utc_time = time_corrected(); | 259 | utc_time = time_corrected(); |
260 | 260 | ||
261 | // There's only one internal tm buffer. | 261 | // There's only one internal tm buffer. |
@@ -284,23 +284,23 @@ void LLStatusBar::refresh() | |||
284 | if (hour == 0) hour = 12; | 284 | if (hour == 0) hour = 12; |
285 | std::ostringstream t; | 285 | std::ostringstream t; |
286 | t << std::setfill(' ') << std::setw(2) << hour << ":" | 286 | t << std::setfill(' ') << std::setw(2) << hour << ":" |
287 | << std::setfill('0') << std::setw(2) << min | 287 | << std::setfill('0') << std::setw(2) << min |
288 | << " " << am_pm << " " << tz; | 288 | << " " << am_pm << " " << tz; |
289 | mTextTime->setText(t.str()); | 289 | mTextTime->setText(t.str()); |
290 | 290 | ||
291 | // Year starts at 1900, set the tooltip to have the date | 291 | // Year starts at 1900, set the tooltip to have the date |
292 | std::ostringstream date; | 292 | std::ostringstream date; |
293 | date << sDays[internal_time->tm_wday] << ", " | 293 | date << sDays[internal_time->tm_wday] << ", " |
294 | << std::setfill('0') << std::setw(2) << internal_time->tm_mday << " " | 294 | << std::setfill('0') << std::setw(2) << internal_time->tm_mday << " " |
295 | << sMonths[internal_time->tm_mon] << " " | 295 | << sMonths[internal_time->tm_mon] << " " |
296 | << internal_time->tm_year + 1900; | 296 | << internal_time->tm_year + 1900; |
297 | mTextTime->setToolTip(date.str()); | 297 | mTextTime->setToolTip(date.str()); |
298 | 298 | ||
299 | LLRect r; | 299 | LLRect r; |
300 | const S32 MENU_RIGHT = gMenuBarView->getRightmostMenuEdge(); | 300 | const S32 MENU_RIGHT = gMenuBarView->getRightmostMenuEdge(); |
301 | S32 x = MENU_RIGHT + MENU_PARCEL_SPACING; | 301 | S32 x = MENU_RIGHT + MENU_PARCEL_SPACING; |
302 | S32 y = 0; | 302 | S32 y = 0; |
303 | 303 | ||
304 | bool search_visible = gSavedSettings.getBOOL("ShowSearchBar"); | 304 | bool search_visible = gSavedSettings.getBOOL("ShowSearchBar"); |
305 | 305 | ||
306 | // reshape menu bar to its content's width | 306 | // reshape menu bar to its content's width |
@@ -348,7 +348,7 @@ void LLStatusBar::refresh() | |||
348 | childSetRect("health", r); | 348 | childSetRect("health", r); |
349 | x += buttonRect.getWidth(); | 349 | x += buttonRect.getWidth(); |
350 | 350 | ||
351 | const S32 health_width = S32( LLFontGL::sSansSerifSmall->getWidth("100%") ); | 351 | const S32 health_width = S32( LLFontGL::sSansSerifSmall->getWidth(std::string("100%")) ); |
352 | r.set(x, y+TEXT_HEIGHT - 2, x+health_width, y); | 352 | r.set(x, y+TEXT_HEIGHT - 2, x+health_width, y); |
353 | mTextHealth->setRect(r); | 353 | mTextHealth->setRect(r); |
354 | x += health_width; | 354 | x += health_width; |
@@ -394,8 +394,8 @@ void LLStatusBar::refresh() | |||
394 | BOOL no_scripts = FALSE; | 394 | BOOL no_scripts = FALSE; |
395 | if((region | 395 | if((region |
396 | && ((region->getRegionFlags() & REGION_FLAGS_SKIP_SCRIPTS) | 396 | && ((region->getRegionFlags() & REGION_FLAGS_SKIP_SCRIPTS) |
397 | || (region->getRegionFlags() & REGION_FLAGS_ESTATE_SKIP_SCRIPTS))) | 397 | || (region->getRegionFlags() & REGION_FLAGS_ESTATE_SKIP_SCRIPTS))) |
398 | || (parcel && !parcel->getAllowOtherScripts())) | 398 | || (parcel && !parcel->getAllowOtherScripts())) |
399 | { | 399 | { |
400 | no_scripts = TRUE; | 400 | no_scripts = TRUE; |
401 | } | 401 | } |
@@ -429,7 +429,7 @@ void LLStatusBar::refresh() | |||
429 | childSetVisible("restrictpush", FALSE); | 429 | childSetVisible("restrictpush", FALSE); |
430 | } | 430 | } |
431 | 431 | ||
432 | BOOL have_voice = parcel && parcel->getVoiceEnabled(); | 432 | BOOL have_voice = parcel && parcel->getParcelFlagAllowVoice(); |
433 | if (have_voice) | 433 | if (have_voice) |
434 | { | 434 | { |
435 | childSetVisible("status_no_voice", FALSE); | 435 | childSetVisible("status_no_voice", FALSE); |
@@ -457,7 +457,7 @@ void LLStatusBar::refresh() | |||
457 | x += buttonRect.getWidth(); | 457 | x += buttonRect.getWidth(); |
458 | } | 458 | } |
459 | 459 | ||
460 | LLString location_name; | 460 | std::string location_name; |
461 | if (region) | 461 | if (region) |
462 | { | 462 | { |
463 | const LLVector3& agent_pos_region = gAgent.getPositionAgent(); | 463 | const LLVector3& agent_pos_region = gAgent.getPositionAgent(); |
@@ -487,14 +487,14 @@ void LLStatusBar::refresh() | |||
487 | 487 | ||
488 | mRegionDetails.mTime = mTextTime->getText(); | 488 | mRegionDetails.mTime = mTextTime->getText(); |
489 | mRegionDetails.mBalance = mBalance; | 489 | mRegionDetails.mBalance = mBalance; |
490 | mRegionDetails.mAccesString = region->getSimAccessString(); | 490 | mRegionDetails.mAccessString = region->getSimAccessString(); |
491 | mRegionDetails.mPing = region->getNetDetailsForLCD(); | 491 | mRegionDetails.mPing = region->getNetDetailsForLCD(); |
492 | if (parcel && !parcel->getName().empty()) | 492 | if (parcel) |
493 | { | 493 | { |
494 | location_name = region->getName() | 494 | location_name = region->getName() |
495 | + llformat(" %d, %d, %d (%s) - %s", | 495 | + llformat(" %d, %d, %d (%s) - %s", |
496 | pos_x, pos_y, pos_z, | 496 | pos_x, pos_y, pos_z, |
497 | region->getSimAccessString(), | 497 | region->getSimAccessString().c_str(), |
498 | parcel->getName().c_str()); | 498 | parcel->getName().c_str()); |
499 | 499 | ||
500 | // keep these around for the LCD to use | 500 | // keep these around for the LCD to use |
@@ -503,6 +503,7 @@ void LLStatusBar::refresh() | |||
503 | mRegionDetails.mX = pos_x; | 503 | mRegionDetails.mX = pos_x; |
504 | mRegionDetails.mY = pos_y; | 504 | mRegionDetails.mY = pos_y; |
505 | mRegionDetails.mZ = pos_z; | 505 | mRegionDetails.mZ = pos_z; |
506 | |||
506 | mRegionDetails.mArea = parcel->getArea(); | 507 | mRegionDetails.mArea = parcel->getArea(); |
507 | mRegionDetails.mForSale = parcel->getForSale(); | 508 | mRegionDetails.mForSale = parcel->getForSale(); |
508 | mRegionDetails.mTraffic = LLViewerParcelMgr::getInstance()->getDwelling(); | 509 | mRegionDetails.mTraffic = LLViewerParcelMgr::getInstance()->getDwelling(); |
@@ -536,7 +537,7 @@ void LLStatusBar::refresh() | |||
536 | location_name = region->getName() | 537 | location_name = region->getName() |
537 | + llformat(" %d, %d, %d (%s)", | 538 | + llformat(" %d, %d, %d (%s)", |
538 | pos_x, pos_y, pos_z, | 539 | pos_x, pos_y, pos_z, |
539 | region->getSimAccessString()); | 540 | region->getSimAccessString().c_str()); |
540 | // keep these around for the LCD to use | 541 | // keep these around for the LCD to use |
541 | mRegionDetails.mRegionName = region->getName(); | 542 | mRegionDetails.mRegionName = region->getName(); |
542 | mRegionDetails.mParcelName = "Unknown"; | 543 | mRegionDetails.mParcelName = "Unknown"; |
@@ -557,7 +558,7 @@ void LLStatusBar::refresh() | |||
557 | // keep these around for the LCD to use | 558 | // keep these around for the LCD to use |
558 | mRegionDetails.mRegionName = "Unknown"; | 559 | mRegionDetails.mRegionName = "Unknown"; |
559 | mRegionDetails.mParcelName = "Unknown"; | 560 | mRegionDetails.mParcelName = "Unknown"; |
560 | mRegionDetails.mAccesString = "Unknown"; | 561 | mRegionDetails.mAccessString = "Unknown"; |
561 | mRegionDetails.mX = 0; | 562 | mRegionDetails.mX = 0; |
562 | mRegionDetails.mY = 0; | 563 | mRegionDetails.mY = 0; |
563 | mRegionDetails.mZ = 0; | 564 | mRegionDetails.mZ = 0; |
@@ -655,8 +656,8 @@ void LLStatusBar::creditBalance(S32 credit) | |||
655 | 656 | ||
656 | void LLStatusBar::setBalance(S32 balance) | 657 | void LLStatusBar::setBalance(S32 balance) |
657 | { | 658 | { |
658 | LLString money_str = LLResMgr::getInstance()->getMonetaryString( balance ); | 659 | std::string money_str = LLResMgr::getInstance()->getMonetaryString( balance ); |
659 | LLString balance_str = "L$"; | 660 | std::string balance_str = "L$"; |
660 | balance_str += money_str; | 661 | balance_str += money_str; |
661 | mTextBalance->setText( balance_str ); | 662 | mTextBalance->setText( balance_str ); |
662 | 663 | ||
@@ -821,14 +822,14 @@ static void onClickBuyLand(void*) | |||
821 | void LLStatusBar::setupDate() | 822 | void LLStatusBar::setupDate() |
822 | { | 823 | { |
823 | // fill the day array with what's in the xui | 824 | // fill the day array with what's in the xui |
824 | LLString day_list = getString("StatBarDaysOfWeek"); | 825 | std::string day_list = getString("StatBarDaysOfWeek"); |
825 | size_t length = day_list.size(); | 826 | size_t length = day_list.size(); |
826 | 827 | ||
827 | // quick input check | 828 | // quick input check |
828 | if(length < MAX_DATE_STRING_LENGTH) | 829 | if(length < MAX_DATE_STRING_LENGTH) |
829 | { | 830 | { |
830 | // tokenize it and put it in the array | 831 | // tokenize it and put it in the array |
831 | LLString cur_word; | 832 | std::string cur_word; |
832 | for(size_t i = 0; i < length; ++i) | 833 | for(size_t i = 0; i < length; ++i) |
833 | { | 834 | { |
834 | if(day_list[i] == ':') | 835 | if(day_list[i] == ':') |
@@ -838,21 +839,21 @@ void LLStatusBar::setupDate() | |||
838 | } | 839 | } |
839 | else | 840 | else |
840 | { | 841 | { |
841 | cur_word.append(1, day_list.c_str()[i]); | 842 | cur_word.append(1, day_list[i]); |
842 | } | 843 | } |
843 | } | 844 | } |
844 | sDays.push_back(cur_word); | 845 | sDays.push_back(cur_word); |
845 | } | 846 | } |
846 | 847 | ||
847 | // fill the day array with what's in the xui | 848 | // fill the day array with what's in the xui |
848 | LLString month_list = getString( "StatBarMonthsOfYear" ); | 849 | std::string month_list = getString( "StatBarMonthsOfYear" ); |
849 | length = month_list.size(); | 850 | length = month_list.size(); |
850 | 851 | ||
851 | // quick input check | 852 | // quick input check |
852 | if(length < MAX_DATE_STRING_LENGTH) | 853 | if(length < MAX_DATE_STRING_LENGTH) |
853 | { | 854 | { |
854 | // tokenize it and put it in the array | 855 | // tokenize it and put it in the array |
855 | LLString cur_word; | 856 | std::string cur_word; |
856 | for(size_t i = 0; i < length; ++i) | 857 | for(size_t i = 0; i < length; ++i) |
857 | { | 858 | { |
858 | if(month_list[i] == ':') | 859 | if(month_list[i] == ':') |
@@ -862,7 +863,7 @@ void LLStatusBar::setupDate() | |||
862 | } | 863 | } |
863 | else | 864 | else |
864 | { | 865 | { |
865 | cur_word.append(1, month_list.c_str()[i]); | 866 | cur_word.append(1, month_list[i]); |
866 | } | 867 | } |
867 | } | 868 | } |
868 | sMonths.push_back(cur_word); | 869 | sMonths.push_back(cur_word); |
@@ -891,7 +892,7 @@ void LLStatusBar::onCommitSearch(LLUICtrl*, void* data) | |||
891 | void LLStatusBar::onClickSearch(void* data) | 892 | void LLStatusBar::onClickSearch(void* data) |
892 | { | 893 | { |
893 | LLStatusBar* self = (LLStatusBar*)data; | 894 | LLStatusBar* self = (LLStatusBar*)data; |
894 | LLString search_text = self->childGetText("search_editor"); | 895 | std::string search_text = self->childGetText("search_editor"); |
895 | LLFloaterDirectory::showFindAll(search_text); | 896 | LLFloaterDirectory::showFindAll(search_text); |
896 | } | 897 | } |
897 | 898 | ||