PageRenderTime 51ms CodeModel.GetById 32ms RepoModel.GetById 0ms app.codeStats 1ms

/indra/newview/llavatarlistitem.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 649 lines | 466 code | 110 blank | 73 comment | 45 complexity | 0fa427b97b05342bf39b37919559ad61 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llavatarlistitem.cpp
  3. * @brief avatar list item source file
  4. *
  5. * $LicenseInfo:firstyear=2009&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #include "llviewerprecompiledheaders.h"
  27. #include "llavataractions.h"
  28. #include "llavatarlistitem.h"
  29. #include "llbutton.h"
  30. #include "llfloaterreg.h"
  31. #include "lltextutil.h"
  32. #include "llagent.h"
  33. #include "llavatarnamecache.h"
  34. #include "llavatariconctrl.h"
  35. #include "lloutputmonitorctrl.h"
  36. bool LLAvatarListItem::sStaticInitialized = false;
  37. S32 LLAvatarListItem::sLeftPadding = 0;
  38. S32 LLAvatarListItem::sNameRightPadding = 0;
  39. S32 LLAvatarListItem::sChildrenWidths[LLAvatarListItem::ALIC_COUNT];
  40. static LLWidgetNameRegistry::StaticRegistrar sRegisterAvatarListItemParams(&typeid(LLAvatarListItem::Params), "avatar_list_item");
  41. LLAvatarListItem::Params::Params()
  42. : default_style("default_style"),
  43. voice_call_invited_style("voice_call_invited_style"),
  44. voice_call_joined_style("voice_call_joined_style"),
  45. voice_call_left_style("voice_call_left_style"),
  46. online_style("online_style"),
  47. offline_style("offline_style"),
  48. name_right_pad("name_right_pad", 0)
  49. {};
  50. LLAvatarListItem::LLAvatarListItem(bool not_from_ui_factory/* = true*/)
  51. : LLPanel(),
  52. mAvatarIcon(NULL),
  53. mAvatarName(NULL),
  54. mLastInteractionTime(NULL),
  55. mIconPermissionOnline(NULL),
  56. mIconPermissionMap(NULL),
  57. mIconPermissionEditMine(NULL),
  58. mIconPermissionEditTheirs(NULL),
  59. mSpeakingIndicator(NULL),
  60. mInfoBtn(NULL),
  61. mProfileBtn(NULL),
  62. mOnlineStatus(E_UNKNOWN),
  63. mShowInfoBtn(true),
  64. mShowProfileBtn(true),
  65. mShowPermissions(false),
  66. mHovered(false)
  67. {
  68. if (not_from_ui_factory)
  69. {
  70. buildFromFile("panel_avatar_list_item.xml");
  71. }
  72. // *NOTE: mantipov: do not use any member here. They can be uninitialized here in case instance
  73. // is created from the UICtrlFactory
  74. }
  75. LLAvatarListItem::~LLAvatarListItem()
  76. {
  77. if (mAvatarId.notNull())
  78. LLAvatarTracker::instance().removeParticularFriendObserver(mAvatarId, this);
  79. }
  80. BOOL LLAvatarListItem::postBuild()
  81. {
  82. mAvatarIcon = getChild<LLAvatarIconCtrl>("avatar_icon");
  83. mAvatarName = getChild<LLTextBox>("avatar_name");
  84. mLastInteractionTime = getChild<LLTextBox>("last_interaction");
  85. mIconPermissionOnline = getChild<LLIconCtrl>("permission_online_icon");
  86. mIconPermissionMap = getChild<LLIconCtrl>("permission_map_icon");
  87. mIconPermissionEditMine = getChild<LLIconCtrl>("permission_edit_mine_icon");
  88. mIconPermissionEditTheirs = getChild<LLIconCtrl>("permission_edit_theirs_icon");
  89. mIconPermissionOnline->setVisible(false);
  90. mIconPermissionMap->setVisible(false);
  91. mIconPermissionEditMine->setVisible(false);
  92. mIconPermissionEditTheirs->setVisible(false);
  93. mSpeakingIndicator = getChild<LLOutputMonitorCtrl>("speaking_indicator");
  94. mInfoBtn = getChild<LLButton>("info_btn");
  95. mProfileBtn = getChild<LLButton>("profile_btn");
  96. mInfoBtn->setVisible(false);
  97. mInfoBtn->setClickedCallback(boost::bind(&LLAvatarListItem::onInfoBtnClick, this));
  98. mProfileBtn->setVisible(false);
  99. mProfileBtn->setClickedCallback(boost::bind(&LLAvatarListItem::onProfileBtnClick, this));
  100. if (!sStaticInitialized)
  101. {
  102. // Remember children widths including their padding from the next sibling,
  103. // so that we can hide and show them again later.
  104. initChildrenWidths(this);
  105. // Right padding between avatar name text box and nearest visible child.
  106. sNameRightPadding = LLUICtrlFactory::getDefaultParams<LLAvatarListItem>().name_right_pad;
  107. sStaticInitialized = true;
  108. }
  109. return TRUE;
  110. }
  111. S32 LLAvatarListItem::notifyParent(const LLSD& info)
  112. {
  113. if (info.has("visibility_changed"))
  114. {
  115. updateChildren();
  116. return 1;
  117. }
  118. return LLPanel::notifyParent(info);
  119. }
  120. void LLAvatarListItem::onMouseEnter(S32 x, S32 y, MASK mask)
  121. {
  122. getChildView("hovered_icon")->setVisible( true);
  123. mInfoBtn->setVisible(mShowInfoBtn);
  124. mProfileBtn->setVisible(mShowProfileBtn);
  125. mHovered = true;
  126. LLPanel::onMouseEnter(x, y, mask);
  127. showPermissions(mShowPermissions);
  128. updateChildren();
  129. }
  130. void LLAvatarListItem::onMouseLeave(S32 x, S32 y, MASK mask)
  131. {
  132. getChildView("hovered_icon")->setVisible( false);
  133. mInfoBtn->setVisible(false);
  134. mProfileBtn->setVisible(false);
  135. mHovered = false;
  136. LLPanel::onMouseLeave(x, y, mask);
  137. showPermissions(false);
  138. updateChildren();
  139. }
  140. // virtual, called by LLAvatarTracker
  141. void LLAvatarListItem::changed(U32 mask)
  142. {
  143. // no need to check mAvatarId for null in this case
  144. setOnline(LLAvatarTracker::instance().isBuddyOnline(mAvatarId));
  145. if (mask & LLFriendObserver::POWERS)
  146. {
  147. showPermissions(mShowPermissions && mHovered);
  148. updateChildren();
  149. }
  150. }
  151. void LLAvatarListItem::setOnline(bool online)
  152. {
  153. // *FIX: setName() overrides font style set by setOnline(). Not an issue ATM.
  154. if (mOnlineStatus != E_UNKNOWN && (bool) mOnlineStatus == online)
  155. return;
  156. mOnlineStatus = (EOnlineStatus) online;
  157. // Change avatar name font style depending on the new online status.
  158. setState(online ? IS_ONLINE : IS_OFFLINE);
  159. }
  160. void LLAvatarListItem::setAvatarName(const std::string& name)
  161. {
  162. setNameInternal(name, mHighlihtSubstring);
  163. }
  164. void LLAvatarListItem::setAvatarToolTip(const std::string& tooltip)
  165. {
  166. mAvatarName->setToolTip(tooltip);
  167. }
  168. void LLAvatarListItem::setHighlight(const std::string& highlight)
  169. {
  170. setNameInternal(mAvatarName->getText(), mHighlihtSubstring = highlight);
  171. }
  172. void LLAvatarListItem::setState(EItemState item_style)
  173. {
  174. const LLAvatarListItem::Params& params = LLUICtrlFactory::getDefaultParams<LLAvatarListItem>();
  175. switch(item_style)
  176. {
  177. default:
  178. case IS_DEFAULT:
  179. mAvatarNameStyle = params.default_style();
  180. break;
  181. case IS_VOICE_INVITED:
  182. mAvatarNameStyle = params.voice_call_invited_style();
  183. break;
  184. case IS_VOICE_JOINED:
  185. mAvatarNameStyle = params.voice_call_joined_style();
  186. break;
  187. case IS_VOICE_LEFT:
  188. mAvatarNameStyle = params.voice_call_left_style();
  189. break;
  190. case IS_ONLINE:
  191. mAvatarNameStyle = params.online_style();
  192. break;
  193. case IS_OFFLINE:
  194. mAvatarNameStyle = params.offline_style();
  195. break;
  196. }
  197. // *NOTE: You cannot set the style on a text box anymore, you must
  198. // rebuild the text. This will cause problems if the text contains
  199. // hyperlinks, as their styles will be wrong.
  200. setNameInternal(mAvatarName->getText(), mHighlihtSubstring);
  201. icon_color_map_t& item_icon_color_map = getItemIconColorMap();
  202. mAvatarIcon->setColor(item_icon_color_map[item_style]);
  203. }
  204. void LLAvatarListItem::setAvatarId(const LLUUID& id, const LLUUID& session_id, bool ignore_status_changes/* = false*/, bool is_resident/* = true*/)
  205. {
  206. if (mAvatarId.notNull())
  207. LLAvatarTracker::instance().removeParticularFriendObserver(mAvatarId, this);
  208. mAvatarId = id;
  209. mSpeakingIndicator->setSpeakerId(id, session_id);
  210. // We'll be notified on avatar online status changes
  211. if (!ignore_status_changes && mAvatarId.notNull())
  212. LLAvatarTracker::instance().addParticularFriendObserver(mAvatarId, this);
  213. if (is_resident)
  214. {
  215. mAvatarIcon->setValue(id);
  216. // Set avatar name.
  217. LLAvatarNameCache::get(id,
  218. boost::bind(&LLAvatarListItem::onAvatarNameCache, this, _2));
  219. }
  220. }
  221. void LLAvatarListItem::showLastInteractionTime(bool show)
  222. {
  223. mLastInteractionTime->setVisible(show);
  224. updateChildren();
  225. }
  226. void LLAvatarListItem::setLastInteractionTime(U32 secs_since)
  227. {
  228. mLastInteractionTime->setValue(formatSeconds(secs_since));
  229. }
  230. void LLAvatarListItem::setShowInfoBtn(bool show)
  231. {
  232. mShowInfoBtn = show;
  233. }
  234. void LLAvatarListItem::setShowProfileBtn(bool show)
  235. {
  236. mShowProfileBtn = show;
  237. }
  238. void LLAvatarListItem::showSpeakingIndicator(bool visible)
  239. {
  240. // Already done? Then do nothing.
  241. if (mSpeakingIndicator->getVisible() == (BOOL)visible)
  242. return;
  243. // Disabled to not contradict with SpeakingIndicatorManager functionality. EXT-3976
  244. // probably this method should be totally removed.
  245. // mSpeakingIndicator->setVisible(visible);
  246. // updateChildren();
  247. }
  248. void LLAvatarListItem::setAvatarIconVisible(bool visible)
  249. {
  250. // Already done? Then do nothing.
  251. if (mAvatarIcon->getVisible() == (BOOL)visible)
  252. {
  253. return;
  254. }
  255. // Show/hide avatar icon.
  256. mAvatarIcon->setVisible(visible);
  257. updateChildren();
  258. }
  259. void LLAvatarListItem::onInfoBtnClick()
  260. {
  261. LLFloaterReg::showInstance("inspect_avatar", LLSD().with("avatar_id", mAvatarId));
  262. }
  263. void LLAvatarListItem::onProfileBtnClick()
  264. {
  265. LLAvatarActions::showProfile(mAvatarId);
  266. }
  267. BOOL LLAvatarListItem::handleDoubleClick(S32 x, S32 y, MASK mask)
  268. {
  269. if(mInfoBtn->getRect().pointInRect(x, y))
  270. {
  271. onInfoBtnClick();
  272. return TRUE;
  273. }
  274. if(mProfileBtn->getRect().pointInRect(x, y))
  275. {
  276. onProfileBtnClick();
  277. return TRUE;
  278. }
  279. return LLPanel::handleDoubleClick(x, y, mask);
  280. }
  281. void LLAvatarListItem::setValue( const LLSD& value )
  282. {
  283. if (!value.isMap()) return;;
  284. if (!value.has("selected")) return;
  285. getChildView("selected_icon")->setVisible( value["selected"]);
  286. }
  287. const LLUUID& LLAvatarListItem::getAvatarId() const
  288. {
  289. return mAvatarId;
  290. }
  291. std::string LLAvatarListItem::getAvatarName() const
  292. {
  293. return mAvatarName->getValue();
  294. }
  295. std::string LLAvatarListItem::getAvatarToolTip() const
  296. {
  297. return mAvatarName->getToolTip();
  298. }
  299. void LLAvatarListItem::updateAvatarName()
  300. {
  301. LLAvatarNameCache::get(getAvatarId(),
  302. boost::bind(&LLAvatarListItem::onAvatarNameCache, this, _2));
  303. }
  304. //== PRIVATE SECITON ==========================================================
  305. void LLAvatarListItem::setNameInternal(const std::string& name, const std::string& highlight)
  306. {
  307. LLTextUtil::textboxSetHighlightedVal(mAvatarName, mAvatarNameStyle, name, highlight);
  308. }
  309. void LLAvatarListItem::onAvatarNameCache(const LLAvatarName& av_name)
  310. {
  311. setAvatarName(av_name.mDisplayName);
  312. setAvatarToolTip(av_name.mUsername);
  313. //requesting the list to resort
  314. notifyParent(LLSD().with("sort", LLSD()));
  315. }
  316. // Convert given number of seconds to a string like "23 minutes", "15 hours" or "3 years",
  317. // taking i18n into account. The format string to use is taken from the panel XML.
  318. std::string LLAvatarListItem::formatSeconds(U32 secs)
  319. {
  320. static const U32 LL_ALI_MIN = 60;
  321. static const U32 LL_ALI_HOUR = LL_ALI_MIN * 60;
  322. static const U32 LL_ALI_DAY = LL_ALI_HOUR * 24;
  323. static const U32 LL_ALI_WEEK = LL_ALI_DAY * 7;
  324. static const U32 LL_ALI_MONTH = LL_ALI_DAY * 30;
  325. static const U32 LL_ALI_YEAR = LL_ALI_DAY * 365;
  326. std::string fmt;
  327. U32 count = 0;
  328. if (secs >= LL_ALI_YEAR)
  329. {
  330. fmt = "FormatYears"; count = secs / LL_ALI_YEAR;
  331. }
  332. else if (secs >= LL_ALI_MONTH)
  333. {
  334. fmt = "FormatMonths"; count = secs / LL_ALI_MONTH;
  335. }
  336. else if (secs >= LL_ALI_WEEK)
  337. {
  338. fmt = "FormatWeeks"; count = secs / LL_ALI_WEEK;
  339. }
  340. else if (secs >= LL_ALI_DAY)
  341. {
  342. fmt = "FormatDays"; count = secs / LL_ALI_DAY;
  343. }
  344. else if (secs >= LL_ALI_HOUR)
  345. {
  346. fmt = "FormatHours"; count = secs / LL_ALI_HOUR;
  347. }
  348. else if (secs >= LL_ALI_MIN)
  349. {
  350. fmt = "FormatMinutes"; count = secs / LL_ALI_MIN;
  351. }
  352. else
  353. {
  354. fmt = "FormatSeconds"; count = secs;
  355. }
  356. LLStringUtil::format_map_t args;
  357. args["[COUNT]"] = llformat("%u", count);
  358. return getString(fmt, args);
  359. }
  360. // static
  361. LLAvatarListItem::icon_color_map_t& LLAvatarListItem::getItemIconColorMap()
  362. {
  363. static icon_color_map_t item_icon_color_map;
  364. if (!item_icon_color_map.empty()) return item_icon_color_map;
  365. item_icon_color_map.insert(
  366. std::make_pair(IS_DEFAULT,
  367. LLUIColorTable::instance().getColor("AvatarListItemIconDefaultColor", LLColor4::white)));
  368. item_icon_color_map.insert(
  369. std::make_pair(IS_VOICE_INVITED,
  370. LLUIColorTable::instance().getColor("AvatarListItemIconVoiceInvitedColor", LLColor4::white)));
  371. item_icon_color_map.insert(
  372. std::make_pair(IS_VOICE_JOINED,
  373. LLUIColorTable::instance().getColor("AvatarListItemIconVoiceJoinedColor", LLColor4::white)));
  374. item_icon_color_map.insert(
  375. std::make_pair(IS_VOICE_LEFT,
  376. LLUIColorTable::instance().getColor("AvatarListItemIconVoiceLeftColor", LLColor4::white)));
  377. item_icon_color_map.insert(
  378. std::make_pair(IS_ONLINE,
  379. LLUIColorTable::instance().getColor("AvatarListItemIconOnlineColor", LLColor4::white)));
  380. item_icon_color_map.insert(
  381. std::make_pair(IS_OFFLINE,
  382. LLUIColorTable::instance().getColor("AvatarListItemIconOfflineColor", LLColor4::white)));
  383. return item_icon_color_map;
  384. }
  385. // static
  386. void LLAvatarListItem::initChildrenWidths(LLAvatarListItem* avatar_item)
  387. {
  388. //speaking indicator width + padding
  389. S32 speaking_indicator_width = avatar_item->getRect().getWidth() - avatar_item->mSpeakingIndicator->getRect().mLeft;
  390. //profile btn width + padding
  391. S32 profile_btn_width = avatar_item->mSpeakingIndicator->getRect().mLeft - avatar_item->mProfileBtn->getRect().mLeft;
  392. //info btn width + padding
  393. S32 info_btn_width = avatar_item->mProfileBtn->getRect().mLeft - avatar_item->mInfoBtn->getRect().mLeft;
  394. // online permission icon width + padding
  395. S32 permission_online_width = avatar_item->mInfoBtn->getRect().mLeft - avatar_item->mIconPermissionOnline->getRect().mLeft;
  396. // map permission icon width + padding
  397. S32 permission_map_width = avatar_item->mIconPermissionOnline->getRect().mLeft - avatar_item->mIconPermissionMap->getRect().mLeft;
  398. // edit my objects permission icon width + padding
  399. S32 permission_edit_mine_width = avatar_item->mIconPermissionMap->getRect().mLeft - avatar_item->mIconPermissionEditMine->getRect().mLeft;
  400. // edit their objects permission icon width + padding
  401. S32 permission_edit_theirs_width = avatar_item->mIconPermissionEditMine->getRect().mLeft - avatar_item->mIconPermissionEditTheirs->getRect().mLeft;
  402. // last interaction time textbox width + padding
  403. S32 last_interaction_time_width = avatar_item->mIconPermissionEditTheirs->getRect().mLeft - avatar_item->mLastInteractionTime->getRect().mLeft;
  404. // avatar icon width + padding
  405. S32 icon_width = avatar_item->mAvatarName->getRect().mLeft - avatar_item->mAvatarIcon->getRect().mLeft;
  406. sLeftPadding = avatar_item->mAvatarIcon->getRect().mLeft;
  407. S32 index = ALIC_COUNT;
  408. sChildrenWidths[--index] = icon_width;
  409. sChildrenWidths[--index] = 0; // for avatar name we don't need its width, it will be calculated as "left available space"
  410. sChildrenWidths[--index] = last_interaction_time_width;
  411. sChildrenWidths[--index] = permission_edit_theirs_width;
  412. sChildrenWidths[--index] = permission_edit_mine_width;
  413. sChildrenWidths[--index] = permission_map_width;
  414. sChildrenWidths[--index] = permission_online_width;
  415. sChildrenWidths[--index] = info_btn_width;
  416. sChildrenWidths[--index] = profile_btn_width;
  417. sChildrenWidths[--index] = speaking_indicator_width;
  418. llassert(index == 0);
  419. }
  420. void LLAvatarListItem::updateChildren()
  421. {
  422. LL_DEBUGS("AvatarItemReshape") << LL_ENDL;
  423. LL_DEBUGS("AvatarItemReshape") << "Updating for: " << getAvatarName() << LL_ENDL;
  424. S32 name_new_width = getRect().getWidth();
  425. S32 ctrl_new_left = name_new_width;
  426. S32 name_new_left = sLeftPadding;
  427. // iterate through all children and set them into correct position depend on each child visibility
  428. // assume that child indexes are in back order: the first in Enum is the last (right) in the item
  429. // iterate & set child views starting from right to left
  430. for (S32 i = 0; i < ALIC_COUNT; ++i)
  431. {
  432. // skip "name" textbox, it will be processed out of loop later
  433. if (ALIC_NAME == i) continue;
  434. LLView* control = getItemChildView((EAvatarListItemChildIndex)i);
  435. LL_DEBUGS("AvatarItemReshape") << "Processing control: " << control->getName() << LL_ENDL;
  436. // skip invisible views
  437. if (!control->getVisible()) continue;
  438. S32 ctrl_width = sChildrenWidths[i]; // including space between current & left controls
  439. // decrease available for
  440. name_new_width -= ctrl_width;
  441. LL_DEBUGS("AvatarItemReshape") << "width: " << ctrl_width << ", name_new_width: " << name_new_width << LL_ENDL;
  442. LLRect control_rect = control->getRect();
  443. LL_DEBUGS("AvatarItemReshape") << "rect before: " << control_rect << LL_ENDL;
  444. if (ALIC_ICON == i)
  445. {
  446. // assume that this is the last iteration,
  447. // so it is not necessary to save "ctrl_new_left" value calculated on previous iterations
  448. ctrl_new_left = sLeftPadding;
  449. name_new_left = ctrl_new_left + ctrl_width;
  450. }
  451. else
  452. {
  453. ctrl_new_left -= ctrl_width;
  454. }
  455. LL_DEBUGS("AvatarItemReshape") << "ctrl_new_left: " << ctrl_new_left << LL_ENDL;
  456. control_rect.setLeftTopAndSize(
  457. ctrl_new_left,
  458. control_rect.mTop,
  459. control_rect.getWidth(),
  460. control_rect.getHeight());
  461. LL_DEBUGS("AvatarItemReshape") << "rect after: " << control_rect << LL_ENDL;
  462. control->setShape(control_rect);
  463. }
  464. // set size and position of the "name" child
  465. LLView* name_view = getItemChildView(ALIC_NAME);
  466. LLRect name_view_rect = name_view->getRect();
  467. LL_DEBUGS("AvatarItemReshape") << "name rect before: " << name_view_rect << LL_ENDL;
  468. // apply paddings
  469. name_new_width -= sLeftPadding;
  470. name_new_width -= sNameRightPadding;
  471. name_view_rect.setLeftTopAndSize(
  472. name_new_left,
  473. name_view_rect.mTop,
  474. name_new_width,
  475. name_view_rect.getHeight());
  476. name_view->setShape(name_view_rect);
  477. LL_DEBUGS("AvatarItemReshape") << "name rect after: " << name_view_rect << LL_ENDL;
  478. }
  479. bool LLAvatarListItem::showPermissions(bool visible)
  480. {
  481. const LLRelationship* relation = LLAvatarTracker::instance().getBuddyInfo(getAvatarId());
  482. if(relation && visible)
  483. {
  484. mIconPermissionOnline->setVisible(relation->isRightGrantedTo(LLRelationship::GRANT_ONLINE_STATUS));
  485. mIconPermissionMap->setVisible(relation->isRightGrantedTo(LLRelationship::GRANT_MAP_LOCATION));
  486. mIconPermissionEditMine->setVisible(relation->isRightGrantedTo(LLRelationship::GRANT_MODIFY_OBJECTS));
  487. mIconPermissionEditTheirs->setVisible(relation->isRightGrantedFrom(LLRelationship::GRANT_MODIFY_OBJECTS));
  488. }
  489. else
  490. {
  491. mIconPermissionOnline->setVisible(false);
  492. mIconPermissionMap->setVisible(false);
  493. mIconPermissionEditMine->setVisible(false);
  494. mIconPermissionEditTheirs->setVisible(false);
  495. }
  496. return NULL != relation;
  497. }
  498. LLView* LLAvatarListItem::getItemChildView(EAvatarListItemChildIndex child_view_index)
  499. {
  500. LLView* child_view = mAvatarName;
  501. switch (child_view_index)
  502. {
  503. case ALIC_ICON:
  504. child_view = mAvatarIcon;
  505. break;
  506. case ALIC_NAME:
  507. child_view = mAvatarName;
  508. break;
  509. case ALIC_INTERACTION_TIME:
  510. child_view = mLastInteractionTime;
  511. break;
  512. case ALIC_SPEAKER_INDICATOR:
  513. child_view = mSpeakingIndicator;
  514. break;
  515. case ALIC_PERMISSION_ONLINE:
  516. child_view = mIconPermissionOnline;
  517. break;
  518. case ALIC_PERMISSION_MAP:
  519. child_view = mIconPermissionMap;
  520. break;
  521. case ALIC_PERMISSION_EDIT_MINE:
  522. child_view = mIconPermissionEditMine;
  523. break;
  524. case ALIC_PERMISSION_EDIT_THEIRS:
  525. child_view = mIconPermissionEditTheirs;
  526. break;
  527. case ALIC_INFO_BUTTON:
  528. child_view = mInfoBtn;
  529. break;
  530. case ALIC_PROFILE_BUTTON:
  531. child_view = mProfileBtn;
  532. break;
  533. default:
  534. LL_WARNS("AvatarItemReshape") << "Unexpected child view index is passed: " << child_view_index << LL_ENDL;
  535. // leave child_view untouched
  536. }
  537. return child_view;
  538. }
  539. // EOF