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/llgroupnotify.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 '')
-rw-r--r-- | linden/indra/newview/llgroupnotify.cpp | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/linden/indra/newview/llgroupnotify.cpp b/linden/indra/newview/llgroupnotify.cpp index b8d38e4..3f8ff3d 100644 --- a/linden/indra/newview/llgroupnotify.cpp +++ b/linden/indra/newview/llgroupnotify.cpp | |||
@@ -61,35 +61,36 @@ S32 LLGroupNotifyBox::sGroupNotifyBoxCount = 0; | |||
61 | // LLGroupNotifyBox | 61 | // LLGroupNotifyBox |
62 | //--------------------------------------------------------------------------- | 62 | //--------------------------------------------------------------------------- |
63 | 63 | ||
64 | char* g_formatted_time(const time_t& the_time, char* buffer) | 64 | static std::string g_formatted_time(const time_t& the_time) |
65 | { | 65 | { |
66 | char buffer[30]; /*Flawfinder: ignore*/ | ||
66 | time_t t = the_time; | 67 | time_t t = the_time; |
67 | if (!t) time(&t); | 68 | if (!t) time(&t); |
68 | LLString::copy(buffer, ctime(&t), 30); | 69 | LLStringUtil::copy(buffer, ctime(&t), 30); |
69 | buffer[24] = '\0'; | 70 | buffer[24] = '\0'; |
70 | return buffer; | 71 | return std::string(buffer); |
71 | } | 72 | } |
72 | 73 | ||
73 | // static | 74 | // static |
74 | LLGroupNotifyBox* LLGroupNotifyBox::show(const char* subject, | 75 | LLGroupNotifyBox* LLGroupNotifyBox::show(const std::string& subject, |
75 | const char* message, | 76 | const std::string& message, |
76 | const char* from_name, | 77 | const std::string& from_name, |
77 | const LLUUID& group_id, | 78 | const LLUUID& group_id, |
78 | const U32& t, | 79 | const U32& t, |
79 | const bool& has_inventory, | 80 | const bool& has_inventory, |
80 | const char* inventory_name, | 81 | const std::string& inventory_name, |
81 | LLOfferInfo* inventory_offer) | 82 | LLOfferInfo* inventory_offer) |
82 | { | 83 | { |
83 | // Get the group data | 84 | // Get the group data |
84 | LLGroupData group_data; | 85 | LLGroupData group_data; |
85 | if (!gAgent.getGroupData(group_id,group_data)) | 86 | if (!gAgent.getGroupData(group_id,group_data)) |
86 | { | 87 | { |
87 | llwarns << "Group notice for unkown group: " << group_id << llendl; | 88 | llwarns << "Group notice for unknown group: " << group_id << llendl; |
88 | return NULL; | 89 | return NULL; |
89 | } | 90 | } |
90 | 91 | ||
91 | LLGroupNotifyBox* self; | 92 | LLGroupNotifyBox* self; |
92 | self = new LLGroupNotifyBox(subject, message, from_name, group_id, group_data.mInsigniaID, group_data.mName.c_str(),t,has_inventory,inventory_name,inventory_offer); | 93 | self = new LLGroupNotifyBox(subject, message, from_name, group_id, group_data.mInsigniaID, group_data.mName,t,has_inventory,inventory_name,inventory_offer); |
93 | gNotifyBoxView->addChild(self); | 94 | gNotifyBoxView->addChild(self); |
94 | 95 | ||
95 | // TODO: play a sound | 96 | // TODO: play a sound |
@@ -112,17 +113,17 @@ bool is_openable(LLAssetType::EType type) | |||
112 | } | 113 | } |
113 | } | 114 | } |
114 | 115 | ||
115 | LLGroupNotifyBox::LLGroupNotifyBox(const char* subject, | 116 | LLGroupNotifyBox::LLGroupNotifyBox(const std::string& subject, |
116 | const char* message, | 117 | const std::string& message, |
117 | const char* from_name, | 118 | const std::string& from_name, |
118 | const LLUUID& group_id, | 119 | const LLUUID& group_id, |
119 | const LLUUID& group_insignia, | 120 | const LLUUID& group_insignia, |
120 | const char* group_name, | 121 | const std::string& group_name, |
121 | const U32& t, | 122 | const U32& t, |
122 | const bool& has_inventory, | 123 | const bool& has_inventory, |
123 | const char* inventory_name, | 124 | const std::string& inventory_name, |
124 | LLOfferInfo* inventory_offer) | 125 | LLOfferInfo* inventory_offer) |
125 | : LLPanel("groupnotify", LLGroupNotifyBox::getGroupNotifyRect(), BORDER_YES), | 126 | : LLPanel(std::string("groupnotify"), LLGroupNotifyBox::getGroupNotifyRect(), BORDER_YES), |
126 | mAnimating(TRUE), | 127 | mAnimating(TRUE), |
127 | mTimer(), | 128 | mTimer(), |
128 | mGroupID(group_id), | 129 | mGroupID(group_id), |
@@ -133,8 +134,7 @@ LLGroupNotifyBox::LLGroupNotifyBox(const char* subject, | |||
133 | 134 | ||
134 | time_t timestamp = (time_t)t; | 135 | time_t timestamp = (time_t)t; |
135 | 136 | ||
136 | char time_buf[30]; /*Flawfinder: ignore*/ | 137 | std::string time_buf = g_formatted_time(timestamp); |
137 | g_formatted_time(timestamp, time_buf); | ||
138 | 138 | ||
139 | setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT); | 139 | setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT); |
140 | setBackgroundVisible(TRUE); | 140 | setBackgroundVisible(TRUE); |
@@ -162,7 +162,7 @@ LLGroupNotifyBox::LLGroupNotifyBox(const char* subject, | |||
162 | class NoticeText : public LLTextBox | 162 | class NoticeText : public LLTextBox |
163 | { | 163 | { |
164 | public: | 164 | public: |
165 | NoticeText(const LLString& name, const LLRect& rect, const LLString& text = LLString::null, const LLFontGL* font = NULL) | 165 | NoticeText(const std::string& name, const LLRect& rect, const std::string& text = LLStringUtil::null, const LLFontGL* font = NULL) |
166 | : LLTextBox(name, rect, text, font) | 166 | : LLTextBox(name, rect, text, font) |
167 | { | 167 | { |
168 | setHAlign(LLFontGL::RIGHT); | 168 | setHAlign(LLFontGL::RIGHT); |
@@ -175,7 +175,7 @@ LLGroupNotifyBox::LLGroupNotifyBox(const char* subject, | |||
175 | 175 | ||
176 | 176 | ||
177 | // Title | 177 | // Title |
178 | addChild(new NoticeText("title",LLRect(x,y,RIGHT - HPAD,y - LINE_HEIGHT),"Group Notice",LLFontGL::sSansSerifHuge)); | 178 | addChild(new NoticeText(std::string("title"),LLRect(x,y,RIGHT - HPAD,y - LINE_HEIGHT),std::string("Group Notice"),LLFontGL::sSansSerifHuge)); |
179 | 179 | ||
180 | y -= llfloor(1.5f*LINE_HEIGHT); | 180 | y -= llfloor(1.5f*LINE_HEIGHT); |
181 | 181 | ||
@@ -184,7 +184,7 @@ LLGroupNotifyBox::LLGroupNotifyBox(const char* subject, | |||
184 | std::stringstream from; | 184 | std::stringstream from; |
185 | from << "Sent by " << from_name << ", " << group_name; | 185 | from << "Sent by " << from_name << ", " << group_name; |
186 | 186 | ||
187 | addChild(new NoticeText("group",LLRect(x,y,RIGHT - HPAD,y - LINE_HEIGHT),from.str().c_str(),LLFontGL::sSansSerif)); | 187 | addChild(new NoticeText(std::string("group"),LLRect(x,y,RIGHT - HPAD,y - LINE_HEIGHT),from.str(),LLFontGL::sSansSerif)); |
188 | 188 | ||
189 | y -= (LINE_HEIGHT + VPAD); | 189 | y -= (LINE_HEIGHT + VPAD); |
190 | x = HPAD + HPAD; | 190 | x = HPAD + HPAD; |
@@ -192,15 +192,15 @@ LLGroupNotifyBox::LLGroupNotifyBox(const char* subject, | |||
192 | // TODO: change this to be the group icon. | 192 | // TODO: change this to be the group icon. |
193 | if (!group_insignia.isNull()) | 193 | if (!group_insignia.isNull()) |
194 | { | 194 | { |
195 | icon = new LLIconCtrl("icon", | 195 | icon = new LLIconCtrl(std::string("icon"), |
196 | LLRect(x, y, x+ICON_WIDTH, y-ICON_WIDTH), | 196 | LLRect(x, y, x+ICON_WIDTH, y-ICON_WIDTH), |
197 | group_insignia); | 197 | group_insignia); |
198 | } | 198 | } |
199 | else | 199 | else |
200 | { | 200 | { |
201 | icon = new LLIconCtrl("icon", | 201 | icon = new LLIconCtrl(std::string("icon"), |
202 | LLRect(x, y, x+ICON_WIDTH, y-ICON_WIDTH), | 202 | LLRect(x, y, x+ICON_WIDTH, y-ICON_WIDTH), |
203 | "notify_box_icon.tga"); | 203 | std::string("notify_box_icon.tga")); |
204 | } | 204 | } |
205 | 205 | ||
206 | icon->setMouseOpaque(FALSE); | 206 | icon->setMouseOpaque(FALSE); |
@@ -210,10 +210,10 @@ LLGroupNotifyBox::LLGroupNotifyBox(const char* subject, | |||
210 | // If we have inventory with this message, leave room for the name. | 210 | // If we have inventory with this message, leave room for the name. |
211 | S32 box_bottom = BTN_TOP + (mHasInventory ? (LINE_HEIGHT + 2*VPAD) : 0); | 211 | S32 box_bottom = BTN_TOP + (mHasInventory ? (LINE_HEIGHT + 2*VPAD) : 0); |
212 | 212 | ||
213 | text = new LLViewerTextEditor("box", | 213 | text = new LLViewerTextEditor(std::string("box"), |
214 | LLRect(x, y, RIGHT, box_bottom), | 214 | LLRect(x, y, RIGHT, box_bottom), |
215 | DB_GROUP_NOTICE_MSG_STR_LEN, | 215 | DB_GROUP_NOTICE_MSG_STR_LEN, |
216 | "", | 216 | LLStringUtil::null, |
217 | LLFontGL::sSansSerif, | 217 | LLFontGL::sSansSerif, |
218 | FALSE); | 218 | FALSE); |
219 | 219 | ||
@@ -224,14 +224,14 @@ LLGroupNotifyBox::LLGroupNotifyBox(const char* subject, | |||
224 | text->appendStyledText(time_buf,false,false,&datestyle); | 224 | text->appendStyledText(time_buf,false,false,&datestyle); |
225 | // Sadly, our LLTextEditor can't handle both styled and unstyled text | 225 | // Sadly, our LLTextEditor can't handle both styled and unstyled text |
226 | // at the same time. Hence this space must be styled. JC | 226 | // at the same time. Hence this space must be styled. JC |
227 | text->appendColoredText(" ",false,false,LLColor4::grey4); | 227 | text->appendColoredText(std::string(" "),false,false,LLColor4::grey4); |
228 | text->appendColoredText(message,false,false,LLColor4::grey4); | 228 | text->appendColoredText(message,false,false,LLColor4::grey4); |
229 | 229 | ||
230 | LLColor4 semi_transparent(1.0f,1.0f,1.0f,0.8f); | 230 | LLColor4 semi_transparent(1.0f,1.0f,1.0f,0.8f); |
231 | text->setCursor(0,0); | 231 | text->setCursor(0,0); |
232 | text->setEnabled(FALSE); | 232 | text->setEnabled(FALSE); |
233 | text->setWordWrap(TRUE); | 233 | text->setWordWrap(TRUE); |
234 | text->setTabStop(FALSE); | 234 | //text->setTabStop(FALSE); // was interfering with copy-and-paste |
235 | text->setTabsToNextField(TRUE); | 235 | text->setTabsToNextField(TRUE); |
236 | text->setMouseOpaque(TRUE); | 236 | text->setMouseOpaque(TRUE); |
237 | text->setBorderVisible(TRUE); | 237 | text->setBorderVisible(TRUE); |
@@ -246,7 +246,7 @@ LLGroupNotifyBox::LLGroupNotifyBox(const char* subject, | |||
246 | 246 | ||
247 | if (mHasInventory) | 247 | if (mHasInventory) |
248 | { | 248 | { |
249 | addChild(new NoticeText("subjecttitle",LLRect(x,y,x + LABEL_WIDTH,y - LINE_HEIGHT),"Attached: ",LLFontGL::sSansSerif)); | 249 | addChild(new NoticeText(std::string("subjecttitle"),LLRect(x,y,x + LABEL_WIDTH,y - LINE_HEIGHT),std::string("Attached: "),LLFontGL::sSansSerif)); |
250 | 250 | ||
251 | LLUIImagePtr item_icon = get_item_icon(mInventoryOffer->mType, | 251 | LLUIImagePtr item_icon = get_item_icon(mInventoryOffer->mType, |
252 | LLInventoryType::IT_TEXTURE, | 252 | LLInventoryType::IT_TEXTURE, |
@@ -257,7 +257,7 @@ LLGroupNotifyBox::LLGroupNotifyBox(const char* subject, | |||
257 | 257 | ||
258 | std::stringstream ss; | 258 | std::stringstream ss; |
259 | ss << " " << inventory_name; | 259 | ss << " " << inventory_name; |
260 | LLTextBox *line = new LLTextBox("object_name",LLRect(x,y,RIGHT - HPAD,y - LINE_HEIGHT),ss.str().c_str(),LLFontGL::sSansSerif); | 260 | LLTextBox *line = new LLTextBox(std::string("object_name"),LLRect(x,y,RIGHT - HPAD,y - LINE_HEIGHT),ss.str(),LLFontGL::sSansSerif); |
261 | line->setEnabled(FALSE); | 261 | line->setEnabled(FALSE); |
262 | line->setBorderVisible(TRUE); | 262 | line->setBorderVisible(TRUE); |
263 | line->setDisabledColor(LLColor4::blue4); | 263 | line->setDisabledColor(LLColor4::blue4); |
@@ -266,7 +266,7 @@ LLGroupNotifyBox::LLGroupNotifyBox(const char* subject, | |||
266 | line->setBackgroundColor( semi_transparent ); | 266 | line->setBackgroundColor( semi_transparent ); |
267 | addChild(line); | 267 | addChild(line); |
268 | 268 | ||
269 | icon = new LLIconCtrl("icon", | 269 | icon = new LLIconCtrl(std::string("icon"), |
270 | LLRect(x, y, x+16, y-16), | 270 | LLRect(x, y, x+16, y-16), |
271 | item_icon->getName()); | 271 | item_icon->getName()); |
272 | icon->setMouseOpaque(FALSE); | 272 | icon->setMouseOpaque(FALSE); |
@@ -274,15 +274,15 @@ LLGroupNotifyBox::LLGroupNotifyBox(const char* subject, | |||
274 | } | 274 | } |
275 | 275 | ||
276 | LLButton* btn; | 276 | LLButton* btn; |
277 | btn = new LLButton("next", | 277 | btn = new LLButton(std::string("next"), |
278 | LLRect(getRect().getWidth()-26, BOTTOM_PAD + 20, getRect().getWidth()-2, BOTTOM_PAD), | 278 | LLRect(getRect().getWidth()-26, BOTTOM_PAD + 20, getRect().getWidth()-2, BOTTOM_PAD), |
279 | "notify_next.png", | 279 | std::string("notify_next.png"), |
280 | "notify_next.png", | 280 | std::string("notify_next.png"), |
281 | "", | 281 | LLStringUtil::null, |
282 | onClickNext, | 282 | onClickNext, |
283 | this, | 283 | this, |
284 | LLFontGL::sSansSerif); | 284 | LLFontGL::sSansSerif); |
285 | btn->setToolTip(LLString("Next")); // *TODO: Translate | 285 | btn->setToolTip(std::string("Next")); // *TODO: Translate |
286 | btn->setScaleImage(TRUE); | 286 | btn->setScaleImage(TRUE); |
287 | addChild(btn); | 287 | addChild(btn); |
288 | mNextBtn = btn; | 288 | mNextBtn = btn; |
@@ -297,7 +297,7 @@ LLGroupNotifyBox::LLGroupNotifyBox(const char* subject, | |||
297 | btn_width, | 297 | btn_width, |
298 | BTN_HEIGHT); | 298 | BTN_HEIGHT); |
299 | 299 | ||
300 | btn = new LLButton("OK", btn_rect, "", onClickOk, this); | 300 | btn = new LLButton(std::string("OK"), btn_rect, LLStringUtil::null, onClickOk, this); |
301 | addChild(btn, -1); | 301 | addChild(btn, -1); |
302 | setDefaultBtn(btn); | 302 | setDefaultBtn(btn); |
303 | 303 | ||
@@ -309,8 +309,8 @@ LLGroupNotifyBox::LLGroupNotifyBox(const char* subject, | |||
309 | wide_btn_width, | 309 | wide_btn_width, |
310 | BTN_HEIGHT); | 310 | BTN_HEIGHT); |
311 | 311 | ||
312 | btn = new LLButton("Group Notices", btn_rect, "", onClickGroupInfo, this); | 312 | btn = new LLButton(std::string("Group Notices"), btn_rect, LLStringUtil::null, onClickGroupInfo, this); |
313 | btn->setToolTip(LLString("View past notices or opt-out of receiving these messages here.")); // TODO: Translate | 313 | btn->setToolTip(std::string("View past notices or opt-out of receiving these messages here.")); // TODO: Translate |
314 | addChild(btn, -1); | 314 | addChild(btn, -1); |
315 | 315 | ||
316 | if (mHasInventory && mInventoryOffer) | 316 | if (mHasInventory && mInventoryOffer) |
@@ -322,7 +322,7 @@ LLGroupNotifyBox::LLGroupNotifyBox(const char* subject, | |||
322 | wide_btn_width, | 322 | wide_btn_width, |
323 | BTN_HEIGHT); | 323 | BTN_HEIGHT); |
324 | 324 | ||
325 | LLString btn_lbl(""); | 325 | std::string btn_lbl(""); |
326 | if(is_openable(mInventoryOffer->mType)) | 326 | if(is_openable(mInventoryOffer->mType)) |
327 | { | 327 | { |
328 | btn_lbl = "Open Attachment"; | 328 | btn_lbl = "Open Attachment"; |
@@ -331,7 +331,7 @@ LLGroupNotifyBox::LLGroupNotifyBox(const char* subject, | |||
331 | { | 331 | { |
332 | btn_lbl = "Save Attachment"; | 332 | btn_lbl = "Save Attachment"; |
333 | } | 333 | } |
334 | mSaveInventoryBtn = new LLButton(btn_lbl, btn_rect, "", onClickSaveInventory, this); | 334 | mSaveInventoryBtn = new LLButton(btn_lbl, btn_rect, LLStringUtil::null, onClickSaveInventory, this); |
335 | mSaveInventoryBtn->setVisible(mHasInventory); | 335 | mSaveInventoryBtn->setVisible(mHasInventory); |
336 | addChild(mSaveInventoryBtn); | 336 | addChild(mSaveInventoryBtn); |
337 | } | 337 | } |