diff options
Diffstat (limited to 'linden/indra/newview/llstatusbar.cpp')
-rw-r--r-- | linden/indra/newview/llstatusbar.cpp | 127 |
1 files changed, 5 insertions, 122 deletions
diff --git a/linden/indra/newview/llstatusbar.cpp b/linden/indra/newview/llstatusbar.cpp index 3bd30cc..366363b 100644 --- a/linden/indra/newview/llstatusbar.cpp +++ b/linden/indra/newview/llstatusbar.cpp | |||
@@ -83,11 +83,8 @@ | |||
83 | #include "llstring.h" | 83 | #include "llstring.h" |
84 | #include "message.h" | 84 | #include "message.h" |
85 | 85 | ||
86 | // system includes | ||
87 | #include <iomanip> | ||
88 | |||
89 | |||
90 | #include "hippoGridManager.h" | 86 | #include "hippoGridManager.h" |
87 | #include "viewertime.h" | ||
91 | 88 | ||
92 | // | 89 | // |
93 | // Globals | 90 | // Globals |
@@ -121,10 +118,6 @@ static void onClickScripts(void*); | |||
121 | static void onClickBuyLand(void*); | 118 | static void onClickBuyLand(void*); |
122 | static void onClickScriptDebug(void*); | 119 | static void onClickScriptDebug(void*); |
123 | 120 | ||
124 | std::vector<std::string> LLStatusBar::sDays; | ||
125 | std::vector<std::string> LLStatusBar::sMonths; | ||
126 | const U32 LLStatusBar::MAX_DATE_STRING_LENGTH = 2000; | ||
127 | |||
128 | LLStatusBar::LLStatusBar(const std::string& name, const LLRect& rect) | 121 | LLStatusBar::LLStatusBar(const std::string& name, const LLRect& rect) |
129 | : LLPanel(name, LLRect(), FALSE), // not mouse opaque | 122 | : LLPanel(name, LLRect(), FALSE), // not mouse opaque |
130 | mBalance(0), | 123 | mBalance(0), |
@@ -136,10 +129,6 @@ mSquareMetersCommitted(0) | |||
136 | setMouseOpaque(FALSE); | 129 | setMouseOpaque(FALSE); |
137 | setIsChrome(TRUE); | 130 | setIsChrome(TRUE); |
138 | 131 | ||
139 | // size of day of the weeks and year | ||
140 | sDays.reserve(7); | ||
141 | sMonths.reserve(12); | ||
142 | |||
143 | mBalanceTimer = new LLFrameTimer(); | 132 | mBalanceTimer = new LLFrameTimer(); |
144 | mHealthTimer = new LLFrameTimer(); | 133 | mHealthTimer = new LLFrameTimer(); |
145 | 134 | ||
@@ -148,9 +137,6 @@ mSquareMetersCommitted(0) | |||
148 | // status bar can never get a tab | 137 | // status bar can never get a tab |
149 | setFocusRoot(FALSE); | 138 | setFocusRoot(FALSE); |
150 | 139 | ||
151 | // build date necessary data (must do after panel built) | ||
152 | setupDate(); | ||
153 | |||
154 | mTextParcelName = getChild<LLTextBox>("ParcelNameText" ); | 140 | mTextParcelName = getChild<LLTextBox>("ParcelNameText" ); |
155 | mTextBalance = getChild<LLTextBox>("BalanceText" ); | 141 | mTextBalance = getChild<LLTextBox>("BalanceText" ); |
156 | 142 | ||
@@ -265,50 +251,10 @@ void LLStatusBar::refresh() | |||
265 | mSGBandwidth->setThreshold(1, bwtotal); | 251 | mSGBandwidth->setThreshold(1, bwtotal); |
266 | mSGBandwidth->setThreshold(2, bwtotal); | 252 | mSGBandwidth->setThreshold(2, bwtotal); |
267 | 253 | ||
268 | // *TODO: Localize / translate time | 254 | // Let's not have to reformat time everywhere, shall we? -- MC |
269 | 255 | gViewerTime->refresh(); | |
270 | // Get current UTC time, adjusted for the user's clock | 256 | mTextTime->setText(gViewerTime->getCurTimeStr()); |
271 | // being off. | 257 | mTextTime->setToolTip(gViewerTime->getCurDateStr()); |
272 | time_t utc_time; | ||
273 | utc_time = time_corrected(); | ||
274 | |||
275 | // There's only one internal tm buffer. | ||
276 | struct tm* internal_time; | ||
277 | |||
278 | // Convert to Pacific, based on server's opinion of whether | ||
279 | // it's daylight savings time there. | ||
280 | internal_time = utc_to_pacific_time(utc_time, gPacificDaylightTime); | ||
281 | |||
282 | S32 hour = internal_time->tm_hour; | ||
283 | S32 min = internal_time->tm_min; | ||
284 | |||
285 | std::string am_pm = "AM"; | ||
286 | if (hour > 11) | ||
287 | { | ||
288 | hour -= 12; | ||
289 | am_pm = "PM"; | ||
290 | } | ||
291 | |||
292 | std::string tz = "PST"; | ||
293 | if (gPacificDaylightTime) | ||
294 | { | ||
295 | tz = "PDT"; | ||
296 | } | ||
297 | // Zero hour is 12 AM | ||
298 | if (hour == 0) hour = 12; | ||
299 | std::ostringstream t; | ||
300 | t << std::setfill(' ') << std::setw(2) << hour << ":" | ||
301 | << std::setfill('0') << std::setw(2) << min | ||
302 | << " " << am_pm << " " << tz; | ||
303 | mTextTime->setText(t.str()); | ||
304 | |||
305 | // Year starts at 1900, set the tooltip to have the date | ||
306 | std::ostringstream date; | ||
307 | date << sDays[internal_time->tm_wday] << ", " | ||
308 | << std::setfill('0') << std::setw(2) << internal_time->tm_mday << " " | ||
309 | << sMonths[internal_time->tm_mon] << " " | ||
310 | << internal_time->tm_year + 1900; | ||
311 | mTextTime->setToolTip(date.str()); | ||
312 | 258 | ||
313 | LLRect r; | 259 | LLRect r; |
314 | const S32 MENU_RIGHT = gMenuBarView->getRightmostMenuEdge(); | 260 | const S32 MENU_RIGHT = gMenuBarView->getRightmostMenuEdge(); |
@@ -877,69 +823,6 @@ static void onClickBuyLand(void*) | |||
877 | LLViewerParcelMgr::getInstance()->startBuyLand(); | 823 | LLViewerParcelMgr::getInstance()->startBuyLand(); |
878 | } | 824 | } |
879 | 825 | ||
880 | // sets the static variables necessary for the date | ||
881 | void LLStatusBar::setupDate() | ||
882 | { | ||
883 | // fill the day array with what's in the xui | ||
884 | std::string day_list = getString("StatBarDaysOfWeek"); | ||
885 | size_t length = day_list.size(); | ||
886 | |||
887 | // quick input check | ||
888 | if(length < MAX_DATE_STRING_LENGTH) | ||
889 | { | ||
890 | // tokenize it and put it in the array | ||
891 | std::string cur_word; | ||
892 | for(size_t i = 0; i < length; ++i) | ||
893 | { | ||
894 | if(day_list[i] == ':') | ||
895 | { | ||
896 | sDays.push_back(cur_word); | ||
897 | cur_word.clear(); | ||
898 | } | ||
899 | else | ||
900 | { | ||
901 | cur_word.append(1, day_list[i]); | ||
902 | } | ||
903 | } | ||
904 | sDays.push_back(cur_word); | ||
905 | } | ||
906 | |||
907 | // fill the day array with what's in the xui | ||
908 | std::string month_list = getString( "StatBarMonthsOfYear" ); | ||
909 | length = month_list.size(); | ||
910 | |||
911 | // quick input check | ||
912 | if(length < MAX_DATE_STRING_LENGTH) | ||
913 | { | ||
914 | // tokenize it and put it in the array | ||
915 | std::string cur_word; | ||
916 | for(size_t i = 0; i < length; ++i) | ||
917 | { | ||
918 | if(month_list[i] == ':') | ||
919 | { | ||
920 | sMonths.push_back(cur_word); | ||
921 | cur_word.clear(); | ||
922 | } | ||
923 | else | ||
924 | { | ||
925 | cur_word.append(1, month_list[i]); | ||
926 | } | ||
927 | } | ||
928 | sMonths.push_back(cur_word); | ||
929 | } | ||
930 | |||
931 | // make sure we have at least 7 days and 12 months | ||
932 | if(sDays.size() < 7) | ||
933 | { | ||
934 | sDays.resize(7); | ||
935 | } | ||
936 | |||
937 | if(sMonths.size() < 12) | ||
938 | { | ||
939 | sMonths.resize(12); | ||
940 | } | ||
941 | } | ||
942 | |||
943 | // static | 826 | // static |
944 | void LLStatusBar::onCommitSearch(LLUICtrl*, void* data) | 827 | void LLStatusBar::onCommitSearch(LLUICtrl*, void* data) |
945 | { | 828 | { |